////////////////////////////////// THREE POINTLIGHT CODE #define LIGHT_POS_1 POINT_LIGHT_0 #define LIGHT_POS_2 POINT_LIGHT_1 #define LIGHT_POS_3 POINT_LIGHT_2 #define LIGHT_DIR_1 1+POINT_LIGHT_0 #define LIGHT_DIR_2 1+POINT_LIGHT_1 #define LIGHT_DIR_3 1+POINT_LIGHT_2 #define LIGHT_COLOR_1 2+POINT_LIGHT_0 #define LIGHT_COLOR_2 2+POINT_LIGHT_1 #define LIGHT_COLOR_3 2+POINT_LIGHT_2 #define ONE_PER_FN POINT_LIGHT_ONE_PER_FN #define NEAR_PER_FN POINT_LIGHT_N_PER_FN #define LOG10_OF_2 c[POINT_LIGHT_LOG_VAL].x #define ZERO c[SPEC_POWER_CONST].x #define ONE c[SPEC_POWER_CONST].y mov r3, NORMAL #undef NORMAL #define NORMAL r3 sub r6, POS, c[LIGHT_POS_1] ; r5 = light to vertex sub r7, POS, c[LIGHT_POS_2] ; r5 = light to vertex sub r8, POS, c[LIGHT_POS_3] ; r5 = light to vertex dp3 r9.x, r6, r6 dp3 r10.x, r7, r7 dp3 r11.x, r8, r8 rsq r9, r9.x rsq r10, r10.x rsq r11, r11.x mul r6, r6, r9.z mul r7, r7, r10.z mul r8, r8, r11.z /* // ANGLE FACTOR dp3 r5.x, NORMAL, -c[LIGHT_DIR_1] dp3 r5.y, NORMAL, -c[LIGHT_DIR_2] dp3 r5.z, NORMAL, -c[LIGHT_DIR_3] */ dp3 r5.x, NORMAL, -r6 dp3 r5.y, NORMAL, -r7 dp3 r5.zw, NORMAL, -r8 max r5, r5, ZERO mad r2, r5.x, c[LIGHT_COLOR_1], r2 mad r2, r5.y, c[LIGHT_COLOR_2], r2 mad r2, r5.z, c[LIGHT_COLOR_3], r2