1
0

Merging r6075 through r6106 from trunk to ogl-es branch.

Burnings renderer changes.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6116 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien
2020-06-12 20:41:49 +00:00
parent 084e0e669a
commit 20b3d56987
117 changed files with 10384 additions and 3817 deletions

View File

@@ -21,6 +21,7 @@
#undef INVERSE_W
#undef IPOL_C0
#undef IPOL_C1
#undef IPOL_T0
#undef IPOL_T1
@@ -34,6 +35,7 @@
//#define WRITE_W
#define IPOL_C0
//#define IPOL_C1
#define IPOL_T0
//#define IPOL_T1
@@ -46,10 +48,14 @@
#undef SUBTEXEL
#endif
#ifndef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
#if BURNING_MATERIAL_MAX_COLORS < 1
#undef IPOL_C0
#endif
#if BURNING_MATERIAL_MAX_COLORS < 2
#undef IPOL_C1
#endif
#if !defined ( SOFTWARE_DRIVER_2_USE_WBUFFER ) && defined ( USE_ZBUFFER )
#ifndef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
#undef IPOL_W
@@ -84,18 +90,34 @@ public:
CTRTextureGouraudAlphaNoZ(CBurningVideoDriver* driver);
//! draws an indexed triangle list
virtual void drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4DVertex *c ) _IRR_OVERRIDE_;
virtual void drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c) _IRR_OVERRIDE_;
virtual void OnSetMaterial(const SBurningShaderMaterial& material) _IRR_OVERRIDE_;
virtual void setParam ( u32 index, f32 value) _IRR_OVERRIDE_;
#if defined(PATCH_SUPERTUX_8_0_1)
SBurningShaderMaterial Material;
virtual void setMaterial(const SBurningShaderMaterial &material)
{
Material = material;
}
virtual void setParam(u32 index, f32 value)
{
OnSetMaterial(Material);
}
#endif
private:
void scanline_bilinear ();
sScanConvertData scan;
sScanLineData line;
// fragment shader
typedef void (CTRTextureGouraudAlphaNoZ::*tFragmentShader) ();
void fragment_linear();
void fragment_linear_test();
void fragment_point_noz();
tFragmentShader fragmentShader;
u32 AlphaRef;
};
//! constructor
@@ -106,24 +128,37 @@ CTRTextureGouraudAlphaNoZ::CTRTextureGouraudAlphaNoZ(CBurningVideoDriver* driver
setDebugName("CTRTextureGouraudAlphaNoZ");
#endif
AlphaRef = 0;
fragmentShader = &CTRTextureGouraudAlphaNoZ::fragment_linear;
}
/*!
*/
void CTRTextureGouraudAlphaNoZ::setParam ( u32 index, f32 value)
void CTRTextureGouraudAlphaNoZ::OnSetMaterial(const SBurningShaderMaterial& material)
{
#ifdef BURNINGVIDEO_RENDERER_FAST
AlphaRef = core::floor32_fast( value * 256.f );
#if defined(BURNINGVIDEO_RENDERER_FAST) && COLOR_MAX==0xff
AlphaRef = core::floor32(material.org.MaterialTypeParam * 256.f);
#else
AlphaRef = u32_to_fixPoint ( core::floor32_fast( value * 256.f ) );
AlphaRef = tofix(material.org.MaterialTypeParam, FIXPOINT_COLOR_MAX);
#endif
//check triangle on w = 1.f instead..
#ifdef SOFTWARE_DRIVER_2_BILINEAR
if (material.Fallback_MaterialType == EMT_TRANSPARENT_ALPHA_CHANNEL_REF)
fragmentShader = &CTRTextureGouraudAlphaNoZ::fragment_linear_test;
else
if ( material.org.TextureLayer[0].BilinearFilter )
fragmentShader = &CTRTextureGouraudAlphaNoZ::fragment_linear;
else
#endif
fragmentShader = &CTRTextureGouraudAlphaNoZ::fragment_point_noz;
}
/*!
*/
void CTRTextureGouraudAlphaNoZ::scanline_bilinear ()
void CTRTextureGouraudAlphaNoZ::fragment_linear()
{
tVideoSample *dst;
@@ -147,15 +182,15 @@ void CTRTextureGouraudAlphaNoZ::scanline_bilinear ()
fp24 slopeW;
#endif
#ifdef IPOL_C0
sVec4 slopeC[MATERIAL_MAX_COLORS];
sVec4 slopeC[BURNING_MATERIAL_MAX_COLORS];
#endif
#ifdef IPOL_T0
sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
#endif
// apply top-left fill-convention, left
xStart = core::ceil32_fast( line.x[0] );
xEnd = core::ceil32_fast( line.x[1] ) - 1;
xStart = fill_convention_left( line.x[0] );
xEnd = fill_convention_right( line.x[1] );
dx = xEnd - xStart;
@@ -163,7 +198,7 @@ void CTRTextureGouraudAlphaNoZ::scanline_bilinear ()
return;
// slopes
const f32 invDeltaX = core::reciprocal_approxim ( line.x[1] - line.x[0] );
const f32 invDeltaX = reciprocal_zero2( line.x[1] - line.x[0] );
#ifdef IPOL_Z
slopeZ = (line.z[1] - line.z[0]) * invDeltaX;
@@ -174,6 +209,9 @@ void CTRTextureGouraudAlphaNoZ::scanline_bilinear ()
#ifdef IPOL_C0
slopeC[0] = (line.c[0][1] - line.c[0][0]) * invDeltaX;
#endif
#ifdef IPOL_C1
slopeC[1] = (line.c[1][1] - line.c[1][0]) * invDeltaX;
#endif
#ifdef IPOL_T0
slopeT[0] = (line.t[0][1] - line.t[0][0]) * invDeltaX;
#endif
@@ -192,6 +230,9 @@ void CTRTextureGouraudAlphaNoZ::scanline_bilinear ()
#ifdef IPOL_C0
line.c[0][0] += slopeC[0] * subPixel;
#endif
#ifdef IPOL_C1
line.c[1][0] += slopeC[1] * subPixel;
#endif
#ifdef IPOL_T0
line.t[0][0] += slopeT[0] * subPixel;
#endif
@@ -200,6 +241,7 @@ void CTRTextureGouraudAlphaNoZ::scanline_bilinear ()
#endif
#endif
SOFTWARE_DRIVER_2_CLIPCHECK;
dst = (tVideoSample*)RenderTarget->getData() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
#ifdef USE_ZBUFFER
@@ -209,7 +251,7 @@ void CTRTextureGouraudAlphaNoZ::scanline_bilinear ()
f32 inversew = FIX_POINT_F32_MUL;
#ifdef BURNINGVIDEO_RENDERER_FAST
#if defined(BURNINGVIDEO_RENDERER_FAST) && COLOR_MAX==0xff
u32 dIndex = ( line.y & 3 ) << 2;
#else
@@ -219,7 +261,11 @@ void CTRTextureGouraudAlphaNoZ::scanline_bilinear ()
#ifdef IPOL_C0
tFixPoint r1, g1, b1;
tFixPoint r2, g2, b2;
tFixPoint a2,r2, g2, b2;
#endif
#ifdef IPOL_C1
tFixPoint a3,r3, g3, b3;
#endif
for ( s32 i = 0; i <= dx; ++i )
@@ -233,7 +279,7 @@ void CTRTextureGouraudAlphaNoZ::scanline_bilinear ()
{
#ifdef BURNINGVIDEO_RENDERER_FAST
#if defined(BURNINGVIDEO_RENDERER_FAST) && COLOR_MAX==0xff
const tFixPointu d = dithermask [ dIndex | ( i ) & 3 ];
@@ -244,7 +290,7 @@ void CTRTextureGouraudAlphaNoZ::scanline_bilinear ()
d + tofix ( line.t[0][0].y,inversew)
);
const u32 alpha = ( argb >> 24 );
const tFixPoint alpha = ( argb >> 24 );
if ( alpha > AlphaRef )
{
#ifdef WRITE_Z
@@ -262,19 +308,14 @@ void CTRTextureGouraudAlphaNoZ::scanline_bilinear ()
#ifdef INVERSE_W
inversew = fix_inverse32 ( line.w[0] );
#endif
getSample_texture ( a0, r0, g0, b0,
&IT[0],
tofix ( line.t[0][0].x,inversew),
tofix ( line.t[0][0].y,inversew)
);
#else
getSample_texture ( a0, r0, g0,b0,
&IT[0],
tofix ( line.t[0][0].x),
tofix ( line.t[0][0].y)
);
#endif
if ( (tFixPointu) a0 > AlphaRef )
if ( a0 > AlphaRef )
{
#ifdef WRITE_Z
z[i] = line.z[0];
@@ -283,39 +324,30 @@ void CTRTextureGouraudAlphaNoZ::scanline_bilinear ()
z[i] = line.w[0];
#endif
#ifdef INVERSE_W
getSample_color ( r2, g2, b2, line.c[0][0], inversew );
#else
getSample_color ( r2, g2, b2, line.c[0][0] );
#endif
r0 = imulFix ( r0, r2 );
g0 = imulFix ( g0, g2 );
b0 = imulFix ( b0, b2 );
#ifdef IPOL_C0
vec4_to_fix( a2,r2, g2, b2, line.c[0][0], inversew );
//a0 = imulFix(a0, a2); //2D uses vertexalpha*texelalpha
r0 = imulFix_simple( r0, r2 );
g0 = imulFix_simple( g0, g2 );
b0 = imulFix_simple( b0, b2 );
color_to_fix ( r1, g1, b1, dst[i] );
a0 >>= 8;
fix_color_norm(a0);
r2 = r1 + imulFix ( a0, r0 - r1 );
g2 = g1 + imulFix ( a0, g0 - g1 );
b2 = b1 + imulFix ( a0, b0 - b1 );
dst[i] = fix4_to_color ( a0, r2, g2, b2 );
dst[i] = fix4_to_sample( a0, r2, g2, b2 );
/*
#else
dst[i] = PixelBlend32 ( dst[i],
fix_to_color ( r0,g0, b0 ),
fix_to_sample( r0,g0, b0 ),
fixPointu_to_u32 ( a0 )
);
*/
/*
getSample_color ( r2, g2, b2, line.c[0][0], inversew * COLOR_MAX );
color_to_fix ( r1, g1, b1, dst[i] );
r2 = r0 + imulFix ( a0, r1 - r0 );
g2 = g0 + imulFix ( a0, g1 - g0 );
b2 = b0 + imulFix ( a0, b1 - b0 );
dst[i] = fix_to_color ( r2, g2, b2 );
*/
#endif
}
#endif
@@ -331,6 +363,9 @@ void CTRTextureGouraudAlphaNoZ::scanline_bilinear ()
#ifdef IPOL_C0
line.c[0][0] += slopeC[0];
#endif
#ifdef IPOL_C1
line.c[1][0] += slopeC[1];
#endif
#ifdef IPOL_T0
line.t[0][0] += slopeT[0];
#endif
@@ -341,7 +376,447 @@ void CTRTextureGouraudAlphaNoZ::scanline_bilinear ()
}
void CTRTextureGouraudAlphaNoZ::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4DVertex *c )
/*!
*/
void CTRTextureGouraudAlphaNoZ::fragment_linear_test()
{
tVideoSample *dst;
#ifdef USE_ZBUFFER
fp24 *z;
#endif
s32 xStart;
s32 xEnd;
s32 dx;
#ifdef SUBTEXEL
f32 subPixel;
#endif
#ifdef IPOL_Z
f32 slopeZ;
#endif
#ifdef IPOL_W
fp24 slopeW;
#endif
#ifdef IPOL_C0
sVec4 slopeC[BURNING_MATERIAL_MAX_COLORS];
#endif
#ifdef IPOL_T0
sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
#endif
// apply top-left fill-convention, left
xStart = fill_convention_left(line.x[0]);
xEnd = fill_convention_right(line.x[1]);
dx = xEnd - xStart;
if (dx < 0)
return;
// slopes
const f32 invDeltaX = reciprocal_zero2(line.x[1] - line.x[0]);
#ifdef IPOL_Z
slopeZ = (line.z[1] - line.z[0]) * invDeltaX;
#endif
#ifdef IPOL_W
slopeW = (line.w[1] - line.w[0]) * invDeltaX;
#endif
#ifdef IPOL_C0
slopeC[0] = (line.c[0][1] - line.c[0][0]) * invDeltaX;
#endif
#ifdef IPOL_C1
slopeC[1] = (line.c[1][1] - line.c[1][0]) * invDeltaX;
#endif
#ifdef IPOL_T0
slopeT[0] = (line.t[0][1] - line.t[0][0]) * invDeltaX;
#endif
#ifdef IPOL_T1
slopeT[1] = (line.t[1][1] - line.t[1][0]) * invDeltaX;
#endif
#ifdef SUBTEXEL
subPixel = ((f32)xStart) - line.x[0];
#ifdef IPOL_Z
line.z[0] += slopeZ * subPixel;
#endif
#ifdef IPOL_W
line.w[0] += slopeW * subPixel;
#endif
#ifdef IPOL_C0
line.c[0][0] += slopeC[0] * subPixel;
#endif
#ifdef IPOL_C1
line.c[1][0] += slopeC[1] * subPixel;
#endif
#ifdef IPOL_T0
line.t[0][0] += slopeT[0] * subPixel;
#endif
#ifdef IPOL_T1
line.t[1][0] += slopeT[1] * subPixel;
#endif
#endif
SOFTWARE_DRIVER_2_CLIPCHECK;
dst = (tVideoSample*)RenderTarget->getData() + (line.y * RenderTarget->getDimension().Width) + xStart;
#ifdef USE_ZBUFFER
z = (fp24*)DepthBuffer->lock() + (line.y * RenderTarget->getDimension().Width) + xStart;
#endif
f32 inversew = FIX_POINT_F32_MUL;
#if defined(BURNINGVIDEO_RENDERER_FAST) && COLOR_MAX==0xff
u32 dIndex = (line.y & 3) << 2;
#else
tFixPoint a0;
tFixPoint r0, g0, b0;
#endif
#ifdef IPOL_C0
tFixPoint r1, g1, b1;
tFixPoint a2, r2, g2, b2;
#endif
#ifdef IPOL_C1
tFixPoint a3, r3, g3, b3;
#endif
for (s32 i = 0; i <= dx; ++i)
{
#ifdef CMP_Z
if (line.z[0] < z[i])
#endif
#ifdef CMP_W
if (line.w[0] >= z[i])
#endif
{
#if defined(BURNINGVIDEO_RENDERER_FAST) && COLOR_MAX==0xff
const tFixPointu d = dithermask[dIndex | (i) & 3];
#ifdef INVERSE_W
inversew = fix_inverse32(line.w[0]);
#endif
u32 argb = getTexel_plain(&IT[0], d + tofix(line.t[0][0].x, inversew),
d + tofix(line.t[0][0].y, inversew)
);
const tFixPoint alpha = (argb >> 24);
if (alpha > AlphaRef)
{
#ifdef WRITE_Z
z[i] = line.z[0];
#endif
#ifdef WRITE_W
z[i] = line.w[0];
#endif
dst[i] = PixelBlend32(dst[i], argb, alpha);
}
#else
#ifdef INVERSE_W
inversew = fix_inverse32(line.w[0]);
#endif
getSample_texture(a0, r0, g0, b0,
&IT[0],
tofix(line.t[0][0].x, inversew),
tofix(line.t[0][0].y, inversew)
);
if (a0 > AlphaRef)
{
#ifdef WRITE_Z
z[i] = line.z[0];
#endif
#ifdef WRITE_W
z[i] = line.w[0];
#endif
#ifdef IPOL_C0
vec4_to_fix(a2, r2, g2, b2, line.c[0][0], inversew);
a0 = imulFix(a0, a2); //2D uses vertexalpha*texelalpha
r0 = imulFix(r0, r2);
g0 = imulFix(g0, g2);
b0 = imulFix(b0, b2);
color_to_fix(r1, g1, b1, dst[i]);
fix_color_norm(a0);
r2 = r1 + imulFix(a0, r0 - r1);
g2 = g1 + imulFix(a0, g0 - g1);
b2 = b1 + imulFix(a0, b0 - b1);
dst[i] = fix4_to_sample(a0, r2, g2, b2);
#else
dst[i] = PixelBlend32(dst[i],
fix_to_sample(r0, g0, b0),
fixPointu_to_u32(a0)
);
#endif
}
#endif
}
#ifdef IPOL_Z
line.z[0] += slopeZ;
#endif
#ifdef IPOL_W
line.w[0] += slopeW;
#endif
#ifdef IPOL_C0
line.c[0][0] += slopeC[0];
#endif
#ifdef IPOL_C1
line.c[1][0] += slopeC[1];
#endif
#ifdef IPOL_T0
line.t[0][0] += slopeT[0];
#endif
#ifdef IPOL_T1
line.t[1][0] += slopeT[1];
#endif
}
}
/*!
*/
void CTRTextureGouraudAlphaNoZ::fragment_point_noz()
{
tVideoSample *dst;
#ifdef USE_ZBUFFER
//fp24 *z;
#endif
s32 xStart;
s32 xEnd;
s32 dx;
#ifdef SUBTEXEL
f32 subPixel;
#endif
#ifdef IPOL_Z
f32 slopeZ;
#endif
#ifdef IPOL_W
fp24 slopeW;
#endif
#ifdef IPOL_C0
sVec4 slopeC[BURNING_MATERIAL_MAX_COLORS];
#endif
#ifdef IPOL_T0
sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
#endif
// apply top-left fill-convention, left
xStart = fill_convention_left(line.x[0]);
xEnd = fill_convention_right(line.x[1]);
dx = xEnd - xStart;
if (dx < 0)
return;
// slopes
const f32 invDeltaX = reciprocal_zero2(line.x[1] - line.x[0]);
#ifdef IPOL_Z
slopeZ = (line.z[1] - line.z[0]) * invDeltaX;
#endif
#ifdef IPOL_W
slopeW = (line.w[1] - line.w[0]) * invDeltaX;
#endif
#ifdef IPOL_C0
slopeC[0] = (line.c[0][1] - line.c[0][0]) * invDeltaX;
#endif
#ifdef IPOL_C1
slopeC[1] = (line.c[1][1] - line.c[1][0]) * invDeltaX;
#endif
#ifdef IPOL_T0
slopeT[0] = (line.t[0][1] - line.t[0][0]) * invDeltaX;
#endif
#ifdef IPOL_T1
slopeT[1] = (line.t[1][1] - line.t[1][0]) * invDeltaX;
#endif
#ifdef SUBTEXEL
subPixel = ((f32)xStart) - line.x[0];
#ifdef IPOL_Z
line.z[0] += slopeZ * subPixel;
#endif
#ifdef IPOL_W
line.w[0] += slopeW * subPixel;
#endif
#ifdef IPOL_C0
line.c[0][0] += slopeC[0] * subPixel;
#endif
#ifdef IPOL_C1
line.c[1][0] += slopeC[1] * subPixel;
#endif
#ifdef IPOL_T0
line.t[0][0] += slopeT[0] * subPixel;
#endif
#ifdef IPOL_T1
line.t[1][0] += slopeT[1] * subPixel;
#endif
#endif
SOFTWARE_DRIVER_2_CLIPCHECK;
dst = (tVideoSample*)RenderTarget->getData() + (line.y * RenderTarget->getDimension().Width) + xStart;
#ifdef USE_ZBUFFER
//z = (fp24*)DepthBuffer->lock() + (line.y * RenderTarget->getDimension().Width) + xStart;
#endif
f32 inversew = FIX_POINT_F32_MUL;
#if defined(BURNINGVIDEO_RENDERER_FAST) && COLOR_MAX==0xff
u32 dIndex = (line.y & 3) << 2;
#else
tFixPoint a0;
tFixPoint r0, g0, b0;
#endif
#ifdef IPOL_C0
tFixPoint r1, g1, b1;
tFixPoint a2,r2, g2, b2;
#endif
#ifdef IPOL_C1
tFixPoint a3, r3, g3, b3;
#endif
for (s32 i = 0; i <= dx; ++i)
{
#ifdef CMP_Z
if (line.z[0] < z[i])
#endif
#ifdef CMP_W
// if (line.w[0] >= z[i])
#endif
{
#if defined(BURNINGVIDEO_RENDERER_FAST) && COLOR_MAX==0xff
const tFixPointu d = dithermask[dIndex | (i) & 3];
#ifdef INVERSE_W
inversew = fix_inverse32(line.w[0]);
#endif
u32 argb = getTexel_plain(&IT[0], d + tofix(line.t[0][0].x, inversew),
d + tofix(line.t[0][0].y, inversew)
);
const tFixPoint alpha = (argb >> 24);
if (alpha > AlphaRef)
{
#ifdef WRITE_Z
z[i] = line.z[0];
#endif
#ifdef WRITE_W
z[i] = line.w[0];
#endif
dst[i] = PixelBlend32(dst[i], argb, alpha);
}
#else
#ifdef INVERSE_W
//inversew = fix_inverse32(line.w[0]);
#endif
getTexel_fix(a0, r0, g0, b0,
&IT[0],
tofix(line.t[0][0].x, inversew),
tofix(line.t[0][0].y, inversew)
);
if (a0 > AlphaRef)
{
#ifdef WRITE_Z
z[i] = line.z[0];
#endif
#ifdef WRITE_W
//z[i] = line.w[0];
#endif
#ifdef IPOL_C0
vec4_to_fix(a2,r2, g2, b2, line.c[0][0], inversew);
a0 = imulFix(a0, a2); //2D uses vertexalpha*texelalpha
r0 = imulFix(r0, r2);
g0 = imulFix(g0, g2);
b0 = imulFix(b0, b2);
color_to_fix(r1, g1, b1, dst[i]);
fix_color_norm(a0);
r2 = r1 + imulFix(a0, r0 - r1);
g2 = g1 + imulFix(a0, g0 - g1);
b2 = b1 + imulFix(a0, b0 - b1);
dst[i] = fix4_to_sample(a0, r2, g2, b2);
#else
dst[i] = PixelBlend32(dst[i],
fix_to_sample(r0, g0, b0),
fixPointu_to_u32(a0)
);
#endif
}
#endif
}
#ifdef IPOL_Z
line.z[0] += slopeZ;
#endif
#ifdef IPOL_W
//line.w[0] += slopeW;
#endif
#ifdef IPOL_C0
line.c[0][0] += slopeC[0];
#endif
#ifdef IPOL_C1
line.c[1][0] += slopeC[1];
#endif
#ifdef IPOL_T0
line.t[0][0] += slopeT[0];
#endif
#ifdef IPOL_T1
line.t[1][0] += slopeT[1];
#endif
}
}
void CTRTextureGouraudAlphaNoZ::drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c)
{
// sort on height, y
if ( F32_A_GREATER_B ( a->Pos.y , b->Pos.y ) ) swapVertexPointer(&a, &b);
@@ -352,9 +827,9 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle ( const s4DVertex *a,const s4DVerte
const f32 ba = b->Pos.y - a->Pos.y;
const f32 cb = c->Pos.y - b->Pos.y;
// calculate delta y of the edges
scan.invDeltaY[0] = core::reciprocal( ca );
scan.invDeltaY[1] = core::reciprocal( ba );
scan.invDeltaY[2] = core::reciprocal( cb );
scan.invDeltaY[0] = reciprocal_zero( ca );
scan.invDeltaY[1] = reciprocal_zero( ba );
scan.invDeltaY[2] = reciprocal_zero( cb );
if ( F32_LOWER_EQUAL_0 ( scan.invDeltaY[0] ) )
return;
@@ -389,6 +864,11 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle ( const s4DVertex *a,const s4DVerte
scan.c[0][0] = a->Color[0];
#endif
#ifdef IPOL_C1
scan.slopeC[1][0] = (c->Color[1] - a->Color[1]) * scan.invDeltaY[0];
scan.c[1][0] = a->Color[1];
#endif
#ifdef IPOL_T0
scan.slopeT[0][0] = (c->Tex[0] - a->Tex[0]) * scan.invDeltaY[0];
scan.t[0][0] = a->Tex[0];
@@ -429,6 +909,11 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle ( const s4DVertex *a,const s4DVerte
scan.c[0][1] = a->Color[0];
#endif
#ifdef IPOL_C1
scan.slopeC[1][1] = (b->Color[1] - a->Color[1]) * scan.invDeltaY[1];
scan.c[1][1] = a->Color[1];
#endif
#ifdef IPOL_T0
scan.slopeT[0][1] = (b->Tex[0] - a->Tex[0]) * scan.invDeltaY[1];
scan.t[0][1] = a->Tex[0];
@@ -440,8 +925,8 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle ( const s4DVertex *a,const s4DVerte
#endif
// apply top-left fill convention, top part
yStart = core::ceil32_fast( a->Pos.y );
yEnd = core::ceil32_fast( b->Pos.y ) - 1;
yStart = fill_convention_left( a->Pos.y );
yEnd = fill_convention_right( b->Pos.y );
#ifdef SUBTEXEL
subPixel = ( (f32) yStart ) - a->Pos.y;
@@ -465,6 +950,11 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle ( const s4DVertex *a,const s4DVerte
scan.c[0][1] += scan.slopeC[0][1] * subPixel;
#endif
#ifdef IPOL_C1
scan.c[1][0] += scan.slopeC[1][0] * subPixel;
scan.c[1][1] += scan.slopeC[1][1] * subPixel;
#endif
#ifdef IPOL_T0
scan.t[0][0] += scan.slopeT[0][0] * subPixel;
scan.t[0][1] += scan.slopeT[0][1] * subPixel;
@@ -498,6 +988,11 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle ( const s4DVertex *a,const s4DVerte
line.c[0][scan.right] = scan.c[0][1];
#endif
#ifdef IPOL_C1
line.c[1][scan.left] = scan.c[1][0];
line.c[1][scan.right] = scan.c[1][1];
#endif
#ifdef IPOL_T0
line.t[0][scan.left] = scan.t[0][0];
line.t[0][scan.right] = scan.t[0][1];
@@ -509,7 +1004,7 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle ( const s4DVertex *a,const s4DVerte
#endif
// render a scanline
scanline_bilinear ( );
(this->*fragmentShader) ();
scan.x[0] += scan.slopeX[0];
scan.x[1] += scan.slopeX[1];
@@ -529,6 +1024,11 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle ( const s4DVertex *a,const s4DVerte
scan.c[0][1] += scan.slopeC[0][1];
#endif
#ifdef IPOL_C1
scan.c[1][0] += scan.slopeC[1][0];
scan.c[1][1] += scan.slopeC[1][1];
#endif
#ifdef IPOL_T0
scan.t[0][0] += scan.slopeT[0][0];
scan.t[0][1] += scan.slopeT[0][1];
@@ -560,6 +1060,10 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle ( const s4DVertex *a,const s4DVerte
#ifdef IPOL_C0
scan.c[0][0] = a->Color[0] + scan.slopeC[0][0] * temp[0];
#endif
#ifdef IPOL_C1
scan.c[1][0] = a->Color[1] + scan.slopeC[1][0] * temp[0];
#endif
#ifdef IPOL_T0
scan.t[0][0] = a->Tex[0] + scan.slopeT[0][0] * temp[0];
#endif
@@ -588,6 +1092,11 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle ( const s4DVertex *a,const s4DVerte
scan.c[0][1] = b->Color[0];
#endif
#ifdef IPOL_C1
scan.slopeC[1][1] = (c->Color[1] - b->Color[1]) * scan.invDeltaY[2];
scan.c[1][1] = b->Color[1];
#endif
#ifdef IPOL_T0
scan.slopeT[0][1] = (c->Tex[0] - b->Tex[0]) * scan.invDeltaY[2];
scan.t[0][1] = b->Tex[0];
@@ -599,8 +1108,8 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle ( const s4DVertex *a,const s4DVerte
#endif
// apply top-left fill convention, top part
yStart = core::ceil32_fast( b->Pos.y );
yEnd = core::ceil32_fast( c->Pos.y ) - 1;
yStart = fill_convention_left( b->Pos.y );
yEnd = fill_convention_right( c->Pos.y );
#ifdef SUBTEXEL
@@ -625,6 +1134,11 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle ( const s4DVertex *a,const s4DVerte
scan.c[0][1] += scan.slopeC[0][1] * subPixel;
#endif
#ifdef IPOL_C1
scan.c[1][0] += scan.slopeC[1][0] * subPixel;
scan.c[1][1] += scan.slopeC[1][1] * subPixel;
#endif
#ifdef IPOL_T0
scan.t[0][0] += scan.slopeT[0][0] * subPixel;
scan.t[0][1] += scan.slopeT[0][1] * subPixel;
@@ -658,6 +1172,11 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle ( const s4DVertex *a,const s4DVerte
line.c[0][scan.right] = scan.c[0][1];
#endif
#ifdef IPOL_C1
line.c[1][scan.left] = scan.c[1][0];
line.c[1][scan.right] = scan.c[1][1];
#endif
#ifdef IPOL_T0
line.t[0][scan.left] = scan.t[0][0];
line.t[0][scan.right] = scan.t[0][1];
@@ -669,7 +1188,7 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle ( const s4DVertex *a,const s4DVerte
#endif
// render a scanline
scanline_bilinear ( );
(this->*fragmentShader) ();
scan.x[0] += scan.slopeX[0];
scan.x[1] += scan.slopeX[1];
@@ -689,6 +1208,11 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle ( const s4DVertex *a,const s4DVerte
scan.c[0][1] += scan.slopeC[0][1];
#endif
#ifdef IPOL_C1
scan.c[1][0] += scan.slopeC[1][0];
scan.c[1][1] += scan.slopeC[1][1];
#endif
#ifdef IPOL_T0
scan.t[0][0] += scan.slopeT[0][0];
scan.t[0][1] += scan.slopeT[0][1];
@@ -720,6 +1244,7 @@ namespace video
//! creates a flat triangle renderer
IBurningShader* createTRTextureGouraudAlphaNoZ(CBurningVideoDriver* driver)
{
// ETR_TEXTURE_GOURAUD_ALPHA_NOZ
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
return new CTRTextureGouraudAlphaNoZ(driver);
#else
@@ -728,6 +1253,7 @@ IBurningShader* createTRTextureGouraudAlphaNoZ(CBurningVideoDriver* driver)
}
} // end namespace video
} // end namespace irr