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