Lines Matching defs:light
243 * CONST[39].___w 1 if this is the last active light, 0 if not
746 * vec3 hitDir = light.direction;
749 * if (light.type != DIRECTIONAL)
751 * vec3 hitVec = light.position - eyeVertex;
754 * atten = 1 / ((light.atten2 * d + light.atten1) * d + light.atten0);
757 * if (light.type == SPOTLIGHT)
759 * float rho = dp3(-hitVec, light.direction);
760 * if (rho < cos(light.phi / 2))
762 * if (rho < cos(light.theta / 2))
763 * atten *= pow(some_func(rho), light.falloff);
776 * ambient += light.ambient * atten;
777 * diffuse += light.diffuse * atten * nDotHit;
778 * specular += light.specular * atten * powFact;
818 /* Declare all light constants to allow indirect adressing */
831 /* if (not DIRECTIONAL light): */
837 /* hitDir = light.position - eyeVtx
845 /* att = 1.0 / (light.att0 + (light.att1 + light.att2 * d) * d) */
859 /* if (SPOT light) */
863 /* rho = dp3(-hitDir, light.spotDir)
865 * if (rho > light.ctht2) NOTE: 0 <= phi <= pi, 0 <= theta <= phi
868 * if (rho <= light.cphi2)
871 * spotAtt = (rho - light.cphi2) / (light.ctht2 - light.cphi2) ^ light.falloff
917 /* break if this was the last light */
1929 const D3DLIGHT9 *light = &context->ff.light[context->ff.active_light[l]];
1931 dst[32 + l * 8].x = light->Type;
1932 dst[32 + l * 8].y = light->Attenuation0;
1933 dst[32 + l * 8].z = light->Attenuation1;
1934 dst[32 + l * 8].w = light->Attenuation2;
1935 memcpy(&dst[33 + l * 8].x, &light->Diffuse, sizeof(light->Diffuse));
1936 memcpy(&dst[34 + l * 8].x, &light->Specular, sizeof(light->Specular));
1937 memcpy(&dst[35 + l * 8].x, &light->Ambient, sizeof(light->Ambient));
1938 nine_d3d_vector4_matrix_mul((D3DVECTOR *)&dst[36 + l * 8].x, &light->Position, GET_D3DTS(VIEW));
1939 nine_d3d_vector3_matrix_mul((D3DVECTOR *)&dst[37 + l * 8].x, &light->Direction, GET_D3DTS(VIEW));
1940 dst[36 + l * 8].w = light->Type == D3DLIGHT_DIRECTIONAL ? 1e9f : light->Range;
1941 dst[37 + l * 8].w = light->Falloff;
1942 dst[38 + l * 8].x = cosf(light->Theta * 0.5f);
1943 dst[38 + l * 8].y = cosf(light->Phi * 0.5f);