~baltix/+junk/irrlicht-test

« back to all changes in this revision

Viewing changes to source/Irrlicht/CTRTextureGouraudNoZ2.cpp

  • Committer: Mantas Kriaučiūnas
  • Date: 2011-07-18 13:06:25 UTC
  • Revision ID: mantas@akl.lt-20110718130625-c5pvifp61e7kj1ol
Included whole irrlicht SVN libraries to work around launchpad recipe issue with quilt, see https://answers.launchpad.net/launchpad/+question/165193

Show diffs side-by-side

added added

removed removed

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