diff options
Diffstat (limited to 'source/Irrlicht/CTRTextureLightMap2_Add.cpp')
-rw-r--r-- | source/Irrlicht/CTRTextureLightMap2_Add.cpp | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/source/Irrlicht/CTRTextureLightMap2_Add.cpp b/source/Irrlicht/CTRTextureLightMap2_Add.cpp index db49d53..d5cc7e3 100644 --- a/source/Irrlicht/CTRTextureLightMap2_Add.cpp +++ b/source/Irrlicht/CTRTextureLightMap2_Add.cpp @@ -46,7 +46,7 @@ #undef SUBTEXEL
#endif
-#ifndef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
+#if BURNING_MATERIAL_MAX_COLORS < 1
#undef IPOL_C0
#endif
@@ -82,15 +82,12 @@ public: CTRTextureLightMap2_Add(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_;
private:
void scanline_bilinear ();
- sScanConvertData scan;
- sScanLineData line;
-
};
//! constructor
@@ -137,8 +134,8 @@ REALINLINE void CTRTextureLightMap2_Add::scanline_bilinear () #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;
@@ -146,7 +143,7 @@ REALINLINE void CTRTextureLightMap2_Add::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;
@@ -183,6 +180,7 @@ REALINLINE void CTRTextureLightMap2_Add::scanline_bilinear () #endif
#endif
+ SOFTWARE_DRIVER_2_CLIPCHECK;
dst = (tVideoSample*)RenderTarget->getData() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
#ifdef USE_ZBUFFER
@@ -190,11 +188,10 @@ REALINLINE void CTRTextureLightMap2_Add::scanline_bilinear () #endif
-#ifdef BURNINGVIDEO_RENDERER_FAST
f32 inversew = FIX_POINT_F32_MUL;
- u32 dIndex = ( line.y & 3 ) << 2;
-
+#if defined(BURNINGVIDEO_RENDERER_FAST) && COLOR_MAX==0xff
+ u32 dIndex = ( line.y & 3 ) << 2;
#else
//
tFixPoint r0, g0, b0;
@@ -219,11 +216,12 @@ REALINLINE void CTRTextureLightMap2_Add::scanline_bilinear () z[i] = line.w[0];
#endif
-#ifdef BURNINGVIDEO_RENDERER_FAST
-
#ifdef INVERSE_W
- inversew = fix_inverse32 ( line.w[0] );
+ inversew = fix_inverse32(line.w[0]);
#endif
+
+#if defined(BURNINGVIDEO_RENDERER_FAST) && COLOR_MAX==0xff
+
const tFixPointu d = dithermask [ dIndex | ( i ) & 3 ];
dst[i] = PixelAdd32 (
@@ -234,12 +232,11 @@ REALINLINE void CTRTextureLightMap2_Add::scanline_bilinear () );
#else
- const f32 inversew = fix_inverse32 ( line.w[0] );
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[0][1].x,inversew), tofix ( line.t[0][1].y,inversew) );
- dst[i] = fix_to_color ( clampfix_maxcolor ( r0 + r1 ),
+ dst[i] = fix_to_sample( clampfix_maxcolor ( r0 + r1 ),
clampfix_maxcolor ( g0 + g1 ),
clampfix_maxcolor ( b0 + b1 )
);
@@ -266,7 +263,7 @@ REALINLINE void CTRTextureLightMap2_Add::scanline_bilinear () }
-void CTRTextureLightMap2_Add::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4DVertex *c )
+void CTRTextureLightMap2_Add::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);
@@ -277,9 +274,9 @@ void CTRTextureLightMap2_Add::drawTriangle ( const s4DVertex *a,const s4DVertex 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;
@@ -365,8 +362,8 @@ void CTRTextureLightMap2_Add::drawTriangle ( const s4DVertex *a,const s4DVertex #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;
@@ -524,8 +521,8 @@ void CTRTextureLightMap2_Add::drawTriangle ( const s4DVertex *a,const s4DVertex #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
|