- 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:
@@ -46,7 +46,7 @@
|
||||
#undef SUBTEXEL
|
||||
#endif
|
||||
|
||||
#ifndef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
|
||||
#if BURNING_MATERIAL_MAX_COLORS < 1
|
||||
#undef IPOL_C0
|
||||
#endif
|
||||
|
||||
@@ -84,18 +84,12 @@ public:
|
||||
CTRTextureGouraudAlpha2(CBurningVideoDriver* driver);
|
||||
|
||||
//! draws an indexed triangle list
|
||||
virtual void drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4DVertex *c ) _IRR_OVERRIDE_;
|
||||
|
||||
virtual void setParam ( u32 index, f32 value) _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_;
|
||||
|
||||
private:
|
||||
void scanline_bilinear ();
|
||||
|
||||
sScanConvertData scan;
|
||||
sScanLineData line;
|
||||
|
||||
u32 AlphaRef;
|
||||
};
|
||||
|
||||
//! constructor
|
||||
@@ -105,19 +99,17 @@ CTRTextureGouraudAlpha2::CTRTextureGouraudAlpha2(CBurningVideoDriver* driver)
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CTRTextureGouraudAlpha2");
|
||||
#endif
|
||||
|
||||
AlphaRef = 0;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
*/
|
||||
void CTRTextureGouraudAlpha2::setParam ( u32 index, f32 value)
|
||||
void CTRTextureGouraudAlpha2::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
|
||||
}
|
||||
|
||||
@@ -147,15 +139,15 @@ void CTRTextureGouraudAlpha2::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 +155,7 @@ void CTRTextureGouraudAlpha2::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;
|
||||
@@ -200,6 +192,7 @@ void CTRTextureGouraudAlpha2::scanline_bilinear ()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
SOFTWARE_DRIVER_2_CLIPCHECK;
|
||||
dst = (tVideoSample*)RenderTarget->getData() + ( line.y * RenderTarget->getDimension().Width ) + xStart;
|
||||
|
||||
#ifdef USE_ZBUFFER
|
||||
@@ -209,17 +202,15 @@ void CTRTextureGouraudAlpha2::scanline_bilinear ()
|
||||
|
||||
f32 inversew = FIX_POINT_F32_MUL;
|
||||
|
||||
#ifdef BURNINGVIDEO_RENDERER_FAST
|
||||
u32 dIndex = ( line.y & 3 ) << 2;
|
||||
|
||||
#if defined(BURNINGVIDEO_RENDERER_FAST) && COLOR_MAX==0xff
|
||||
u32 dIndex = (line.y & 3) << 2;
|
||||
#else
|
||||
tFixPoint a0;
|
||||
tFixPoint r0, g0, b0;
|
||||
#endif
|
||||
tFixPoint a0, r0, g0, b0;
|
||||
|
||||
#ifdef IPOL_C0
|
||||
tFixPoint r1, g1, b1;
|
||||
tFixPoint r2, g2, b2;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for ( s32 i = 0; i <= dx; ++i )
|
||||
@@ -233,7 +224,7 @@ void CTRTextureGouraudAlpha2::scanline_bilinear ()
|
||||
|
||||
{
|
||||
|
||||
#ifdef BURNINGVIDEO_RENDERER_FAST
|
||||
#if defined(BURNINGVIDEO_RENDERER_FAST) && COLOR_MAX==0xff
|
||||
|
||||
const tFixPointu d = dithermask [ dIndex | ( i ) & 3 ];
|
||||
|
||||
@@ -245,7 +236,7 @@ void CTRTextureGouraudAlpha2::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
|
||||
@@ -263,19 +254,14 @@ void CTRTextureGouraudAlpha2::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];
|
||||
@@ -284,30 +270,23 @@ void CTRTextureGouraudAlpha2::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( r2, g2, b2, line.c[0][0], inversew );
|
||||
|
||||
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 );
|
||||
|
||||
/*
|
||||
dst[i] = PixelBlend32 ( dst[i],
|
||||
fix_to_color ( 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] );
|
||||
@@ -315,9 +294,14 @@ void CTRTextureGouraudAlpha2::scanline_bilinear ()
|
||||
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 );
|
||||
dst[i] = fix_to_sample ( r2, g2, b2 );
|
||||
*/
|
||||
|
||||
#else
|
||||
dst[i] = PixelBlend32 ( dst[i],
|
||||
fix_to_sample( r0,g0, b0 ),
|
||||
fixPointu_to_u32 ( a0 )
|
||||
);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -342,7 +326,7 @@ void CTRTextureGouraudAlpha2::scanline_bilinear ()
|
||||
|
||||
}
|
||||
|
||||
void CTRTextureGouraudAlpha2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4DVertex *c )
|
||||
void CTRTextureGouraudAlpha2::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);
|
||||
@@ -353,9 +337,9 @@ void CTRTextureGouraudAlpha2::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;
|
||||
@@ -441,8 +425,8 @@ void CTRTextureGouraudAlpha2::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;
|
||||
@@ -600,8 +584,8 @@ void CTRTextureGouraudAlpha2::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
|
||||
|
||||
@@ -720,6 +704,7 @@ namespace video
|
||||
//! creates a flat triangle renderer
|
||||
IBurningShader* createTRTextureGouraudAlpha(CBurningVideoDriver* driver)
|
||||
{
|
||||
//ETR_TEXTURE_GOURAUD_ALPHA
|
||||
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
|
||||
return new CTRTextureGouraudAlpha2(driver);
|
||||
#else
|
||||
|
Reference in New Issue
Block a user