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