]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/CTRTextureLightMap2_Add.cpp
Merging r6145 through r6171 from trunk to ogl-es branch
[irrlicht.git] / source / Irrlicht / CTRTextureLightMap2_Add.cpp
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt / Thomas Alten\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h\r
4 \r
5 #include "IrrCompileConfig.h"\r
6 #include "IBurningShader.h"\r
7 \r
8 #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_\r
9 \r
10 // compile flag for this file\r
11 #undef USE_ZBUFFER\r
12 #undef IPOL_Z\r
13 #undef CMP_Z\r
14 #undef WRITE_Z\r
15 \r
16 #undef IPOL_W\r
17 #undef CMP_W\r
18 #undef WRITE_W\r
19 \r
20 #undef SUBTEXEL\r
21 #undef INVERSE_W\r
22 \r
23 #undef IPOL_C0\r
24 #undef IPOL_T0\r
25 #undef IPOL_T1\r
26 \r
27 // define render case\r
28 #define SUBTEXEL\r
29 #define INVERSE_W\r
30 \r
31 #define USE_ZBUFFER\r
32 #define IPOL_W\r
33 #define CMP_W\r
34 #define WRITE_W\r
35 \r
36 //#define IPOL_C0\r
37 #define IPOL_T0\r
38 #define IPOL_T1\r
39 \r
40 // apply global override\r
41 #ifndef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT\r
42         #undef INVERSE_W\r
43 #endif\r
44 \r
45 #ifndef SOFTWARE_DRIVER_2_SUBTEXEL\r
46         #undef SUBTEXEL\r
47 #endif\r
48 \r
49 #if BURNING_MATERIAL_MAX_COLORS < 1\r
50         #undef IPOL_C0\r
51 #endif\r
52 \r
53 #if !defined ( SOFTWARE_DRIVER_2_USE_WBUFFER ) && defined ( USE_ZBUFFER )\r
54         #ifndef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT\r
55                 #undef IPOL_W\r
56         #endif\r
57         #define IPOL_Z\r
58 \r
59         #ifdef CMP_W\r
60                 #undef CMP_W\r
61                 #define CMP_Z\r
62         #endif\r
63 \r
64         #ifdef WRITE_W\r
65                 #undef WRITE_W\r
66                 #define WRITE_Z\r
67         #endif\r
68 \r
69 #endif\r
70 \r
71 namespace irr\r
72 {\r
73 \r
74 namespace video\r
75 {\r
76 \r
77 class CTRTextureLightMap2_Add : public IBurningShader\r
78 {\r
79 public:\r
80 \r
81         //! constructor\r
82         CTRTextureLightMap2_Add(CBurningVideoDriver* driver);\r
83 \r
84         //! draws an indexed triangle list\r
85         virtual void drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c) _IRR_OVERRIDE_;\r
86 \r
87 \r
88 private:\r
89         void fragmentShader();\r
90 \r
91 };\r
92 \r
93 //! constructor\r
94 CTRTextureLightMap2_Add::CTRTextureLightMap2_Add(CBurningVideoDriver* driver)\r
95 : IBurningShader(driver)\r
96 {\r
97         #ifdef _DEBUG\r
98         setDebugName("CTRTextureLightMap2_Add");\r
99         #endif\r
100 }\r
101 \r
102 \r
103 \r
104 /*!\r
105 */\r
106 REALINLINE void CTRTextureLightMap2_Add::fragmentShader()\r
107 {\r
108         tVideoSample *dst;\r
109 \r
110 #ifdef USE_ZBUFFER\r
111         fp24 *z;\r
112 #endif\r
113 \r
114         s32 xStart;\r
115         s32 xEnd;\r
116         s32 dx;\r
117 \r
118 \r
119 #ifdef SUBTEXEL\r
120         f32 subPixel;\r
121 #endif\r
122 \r
123 #ifdef IPOL_Z\r
124         f32 slopeZ;\r
125 #endif\r
126 #ifdef IPOL_W\r
127         fp24 slopeW;\r
128 #endif\r
129 #ifdef IPOL_C0\r
130         sVec4 slopeC;\r
131 #endif\r
132 #ifdef IPOL_T0\r
133         sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];\r
134 #endif\r
135 \r
136         // apply top-left fill-convention, left\r
137         xStart = fill_convention_left( line.x[0] );\r
138         xEnd = fill_convention_right( line.x[1] );\r
139 \r
140         dx = xEnd - xStart;\r
141 \r
142         if ( dx < 0 )\r
143                 return;\r
144 \r
145         // slopes\r
146         const f32 invDeltaX = fill_step_x( line.x[1] - line.x[0] );\r
147 \r
148 #ifdef IPOL_Z\r
149         slopeZ = (line.z[1] - line.z[0]) * invDeltaX;\r
150 #endif\r
151 #ifdef IPOL_W\r
152         slopeW = (line.w[1] - line.w[0]) * invDeltaX;\r
153 #endif\r
154 #ifdef IPOL_C0\r
155         slopeC = (line.c[1] - line.c[0]) * invDeltaX;\r
156 #endif\r
157 #ifdef IPOL_T0\r
158         slopeT[0] = (line.t[0][1] - line.t[0][0]) * invDeltaX;\r
159 #endif\r
160 #ifdef IPOL_T1\r
161         slopeT[1] = (line.t[1][1] - line.t[1][0]) * invDeltaX;\r
162 #endif\r
163 \r
164 #ifdef SUBTEXEL\r
165         subPixel = ( (f32) xStart ) - line.x[0];\r
166 #ifdef IPOL_Z\r
167         line.z[0] += slopeZ * subPixel;\r
168 #endif\r
169 #ifdef IPOL_W\r
170         line.w[0] += slopeW * subPixel;\r
171 #endif\r
172 #ifdef IPOL_C0\r
173         line.c[0] += slopeC * subPixel;\r
174 #endif\r
175 #ifdef IPOL_T0\r
176         line.t[0][0] += slopeT[0] * subPixel;\r
177 #endif\r
178 #ifdef IPOL_T1\r
179         line.t[1][0] += slopeT[1] * subPixel;\r
180 #endif\r
181 #endif\r
182 \r
183         SOFTWARE_DRIVER_2_CLIPCHECK;\r
184         dst = (tVideoSample*)RenderTarget->getData() + ( line.y * RenderTarget->getDimension().Width ) + xStart;\r
185 \r
186 #ifdef USE_ZBUFFER\r
187         z = (fp24*) DepthBuffer->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart;\r
188 #endif\r
189 \r
190 \r
191         f32 inversew = FIX_POINT_F32_MUL;\r
192 \r
193 #if defined(BURNINGVIDEO_RENDERER_FAST) && COLOR_MAX==0xff\r
194         u32 dIndex = ( line.y & 3 ) << 2;\r
195 #else\r
196         //\r
197         tFixPoint r0, g0, b0;\r
198         tFixPoint r1, g1, b1;\r
199 #endif\r
200 \r
201 \r
202         for ( s32 i = 0; i <= dx; i += SOFTWARE_DRIVER_2_STEP_X)\r
203         {\r
204 #ifdef CMP_Z\r
205                 if ( line.z[0] < z[i] )\r
206 #endif\r
207 #ifdef CMP_W\r
208                 if ( line.w[0] >= z[i] )\r
209 #endif\r
210                 {\r
211 \r
212 #ifdef WRITE_Z\r
213                         z[i] = line.z[0];\r
214 #endif\r
215 #ifdef WRITE_W\r
216                         z[i] = line.w[0];\r
217 #endif\r
218 \r
219 #ifdef INVERSE_W\r
220                         inversew = fix_inverse32(line.w[0]);\r
221 #endif\r
222 \r
223 #if defined(BURNINGVIDEO_RENDERER_FAST) && COLOR_MAX==0xff\r
224 \r
225                         const tFixPointu d = dithermask [ dIndex | ( i ) & 3 ];\r
226 \r
227                         dst[i] = PixelAdd32 (\r
228                                         getTexel_plain ( &IT[0],        d + tofix ( line.t[0][0].x,inversew),\r
229                                                                                                 d + tofix ( line.t[0][0].y,inversew) ),\r
230                                         getTexel_plain ( &IT[1],        d + tofix ( line.t[1][0].x,inversew),\r
231                                                                                                 d + tofix ( line.t[1][0].y,inversew) )\r
232                                                         );\r
233 \r
234 #else\r
235 \r
236                         getSample_texture ( r0, g0, b0, &IT[0], tofix ( line.t[0][0].x,inversew), tofix ( line.t[0][0].y,inversew) );\r
237                         getSample_texture ( r1, g1, b1, &IT[1], tofix ( line.t[1][0].x,inversew), tofix ( line.t[1][0].y,inversew) );\r
238 \r
239                         dst[i] = fix_to_sample( clampfix_maxcolor ( r0 + r1 ),\r
240                                                                         clampfix_maxcolor ( g0 + g1 ),\r
241                                                                         clampfix_maxcolor ( b0 + b1 )\r
242                                                                 );\r
243 #endif\r
244 \r
245                 }\r
246 \r
247 #ifdef IPOL_Z\r
248                 line.z[0] += slopeZ;\r
249 #endif\r
250 #ifdef IPOL_W\r
251                 line.w[0] += slopeW;\r
252 #endif\r
253 #ifdef IPOL_C0\r
254                 line.c[0] += slopeC;\r
255 #endif\r
256 #ifdef IPOL_T0\r
257                 line.t[0][0] += slopeT[0];\r
258 #endif\r
259 #ifdef IPOL_T1\r
260                 line.t[1][0] += slopeT[1];\r
261 #endif\r
262         }\r
263 \r
264 }\r
265 \r
266 void CTRTextureLightMap2_Add::drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c)\r
267 {\r
268         // sort on height, y\r
269         if ( F32_A_GREATER_B ( a->Pos.y , b->Pos.y ) ) swapVertexPointer(&a, &b);\r
270         if ( F32_A_GREATER_B ( b->Pos.y , c->Pos.y ) ) swapVertexPointer(&b, &c);\r
271         if ( F32_A_GREATER_B ( a->Pos.y , b->Pos.y ) ) swapVertexPointer(&a, &b);\r
272 \r
273         const f32 ca = c->Pos.y - a->Pos.y;\r
274         const f32 ba = b->Pos.y - a->Pos.y;\r
275         const f32 cb = c->Pos.y - b->Pos.y;\r
276         // calculate delta y of the edges\r
277         scan.invDeltaY[0] = fill_step_y( ca );\r
278         scan.invDeltaY[1] = fill_step_y( ba );\r
279         scan.invDeltaY[2] = fill_step_y( cb );\r
280 \r
281         if ( F32_LOWER_EQUAL_0 ( scan.invDeltaY[0] ) )\r
282                 return;\r
283 \r
284         // find if the major edge is left or right aligned\r
285         f32 temp[4];\r
286 \r
287         temp[0] = a->Pos.x - c->Pos.x;\r
288         temp[1] = -ca;\r
289         temp[2] = b->Pos.x - a->Pos.x;\r
290         temp[3] = ba;\r
291 \r
292         scan.left = ( temp[0] * temp[3] - temp[1] * temp[2] ) > 0.f ? 0 : 1;\r
293         scan.right = 1 - scan.left;\r
294 \r
295         // calculate slopes for the major edge\r
296         scan.slopeX[0] = (c->Pos.x - a->Pos.x) * scan.invDeltaY[0];\r
297         scan.x[0] = a->Pos.x;\r
298 \r
299 #ifdef IPOL_Z\r
300         scan.slopeZ[0] = (c->Pos.z - a->Pos.z) * scan.invDeltaY[0];\r
301         scan.z[0] = a->Pos.z;\r
302 #endif\r
303 \r
304 #ifdef IPOL_W\r
305         scan.slopeW[0] = (c->Pos.w - a->Pos.w) * scan.invDeltaY[0];\r
306         scan.w[0] = a->Pos.w;\r
307 #endif\r
308 \r
309 #ifdef IPOL_C0\r
310         scan.slopeC[0] = (c->Color[0] - a->Color[0]) * scan.invDeltaY[0];\r
311         scan.c[0] = a->Color[0];\r
312 #endif\r
313 \r
314 #ifdef IPOL_T0\r
315         scan.slopeT[0][0] = (c->Tex[0] - a->Tex[0]) * scan.invDeltaY[0];\r
316         scan.t[0][0] = a->Tex[0];\r
317 #endif\r
318 \r
319 #ifdef IPOL_T1\r
320         scan.slopeT[1][0] = (c->Tex[1] - a->Tex[1]) * scan.invDeltaY[0];\r
321         scan.t[1][0] = a->Tex[1];\r
322 #endif\r
323 \r
324         // top left fill convention y run\r
325         s32 yStart;\r
326         s32 yEnd;\r
327 \r
328 #ifdef SUBTEXEL\r
329         f32 subPixel;\r
330 #endif\r
331 \r
332         // rasterize upper sub-triangle\r
333         if ( (f32) 0.0 != scan.invDeltaY[1]  )\r
334         {\r
335                 // calculate slopes for top edge\r
336                 scan.slopeX[1] = (b->Pos.x - a->Pos.x) * scan.invDeltaY[1];\r
337                 scan.x[1] = a->Pos.x;\r
338 \r
339 #ifdef IPOL_Z\r
340                 scan.slopeZ[1] = (b->Pos.z - a->Pos.z) * scan.invDeltaY[1];\r
341                 scan.z[1] = a->Pos.z;\r
342 #endif\r
343 \r
344 #ifdef IPOL_W\r
345                 scan.slopeW[1] = (b->Pos.w - a->Pos.w) * scan.invDeltaY[1];\r
346                 scan.w[1] = a->Pos.w;\r
347 #endif\r
348 \r
349 #ifdef IPOL_C0\r
350                 scan.slopeC[1] = (b->Color[0] - a->Color[0]) * scan.invDeltaY[1];\r
351                 scan.c[1] = a->Color[0];\r
352 #endif\r
353 \r
354 #ifdef IPOL_T0\r
355                 scan.slopeT[0][1] = (b->Tex[0] - a->Tex[0]) * scan.invDeltaY[1];\r
356                 scan.t[0][1] = a->Tex[0];\r
357 #endif\r
358 \r
359 #ifdef IPOL_T1\r
360                 scan.slopeT[1][1] = (b->Tex[1] - a->Tex[1]) * scan.invDeltaY[1];\r
361                 scan.t[1][1] = a->Tex[1];\r
362 #endif\r
363 \r
364                 // apply top-left fill convention, top part\r
365                 yStart = fill_convention_left( a->Pos.y );\r
366                 yEnd = fill_convention_right( b->Pos.y );\r
367 \r
368 #ifdef SUBTEXEL\r
369                 subPixel = ( (f32) yStart ) - a->Pos.y;\r
370 \r
371                 // correct to pixel center\r
372                 scan.x[0] += scan.slopeX[0] * subPixel;\r
373                 scan.x[1] += scan.slopeX[1] * subPixel;\r
374 \r
375 #ifdef IPOL_Z\r
376                 scan.z[0] += scan.slopeZ[0] * subPixel;\r
377                 scan.z[1] += scan.slopeZ[1] * subPixel;\r
378 #endif\r
379 \r
380 #ifdef IPOL_W\r
381                 scan.w[0] += scan.slopeW[0] * subPixel;\r
382                 scan.w[1] += scan.slopeW[1] * subPixel;\r
383 #endif\r
384 \r
385 #ifdef IPOL_C0\r
386                 scan.c[0] += scan.slopeC[0] * subPixel;\r
387                 scan.c[1] += scan.slopeC[1] * subPixel;\r
388 #endif\r
389 \r
390 #ifdef IPOL_T0\r
391                 scan.t[0][0] += scan.slopeT[0][0] * subPixel;\r
392                 scan.t[0][1] += scan.slopeT[0][1] * subPixel;\r
393 #endif\r
394 \r
395 #ifdef IPOL_T1\r
396                 scan.t[1][0] += scan.slopeT[1][0] * subPixel;\r
397                 scan.t[1][1] += scan.slopeT[1][1] * subPixel;\r
398 #endif\r
399 \r
400 #endif\r
401 \r
402                 // rasterize the edge scanlines\r
403                 for( line.y = yStart; line.y <= yEnd; line.y += SOFTWARE_DRIVER_2_STEP_Y)\r
404                 {\r
405                         line.x[scan.left] = scan.x[0];\r
406                         line.x[scan.right] = scan.x[1];\r
407 \r
408 #ifdef IPOL_Z\r
409                         line.z[scan.left] = scan.z[0];\r
410                         line.z[scan.right] = scan.z[1];\r
411 #endif\r
412 \r
413 #ifdef IPOL_W\r
414                         line.w[scan.left] = scan.w[0];\r
415                         line.w[scan.right] = scan.w[1];\r
416 #endif\r
417 \r
418 #ifdef IPOL_C0\r
419                         line.c[scan.left] = scan.c[0];\r
420                         line.c[scan.right] = scan.c[1];\r
421 #endif\r
422 \r
423 #ifdef IPOL_T0\r
424                         line.t[0][scan.left] = scan.t[0][0];\r
425                         line.t[0][scan.right] = scan.t[0][1];\r
426 #endif\r
427 \r
428 #ifdef IPOL_T1\r
429                         line.t[1][scan.left] = scan.t[1][0];\r
430                         line.t[1][scan.right] = scan.t[1][1];\r
431 #endif\r
432 \r
433                         // render a scanline\r
434                         interlace_scanline fragmentShader();\r
435 \r
436                         scan.x[0] += scan.slopeX[0];\r
437                         scan.x[1] += scan.slopeX[1];\r
438 \r
439 #ifdef IPOL_Z\r
440                         scan.z[0] += scan.slopeZ[0];\r
441                         scan.z[1] += scan.slopeZ[1];\r
442 #endif\r
443 \r
444 #ifdef IPOL_W\r
445                         scan.w[0] += scan.slopeW[0];\r
446                         scan.w[1] += scan.slopeW[1];\r
447 #endif\r
448 \r
449 #ifdef IPOL_C0\r
450                         scan.c[0] += scan.slopeC[0];\r
451                         scan.c[1] += scan.slopeC[1];\r
452 #endif\r
453 \r
454 #ifdef IPOL_T0\r
455                         scan.t[0][0] += scan.slopeT[0][0];\r
456                         scan.t[0][1] += scan.slopeT[0][1];\r
457 #endif\r
458 \r
459 #ifdef IPOL_T1\r
460                         scan.t[1][0] += scan.slopeT[1][0];\r
461                         scan.t[1][1] += scan.slopeT[1][1];\r
462 #endif\r
463 \r
464                 }\r
465         }\r
466 \r
467         // rasterize lower sub-triangle\r
468         if ( (f32) 0.0 != scan.invDeltaY[2] )\r
469         {\r
470                 // advance to middle point\r
471                 if( (f32) 0.0 != scan.invDeltaY[1] )\r
472                 {\r
473                         temp[0] = b->Pos.y - a->Pos.y;  // dy\r
474 \r
475                         scan.x[0] = a->Pos.x + scan.slopeX[0] * temp[0];\r
476 #ifdef IPOL_Z\r
477                         scan.z[0] = a->Pos.z + scan.slopeZ[0] * temp[0];\r
478 #endif\r
479 #ifdef IPOL_W\r
480                         scan.w[0] = a->Pos.w + scan.slopeW[0] * temp[0];\r
481 #endif\r
482 #ifdef IPOL_C0\r
483                         scan.c[0] = a->Color[0] + scan.slopeC[0] * temp[0];\r
484 #endif\r
485 #ifdef IPOL_T0\r
486                         scan.t[0][0] = a->Tex[0] + scan.slopeT[0][0] * temp[0];\r
487 #endif\r
488 #ifdef IPOL_T1\r
489                         scan.t[1][0] = a->Tex[1] + scan.slopeT[1][0] * temp[0];\r
490 #endif\r
491 \r
492                 }\r
493 \r
494                 // calculate slopes for bottom edge\r
495                 scan.slopeX[1] = (c->Pos.x - b->Pos.x) * scan.invDeltaY[2];\r
496                 scan.x[1] = b->Pos.x;\r
497 \r
498 #ifdef IPOL_Z\r
499                 scan.slopeZ[1] = (c->Pos.z - b->Pos.z) * scan.invDeltaY[2];\r
500                 scan.z[1] = b->Pos.z;\r
501 #endif\r
502 \r
503 #ifdef IPOL_W\r
504                 scan.slopeW[1] = (c->Pos.w - b->Pos.w) * scan.invDeltaY[2];\r
505                 scan.w[1] = b->Pos.w;\r
506 #endif\r
507 \r
508 #ifdef IPOL_C0\r
509                 scan.slopeC[1] = (c->Color[0] - b->Color[0]) * scan.invDeltaY[2];\r
510                 scan.c[1] = b->Color[0];\r
511 #endif\r
512 \r
513 #ifdef IPOL_T0\r
514                 scan.slopeT[0][1] = (c->Tex[0] - b->Tex[0]) * scan.invDeltaY[2];\r
515                 scan.t[0][1] = b->Tex[0];\r
516 #endif\r
517 \r
518 #ifdef IPOL_T1\r
519                 scan.slopeT[1][1] = (c->Tex[1] - b->Tex[1]) * scan.invDeltaY[2];\r
520                 scan.t[1][1] = b->Tex[1];\r
521 #endif\r
522 \r
523                 // apply top-left fill convention, top part\r
524                 yStart = fill_convention_left( b->Pos.y );\r
525                 yEnd = fill_convention_right( c->Pos.y );\r
526 \r
527 #ifdef SUBTEXEL\r
528 \r
529                 subPixel = ( (f32) yStart ) - b->Pos.y;\r
530 \r
531                 // correct to pixel center\r
532                 scan.x[0] += scan.slopeX[0] * subPixel;\r
533                 scan.x[1] += scan.slopeX[1] * subPixel;\r
534 \r
535 #ifdef IPOL_Z\r
536                 scan.z[0] += scan.slopeZ[0] * subPixel;\r
537                 scan.z[1] += scan.slopeZ[1] * subPixel;\r
538 #endif\r
539 \r
540 #ifdef IPOL_W\r
541                 scan.w[0] += scan.slopeW[0] * subPixel;\r
542                 scan.w[1] += scan.slopeW[1] * subPixel;\r
543 #endif\r
544 \r
545 #ifdef IPOL_C0\r
546                 scan.c[0] += scan.slopeC[0] * subPixel;\r
547                 scan.c[1] += scan.slopeC[1] * subPixel;\r
548 #endif\r
549 \r
550 #ifdef IPOL_T0\r
551                 scan.t[0][0] += scan.slopeT[0][0] * subPixel;\r
552                 scan.t[0][1] += scan.slopeT[0][1] * subPixel;\r
553 #endif\r
554 \r
555 #ifdef IPOL_T1\r
556                 scan.t[1][0] += scan.slopeT[1][0] * subPixel;\r
557                 scan.t[1][1] += scan.slopeT[1][1] * subPixel;\r
558 #endif\r
559 \r
560 #endif\r
561 \r
562                 // rasterize the edge scanlines\r
563                 for( line.y = yStart; line.y <= yEnd; line.y += SOFTWARE_DRIVER_2_STEP_Y)\r
564                 {\r
565                         line.x[scan.left] = scan.x[0];\r
566                         line.x[scan.right] = scan.x[1];\r
567 \r
568 #ifdef IPOL_Z\r
569                         line.z[scan.left] = scan.z[0];\r
570                         line.z[scan.right] = scan.z[1];\r
571 #endif\r
572 \r
573 #ifdef IPOL_W\r
574                         line.w[scan.left] = scan.w[0];\r
575                         line.w[scan.right] = scan.w[1];\r
576 #endif\r
577 \r
578 #ifdef IPOL_C0\r
579                         line.c[scan.left] = scan.c[0];\r
580                         line.c[scan.right] = scan.c[1];\r
581 #endif\r
582 \r
583 #ifdef IPOL_T0\r
584                         line.t[0][scan.left] = scan.t[0][0];\r
585                         line.t[0][scan.right] = scan.t[0][1];\r
586 #endif\r
587 \r
588 #ifdef IPOL_T1\r
589                         line.t[1][scan.left] = scan.t[1][0];\r
590                         line.t[1][scan.right] = scan.t[1][1];\r
591 #endif\r
592 \r
593                         // render a scanline\r
594                         interlace_scanline fragmentShader();\r
595 \r
596                         scan.x[0] += scan.slopeX[0];\r
597                         scan.x[1] += scan.slopeX[1];\r
598 \r
599 #ifdef IPOL_Z\r
600                         scan.z[0] += scan.slopeZ[0];\r
601                         scan.z[1] += scan.slopeZ[1];\r
602 #endif\r
603 \r
604 #ifdef IPOL_W\r
605                         scan.w[0] += scan.slopeW[0];\r
606                         scan.w[1] += scan.slopeW[1];\r
607 #endif\r
608 \r
609 #ifdef IPOL_C0\r
610                         scan.c[0] += scan.slopeC[0];\r
611                         scan.c[1] += scan.slopeC[1];\r
612 #endif\r
613 \r
614 #ifdef IPOL_T0\r
615                         scan.t[0][0] += scan.slopeT[0][0];\r
616                         scan.t[0][1] += scan.slopeT[0][1];\r
617 #endif\r
618 \r
619 #ifdef IPOL_T1\r
620                         scan.t[1][0] += scan.slopeT[1][0];\r
621                         scan.t[1][1] += scan.slopeT[1][1];\r
622 #endif\r
623 \r
624                 }\r
625         }\r
626 \r
627 \r
628 }\r
629 \r
630 \r
631 } // end namespace video\r
632 } // end namespace irr\r
633 \r
634 #endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_\r
635 \r
636 namespace irr\r
637 {\r
638 namespace video\r
639 {\r
640 \r
641 //! creates a flat triangle renderer\r
642 IBurningShader* createTriangleRendererTextureLightMap2_Add(CBurningVideoDriver* driver)\r
643 {\r
644         /* ETR_TEXTURE_GOURAUD_LIGHTMAP_ADD */\r
645         #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_\r
646         return new CTRTextureLightMap2_Add(driver);\r
647         #else\r
648         return 0;\r
649         #endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_\r
650 }\r
651 \r
652 \r
653 } // end namespace video\r
654 } // end namespace irr\r
655 \r
656 \r
657 \r