Home | History | Annotate | Download | only in tnl

Lines Matching refs:light

53    GLfloat (*base)[3] = ctx->Light._BaseColor;
77 sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
82 sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
91 struct gl_light *light;
95 sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
97 sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
109 /* Add contribution from each enabled light source */
110 foreach (light, &ctx->Light.EnabledList) {
116 GLfloat VP[3]; /* unit vector from vertex to light */
121 if (!(light->_Flags & LIGHT_POSITIONAL)) {
122 /* directional light */
123 COPY_3V(VP, light->_VP_inf_norm);
124 attenuation = light->_VP_inf_spot_attenuation;
127 GLfloat d; /* distance from vertex to light */
129 SUB_3V(VP, light->_Position, vertex);
138 attenuation = 1.0F / (light->ConstantAttenuation + d *
139 (light->LinearAttenuation + d *
140 light->QuadraticAttenuation));
143 if (light->_Flags & LIGHT_SPOT) {
144 GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection);
146 if (PV_dot_dir<light->_CosCutoff) {
147 continue; /* this light makes no contribution */
150 GLfloat spot = powf(PV_dot_dir, light->SpotExponent);
157 continue; /* this light makes no contribution */
159 /* Compute dot product or normal and vector from V to light pos */
164 ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]);
175 ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]);
182 COPY_3V(contrib, light->_MatAmbient[side]);
183 ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[side]);
187 if (ctx->Light.Model.LocalViewer) {
195 else if (light->_Flags & LIGHT_POSITIONAL) {
201 h = light->_h_inf_norm;
211 light->_MatSpecular[side]);
237 GLfloat (*base)[3] = ctx->Light._BaseColor;
257 sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
261 sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
269 struct gl_light *light;
273 sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
275 sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
285 /* Add contribution from each enabled light source */
286 foreach (light, &ctx->Light.EnabledList) {
293 GLfloat VP[3]; /* unit vector from vertex to light */
298 if (!(light->_Flags & LIGHT_POSITIONAL)) {
299 /* directional light */
300 COPY_3V(VP, light->_VP_inf_norm);
301 attenuation = light->_VP_inf_spot_attenuation;
304 GLfloat d; /* distance from vertex to light */
307 SUB_3V(VP, light->_Position, vertex);
316 attenuation = 1.0F / (light->ConstantAttenuation + d *
317 (light->LinearAttenuation + d *
318 light->QuadraticAttenuation));
321 if (light->_Flags & LIGHT_SPOT) {
322 GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection);
324 if (PV_dot_dir<light->_CosCutoff) {
325 continue; /* this light makes no contribution */
328 GLfloat spot = powf(PV_dot_dir, light->SpotExponent);
335 continue; /* this light makes no contribution */
337 /* Compute dot product or normal and vector from V to light pos */
342 ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]);
353 ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]);
359 COPY_3V(contrib, light->_MatAmbient[side]);
362 ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[side]);
366 if (ctx->Light.Model.LocalViewer) {
374 else if (light->_Flags & LIGHT_POSITIONAL) {
380 h = light->_h_inf_norm;
388 light->_MatSpecular[side]);
408 /* As below, but with just a single light.
423 const struct gl_light *light = ctx->Light.EnabledList.next;
466 COPY_3V(base[0], light->_MatAmbient[0]);
467 ACC_3V(base[0], ctx->Light._BaseColor[0] );
468 base[0][3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
471 COPY_3V(base[1], light->_MatAmbient[1]);
472 ACC_3V(base[1], ctx->Light._BaseColor[1]);
473 base[1][3] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
477 n_dot_VP = DOT3(normal, light->_VP_inf_norm);
481 GLfloat n_dot_h = -DOT3(normal, light->_h_inf_norm);
484 ACC_SCALE_SCALAR_3V(sum, -n_dot_VP, light->_MatDiffuse[1]);
487 ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[1]);
495 GLfloat n_dot_h = DOT3(normal, light->_h_inf_norm);
498 ACC_SCALE_SCALAR_3V(sum, n_dot_VP, light->_MatDiffuse[0]);
501 ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[0]);
513 /* Light infinite lights
534 const struct gl_light *light;
542 sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
543 sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
566 sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
568 sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
573 COPY_3V(sum[0], ctx->Light._BaseColor[0]);
575 COPY_3V(sum[1], ctx->Light._BaseColor[1]);
578 foreach (light, &ctx->Light.EnabledList) {
581 ACC_3V(sum[0], light->_MatAmbient[0]);
583 ACC_3V(sum[1], light->_MatAmbient[1]);
586 n_dot_VP = DOT3(normal, light->_VP_inf_norm);
589 ACC_SCALE_SCALAR_3V(sum[0], n_dot_VP, light->_MatDiffuse[0]);
590 n_dot_h = DOT3(normal, light->_h_inf_norm);
593 ACC_SCALE_SCALAR_3V( sum[0], spec, light->_MatSpecular[0]);
598 ACC_SCALE_SCALAR_3V(sum[1], -n_dot_VP, light->_MatDiffuse[1]);
599 n_dot_h = -DOT3(normal, light->_h_inf_norm);
602 ACC_SCALE_SCALAR_3V( sum[1], spec, light->_MatSpecular[1]);