Fixed typo
[reactos.git] / dll / opengl / mesa / tnl / t_vb_lighttmp.h
1 /*
2 * Mesa 3-D graphics library
3 * Version: 5.1
4 *
5 * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 *
24 *
25 * Authors:
26 * Brian Paul
27 * Keith Whitwell <keith@tungstengraphics.com>
28 */
29
30
31 /* define TRACE to trace lighting code */
32 /* #define TRACE 1 */
33
34 /*
35 * ctx is the current context
36 * VB is the vertex buffer
37 * stage is the lighting stage-private data
38 * input is the vector of eye or object-space vertex coordinates
39 */
40 static void TAG(light_rgba_spec)( struct gl_context *ctx,
41 struct vertex_buffer *VB,
42 struct tnl_pipeline_stage *stage,
43 GLvector4f *input )
44 {
45 struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
46 GLfloat (*base)[3] = ctx->Light._BaseColor;
47 GLfloat sumA[2];
48 GLuint j;
49
50 const GLuint vstride = input->stride;
51 const GLfloat *vertex = (GLfloat *)input->data;
52 const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
53 const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
54
55 GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
56 #if IDX & LIGHT_TWOSIDE
57 GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
58 #endif
59
60 const GLuint nr = VB->Count;
61
62 #ifdef TRACE
63 fprintf(stderr, "%s\n", __FUNCTION__ );
64 #endif
65
66 VB->AttribPtr[_TNL_ATTRIB_COLOR] = &store->LitColor[0];
67 sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
68
69 #if IDX & LIGHT_TWOSIDE
70 VB->BackfaceColorPtr = &store->LitColor[1];
71 sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
72 #endif
73
74
75 store->LitColor[0].stride = 16;
76 store->LitColor[1].stride = 16;
77
78 for (j = 0; j < nr; j++,STRIDE_F(vertex,vstride),STRIDE_F(normal,nstride)) {
79 GLfloat sum[2][3], spec[2][3];
80 struct gl_light *light;
81
82 #if IDX & LIGHT_MATERIAL
83 update_materials( ctx, store );
84 sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
85 #if IDX & LIGHT_TWOSIDE
86 sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
87 #endif
88 #endif
89
90 COPY_3V(sum[0], base[0]);
91 ZERO_3V(spec[0]);
92
93 #if IDX & LIGHT_TWOSIDE
94 COPY_3V(sum[1], base[1]);
95 ZERO_3V(spec[1]);
96 #endif
97
98 /* Add contribution from each enabled light source */
99 foreach (light, &ctx->Light.EnabledList) {
100 GLfloat n_dot_h;
101 GLfloat correction;
102 GLint side;
103 GLfloat contrib[3];
104 GLfloat attenuation;
105 GLfloat VP[3]; /* unit vector from vertex to light */
106 GLfloat n_dot_VP; /* n dot VP */
107 GLfloat *h;
108
109 /* compute VP and attenuation */
110 if (!(light->_Flags & LIGHT_POSITIONAL)) {
111 /* directional light */
112 COPY_3V(VP, light->_VP_inf_norm);
113 attenuation = light->_VP_inf_spot_attenuation;
114 }
115 else {
116 GLfloat d; /* distance from vertex to light */
117
118 SUB_3V(VP, light->_Position, vertex);
119
120 d = (GLfloat) LEN_3FV( VP );
121
122 if (d > 1e-6) {
123 GLfloat invd = 1.0F / d;
124 SELF_SCALE_SCALAR_3V(VP, invd);
125 }
126
127 attenuation = 1.0F / (light->ConstantAttenuation + d *
128 (light->LinearAttenuation + d *
129 light->QuadraticAttenuation));
130
131 /* spotlight attenuation */
132 if (light->_Flags & LIGHT_SPOT) {
133 GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection);
134
135 if (PV_dot_dir<light->_CosCutoff) {
136 continue; /* this light makes no contribution */
137 }
138 else {
139 GLdouble x = PV_dot_dir * (EXP_TABLE_SIZE-1);
140 GLint k = (GLint) x;
141 GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0]
142 + (x-k)*light->_SpotExpTable[k][1]);
143 attenuation *= spot;
144 }
145 }
146 }
147
148 if (attenuation < 1e-3)
149 continue; /* this light makes no contribution */
150
151 /* Compute dot product or normal and vector from V to light pos */
152 n_dot_VP = DOT3( normal, VP );
153
154 /* Which side gets the diffuse & specular terms? */
155 if (n_dot_VP < 0.0F) {
156 ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]);
157 #if IDX & LIGHT_TWOSIDE
158 side = 1;
159 correction = -1;
160 n_dot_VP = -n_dot_VP;
161 #else
162 continue;
163 #endif
164 }
165 else {
166 #if IDX & LIGHT_TWOSIDE
167 ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]);
168 #endif
169 side = 0;
170 correction = 1;
171 }
172
173 /* diffuse term */
174 COPY_3V(contrib, light->_MatAmbient[side]);
175 ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[side]);
176 ACC_SCALE_SCALAR_3V(sum[side], attenuation, contrib );
177
178 /* specular term - cannibalize VP... */
179 if (ctx->Light.Model.LocalViewer) {
180 GLfloat v[3];
181 COPY_3V(v, vertex);
182 NORMALIZE_3FV(v);
183 SUB_3V(VP, VP, v); /* h = VP + VPe */
184 h = VP;
185 NORMALIZE_3FV(h);
186 }
187 else if (light->_Flags & LIGHT_POSITIONAL) {
188 h = VP;
189 ACC_3V(h, ctx->_EyeZDir);
190 NORMALIZE_3FV(h);
191 }
192 else {
193 h = light->_h_inf_norm;
194 }
195
196 n_dot_h = correction * DOT3(normal, h);
197
198 if (n_dot_h > 0.0F) {
199 GLfloat spec_coef;
200 struct gl_shine_tab *tab = ctx->_ShineTable[side];
201 GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef );
202
203 if (spec_coef > 1.0e-10) {
204 spec_coef *= attenuation;
205 ACC_SCALE_SCALAR_3V( spec[side], spec_coef,
206 light->_MatSpecular[side]);
207 }
208 }
209 } /*loop over lights*/
210
211 COPY_3V( Fcolor[j], sum[0] );
212 Fcolor[j][3] = sumA[0];
213
214 #if IDX & LIGHT_TWOSIDE
215 COPY_3V( Bcolor[j], sum[1] );
216 Bcolor[j][3] = sumA[1];
217 #endif
218 }
219 }
220
221
222 static void TAG(light_rgba)( struct gl_context *ctx,
223 struct vertex_buffer *VB,
224 struct tnl_pipeline_stage *stage,
225 GLvector4f *input )
226 {
227 struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
228 GLuint j;
229
230 GLfloat (*base)[3] = ctx->Light._BaseColor;
231 GLfloat sumA[2];
232
233 const GLuint vstride = input->stride;
234 const GLfloat *vertex = (GLfloat *) input->data;
235 const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
236 const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
237
238 GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
239 #if IDX & LIGHT_TWOSIDE
240 GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
241 #endif
242
243 const GLuint nr = VB->Count;
244
245 #ifdef TRACE
246 fprintf(stderr, "%s\n", __FUNCTION__ );
247 #endif
248
249 VB->AttribPtr[_TNL_ATTRIB_COLOR] = &store->LitColor[0];
250 sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
251
252 #if IDX & LIGHT_TWOSIDE
253 VB->BackfaceColorPtr = &store->LitColor[1];
254 sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
255 #endif
256
257 store->LitColor[0].stride = 16;
258 store->LitColor[1].stride = 16;
259
260 for (j = 0; j < nr; j++,STRIDE_F(vertex,vstride),STRIDE_F(normal,nstride)) {
261 GLfloat sum[2][3];
262 struct gl_light *light;
263
264 #if IDX & LIGHT_MATERIAL
265 update_materials( ctx, store );
266 sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
267 #if IDX & LIGHT_TWOSIDE
268 sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
269 #endif
270 #endif
271
272 COPY_3V(sum[0], base[0]);
273
274 #if IDX & LIGHT_TWOSIDE
275 COPY_3V(sum[1], base[1]);
276 #endif
277
278 /* Add contribution from each enabled light source */
279 foreach (light, &ctx->Light.EnabledList) {
280
281 GLfloat n_dot_h;
282 GLfloat correction;
283 GLint side;
284 GLfloat contrib[3];
285 GLfloat attenuation = 1.0;
286 GLfloat VP[3]; /* unit vector from vertex to light */
287 GLfloat n_dot_VP; /* n dot VP */
288 GLfloat *h;
289
290 /* compute VP and attenuation */
291 if (!(light->_Flags & LIGHT_POSITIONAL)) {
292 /* directional light */
293 COPY_3V(VP, light->_VP_inf_norm);
294 attenuation = light->_VP_inf_spot_attenuation;
295 }
296 else {
297 GLfloat d; /* distance from vertex to light */
298
299
300 SUB_3V(VP, light->_Position, vertex);
301
302 d = (GLfloat) LEN_3FV( VP );
303
304 if ( d > 1e-6) {
305 GLfloat invd = 1.0F / d;
306 SELF_SCALE_SCALAR_3V(VP, invd);
307 }
308
309 attenuation = 1.0F / (light->ConstantAttenuation + d *
310 (light->LinearAttenuation + d *
311 light->QuadraticAttenuation));
312
313 /* spotlight attenuation */
314 if (light->_Flags & LIGHT_SPOT) {
315 GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection);
316
317 if (PV_dot_dir<light->_CosCutoff) {
318 continue; /* this light makes no contribution */
319 }
320 else {
321 GLdouble x = PV_dot_dir * (EXP_TABLE_SIZE-1);
322 GLint k = (GLint) x;
323 GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0]
324 + (x-k)*light->_SpotExpTable[k][1]);
325 attenuation *= spot;
326 }
327 }
328 }
329
330 if (attenuation < 1e-3)
331 continue; /* this light makes no contribution */
332
333 /* Compute dot product or normal and vector from V to light pos */
334 n_dot_VP = DOT3( normal, VP );
335
336 /* which side are we lighting? */
337 if (n_dot_VP < 0.0F) {
338 ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]);
339 #if IDX & LIGHT_TWOSIDE
340 side = 1;
341 correction = -1;
342 n_dot_VP = -n_dot_VP;
343 #else
344 continue;
345 #endif
346 }
347 else {
348 #if IDX & LIGHT_TWOSIDE
349 ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]);
350 #endif
351 side = 0;
352 correction = 1;
353 }
354
355 COPY_3V(contrib, light->_MatAmbient[side]);
356
357 /* diffuse term */
358 ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[side]);
359
360 /* specular term - cannibalize VP... */
361 {
362 if (ctx->Light.Model.LocalViewer) {
363 GLfloat v[3];
364 COPY_3V(v, vertex);
365 NORMALIZE_3FV(v);
366 SUB_3V(VP, VP, v); /* h = VP + VPe */
367 h = VP;
368 NORMALIZE_3FV(h);
369 }
370 else if (light->_Flags & LIGHT_POSITIONAL) {
371 h = VP;
372 ACC_3V(h, ctx->_EyeZDir);
373 NORMALIZE_3FV(h);
374 }
375 else {
376 h = light->_h_inf_norm;
377 }
378
379 n_dot_h = correction * DOT3(normal, h);
380
381 if (n_dot_h > 0.0F)
382 {
383 GLfloat spec_coef;
384 struct gl_shine_tab *tab = ctx->_ShineTable[side];
385
386 GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef );
387
388 ACC_SCALE_SCALAR_3V( contrib, spec_coef,
389 light->_MatSpecular[side]);
390 }
391 }
392
393 ACC_SCALE_SCALAR_3V( sum[side], attenuation, contrib );
394 }
395
396 COPY_3V( Fcolor[j], sum[0] );
397 Fcolor[j][3] = sumA[0];
398
399 #if IDX & LIGHT_TWOSIDE
400 COPY_3V( Bcolor[j], sum[1] );
401 Bcolor[j][3] = sumA[1];
402 #endif
403 }
404 }
405
406
407
408
409 /* As below, but with just a single light.
410 */
411 static void TAG(light_fast_rgba_single)( struct gl_context *ctx,
412 struct vertex_buffer *VB,
413 struct tnl_pipeline_stage *stage,
414 GLvector4f *input )
415
416 {
417 struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
418 const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
419 const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
420 GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
421 #if IDX & LIGHT_TWOSIDE
422 GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
423 #endif
424 const struct gl_light *light = ctx->Light.EnabledList.next;
425 GLuint j = 0;
426 GLfloat base[2][4];
427 #if IDX & LIGHT_MATERIAL
428 const GLuint nr = VB->Count;
429 #else
430 const GLuint nr = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->count;
431 #endif
432
433 #ifdef TRACE
434 fprintf(stderr, "%s\n", __FUNCTION__ );
435 #endif
436
437 (void) input; /* doesn't refer to Eye or Obj */
438
439 VB->AttribPtr[_TNL_ATTRIB_COLOR] = &store->LitColor[0];
440 #if IDX & LIGHT_TWOSIDE
441 VB->BackfaceColorPtr = &store->LitColor[1];
442 #endif
443
444 if (nr > 1) {
445 store->LitColor[0].stride = 16;
446 store->LitColor[1].stride = 16;
447 }
448 else {
449 store->LitColor[0].stride = 0;
450 store->LitColor[1].stride = 0;
451 }
452
453 for (j = 0; j < nr; j++, STRIDE_F(normal,nstride)) {
454
455 GLfloat n_dot_VP;
456
457 #if IDX & LIGHT_MATERIAL
458 update_materials( ctx, store );
459 #endif
460
461 /* No attenuation, so incoporate _MatAmbient into base color.
462 */
463 #if !(IDX & LIGHT_MATERIAL)
464 if ( j == 0 )
465 #endif
466 {
467 COPY_3V(base[0], light->_MatAmbient[0]);
468 ACC_3V(base[0], ctx->Light._BaseColor[0] );
469 base[0][3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
470
471 #if IDX & LIGHT_TWOSIDE
472 COPY_3V(base[1], light->_MatAmbient[1]);
473 ACC_3V(base[1], ctx->Light._BaseColor[1]);
474 base[1][3] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
475 #endif
476 }
477
478 n_dot_VP = DOT3(normal, light->_VP_inf_norm);
479
480 if (n_dot_VP < 0.0F) {
481 #if IDX & LIGHT_TWOSIDE
482 GLfloat n_dot_h = -DOT3(normal, light->_h_inf_norm);
483 GLfloat sum[3];
484 COPY_3V(sum, base[1]);
485 ACC_SCALE_SCALAR_3V(sum, -n_dot_VP, light->_MatDiffuse[1]);
486 if (n_dot_h > 0.0F) {
487 GLfloat spec;
488 GET_SHINE_TAB_ENTRY( ctx->_ShineTable[1], n_dot_h, spec );
489 ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[1]);
490 }
491 COPY_3V(Bcolor[j], sum );
492 Bcolor[j][3] = base[1][3];
493 #endif
494 COPY_4FV(Fcolor[j], base[0]);
495 }
496 else {
497 GLfloat n_dot_h = DOT3(normal, light->_h_inf_norm);
498 GLfloat sum[3];
499 COPY_3V(sum, base[0]);
500 ACC_SCALE_SCALAR_3V(sum, n_dot_VP, light->_MatDiffuse[0]);
501 if (n_dot_h > 0.0F) {
502 GLfloat spec;
503 GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec );
504 ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[0]);
505
506 }
507 COPY_3V(Fcolor[j], sum );
508 Fcolor[j][3] = base[0][3];
509 #if IDX & LIGHT_TWOSIDE
510 COPY_4FV(Bcolor[j], base[1]);
511 #endif
512 }
513 }
514 }
515
516
517 /* Light infinite lights
518 */
519 static void TAG(light_fast_rgba)( struct gl_context *ctx,
520 struct vertex_buffer *VB,
521 struct tnl_pipeline_stage *stage,
522 GLvector4f *input )
523 {
524 struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
525 GLfloat sumA[2];
526 const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
527 const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
528 GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
529 #if IDX & LIGHT_TWOSIDE
530 GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
531 #endif
532 GLuint j = 0;
533 #if IDX & LIGHT_MATERIAL
534 const GLuint nr = VB->Count;
535 #else
536 const GLuint nr = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->count;
537 #endif
538 const struct gl_light *light;
539
540 #ifdef TRACE
541 fprintf(stderr, "%s %d\n", __FUNCTION__, nr );
542 #endif
543
544 (void) input;
545
546 sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
547 sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
548
549 VB->AttribPtr[_TNL_ATTRIB_COLOR] = &store->LitColor[0];
550 #if IDX & LIGHT_TWOSIDE
551 VB->BackfaceColorPtr = &store->LitColor[1];
552 #endif
553
554 if (nr > 1) {
555 store->LitColor[0].stride = 16;
556 store->LitColor[1].stride = 16;
557 }
558 else {
559 store->LitColor[0].stride = 0;
560 store->LitColor[1].stride = 0;
561 }
562
563 for (j = 0; j < nr; j++, STRIDE_F(normal,nstride)) {
564
565 GLfloat sum[2][3];
566
567 #if IDX & LIGHT_MATERIAL
568 update_materials( ctx, store );
569
570 sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
571 #if IDX & LIGHT_TWOSIDE
572 sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
573 #endif
574 #endif
575
576
577 COPY_3V(sum[0], ctx->Light._BaseColor[0]);
578 #if IDX & LIGHT_TWOSIDE
579 COPY_3V(sum[1], ctx->Light._BaseColor[1]);
580 #endif
581
582 foreach (light, &ctx->Light.EnabledList) {
583 GLfloat n_dot_h, n_dot_VP, spec;
584
585 ACC_3V(sum[0], light->_MatAmbient[0]);
586 #if IDX & LIGHT_TWOSIDE
587 ACC_3V(sum[1], light->_MatAmbient[1]);
588 #endif
589
590 n_dot_VP = DOT3(normal, light->_VP_inf_norm);
591
592 if (n_dot_VP > 0.0F) {
593 ACC_SCALE_SCALAR_3V(sum[0], n_dot_VP, light->_MatDiffuse[0]);
594 n_dot_h = DOT3(normal, light->_h_inf_norm);
595 if (n_dot_h > 0.0F) {
596 struct gl_shine_tab *tab = ctx->_ShineTable[0];
597 GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec );
598 ACC_SCALE_SCALAR_3V( sum[0], spec, light->_MatSpecular[0]);
599 }
600 }
601 #if IDX & LIGHT_TWOSIDE
602 else {
603 ACC_SCALE_SCALAR_3V(sum[1], -n_dot_VP, light->_MatDiffuse[1]);
604 n_dot_h = -DOT3(normal, light->_h_inf_norm);
605 if (n_dot_h > 0.0F) {
606 struct gl_shine_tab *tab = ctx->_ShineTable[1];
607 GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec );
608 ACC_SCALE_SCALAR_3V( sum[1], spec, light->_MatSpecular[1]);
609 }
610 }
611 #endif
612 }
613
614 COPY_3V( Fcolor[j], sum[0] );
615 Fcolor[j][3] = sumA[0];
616
617 #if IDX & LIGHT_TWOSIDE
618 COPY_3V( Bcolor[j], sum[1] );
619 Bcolor[j][3] = sumA[1];
620 #endif
621 }
622 }
623
624
625
626
627 static void TAG(init_light_tab)( void )
628 {
629 _tnl_light_tab[IDX] = TAG(light_rgba);
630 _tnl_light_fast_tab[IDX] = TAG(light_fast_rgba);
631 _tnl_light_fast_single_tab[IDX] = TAG(light_fast_rgba_single);
632 _tnl_light_spec_tab[IDX] = TAG(light_rgba_spec);
633 }
634
635
636 #undef TAG
637 #undef IDX