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
5
#include "IrrCompileConfig.h"
6
#include "IBurningShader.h"
8
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
10
// compile flag for this file
40
// apply global override
41
#ifndef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
45
#ifndef SOFTWARE_DRIVER_2_SUBTEXEL
49
#ifndef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
53
#if !defined ( SOFTWARE_DRIVER_2_USE_WBUFFER ) && defined ( USE_ZBUFFER )
54
#ifndef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
79
class CTRTextureBlend : public IBurningShader
84
CTRTextureBlend(CBurningVideoDriver* driver);
86
//! draws an indexed triangle list
87
virtual void drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4DVertex *c );
89
virtual void setZCompareFunc ( u32 func);
90
virtual void setParam ( u32 index, f32 value);
95
typedef void (CTRTextureBlend::*tFragmentShader) ();
96
void fragment_dst_color_zero ();
97
void fragment_dst_color_one ();
98
void fragment_dst_color_src_alpha ();
99
void fragment_dst_color_one_minus_dst_alpha ();
100
void fragment_zero_one_minus_scr_color ();
101
void fragment_src_color_src_alpha ();
102
void fragment_one_one_minus_src_alpha ();
103
void fragment_one_minus_dst_alpha_one();
104
void fragment_src_alpha_one();
106
tFragmentShader fragmentShader;
107
sScanConvertData scan;
114
CTRTextureBlend::CTRTextureBlend(CBurningVideoDriver* driver)
115
: IBurningShader(driver)
118
setDebugName("CTRTextureBlend");
126
void CTRTextureBlend::setZCompareFunc ( u32 func)
133
void CTRTextureBlend::setParam ( u32 index, f32 value)
137
E_BLEND_FACTOR srcFact,dstFact;
138
E_MODULATE_FUNC modulate;
140
unpack_texureBlendFunc ( srcFact, dstFact, modulate, alphaSrc, value );
144
if ( srcFact == EBF_DST_COLOR && dstFact == EBF_ZERO )
146
fragmentShader = &CTRTextureBlend::fragment_dst_color_zero;
149
if ( srcFact == EBF_DST_COLOR && dstFact == EBF_ONE )
151
fragmentShader = &CTRTextureBlend::fragment_dst_color_one;
154
if ( srcFact == EBF_DST_COLOR && dstFact == EBF_SRC_ALPHA)
156
fragmentShader = &CTRTextureBlend::fragment_dst_color_src_alpha;
159
if ( srcFact == EBF_DST_COLOR && dstFact == EBF_ONE_MINUS_DST_ALPHA)
161
fragmentShader = &CTRTextureBlend::fragment_dst_color_one_minus_dst_alpha;
164
if ( srcFact == EBF_ZERO && dstFact == EBF_ONE_MINUS_SRC_COLOR )
166
fragmentShader = &CTRTextureBlend::fragment_zero_one_minus_scr_color;
169
if ( srcFact == EBF_ONE && dstFact == EBF_ONE_MINUS_SRC_ALPHA)
171
fragmentShader = &CTRTextureBlend::fragment_one_one_minus_src_alpha;
174
if ( srcFact == EBF_ONE_MINUS_DST_ALPHA && dstFact == EBF_ONE )
176
fragmentShader = &CTRTextureBlend::fragment_one_minus_dst_alpha_one;
179
if ( srcFact == EBF_SRC_ALPHA && dstFact == EBF_ONE )
181
fragmentShader = &CTRTextureBlend::fragment_src_alpha_one;
184
if ( srcFact == EBF_SRC_COLOR && dstFact == EBF_SRC_ALPHA )
186
fragmentShader = &CTRTextureBlend::fragment_src_color_src_alpha;
191
fragmentShader = &CTRTextureBlend::fragment_dst_color_zero;
194
static const c8 *n[] =
199
"gl_one_minus_dst_color",
201
"gl_one_minus_src_color",
203
"gl_one_minus_src_alpha",
205
"gl_one_minus_dst_alpha",
206
"gl_src_alpha_saturate"
209
static E_BLEND_FACTOR lsrcFact = EBF_ZERO;
210
static E_BLEND_FACTOR ldstFact = EBF_ZERO;
212
if ( showname && ( lsrcFact != srcFact || ldstFact != dstFact ) )
215
snprintf ( buf, 128, "missing shader: %s %s",n[srcFact], n[dstFact] );
216
os::Printer::log( buf, ELL_INFORMATION );
227
void CTRTextureBlend::fragment_dst_color_src_alpha ()
251
sVec4 slopeC[MATERIAL_MAX_COLORS];
254
sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
257
// apply top-left fill-convention, left
258
xStart = core::ceil32( line.x[0] );
259
xEnd = core::ceil32( line.x[1] ) - 1;
267
const f32 invDeltaX = core::reciprocal_approxim ( line.x[1] - line.x[0] );
270
slopeZ = (line.z[1] - line.z[0]) * invDeltaX;
273
slopeW = (line.w[1] - line.w[0]) * invDeltaX;
276
slopeC[0] = (line.c[0][1] - line.c[0][0]) * invDeltaX;
279
slopeT[0] = (line.t[0][1] - line.t[0][0]) * invDeltaX;
282
slopeT[1] = (line.t[1][1] - line.t[1][0]) * invDeltaX;
286
subPixel = ( (f32) xStart ) - line.x[0];
288
line.z[0] += slopeZ * subPixel;
291
line.w[0] += slopeW * subPixel;
294
line.c[0][0] += slopeC[0] * subPixel;
297
line.t[0][0] += slopeT[0] * subPixel;
300
line.t[1][0] += slopeT[1] * subPixel;
304
dst = (tVideoSample*)RenderTarget->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
307
z = (fp24*) DepthBuffer->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
311
f32 iw = FIX_POINT_F32_MUL;
313
tFixPoint a0, r0, g0, b0;
314
tFixPoint r1, g1, b1;
321
for ( i = 0; i <= dx; ++i )
324
if ( line.w[0] >= z[i] )
334
iw = fix_inverse32 ( line.w[0] );
337
getSample_texture ( a0,r0,g0,b0,
339
tofix ( line.t[0][0].x,iw),
340
tofix ( line.t[0][0].y,iw)
343
color_to_fix ( r1, g1, b1, dst[i] );
345
dst[i] = fix_to_color ( clampfix_maxcolor ( imulFix_tex2 ( r0, r1 ) ),
346
clampfix_maxcolor ( imulFix_tex2 ( g0, g1 ) ),
347
clampfix_maxcolor ( imulFix_tex2 ( b0, b1 ) )
355
line.t[0][0] += slopeT[0];
358
line.c[0][0] += slopeC[0];
364
for ( i = 0; i <= dx; ++i )
367
if ( line.w[0] == z[i] )
377
iw = fix_inverse32 ( line.w[0] );
380
getSample_texture ( a0,r0,g0,b0,
382
tofix ( line.t[0][0].x,iw),
383
tofix ( line.t[0][0].y,iw)
386
color_to_fix ( r1, g1, b1, dst[i] );
388
dst[i] = fix_to_color ( clampfix_maxcolor ( imulFix_tex2 ( r0, r1 ) ),
389
clampfix_maxcolor ( imulFix_tex2 ( g0, g1 ) ),
390
clampfix_maxcolor ( imulFix_tex2 ( b0, b1 ) )
399
line.t[0][0] += slopeT[0];
402
line.c[0][0] += slopeC[0];
411
void CTRTextureBlend::fragment_src_color_src_alpha ()
435
sVec4 slopeC[MATERIAL_MAX_COLORS];
438
sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
441
// apply top-left fill-convention, left
442
xStart = core::ceil32( line.x[0] );
443
xEnd = core::ceil32( line.x[1] ) - 1;
451
const f32 invDeltaX = core::reciprocal_approxim ( line.x[1] - line.x[0] );
454
slopeZ = (line.z[1] - line.z[0]) * invDeltaX;
457
slopeW = (line.w[1] - line.w[0]) * invDeltaX;
460
slopeC[0] = (line.c[0][1] - line.c[0][0]) * invDeltaX;
463
slopeT[0] = (line.t[0][1] - line.t[0][0]) * invDeltaX;
466
slopeT[1] = (line.t[1][1] - line.t[1][0]) * invDeltaX;
470
subPixel = ( (f32) xStart ) - line.x[0];
472
line.z[0] += slopeZ * subPixel;
475
line.w[0] += slopeW * subPixel;
478
line.c[0][0] += slopeC[0] * subPixel;
481
line.t[0][0] += slopeT[0] * subPixel;
484
line.t[1][0] += slopeT[1] * subPixel;
488
dst = (tVideoSample*)RenderTarget->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
491
z = (fp24*) DepthBuffer->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
495
f32 iw = FIX_POINT_F32_MUL;
497
tFixPoint a0, r0, g0, b0;
498
tFixPoint r1, g1, b1;
505
for ( i = 0; i <= dx; ++i )
508
if ( line.w[0] >= z[i] )
518
iw = fix_inverse32 ( line.w[0] );
521
getSample_texture ( a0, r0, g0, b0, &IT[0], tofix ( line.t[0][0].x,iw), tofix ( line.t[0][0].y,iw) );
522
color_to_fix ( r1, g1, b1, dst[i] );
524
// u32 check = imulFix_tex1( r0, r1 );
525
dst[i] = fix_to_color ( clampfix_maxcolor ( imulFix_tex1( r0, r1 ) + imulFix_tex1( r1, a0 ) ),
526
clampfix_maxcolor ( imulFix_tex1( g0, g1 ) + imulFix_tex1( g1, a0 ) ),
527
clampfix_maxcolor ( imulFix_tex1( b0, b1 ) + imulFix_tex1( b1, a0 ) )
535
line.t[0][0] += slopeT[0];
538
line.c[0][0] += slopeC[0];
544
for ( i = 0; i <= dx; ++i )
547
if ( line.w[0] == z[i] )
557
iw = fix_inverse32 ( line.w[0] );
560
getSample_texture ( a0,r0,g0,b0,
562
tofix ( line.t[0][0].x,iw),
563
tofix ( line.t[0][0].y,iw)
566
color_to_fix ( r1, g1, b1, dst[i] );
568
dst[i] = fix_to_color ( clampfix_maxcolor ( imulFix_tex2 ( r0, r1 ) ),
569
clampfix_maxcolor ( imulFix_tex2 ( g0, g1 ) ),
570
clampfix_maxcolor ( imulFix_tex2 ( b0, b1 ) )
579
line.t[0][0] += slopeT[0];
582
line.c[0][0] += slopeC[0];
591
void CTRTextureBlend::fragment_one_one_minus_src_alpha()
615
sVec4 slopeC[MATERIAL_MAX_COLORS];
618
sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
621
// apply top-left fill-convention, left
622
xStart = core::ceil32( line.x[0] );
623
xEnd = core::ceil32( line.x[1] ) - 1;
631
const f32 invDeltaX = core::reciprocal_approxim ( line.x[1] - line.x[0] );
634
slopeZ = (line.z[1] - line.z[0]) * invDeltaX;
637
slopeW = (line.w[1] - line.w[0]) * invDeltaX;
640
slopeC[0] = (line.c[0][1] - line.c[0][0]) * invDeltaX;
643
slopeT[0] = (line.t[0][1] - line.t[0][0]) * invDeltaX;
646
slopeT[1] = (line.t[1][1] - line.t[1][0]) * invDeltaX;
650
subPixel = ( (f32) xStart ) - line.x[0];
652
line.z[0] += slopeZ * subPixel;
655
line.w[0] += slopeW * subPixel;
658
line.c[0][0] += slopeC[0] * subPixel;
661
line.t[0][0] += slopeT[0] * subPixel;
664
line.t[1][0] += slopeT[1] * subPixel;
668
dst = (tVideoSample*)RenderTarget->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
671
z = (fp24*) DepthBuffer->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
675
f32 iw = FIX_POINT_F32_MUL;
677
tFixPoint a0,r0, g0, b0;
678
tFixPoint r1, g1, b1;
679
tFixPoint r2, g2, b2;
686
for ( i = 0; i <= dx; ++i )
689
if ( line.w[0] >= z[i] )
699
iw = fix_inverse32 ( line.w[0] );
702
getSample_texture ( a0, r0, g0, b0, IT + 0, tofix ( line.t[0][0].x,iw),tofix ( line.t[0][0].y,iw) );
703
a0 = FIX_POINT_ONE - a0;
705
color_to_fix1 ( r1, g1, b1, dst[i] );
707
getSample_color ( r2, g2, b2, line.c[0][0],iw );
709
dst[i] = fix_to_color ( imulFix ( r0 + imulFix ( r1, a0 ), r2 ),
710
imulFix ( g0 + imulFix ( g1, a0 ), g2 ),
711
imulFix ( b0 + imulFix ( b1, a0 ), b2 )
714
dst[i] = fix_to_color ( r0 + imulFix ( r1, a0 ),
715
g0 + imulFix ( g1, a0 ),
716
b0 + imulFix ( b1, a0 )
727
line.t[0][0] += slopeT[0];
730
line.c[0][0] += slopeC[0];
736
for ( i = 0; i <= dx; ++i )
739
if ( line.w[0] == z[i] )
749
iw = fix_inverse32 ( line.w[0] );
751
getSample_texture ( a0, r0, g0, b0, IT + 0, tofix ( line.t[0][0].x,iw),tofix ( line.t[0][0].y,iw) );
752
a0 = FIX_POINT_ONE - a0;
754
color_to_fix1 ( r1, g1, b1, dst[i] );
756
getSample_color ( r2, g2, b2, line.c[0][0],iw );
758
dst[i] = fix_to_color ( imulFix ( r0 + imulFix ( r1, a0 ), r2 ),
759
imulFix ( g0 + imulFix ( g1, a0 ), g2 ),
760
imulFix ( b0 + imulFix ( b1, a0 ), b2 )
763
dst[i] = fix_to_color ( r0 + imulFix ( r1, a0 ),
764
g0 + imulFix ( g1, a0 ),
765
b0 + imulFix ( b1, a0 )
776
line.t[0][0] += slopeT[0];
779
line.c[0][0] += slopeC[0];
788
void CTRTextureBlend::fragment_one_minus_dst_alpha_one ()
812
sVec4 slopeC[MATERIAL_MAX_COLORS];
815
sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
818
// apply top-left fill-convention, left
819
xStart = core::ceil32( line.x[0] );
820
xEnd = core::ceil32( line.x[1] ) - 1;
828
const f32 invDeltaX = core::reciprocal_approxim ( line.x[1] - line.x[0] );
831
slopeZ = (line.z[1] - line.z[0]) * invDeltaX;
834
slopeW = (line.w[1] - line.w[0]) * invDeltaX;
837
slopeC[0] = (line.c[0][1] - line.c[0][0]) * invDeltaX;
840
slopeT[0] = (line.t[0][1] - line.t[0][0]) * invDeltaX;
843
slopeT[1] = (line.t[1][1] - line.t[1][0]) * invDeltaX;
847
subPixel = ( (f32) xStart ) - line.x[0];
849
line.z[0] += slopeZ * subPixel;
852
line.w[0] += slopeW * subPixel;
855
line.c[0][0] += slopeC[0] * subPixel;
858
line.t[0][0] += slopeT[0] * subPixel;
861
line.t[1][0] += slopeT[1] * subPixel;
865
dst = (tVideoSample*)RenderTarget->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
868
z = (fp24*) DepthBuffer->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
872
f32 iw = FIX_POINT_F32_MUL;
874
tFixPoint r0, g0, b0;
875
tFixPoint a1, r1, g1, b1;
876
tFixPoint r2, g2, b2;
883
for ( i = 0; i <= dx; ++i )
886
if ( line.w[0] >= z[i] )
896
iw = fix_inverse32 ( line.w[0] );
899
getSample_texture ( r0, g0, b0, IT + 0, tofix ( line.t[0][0].x,iw),tofix ( line.t[0][0].y,iw) );
900
color_to_fix1 ( a1, r1, g1, b1, dst[i] );
902
getSample_color ( r2, g2, b2, line.c[0][0],iw );
904
a1 = FIX_POINT_ONE - a1;
905
dst[i] = fix_to_color ( imulFix ( imulFix ( r0, a1 ) + r1, r2 ),
906
imulFix ( imulFix ( g0, a1 ) + g1, g2 ),
907
imulFix ( imulFix ( b0, a1 ) + b1, b2 )
910
dst[i] = fix_to_color ( imulFix ( r0, a1) + r0,
911
imulFix ( g0, a1) + g0,
912
imulFix ( b0, a1) + b0
923
line.t[0][0] += slopeT[0];
926
line.c[0][0] += slopeC[0];
932
for ( i = 0; i <= dx; ++i )
935
if ( line.w[0] == z[i] )
945
iw = fix_inverse32 ( line.w[0] );
947
getSample_texture ( r0, g0, b0, IT + 0, tofix ( line.t[0][0].x,iw),tofix ( line.t[0][0].y,iw) );
948
color_to_fix1 ( a1, r1, g1, b1, dst[i] );
951
getSample_color ( r2, g2, b2, line.c[0][0],iw );
953
a1 = FIX_POINT_ONE - a1;
954
dst[i] = fix_to_color ( imulFix ( imulFix ( r0, a1 ) + r1, r2 ),
955
imulFix ( imulFix ( g0, a1 ) + g1, g2 ),
956
imulFix ( imulFix ( b0, a1 ) + b1, b2 )
959
dst[i] = fix_to_color ( imulFix ( r0, a1) + r0,
960
imulFix ( g0, a1) + g0,
961
imulFix ( b0, a1) + b0
972
line.t[0][0] += slopeT[0];
975
line.c[0][0] += slopeC[0];
984
void CTRTextureBlend::fragment_src_alpha_one ()
1008
sVec4 slopeC[MATERIAL_MAX_COLORS];
1011
sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
1014
// apply top-left fill-convention, left
1015
xStart = core::ceil32( line.x[0] );
1016
xEnd = core::ceil32( line.x[1] ) - 1;
1024
const f32 invDeltaX = core::reciprocal_approxim ( line.x[1] - line.x[0] );
1027
slopeZ = (line.z[1] - line.z[0]) * invDeltaX;
1030
slopeW = (line.w[1] - line.w[0]) * invDeltaX;
1033
slopeC[0] = (line.c[0][1] - line.c[0][0]) * invDeltaX;
1036
slopeT[0] = (line.t[0][1] - line.t[0][0]) * invDeltaX;
1039
slopeT[1] = (line.t[1][1] - line.t[1][0]) * invDeltaX;
1043
subPixel = ( (f32) xStart ) - line.x[0];
1045
line.z[0] += slopeZ * subPixel;
1048
line.w[0] += slopeW * subPixel;
1051
line.c[0][0] += slopeC[0] * subPixel;
1054
line.t[0][0] += slopeT[0] * subPixel;
1057
line.t[1][0] += slopeT[1] * subPixel;
1061
dst = (tVideoSample*)RenderTarget->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
1064
z = (fp24*) DepthBuffer->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
1068
f32 iw = FIX_POINT_F32_MUL;
1070
tFixPoint a0, r0, g0, b0;
1071
tFixPoint r1, g1, b1;
1072
tFixPoint r2, g2, b2;
1079
for ( i = 0; i <= dx; ++i )
1082
if ( line.w[0] >= z[i] )
1089
iw = fix_inverse32 ( line.w[0] );
1092
getSample_texture ( a0, r0, g0, b0, IT + 0, tofix ( line.t[0][0].x,iw),tofix ( line.t[0][0].y,iw) );
1097
color_to_fix ( r1, g1, b1, dst[i] );
1100
getSample_color ( r2, g2, b2, line.c[0][0],iw );
1102
dst[i] = fix4_to_color ( a0,
1103
clampfix_maxcolor ( imulFix (r0,a0 ) + r1),
1104
clampfix_maxcolor ( imulFix (g0,a0 ) + g1),
1105
clampfix_maxcolor ( imulFix (b0,a0 ) + b1)
1110
dst[i] = fix4_to_color ( a0,
1111
imulFix ( imulFix ( r0, a0 ) + r1, r2 ),
1112
imulFix ( imulFix ( g0, a0 ) + g1, g2 ),
1113
imulFix ( imulFix ( b0, a0 ) + b1, b2 )
1117
dst[i] = fix4_to_color ( a0,
1118
clampfix_maxcolor ( imulFix (r0,a0 ) + r1 ),
1119
clampfix_maxcolor ( imulFix (g0,a0 ) + g1 ),
1120
clampfix_maxcolor ( imulFix (b0,a0 ) + b1 )
1133
line.w[0] += slopeW;
1136
line.t[0][0] += slopeT[0];
1139
line.c[0][0] += slopeC[0];
1145
for ( i = 0; i <= dx; ++i )
1148
if ( line.w[0] == z[i] )
1153
iw = fix_inverse32 ( line.w[0] );
1156
getSample_texture ( a0, r0, g0, b0, IT + 0, tofix ( line.t[0][0].x,iw),tofix ( line.t[0][0].y,iw) );
1161
color_to_fix ( r1, g1, b1, dst[i] );
1164
getSample_color ( r2, g2, b2, line.c[0][0],iw );
1166
dst[i] = fix4_to_color ( a0,
1167
clampfix_maxcolor ( imulFix ( imulFix (r0,a0 ) + r1, r2 ) ),
1168
clampfix_maxcolor ( imulFix ( imulFix (g0,a0 ) + g1, g2 ) ),
1169
clampfix_maxcolor ( imulFix ( imulFix (b0,a0 ) + b1, b2 ) )
1174
dst[i] = fix4_to_color ( a0,
1175
imulFix ( imulFix ( r0, a0 ) + r1, r2 ),
1176
imulFix ( imulFix ( g0, a0 ) + g1, g2 ),
1177
imulFix ( imulFix ( b0, a0 ) + b1, b2 )
1181
dst[i] = fix4_to_color ( a0,
1182
clampfix_maxcolor ( imulFix (r0,a0 ) + r1 ),
1183
clampfix_maxcolor ( imulFix (g0,a0 ) + g1 ),
1184
clampfix_maxcolor ( imulFix (b0,a0 ) + b1 )
1195
line.w[0] += slopeW;
1198
line.t[0][0] += slopeT[0];
1201
line.c[0][0] += slopeC[0];
1211
void CTRTextureBlend::fragment_dst_color_one_minus_dst_alpha ()
1235
sVec4 slopeC[MATERIAL_MAX_COLORS];
1238
sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
1241
// apply top-left fill-convention, left
1242
xStart = core::ceil32( line.x[0] );
1243
xEnd = core::ceil32( line.x[1] ) - 1;
1251
const f32 invDeltaX = core::reciprocal_approxim ( line.x[1] - line.x[0] );
1254
slopeZ = (line.z[1] - line.z[0]) * invDeltaX;
1257
slopeW = (line.w[1] - line.w[0]) * invDeltaX;
1260
slopeC[0] = (line.c[0][1] - line.c[0][0]) * invDeltaX;
1263
slopeT[0] = (line.t[0][1] - line.t[0][0]) * invDeltaX;
1266
slopeT[1] = (line.t[1][1] - line.t[1][0]) * invDeltaX;
1270
subPixel = ( (f32) xStart ) - line.x[0];
1272
line.z[0] += slopeZ * subPixel;
1275
line.w[0] += slopeW * subPixel;
1278
line.c[0][0] += slopeC[0] * subPixel;
1281
line.t[0][0] += slopeT[0] * subPixel;
1284
line.t[1][0] += slopeT[1] * subPixel;
1288
dst = (tVideoSample*)RenderTarget->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
1291
z = (fp24*) DepthBuffer->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
1295
f32 iw = FIX_POINT_F32_MUL;
1297
tFixPoint r0, g0, b0;
1298
tFixPoint a1, r1, g1, b1;
1299
tFixPoint r2, g2, b2;
1306
for ( i = 0; i <= dx; ++i )
1309
if ( line.w[0] >= z[i] )
1319
iw = fix_inverse32 ( line.w[0] );
1322
getSample_texture ( r0, g0, b0, IT + 0, tofix ( line.t[0][0].x,iw),tofix ( line.t[0][0].y,iw) );
1323
color_to_fix1 ( a1, r1, g1, b1, dst[i] );
1325
getSample_color ( r2, g2, b2, line.c[0][0],iw );
1327
a1 = FIX_POINT_ONE - a1;
1328
dst[i] = fix_to_color ( imulFix ( imulFix ( r1, r0 + a1 ), r2 ),
1329
imulFix ( imulFix ( g1, g0 + a1 ), g2 ),
1330
imulFix ( imulFix ( b1, b0 + a1 ), b2 )
1333
dst[i] = fix_to_color ( imulFix ( r1, r0 + a1 ),
1334
imulFix ( g1, g0 + a1 ),
1335
imulFix ( b1, b0 + a1 )
1343
line.w[0] += slopeW;
1346
line.t[0][0] += slopeT[0];
1349
line.c[0][0] += slopeC[0];
1355
for ( i = 0; i <= dx; ++i )
1358
if ( line.w[0] == z[i] )
1368
iw = fix_inverse32 ( line.w[0] );
1370
getSample_texture ( r0, g0, b0, IT + 0, tofix ( line.t[0][0].x,iw),tofix ( line.t[0][0].y,iw) );
1371
color_to_fix1 ( a1, r1, g1, b1, dst[i] );
1374
getSample_color ( r2, g2, b2, line.c[0][0],iw );
1376
a1 = FIX_POINT_ONE - a1;
1377
dst[i] = fix_to_color ( imulFix ( imulFix ( r1, r0 + a1 ), r2 ),
1378
imulFix ( imulFix ( g1, g0 + a1 ), g2 ),
1379
imulFix ( imulFix ( b1, b0 + a1 ), b2 )
1382
dst[i] = fix_to_color ( imulFix ( r1, r0 + a1 ),
1383
imulFix ( g1, g0 + a1 ),
1384
imulFix ( b1, b0 + a1 )
1392
line.w[0] += slopeW;
1395
line.t[0][0] += slopeT[0];
1398
line.c[0][0] += slopeC[0];
1407
void CTRTextureBlend::fragment_dst_color_zero ()
1431
sVec4 slopeC[MATERIAL_MAX_COLORS];
1434
sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
1437
// apply top-left fill-convention, left
1438
xStart = core::ceil32( line.x[0] );
1439
xEnd = core::ceil32( line.x[1] ) - 1;
1447
const f32 invDeltaX = core::reciprocal_approxim ( line.x[1] - line.x[0] );
1450
slopeZ = (line.z[1] - line.z[0]) * invDeltaX;
1453
slopeW = (line.w[1] - line.w[0]) * invDeltaX;
1456
slopeC[0] = (line.c[0][1] - line.c[0][0]) * invDeltaX;
1459
slopeT[0] = (line.t[0][1] - line.t[0][0]) * invDeltaX;
1462
slopeT[1] = (line.t[1][1] - line.t[1][0]) * invDeltaX;
1466
subPixel = ( (f32) xStart ) - line.x[0];
1468
line.z[0] += slopeZ * subPixel;
1471
line.w[0] += slopeW * subPixel;
1474
line.c[0][0] += slopeC[0] * subPixel;
1477
line.t[0][0] += slopeT[0] * subPixel;
1480
line.t[1][0] += slopeT[1] * subPixel;
1484
dst = (tVideoSample*)RenderTarget->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
1487
z = (fp24*) DepthBuffer->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
1491
f32 iw = FIX_POINT_F32_MUL;
1493
tFixPoint r0, g0, b0;
1494
tFixPoint r1, g1, b1;
1495
tFixPoint r2, g2, b2;
1502
for ( i = 0; i <= dx; ++i )
1505
if ( line.w[0] >= z[i] )
1515
iw = fix_inverse32 ( line.w[0] );
1518
getSample_texture ( r0, g0, b0, IT + 0, tofix ( line.t[0][0].x,iw),tofix ( line.t[0][0].y,iw) );
1519
color_to_fix1 ( r1, g1, b1, dst[i] );
1522
getSample_color ( r2, g2, b2, line.c[0][0],iw );
1524
dst[i] = fix_to_color ( imulFix ( imulFix ( r0, r1 ), r2 ),
1525
imulFix ( imulFix ( g0, g1 ), g2 ),
1526
imulFix ( imulFix ( b0, b1 ), b2 ) );
1528
dst[i] = fix_to_color ( imulFix ( r0, r1 ),
1538
line.w[0] += slopeW;
1541
line.t[0][0] += slopeT[0];
1544
line.c[0][0] += slopeC[0];
1550
for ( i = 0; i <= dx; ++i )
1553
if ( line.w[0] == z[i] )
1563
iw = fix_inverse32 ( line.w[0] );
1565
getSample_texture ( r0, g0, b0, IT + 0, tofix ( line.t[0][0].x,iw),tofix ( line.t[0][0].y,iw) );
1566
color_to_fix1 ( r1, g1, b1, dst[i] );
1569
getSample_color ( r2, g2, b2, line.c[0][0],iw );
1571
dst[i] = fix_to_color ( imulFix ( imulFix ( r0, r1 ), r2 ),
1572
imulFix ( imulFix ( g0, g1 ), g2 ),
1573
imulFix ( imulFix ( b0, b1 ), b2 )
1576
dst[i] = fix_to_color ( imulFix ( r0, r1 ),
1586
line.w[0] += slopeW;
1589
line.t[0][0] += slopeT[0];
1592
line.c[0][0] += slopeC[0];
1601
void CTRTextureBlend::fragment_dst_color_one ()
1625
sVec4 slopeC[MATERIAL_MAX_COLORS];
1628
sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
1631
// apply top-left fill-convention, left
1632
xStart = core::ceil32( line.x[0] );
1633
xEnd = core::ceil32( line.x[1] ) - 1;
1641
const f32 invDeltaX = core::reciprocal_approxim ( line.x[1] - line.x[0] );
1644
slopeZ = (line.z[1] - line.z[0]) * invDeltaX;
1647
slopeW = (line.w[1] - line.w[0]) * invDeltaX;
1650
slopeC[0] = (line.c[0][1] - line.c[0][0]) * invDeltaX;
1653
slopeT[0] = (line.t[0][1] - line.t[0][0]) * invDeltaX;
1656
slopeT[1] = (line.t[1][1] - line.t[1][0]) * invDeltaX;
1660
subPixel = ( (f32) xStart ) - line.x[0];
1662
line.z[0] += slopeZ * subPixel;
1665
line.w[0] += slopeW * subPixel;
1668
line.c[0][0] += slopeC[0] * subPixel;
1671
line.t[0][0] += slopeT[0] * subPixel;
1674
line.t[1][0] += slopeT[1] * subPixel;
1678
dst = (tVideoSample*)RenderTarget->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
1681
z = (fp24*) DepthBuffer->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
1685
f32 iw = FIX_POINT_F32_MUL;
1687
tFixPoint r0, g0, b0;
1688
tFixPoint r1, g1, b1;
1689
tFixPoint r2, g2, b2;
1696
for ( i = 0; i <= dx; ++i )
1699
if ( line.w[0] >= z[i] )
1709
iw = fix_inverse32 ( line.w[0] );
1712
getSample_texture ( r0, g0, b0, IT + 0, tofix ( line.t[0][0].x,iw),tofix ( line.t[0][0].y,iw) );
1713
color_to_fix ( r1, g1, b1, dst[i] );
1715
getSample_color ( r2, g2, b2, line.c[0][0],iw );
1717
dst[i] = fix_to_color ( clampfix_maxcolor ( imulFix_tex1 ( r0, r1 ) + r1 ),
1718
clampfix_maxcolor ( imulFix_tex1 ( g0, g1 ) + g1 ),
1719
clampfix_maxcolor ( imulFix_tex1 ( b0, b1 ) + b1 )
1723
dst[i] = fix_to_color ( clampfix_maxcolor ( imulFix_tex1 ( r0, r1 ) + r1 ),
1724
clampfix_maxcolor ( imulFix_tex1 ( g0, g1 ) + g1 ),
1725
clampfix_maxcolor ( imulFix_tex1 ( b0, b1 ) + b1 )
1733
line.w[0] += slopeW;
1736
line.t[0][0] += slopeT[0];
1739
line.c[0][0] += slopeC[0];
1745
for ( i = 0; i <= dx; ++i )
1748
if ( line.w[0] == z[i] )
1758
iw = fix_inverse32 ( line.w[0] );
1760
getSample_texture ( r0, g0, b0, IT + 0, tofix ( line.t[0][0].x,iw),tofix ( line.t[0][0].y,iw) );
1761
color_to_fix ( r1, g1, b1, dst[i] );
1764
getSample_color ( r2, g2, b2, line.c[0][0],iw );
1766
dst[i] = fix_to_color ( clampfix_maxcolor ( imulFix_tex1 ( r0, r1 ) + r1 ),
1767
clampfix_maxcolor ( imulFix_tex1 ( g0, g1 ) + g1 ),
1768
clampfix_maxcolor ( imulFix_tex1 ( b0, b1 ) + b1 )
1772
dst[i] = fix_to_color ( clampfix_maxcolor ( imulFix_tex1 ( r0, r1 ) + r1 ),
1773
clampfix_maxcolor ( imulFix_tex1 ( g0, g1 ) + g1 ),
1774
clampfix_maxcolor ( imulFix_tex1 ( b0, b1 ) + b1 )
1783
line.w[0] += slopeW;
1786
line.t[0][0] += slopeT[0];
1789
line.c[0][0] += slopeC[0];
1798
void CTRTextureBlend::fragment_zero_one_minus_scr_color ()
1822
sVec4 slopeC[MATERIAL_MAX_COLORS];
1825
sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
1828
// apply top-left fill-convention, left
1829
xStart = core::ceil32( line.x[0] );
1830
xEnd = core::ceil32( line.x[1] ) - 1;
1838
const f32 invDeltaX = core::reciprocal_approxim ( line.x[1] - line.x[0] );
1841
slopeZ = (line.z[1] - line.z[0]) * invDeltaX;
1844
slopeW = (line.w[1] - line.w[0]) * invDeltaX;
1847
slopeC[0] = (line.c[0][1] - line.c[0][0]) * invDeltaX;
1850
slopeT[0] = (line.t[0][1] - line.t[0][0]) * invDeltaX;
1853
slopeT[1] = (line.t[1][1] - line.t[1][0]) * invDeltaX;
1857
subPixel = ( (f32) xStart ) - line.x[0];
1859
line.z[0] += slopeZ * subPixel;
1862
line.w[0] += slopeW * subPixel;
1865
line.c[0][0] += slopeC[0] * subPixel;
1868
line.t[0][0] += slopeT[0] * subPixel;
1871
line.t[1][0] += slopeT[1] * subPixel;
1875
dst = (tVideoSample*)RenderTarget->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
1878
z = (fp24*) DepthBuffer->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
1882
f32 iw = FIX_POINT_F32_MUL;
1884
tFixPoint r0, g0, b0;
1885
tFixPoint r1, g1, b1;
1886
tFixPoint r2, g2, b2;
1893
for ( i = 0; i <= dx; ++i )
1896
if ( line.w[0] >= z[i] )
1906
iw = fix_inverse32 ( line.w[0] );
1909
getSample_texture ( r0, g0, b0, IT + 0, tofix ( line.t[0][0].x,iw),tofix ( line.t[0][0].y,iw) );
1910
color_to_fix1 ( r1, g1, b1, dst[i] );
1912
getSample_color ( r2, g2, b2, line.c[0][0],iw );
1914
dst[i] = fix_to_color ( imulFix ( FIX_POINT_ONE - r0, r1 ),
1915
imulFix ( FIX_POINT_ONE - g0, g1 ),
1916
imulFix ( FIX_POINT_ONE - b0, b1 )
1920
dst[i] = fix_to_color ( imulFix ( FIX_POINT_ONE - r0, r1 ),
1921
imulFix ( FIX_POINT_ONE - g0, g1 ),
1922
imulFix ( FIX_POINT_ONE - b0, b1 )
1930
line.w[0] += slopeW;
1933
line.t[0][0] += slopeT[0];
1936
line.c[0][0] += slopeC[0];
1942
for ( i = 0; i <= dx; ++i )
1945
if ( line.w[0] == z[i] )
1955
iw = fix_inverse32 ( line.w[0] );
1957
getSample_texture ( r0, g0, b0, IT + 0, tofix ( line.t[0][0].x,iw),tofix ( line.t[0][0].y,iw) );
1958
color_to_fix1 ( r1, g1, b1, dst[i] );
1960
getSample_color ( r2, g2, b2, line.c[0][0],iw );
1962
dst[i] = fix_to_color ( imulFix ( FIX_POINT_ONE - r0, r1 ),
1963
imulFix ( FIX_POINT_ONE - g0, g1 ),
1964
imulFix ( FIX_POINT_ONE - b0, b1 )
1968
dst[i] = fix_to_color ( imulFix ( FIX_POINT_ONE - r0, r1 ),
1969
imulFix ( FIX_POINT_ONE - g0, g1 ),
1970
imulFix ( FIX_POINT_ONE - b0, b1 )
1978
line.w[0] += slopeW;
1981
line.t[0][0] += slopeT[0];
1984
line.c[0][0] += slopeC[0];
1993
void CTRTextureBlend::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4DVertex *c )
1995
if ( 0 == fragmentShader )
1998
// sort on height, y
1999
if ( F32_A_GREATER_B ( a->Pos.y , b->Pos.y ) ) swapVertexPointer(&a, &b);
2000
if ( F32_A_GREATER_B ( b->Pos.y , c->Pos.y ) ) swapVertexPointer(&b, &c);
2001
if ( F32_A_GREATER_B ( a->Pos.y , b->Pos.y ) ) swapVertexPointer(&a, &b);
2003
const f32 ca = c->Pos.y - a->Pos.y;
2004
const f32 ba = b->Pos.y - a->Pos.y;
2005
const f32 cb = c->Pos.y - b->Pos.y;
2006
// calculate delta y of the edges
2007
scan.invDeltaY[0] = core::reciprocal( ca );
2008
scan.invDeltaY[1] = core::reciprocal( ba );
2009
scan.invDeltaY[2] = core::reciprocal( cb );
2011
if ( F32_LOWER_EQUAL_0 ( scan.invDeltaY[0] ) )
2014
// find if the major edge is left or right aligned
2017
temp[0] = a->Pos.x - c->Pos.x;
2019
temp[2] = b->Pos.x - a->Pos.x;
2022
scan.left = ( temp[0] * temp[3] - temp[1] * temp[2] ) > 0.f ? 0 : 1;
2023
scan.right = 1 - scan.left;
2025
// calculate slopes for the major edge
2026
scan.slopeX[0] = (c->Pos.x - a->Pos.x) * scan.invDeltaY[0];
2027
scan.x[0] = a->Pos.x;
2030
scan.slopeZ[0] = (c->Pos.z - a->Pos.z) * scan.invDeltaY[0];
2031
scan.z[0] = a->Pos.z;
2035
scan.slopeW[0] = (c->Pos.w - a->Pos.w) * scan.invDeltaY[0];
2036
scan.w[0] = a->Pos.w;
2040
scan.slopeC[0][0] = (c->Color[0] - a->Color[0]) * scan.invDeltaY[0];
2041
scan.c[0][0] = a->Color[0];
2045
scan.slopeT[0][0] = (c->Tex[0] - a->Tex[0]) * scan.invDeltaY[0];
2046
scan.t[0][0] = a->Tex[0];
2050
scan.slopeT[1][0] = (c->Tex[1] - a->Tex[1]) * scan.invDeltaY[0];
2051
scan.t[1][0] = a->Tex[1];
2054
// top left fill convention y run
2062
// rasterize upper sub-triangle
2063
if ( (f32) 0.0 != scan.invDeltaY[1] )
2065
// calculate slopes for top edge
2066
scan.slopeX[1] = (b->Pos.x - a->Pos.x) * scan.invDeltaY[1];
2067
scan.x[1] = a->Pos.x;
2070
scan.slopeZ[1] = (b->Pos.z - a->Pos.z) * scan.invDeltaY[1];
2071
scan.z[1] = a->Pos.z;
2075
scan.slopeW[1] = (b->Pos.w - a->Pos.w) * scan.invDeltaY[1];
2076
scan.w[1] = a->Pos.w;
2080
scan.slopeC[0][1] = (b->Color[0] - a->Color[0]) * scan.invDeltaY[1];
2081
scan.c[0][1] = a->Color[0];
2085
scan.slopeT[0][1] = (b->Tex[0] - a->Tex[0]) * scan.invDeltaY[1];
2086
scan.t[0][1] = a->Tex[0];
2090
scan.slopeT[1][1] = (b->Tex[1] - a->Tex[1]) * scan.invDeltaY[1];
2091
scan.t[1][1] = a->Tex[1];
2094
// apply top-left fill convention, top part
2095
yStart = core::ceil32( a->Pos.y );
2096
yEnd = core::ceil32( b->Pos.y ) - 1;
2099
subPixel = ( (f32) yStart ) - a->Pos.y;
2101
// correct to pixel center
2102
scan.x[0] += scan.slopeX[0] * subPixel;
2103
scan.x[1] += scan.slopeX[1] * subPixel;
2106
scan.z[0] += scan.slopeZ[0] * subPixel;
2107
scan.z[1] += scan.slopeZ[1] * subPixel;
2111
scan.w[0] += scan.slopeW[0] * subPixel;
2112
scan.w[1] += scan.slopeW[1] * subPixel;
2116
scan.c[0][0] += scan.slopeC[0][0] * subPixel;
2117
scan.c[0][1] += scan.slopeC[0][1] * subPixel;
2121
scan.t[0][0] += scan.slopeT[0][0] * subPixel;
2122
scan.t[0][1] += scan.slopeT[0][1] * subPixel;
2126
scan.t[1][0] += scan.slopeT[1][0] * subPixel;
2127
scan.t[1][1] += scan.slopeT[1][1] * subPixel;
2132
// rasterize the edge scanlines
2133
for( line.y = yStart; line.y <= yEnd; ++line.y)
2135
line.x[scan.left] = scan.x[0];
2136
line.x[scan.right] = scan.x[1];
2139
line.z[scan.left] = scan.z[0];
2140
line.z[scan.right] = scan.z[1];
2144
line.w[scan.left] = scan.w[0];
2145
line.w[scan.right] = scan.w[1];
2149
line.c[0][scan.left] = scan.c[0][0];
2150
line.c[0][scan.right] = scan.c[0][1];
2154
line.t[0][scan.left] = scan.t[0][0];
2155
line.t[0][scan.right] = scan.t[0][1];
2159
line.t[1][scan.left] = scan.t[1][0];
2160
line.t[1][scan.right] = scan.t[1][1];
2163
// render a scanline
2164
(this->*fragmentShader) ();
2166
scan.x[0] += scan.slopeX[0];
2167
scan.x[1] += scan.slopeX[1];
2170
scan.z[0] += scan.slopeZ[0];
2171
scan.z[1] += scan.slopeZ[1];
2175
scan.w[0] += scan.slopeW[0];
2176
scan.w[1] += scan.slopeW[1];
2180
scan.c[0][0] += scan.slopeC[0][0];
2181
scan.c[0][1] += scan.slopeC[0][1];
2185
scan.t[0][0] += scan.slopeT[0][0];
2186
scan.t[0][1] += scan.slopeT[0][1];
2190
scan.t[1][0] += scan.slopeT[1][0];
2191
scan.t[1][1] += scan.slopeT[1][1];
2197
// rasterize lower sub-triangle
2198
if ( (f32) 0.0 != scan.invDeltaY[2] )
2200
// advance to middle point
2201
if( (f32) 0.0 != scan.invDeltaY[1] )
2203
temp[0] = b->Pos.y - a->Pos.y; // dy
2205
scan.x[0] = a->Pos.x + scan.slopeX[0] * temp[0];
2207
scan.z[0] = a->Pos.z + scan.slopeZ[0] * temp[0];
2210
scan.w[0] = a->Pos.w + scan.slopeW[0] * temp[0];
2213
scan.c[0][0] = a->Color[0] + scan.slopeC[0][0] * temp[0];
2216
scan.t[0][0] = a->Tex[0] + scan.slopeT[0][0] * temp[0];
2219
scan.t[1][0] = a->Tex[1] + scan.slopeT[1][0] * temp[0];
2224
// calculate slopes for bottom edge
2225
scan.slopeX[1] = (c->Pos.x - b->Pos.x) * scan.invDeltaY[2];
2226
scan.x[1] = b->Pos.x;
2229
scan.slopeZ[1] = (c->Pos.z - b->Pos.z) * scan.invDeltaY[2];
2230
scan.z[1] = b->Pos.z;
2234
scan.slopeW[1] = (c->Pos.w - b->Pos.w) * scan.invDeltaY[2];
2235
scan.w[1] = b->Pos.w;
2239
scan.slopeC[0][1] = (c->Color[0] - b->Color[0]) * scan.invDeltaY[2];
2240
scan.c[0][1] = b->Color[0];
2244
scan.slopeT[0][1] = (c->Tex[0] - b->Tex[0]) * scan.invDeltaY[2];
2245
scan.t[0][1] = b->Tex[0];
2249
scan.slopeT[1][1] = (c->Tex[1] - b->Tex[1]) * scan.invDeltaY[2];
2250
scan.t[1][1] = b->Tex[1];
2253
// apply top-left fill convention, top part
2254
yStart = core::ceil32( b->Pos.y );
2255
yEnd = core::ceil32( c->Pos.y ) - 1;
2259
subPixel = ( (f32) yStart ) - b->Pos.y;
2261
// correct to pixel center
2262
scan.x[0] += scan.slopeX[0] * subPixel;
2263
scan.x[1] += scan.slopeX[1] * subPixel;
2266
scan.z[0] += scan.slopeZ[0] * subPixel;
2267
scan.z[1] += scan.slopeZ[1] * subPixel;
2271
scan.w[0] += scan.slopeW[0] * subPixel;
2272
scan.w[1] += scan.slopeW[1] * subPixel;
2276
scan.c[0][0] += scan.slopeC[0][0] * subPixel;
2277
scan.c[0][1] += scan.slopeC[0][1] * subPixel;
2281
scan.t[0][0] += scan.slopeT[0][0] * subPixel;
2282
scan.t[0][1] += scan.slopeT[0][1] * subPixel;
2286
scan.t[1][0] += scan.slopeT[1][0] * subPixel;
2287
scan.t[1][1] += scan.slopeT[1][1] * subPixel;
2292
// rasterize the edge scanlines
2293
for( line.y = yStart; line.y <= yEnd; ++line.y)
2295
line.x[scan.left] = scan.x[0];
2296
line.x[scan.right] = scan.x[1];
2299
line.z[scan.left] = scan.z[0];
2300
line.z[scan.right] = scan.z[1];
2304
line.w[scan.left] = scan.w[0];
2305
line.w[scan.right] = scan.w[1];
2309
line.c[0][scan.left] = scan.c[0][0];
2310
line.c[0][scan.right] = scan.c[0][1];
2314
line.t[0][scan.left] = scan.t[0][0];
2315
line.t[0][scan.right] = scan.t[0][1];
2319
line.t[1][scan.left] = scan.t[1][0];
2320
line.t[1][scan.right] = scan.t[1][1];
2323
// render a scanline
2324
(this->*fragmentShader) ();
2326
scan.x[0] += scan.slopeX[0];
2327
scan.x[1] += scan.slopeX[1];
2330
scan.z[0] += scan.slopeZ[0];
2331
scan.z[1] += scan.slopeZ[1];
2335
scan.w[0] += scan.slopeW[0];
2336
scan.w[1] += scan.slopeW[1];
2340
scan.c[0][0] += scan.slopeC[0][0];
2341
scan.c[0][1] += scan.slopeC[0][1];
2345
scan.t[0][0] += scan.slopeT[0][0];
2346
scan.t[0][1] += scan.slopeT[0][1];
2350
scan.t[1][0] += scan.slopeT[1][0];
2351
scan.t[1][1] += scan.slopeT[1][1];
2361
} // end namespace video
2362
} // end namespace irr
2364
#endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_
2371
//! creates a flat triangle renderer
2372
IBurningShader* createTRTextureBlend(CBurningVideoDriver* driver)
2374
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
2375
return new CTRTextureBlend(driver);
2378
#endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_
2382
} // end namespace video
2383
} // end namespace irr