burning v0.53
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6364 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
#undef INVERSE_W
|
||||
|
||||
#undef IPOL_C0
|
||||
#undef IPOL_C1
|
||||
#undef IPOL_C1_FOG
|
||||
#undef IPOL_T0
|
||||
#undef IPOL_T1
|
||||
|
||||
@@ -34,45 +36,47 @@
|
||||
#define WRITE_W
|
||||
|
||||
#define IPOL_C0
|
||||
#define IPOL_C1
|
||||
#define IPOL_T0
|
||||
#define IPOL_T1
|
||||
|
||||
// apply global override
|
||||
#ifndef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
|
||||
#undef INVERSE_W
|
||||
#undef INVERSE_W
|
||||
#endif
|
||||
|
||||
#ifndef SOFTWARE_DRIVER_2_SUBTEXEL
|
||||
#undef SUBTEXEL
|
||||
#undef SUBTEXEL
|
||||
#endif
|
||||
|
||||
#if BURNING_MATERIAL_MAX_COLORS < 1
|
||||
#undef IPOL_C0
|
||||
#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
|
||||
#endif
|
||||
#define IPOL_Z
|
||||
#ifndef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
|
||||
#undef IPOL_W
|
||||
#endif
|
||||
#define IPOL_Z
|
||||
|
||||
#ifdef CMP_W
|
||||
#undef CMP_W
|
||||
#define CMP_Z
|
||||
#endif
|
||||
#ifdef CMP_W
|
||||
#undef CMP_W
|
||||
#define CMP_Z
|
||||
#endif
|
||||
|
||||
#ifdef WRITE_W
|
||||
#undef WRITE_W
|
||||
#define WRITE_Z
|
||||
#endif
|
||||
#ifdef WRITE_W
|
||||
#undef WRITE_W
|
||||
#define WRITE_Z
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
||||
namespace video
|
||||
{
|
||||
burning_namespace_start
|
||||
|
||||
class CTR_transparent_reflection_2_layer : public IBurningShader
|
||||
{
|
||||
@@ -94,11 +98,11 @@ private:
|
||||
|
||||
//! constructor
|
||||
CTR_transparent_reflection_2_layer::CTR_transparent_reflection_2_layer(CBurningVideoDriver* driver)
|
||||
: IBurningShader(driver)
|
||||
: IBurningShader(driver)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CTR_transparent_reflection_2_layer");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void CTR_transparent_reflection_2_layer::OnSetMaterial(const SBurningShaderMaterial& material)
|
||||
@@ -111,10 +115,10 @@ void CTR_transparent_reflection_2_layer::OnSetMaterial(const SBurningShaderMater
|
||||
*/
|
||||
void CTR_transparent_reflection_2_layer::fragmentShader()
|
||||
{
|
||||
tVideoSample *dst;
|
||||
tVideoSample* dst;
|
||||
|
||||
#ifdef USE_ZBUFFER
|
||||
fp24 *z;
|
||||
fp24* z;
|
||||
#endif
|
||||
|
||||
s32 xStart;
|
||||
@@ -133,23 +137,23 @@ void CTR_transparent_reflection_2_layer::fragmentShader()
|
||||
fp24 slopeW;
|
||||
#endif
|
||||
#ifdef IPOL_C0
|
||||
sVec4 slopeC;
|
||||
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] );
|
||||
xStart = fill_convention_left(line.x[0]);
|
||||
xEnd = fill_convention_right(line.x[1]);
|
||||
|
||||
dx = xEnd - xStart;
|
||||
|
||||
if ( dx < 0 )
|
||||
if (dx < 0)
|
||||
return;
|
||||
|
||||
// slopes
|
||||
const f32 invDeltaX = fill_step_x( line.x[1] - line.x[0] );
|
||||
const f32 invDeltaX = fill_step_x(line.x[1] - line.x[0]);
|
||||
|
||||
#ifdef IPOL_Z
|
||||
slopeZ = (line.z[1] - line.z[0]) * invDeltaX;
|
||||
@@ -158,7 +162,10 @@ void CTR_transparent_reflection_2_layer::fragmentShader()
|
||||
slopeW = (line.w[1] - line.w[0]) * invDeltaX;
|
||||
#endif
|
||||
#ifdef IPOL_C0
|
||||
slopeC = (line.c[0][1] - line.c[0][0]) * invDeltaX;
|
||||
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;
|
||||
@@ -168,7 +175,7 @@ void CTR_transparent_reflection_2_layer::fragmentShader()
|
||||
#endif
|
||||
|
||||
#ifdef SUBTEXEL
|
||||
subPixel = ( (f32) xStart ) - line.x[0];
|
||||
subPixel = ((f32)xStart) - line.x[0];
|
||||
#ifdef IPOL_Z
|
||||
line.z[0] += slopeZ * subPixel;
|
||||
#endif
|
||||
@@ -176,7 +183,10 @@ void CTR_transparent_reflection_2_layer::fragmentShader()
|
||||
line.w[0] += slopeW * subPixel;
|
||||
#endif
|
||||
#ifdef IPOL_C0
|
||||
line.c[0][0] += slopeC * subPixel;
|
||||
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;
|
||||
@@ -187,10 +197,10 @@ void CTR_transparent_reflection_2_layer::fragmentShader()
|
||||
#endif
|
||||
|
||||
SOFTWARE_DRIVER_2_CLIPCHECK;
|
||||
dst = (tVideoSample*)RenderTarget->getData() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
|
||||
dst = (tVideoSample*)RenderTarget->getData() + (line.y * RenderTarget->getDimension().Width) + xStart;
|
||||
|
||||
#ifdef USE_ZBUFFER
|
||||
z = (fp24*) DepthBuffer->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
|
||||
z = (fp24*)DepthBuffer->lock() + (line.y * RenderTarget->getDimension().Width) + xStart;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -203,152 +213,197 @@ void CTR_transparent_reflection_2_layer::fragmentShader()
|
||||
tFixPoint a1;
|
||||
#endif
|
||||
|
||||
switch(MaterialType) {
|
||||
#ifdef IPOL_C1_FOG
|
||||
tFixPoint aFog = FIX_POINT_ONE;
|
||||
#endif
|
||||
|
||||
switch (MaterialType) {
|
||||
default:
|
||||
case EMT_REFLECTION_2_LAYER:
|
||||
for (s32 i = 0; i <= dx; i += SOFTWARE_DRIVER_2_STEP_X)
|
||||
{
|
||||
for (s32 i = 0; i <= dx; i += SOFTWARE_DRIVER_2_STEP_X)
|
||||
{
|
||||
#ifdef CMP_Z
|
||||
if (line.z[0] < z[i])
|
||||
if (line.z[0] < z[i])
|
||||
#endif
|
||||
#ifdef CMP_W
|
||||
if (line.w[0] >= z[i])
|
||||
if (line.w[0] >= z[i])
|
||||
#endif
|
||||
{
|
||||
{
|
||||
|
||||
#ifdef INVERSE_W
|
||||
inversew = fix_inverse32(line.w[0]);
|
||||
inversew = fix_inverse32(line.w[0]);
|
||||
#endif
|
||||
|
||||
getSample_texture(r0, g0, b0, &IT[0], tofix(line.t[0][0].x, inversew), tofix(line.t[0][0].y, inversew));
|
||||
getSample_texture(r1, g1, b1, &IT[1], tofix(line.t[1][0].x, inversew), tofix(line.t[1][0].y, inversew));
|
||||
#ifdef IPOL_C1_FOG
|
||||
//complete inside fog
|
||||
if (TL_Flag & TL_FOG)
|
||||
{
|
||||
aFog = tofix(line.c[1][0].a, inversew);
|
||||
if (aFog <= 0)
|
||||
{
|
||||
dst[i] = fog_color_sample;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
r0 = imulFix_tex1(r0, r1);
|
||||
g0 = imulFix_tex1(g0, g1);
|
||||
b0 = imulFix_tex1(b0, b1);
|
||||
getSample_texture(r0, g0, b0, &IT[0], tofix(line.t[0][0].x, inversew), tofix(line.t[0][0].y, inversew));
|
||||
getSample_texture(r1, g1, b1, &IT[1], tofix(line.t[1][0].x, inversew), tofix(line.t[1][0].y, inversew));
|
||||
|
||||
r0 = imulFix_tex1(r0, r1);
|
||||
g0 = imulFix_tex1(g0, g1);
|
||||
b0 = imulFix_tex1(b0, b1);
|
||||
|
||||
#ifdef IPOL_C0
|
||||
vec4_to_fix(r1, g1, b1, line.c[0][0], inversew);
|
||||
r0 = imulFix_simple(r1, r0);
|
||||
g0 = imulFix_simple(g1, g0);
|
||||
b0 = imulFix_simple(b1, b0);
|
||||
vec4_to_fix(r1, g1, b1, line.c[0][0], inversew);
|
||||
r0 = imulFix_simple(r1, r0);
|
||||
g0 = imulFix_simple(g1, g0);
|
||||
b0 = imulFix_simple(b1, b0);
|
||||
#endif
|
||||
|
||||
dst[i] = fix_to_sample(r0, g0, b0);
|
||||
#ifdef IPOL_C1
|
||||
|
||||
//specular highlight
|
||||
if (TL_Flag & TL_SPECULAR)
|
||||
{
|
||||
vec4_to_fix(r1, g1, b1, line.c[1][0], inversew * COLOR_MAX);
|
||||
r0 = clampfix_maxcolor(r1 + r0);
|
||||
g0 = clampfix_maxcolor(g1 + g0);
|
||||
b0 = clampfix_maxcolor(b1 + b0);
|
||||
}
|
||||
#endif
|
||||
#ifdef IPOL_C1_FOG
|
||||
//mix with distance
|
||||
if (aFog < FIX_POINT_ONE) //TL_Flag & TL_FOG)
|
||||
{
|
||||
r0 = fog_color[1] + imulFix(aFog, r0 - fog_color[1]);
|
||||
g0 = fog_color[2] + imulFix(aFog, g0 - fog_color[2]);
|
||||
b0 = fog_color[3] + imulFix(aFog, b0 - fog_color[3]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
dst[i] = fix_to_sample(r0, g0, b0);
|
||||
|
||||
#ifdef WRITE_Z
|
||||
z[i] = line.z[0];
|
||||
z[i] = line.z[0];
|
||||
#endif
|
||||
#ifdef WRITE_W
|
||||
z[i] = line.w[0];
|
||||
z[i] = line.w[0];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef IPOL_Z
|
||||
line.z[0] += slopeZ;
|
||||
line.z[0] += slopeZ;
|
||||
#endif
|
||||
#ifdef IPOL_W
|
||||
line.w[0] += slopeW;
|
||||
line.w[0] += slopeW;
|
||||
#endif
|
||||
#ifdef IPOL_C0
|
||||
line.c[0][0] += slopeC;
|
||||
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];
|
||||
line.t[0][0] += slopeT[0];
|
||||
#endif
|
||||
#ifdef IPOL_T1
|
||||
line.t[1][0] += slopeT[1];
|
||||
line.t[1][0] += slopeT[1];
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case EMT_TRANSPARENT_REFLECTION_2_LAYER:
|
||||
for (s32 i = 0; i <= dx; i += SOFTWARE_DRIVER_2_STEP_X)
|
||||
{
|
||||
for (s32 i = 0; i <= dx; i += SOFTWARE_DRIVER_2_STEP_X)
|
||||
{
|
||||
#ifdef CMP_Z
|
||||
if (line.z[0] < z[i])
|
||||
if (line.z[0] < z[i])
|
||||
#endif
|
||||
#ifdef CMP_W
|
||||
if (line.w[0] >= z[i])
|
||||
if (line.w[0] >= z[i])
|
||||
#endif
|
||||
{
|
||||
{
|
||||
|
||||
#ifdef INVERSE_W
|
||||
inversew = fix_inverse32(line.w[0]);
|
||||
inversew = fix_inverse32(line.w[0]);
|
||||
#endif
|
||||
|
||||
getSample_texture(r0, g0, b0, &IT[0], tofix(line.t[0][0].x, inversew), tofix(line.t[0][0].y, inversew));
|
||||
getSample_texture(r1, g1, b1, &IT[1], tofix(line.t[1][0].x, inversew), tofix(line.t[1][0].y, inversew));
|
||||
getSample_texture(r0, g0, b0, &IT[0], tofix(line.t[0][0].x, inversew), tofix(line.t[0][0].y, inversew));
|
||||
getSample_texture(r1, g1, b1, &IT[1], tofix(line.t[1][0].x, inversew), tofix(line.t[1][0].y, inversew));
|
||||
|
||||
r0 = imulFix_tex1(r0, r1);
|
||||
g0 = imulFix_tex1(g0, g1);
|
||||
b0 = imulFix_tex1(b0, b1);
|
||||
r0 = imulFix_tex1(r0, r1);
|
||||
g0 = imulFix_tex1(g0, g1);
|
||||
b0 = imulFix_tex1(b0, b1);
|
||||
|
||||
#ifdef IPOL_C0
|
||||
vec4_to_fix(a1, r1, g1, b1, line.c[0][0], inversew);
|
||||
r0 = imulFix_simple(r1, r0);
|
||||
g0 = imulFix_simple(g1, g0);
|
||||
b0 = imulFix_simple(b1, b0);
|
||||
vec4_to_fix(a1, r1, g1, b1, line.c[0][0], inversew);
|
||||
r0 = imulFix_simple(r1, r0);
|
||||
g0 = imulFix_simple(g1, g0);
|
||||
b0 = imulFix_simple(b1, b0);
|
||||
|
||||
//vertex alpha blend EMT_TRANSPARENT_REFLECTION_2_LAYER
|
||||
if (a1 + 2 < FIX_POINT_ONE)
|
||||
{
|
||||
color_to_fix(r1, g1, b1, dst[i]);
|
||||
r0 = r1 + imulFix(a1, r0 - r1);
|
||||
g0 = g1 + imulFix(a1, g0 - g1);
|
||||
b0 = b1 + imulFix(a1, b0 - b1);
|
||||
}
|
||||
//vertex alpha blend EMT_TRANSPARENT_REFLECTION_2_LAYER
|
||||
if (a1 + 2 < FIX_POINT_ONE)
|
||||
{
|
||||
color_to_fix(r1, g1, b1, dst[i]);
|
||||
r0 = r1 + imulFix(a1, r0 - r1);
|
||||
g0 = g1 + imulFix(a1, g0 - g1);
|
||||
b0 = b1 + imulFix(a1, b0 - b1);
|
||||
}
|
||||
#endif
|
||||
|
||||
dst[i] = fix_to_sample(r0, g0, b0);
|
||||
dst[i] = fix_to_sample(r0, g0, b0);
|
||||
|
||||
#ifdef WRITE_Z
|
||||
//z[i] = line.z[0];
|
||||
//z[i] = line.z[0];
|
||||
#endif
|
||||
#ifdef WRITE_W
|
||||
//z[i] = line.w[0];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef IPOL_Z
|
||||
line.z[0] += slopeZ;
|
||||
line.z[0] += slopeZ;
|
||||
#endif
|
||||
#ifdef IPOL_W
|
||||
line.w[0] += slopeW;
|
||||
line.w[0] += slopeW;
|
||||
#endif
|
||||
#ifdef IPOL_C0
|
||||
line.c[0][0] += slopeC;
|
||||
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];
|
||||
line.t[0][0] += slopeT[0];
|
||||
#endif
|
||||
#ifdef IPOL_T1
|
||||
line.t[1][0] += slopeT[1];
|
||||
line.t[1][0] += slopeT[1];
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning_restrict a,const s4DVertex* burning_restrict b,const s4DVertex* burning_restrict c )
|
||||
void CTR_transparent_reflection_2_layer::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);
|
||||
if ( F32_A_GREATER_B ( b->Pos.y , c->Pos.y ) ) swapVertexPointer(&b, &c);
|
||||
if ( F32_A_GREATER_B ( a->Pos.y , b->Pos.y ) ) swapVertexPointer(&a, &b);
|
||||
if (F32_A_GREATER_B(a->Pos.y, b->Pos.y)) swapVertexPointer(&a, &b);
|
||||
if (F32_A_GREATER_B(b->Pos.y, c->Pos.y)) swapVertexPointer(&b, &c);
|
||||
if (F32_A_GREATER_B(a->Pos.y, b->Pos.y)) swapVertexPointer(&a, &b);
|
||||
|
||||
const f32 ca = c->Pos.y - a->Pos.y;
|
||||
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] = fill_step_y( ca );
|
||||
scan.invDeltaY[1] = fill_step_y( ba );
|
||||
scan.invDeltaY[2] = fill_step_y( cb );
|
||||
scan.invDeltaY[0] = fill_step_y(ca);
|
||||
scan.invDeltaY[1] = fill_step_y(ba);
|
||||
scan.invDeltaY[2] = fill_step_y(cb);
|
||||
|
||||
if ( F32_LOWER_EQUAL_0 ( scan.invDeltaY[0] ) )
|
||||
if (F32_LOWER_EQUAL_0(scan.invDeltaY[0]))
|
||||
return;
|
||||
|
||||
// find if the major edge is left or right aligned
|
||||
@@ -359,7 +414,7 @@ void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning
|
||||
temp[2] = b->Pos.x - a->Pos.x;
|
||||
temp[3] = ba;
|
||||
|
||||
scan.left = ( temp[0] * temp[3] - temp[1] * temp[2] ) > 0.f ? 0 : 1;
|
||||
scan.left = (temp[0] * temp[3] - temp[1] * temp[2]) < 0.f ? 1 : 0;
|
||||
scan.right = 1 - scan.left;
|
||||
|
||||
// calculate slopes for the major edge
|
||||
@@ -381,6 +436,11 @@ void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning
|
||||
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];
|
||||
@@ -400,7 +460,7 @@ void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning
|
||||
#endif
|
||||
|
||||
// rasterize upper sub-triangle
|
||||
if ( F32_GREATER_0(scan.invDeltaY[1]) )
|
||||
if (F32_GREATER_0(scan.invDeltaY[1]))
|
||||
{
|
||||
// calculate slopes for top edge
|
||||
scan.slopeX[1] = (b->Pos.x - a->Pos.x) * scan.invDeltaY[1];
|
||||
@@ -421,6 +481,11 @@ void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning
|
||||
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];
|
||||
@@ -432,11 +497,11 @@ void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning
|
||||
#endif
|
||||
|
||||
// apply top-left fill convention, top part
|
||||
yStart = fill_convention_left( a->Pos.y );
|
||||
yEnd = fill_convention_right( b->Pos.y );
|
||||
yStart = fill_convention_top(a->Pos.y);
|
||||
yEnd = fill_convention_down(b->Pos.y);
|
||||
|
||||
#ifdef SUBTEXEL
|
||||
subPixel = ( (f32) yStart ) - a->Pos.y;
|
||||
subPixel = ((f32)yStart) - a->Pos.y;
|
||||
|
||||
// correct to pixel center
|
||||
scan.x[0] += scan.slopeX[0] * subPixel;
|
||||
@@ -457,6 +522,11 @@ void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning
|
||||
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;
|
||||
@@ -470,7 +540,7 @@ void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning
|
||||
#endif
|
||||
|
||||
// rasterize the edge scanlines
|
||||
for( line.y = yStart; line.y <= yEnd; line.y += SOFTWARE_DRIVER_2_STEP_Y)
|
||||
for (line.y = yStart; line.y <= yEnd; line.y += SOFTWARE_DRIVER_2_STEP_Y)
|
||||
{
|
||||
line.x[scan.left] = scan.x[0];
|
||||
line.x[scan.right] = scan.x[1];
|
||||
@@ -490,6 +560,11 @@ void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning
|
||||
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];
|
||||
@@ -501,8 +576,8 @@ void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning
|
||||
#endif
|
||||
|
||||
// render a scanline
|
||||
interlace_scanline
|
||||
fragmentShader();
|
||||
if_interlace_scanline
|
||||
fragmentShader();
|
||||
|
||||
scan.x[0] += scan.slopeX[0];
|
||||
scan.x[1] += scan.slopeX[1];
|
||||
@@ -522,6 +597,11 @@ void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning
|
||||
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];
|
||||
@@ -536,10 +616,10 @@ void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning
|
||||
}
|
||||
|
||||
// rasterize lower sub-triangle
|
||||
if ( F32_GREATER_0(scan.invDeltaY[2]) )
|
||||
if (F32_GREATER_0(scan.invDeltaY[2]))
|
||||
{
|
||||
// advance to middle point
|
||||
if( F32_GREATER_0(scan.invDeltaY[1]) )
|
||||
if (F32_GREATER_0(scan.invDeltaY[1]))
|
||||
{
|
||||
temp[0] = b->Pos.y - a->Pos.y; // dy
|
||||
|
||||
@@ -553,6 +633,9 @@ void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning
|
||||
#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
|
||||
@@ -581,6 +664,11 @@ void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning
|
||||
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];
|
||||
@@ -592,12 +680,12 @@ void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning
|
||||
#endif
|
||||
|
||||
// apply top-left fill convention, top part
|
||||
yStart = fill_convention_left( b->Pos.y );
|
||||
yEnd = fill_convention_right( c->Pos.y );
|
||||
yStart = fill_convention_top(b->Pos.y);
|
||||
yEnd = fill_convention_down(c->Pos.y);
|
||||
|
||||
#ifdef SUBTEXEL
|
||||
|
||||
subPixel = ( (f32) yStart ) - b->Pos.y;
|
||||
subPixel = ((f32)yStart) - b->Pos.y;
|
||||
|
||||
// correct to pixel center
|
||||
scan.x[0] += scan.slopeX[0] * subPixel;
|
||||
@@ -618,6 +706,11 @@ void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning
|
||||
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;
|
||||
@@ -631,7 +724,7 @@ void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning
|
||||
#endif
|
||||
|
||||
// rasterize the edge scanlines
|
||||
for( line.y = yStart; line.y <= yEnd; line.y += SOFTWARE_DRIVER_2_STEP_Y)
|
||||
for (line.y = yStart; line.y <= yEnd; line.y += SOFTWARE_DRIVER_2_STEP_Y)
|
||||
{
|
||||
line.x[scan.left] = scan.x[0];
|
||||
line.x[scan.right] = scan.x[1];
|
||||
@@ -651,6 +744,11 @@ void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning
|
||||
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];
|
||||
@@ -662,8 +760,8 @@ void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning
|
||||
#endif
|
||||
|
||||
// render a scanline
|
||||
interlace_scanline
|
||||
fragmentShader();
|
||||
if_interlace_scanline
|
||||
fragmentShader();
|
||||
|
||||
scan.x[0] += scan.slopeX[0];
|
||||
scan.x[1] += scan.slopeX[1];
|
||||
@@ -683,6 +781,11 @@ void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning
|
||||
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];
|
||||
@@ -699,33 +802,27 @@ void CTR_transparent_reflection_2_layer::drawTriangle ( const s4DVertex* burning
|
||||
}
|
||||
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
burning_namespace_end
|
||||
|
||||
#endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
burning_namespace_start
|
||||
|
||||
//! creates a flat triangle renderer
|
||||
IBurningShader* createTriangleRendererTexture_transparent_reflection_2_layer(CBurningVideoDriver* driver)
|
||||
{
|
||||
/*
|
||||
ETR_TRANSPARENT_REFLECTION_2_LAYER
|
||||
ETR_TRANSPARENT_REFLECTION_2_LAYER
|
||||
Irrlicht EMT_REFLECTION_2_LAYER,EMT_TRANSPARENT_REFLECTION_2_LAYER
|
||||
*/
|
||||
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
|
||||
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
|
||||
return new CTR_transparent_reflection_2_layer(driver);
|
||||
#else
|
||||
#else
|
||||
return 0;
|
||||
#endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_
|
||||
#endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_
|
||||
}
|
||||
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
burning_namespace_end
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user