Home | History | Annotate | Download | only in tnl

Lines Matching refs:light

52    GLfloat (*base)[3] = ctx->Light._BaseColor;
76 sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
81 sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
94 sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
96 sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
108 /* Add contribution from each enabled light source */
109 mask = ctx->Light._EnabledLights;
112 struct gl_light *light = &ctx->Light.Light[l];
118 GLfloat VP[3]; /* unit vector from vertex to light */
123 if (!(light->_Flags & LIGHT_POSITIONAL)) {
124 /* directional light */
125 COPY_3V(VP, light->_VP_inf_norm);
126 attenuation = light->_VP_inf_spot_attenuation;
129 GLfloat d; /* distance from vertex to light */
131 SUB_3V(VP, light->_Position, vertex);
140 attenuation = 1.0F / (light->ConstantAttenuation + d *
141 (light->LinearAttenuation + d *
142 light->QuadraticAttenuation));
145 if (light->_Flags & LIGHT_SPOT) {
146 GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection);
148 if (PV_dot_dir<light->_CosCutoff) {
149 continue; /* this light makes no contribution */
152 GLfloat spot = powf(PV_dot_dir, light->SpotExponent);
159 continue; /* this light makes no contribution */
161 /* Compute dot product or normal and vector from V to light pos */
166 ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]);
177 ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]);
184 COPY_3V(contrib, light->_MatAmbient[side]);
185 ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[side]);
189 if (ctx->Light.Model.LocalViewer) {
197 else if (light->_Flags & LIGHT_POSITIONAL) {
203 h = light->_h_inf_norm;
213 light->_MatSpecular[side]);
239 GLfloat (*base)[3] = ctx->Light._BaseColor;
259 sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
263 sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
275 sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
277 sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
287 /* Add contribution from each enabled light source */
288 mask = ctx->Light._EnabledLights;
291 struct gl_light *light = &ctx->Light.Light[l];
297 GLfloat VP[3]; /* unit vector from vertex to light */
302 if (!(light->_Flags & LIGHT_POSITIONAL)) {
303 /* directional light */
304 COPY_3V(VP, light->_VP_inf_norm);
305 attenuation = light->_VP_inf_spot_attenuation;
308 GLfloat d; /* distance from vertex to light */
310 SUB_3V(VP, light->_Position, vertex);
319 attenuation = 1.0F / (light->ConstantAttenuation + d *
320 (light->LinearAttenuation + d *
321 light->QuadraticAttenuation));
324 if (light->_Flags & LIGHT_SPOT) {
325 GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection);
327 if (PV_dot_dir<light->_CosCutoff) {
328 continue; /* this light makes no contribution */
331 GLfloat spot = powf(PV_dot_dir, light->SpotExponent);
338 continue; /* this light makes no contribution */
340 /* Compute dot product or normal and vector from V to light pos */
345 ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]);
356 ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]);
362 COPY_3V(contrib, light->_MatAmbient[side]);
365 ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[side]);
369 if (ctx->Light.Model.LocalViewer) {
377 else if (light->_Flags & LIGHT_POSITIONAL) {
383 h = light->_h_inf_norm;
391 light->_MatSpecular[side]);
411 /* As below, but with just a single light.
426 const struct gl_light *light =
427 &ctx->Light.Light[ffs(ctx->Light._EnabledLights) - 1];
470 COPY_3V(base[0], light->_MatAmbient[0]);
471 ACC_3V(base[0], ctx->Light._BaseColor[0] );
472 base[0][3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
475 COPY_3V(base[1], light->_MatAmbient[1]);
476 ACC_3V(base[1], ctx->Light._BaseColor[1]);
477 base[1][3] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
481 n_dot_VP = DOT3(normal, light->_VP_inf_norm);
485 GLfloat n_dot_h = -DOT3(normal, light->_h_inf_norm);
488 ACC_SCALE_SCALAR_3V(sum, -n_dot_VP, light->_MatDiffuse[1]);
491 ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[1]);
499 GLfloat n_dot_h = DOT3(normal, light->_h_inf_norm);
502 ACC_SCALE_SCALAR_3V(sum, n_dot_VP, light->_MatDiffuse[0]);
505 ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[0]);
517 /* Light infinite lights
545 sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
546 sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
570 sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
572 sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
577 COPY_3V(sum[0], ctx->Light._BaseColor[0]);
579 COPY_3V(sum[1], ctx->Light._BaseColor[1]);
582 mask = ctx->Light._EnabledLights;
585 const struct gl_light *light = &ctx->Light.Light[l];
588 ACC_3V(sum[0], light->_MatAmbient[0]);
590 ACC_3V(sum[1], light->_MatAmbient[1]);
593 n_dot_VP = DOT3(normal, light->_VP_inf_norm);
596 ACC_SCALE_SCALAR_3V(sum[0], n_dot_VP, light->_MatDiffuse[0]);
597 n_dot_h = DOT3(normal, light->_h_inf_norm);
600 ACC_SCALE_SCALAR_3V( sum[0], spec, light->_MatSpecular[0]);
605 ACC_SCALE_SCALAR_3V(sum[1], -n_dot_VP, light->_MatDiffuse[1]);
606 n_dot_h = -DOT3(normal, light->_h_inf_norm);
609 ACC_SCALE_SCALAR_3V( sum[1], spec, light->_MatSpecular[1]);