1
0

- BurningVideo: 0.50

- 10 year anniversary update
  - Lighting model reworked. moved to eyespace like openGL. [Specular Highlights, Fog, Sphere/Reflection Map] 
  - increased internal s4DVertex to support 4 Textures and 4 Colors [switchable]
  - Textures are handled as sRGB during Mipmap Generation. More accurate, less visual disruption
  - 2D is drawn as 3D like hardware drivers. [switchable]. enables viewport scaling, material2D
  - Texture Spatial Resolution Limiting working. [lower memory consumption,SOFTWARE_DRIVER_2_TEXTURE_MAXSIZE]
  - SuperTuxKart 8.0.1 playable


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6086 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
engineer_apple
2020-02-22 20:48:12 +00:00
parent 9c837aa41b
commit 86dd0cde26
57 changed files with 10240 additions and 3736 deletions

View File

@@ -46,7 +46,7 @@
#undef SUBTEXEL
#endif
#ifndef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
#if BURNING_MATERIAL_MAX_COLORS < 1
#undef IPOL_C0
#endif
@@ -83,13 +83,11 @@ public:
CTRGouraud2(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 bool canWireFrame () { return true; }
private:
void scanline_bilinear ();
sScanConvertData scan;
sScanLineData line;
protected:
virtual void scanline_bilinear ();
};
@@ -136,8 +134,8 @@ void CTRGouraud2::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;
@@ -145,7 +143,7 @@ void CTRGouraud2::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;
@@ -182,6 +180,7 @@ void CTRGouraud2::scanline_bilinear ()
#endif
#endif
SOFTWARE_DRIVER_2_CLIPCHECK;
dst = (tVideoSample*)RenderTarget->getData() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
#ifdef USE_ZBUFFER
@@ -193,34 +192,31 @@ void CTRGouraud2::scanline_bilinear ()
#ifdef IPOL_C0
tFixPoint r0, g0, b0;
#ifdef INVERSE_W
f32 inversew;
#endif
f32 inversew = FIX_POINT_F32_MUL * COLOR_MAX;
#endif
for ( s32 i = 0; i <= dx; ++i )
{
//if test active only first pixel
if ( (0 == EdgeTestPass) & i ) break;
#ifdef CMP_Z
if ( line.z[0] < z[i] )
#endif
#ifdef CMP_W
if ( line.w[0] >= z[i] )
if (line.w[0] >= z[i] )
#endif
{
#ifdef IPOL_C0
#ifdef INVERSE_W
inversew = core::reciprocal ( line.w[0] );
getSample_color ( r0, g0, b0, line.c[0][0] * inversew );
#else
getSample_color ( r0, g0, b0, line.c[0][0] );
inversew = fix_inverse32_color(line.w[0]);
#endif
dst[i] = fix_to_color ( r0, g0, b0 );
vec4_to_fix( r0, g0, b0, line.c[0][0],inversew );
dst[i] = fix_to_sample( r0, g0, b0 );
#else
dst[i] = COLOR_BRIGHT_WHITE;
dst[i] = PrimitiveColor;
#endif
#ifdef WRITE_Z
@@ -251,7 +247,7 @@ void CTRGouraud2::scanline_bilinear ()
}
void CTRGouraud2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4DVertex *c )
void CTRGouraud2::drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c)
{
// sort on height, y
if ( a->Pos.y > b->Pos.y ) swapVertexPointer(&a, &b);
@@ -262,10 +258,10 @@ void CTRGouraud2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4D
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_edge( ca );
scan.invDeltaY[1] = reciprocal_edge( ba );
scan.invDeltaY[2] = reciprocal_edge( cb );
if ( F32_LOWER_EQUAL_0 ( scan.invDeltaY[0] ) )
return;
@@ -351,8 +347,8 @@ void CTRGouraud2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4D
#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;
@@ -421,6 +417,7 @@ void CTRGouraud2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4D
// render a scanline
scanline_bilinear ();
if ( EdgeTestPass & edge_test_first_line ) break;
scan.x[0] += scan.slopeX[0];
scan.x[1] += scan.slopeX[1];
@@ -454,7 +451,7 @@ void CTRGouraud2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4D
}
// rasterize lower sub-triangle
if ( (f32) 0.0 != scan.invDeltaY[2] )
if ( (f32) 0.0 != scan.invDeltaY[2] )
{
// advance to middle point
if( (f32) 0.0 != scan.invDeltaY[1] )
@@ -510,8 +507,8 @@ void CTRGouraud2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4D
#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
@@ -581,6 +578,7 @@ void CTRGouraud2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4D
// render a scanline
scanline_bilinear ();
if ( EdgeTestPass & edge_test_first_line ) break;
scan.x[0] += scan.slopeX[0];
scan.x[1] += scan.slopeX[1];
@@ -630,6 +628,7 @@ namespace video
//! creates a flat triangle renderer
IBurningShader* createTriangleRendererGouraud2(CBurningVideoDriver* driver)
{
// ETR_GOURAUD . no texture
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
return new CTRGouraud2(driver);
#else