fix Model doesn't obey m_bTextureWrapping
This commit is contained in:
@@ -320,10 +320,9 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties
|
||||
}
|
||||
}
|
||||
|
||||
void Actor::SetRenderStates()
|
||||
void Actor::SetGlobalRenderStates()
|
||||
{
|
||||
// set Actor-defined render states
|
||||
DISPLAY->SetTextureWrapping( m_bTextureWrapping );
|
||||
DISPLAY->SetBlendMode( m_BlendMode );
|
||||
DISPLAY->SetZWrite( m_bZWrite );
|
||||
DISPLAY->SetZTestMode( m_ZTestMode );
|
||||
@@ -332,6 +331,11 @@ void Actor::SetRenderStates()
|
||||
DISPLAY->SetCullMode( m_CullMode );
|
||||
}
|
||||
|
||||
void Actor::SetTextureRenderStates()
|
||||
{
|
||||
DISPLAY->SetTextureWrapping( m_bTextureWrapping );
|
||||
}
|
||||
|
||||
void Actor::EndDraw()
|
||||
{
|
||||
DISPLAY->PopMatrix();
|
||||
|
||||
@@ -71,7 +71,8 @@ public:
|
||||
void Draw(); // calls, NeedsDraw, BeginDraw, DrawPrimitives, EndDraw
|
||||
virtual bool EarlyAbortDraw() { return false; } // return true to early abort drawing of this Actor
|
||||
virtual void BeginDraw(); // pushes transform onto world matrix stack
|
||||
virtual void SetRenderStates(); // Actor should call at beginning of their DrawPrimitives() after setting textures
|
||||
virtual void SetGlobalRenderStates(); // Actor should call this at beginning of their DrawPrimitives()
|
||||
virtual void SetTextureRenderStates(); // Actor should call this after setting a texture
|
||||
virtual void DrawPrimitives() {}; // Derivitives should override
|
||||
virtual void EndDraw(); // pops transform from world matrix stack
|
||||
|
||||
|
||||
@@ -328,6 +328,8 @@ void BitmapText::DrawChars()
|
||||
end++;
|
||||
DISPLAY->ClearAllTextures();
|
||||
DISPLAY->SetTexture( 0, tex[start] );
|
||||
// don't bother setting texture render states for text. We never go outside of 0..1.
|
||||
//Actor::SetTextureRenderStates();
|
||||
RageSpriteVertex &start_vertex = verts[start*4];
|
||||
int iNumVertsToDraw = (end-start)*4;
|
||||
DISPLAY->DrawQuads( &start_vertex, iNumVertsToDraw );
|
||||
@@ -487,7 +489,7 @@ bool BitmapText::EarlyAbortDraw()
|
||||
// draw text at x, y using colorTop blended down to colorBottom, with size multiplied by scale
|
||||
void BitmapText::DrawPrimitives()
|
||||
{
|
||||
Actor::SetRenderStates(); // set Actor-specified render states
|
||||
Actor::SetGlobalRenderStates(); // set Actor-specified render states
|
||||
DISPLAY->SetTextureModeModulate();
|
||||
|
||||
/* Draw if we're not fully transparent or the zbuffer is enabled */
|
||||
|
||||
@@ -123,9 +123,12 @@ void GraphDisplay::Update( float fDeltaTime )
|
||||
|
||||
void GraphDisplay::DrawPrimitives()
|
||||
{
|
||||
Actor::SetGlobalRenderStates(); // set Actor-specified render states
|
||||
|
||||
DISPLAY->ClearAllTextures();
|
||||
DISPLAY->SetTexture( 0, m_pTexture );
|
||||
Actor::SetRenderStates(); // set Actor-specified render states
|
||||
// don't bother setting texture render states for a null texture
|
||||
//Actor::SetTextureRenderStates();
|
||||
|
||||
DISPLAY->DrawQuads( Slices, ARRAYSIZE(Slices) );
|
||||
DISPLAY->SetTexture( 0, NULL );
|
||||
|
||||
@@ -317,12 +317,12 @@ void Model::DrawCelShaded()
|
||||
|
||||
void Model::DrawPrimitives()
|
||||
{
|
||||
Actor::SetGlobalRenderStates(); // set Actor-specified render states
|
||||
|
||||
/* Don't if we're fully transparent */
|
||||
if( m_pTempState->diffuse[0].a < 0.001f && m_pTempState->glow.a < 0.001f )
|
||||
return;
|
||||
|
||||
Actor::SetRenderStates(); // set Actor-specified render states
|
||||
|
||||
DISPLAY->Scale( 1, -1, 1 ); // flip Y so positive is up
|
||||
|
||||
//////////////////////
|
||||
@@ -359,7 +359,6 @@ void Model::DrawPrimitives()
|
||||
fScrollX += mat.diffuse.m_fTexOffsetX;
|
||||
float fScrollY = mat.diffuse.m_fTexVelocityY * mat.diffuse.GetSecondsIntoAnimation() / mat.diffuse.GetAnimationLengthSeconds();
|
||||
fScrollY += mat.diffuse.m_fTexOffsetY;
|
||||
DISPLAY->SetTextureWrapping( true );
|
||||
DISPLAY->TextureTranslate( fScrollX, fScrollY, 0 );
|
||||
}
|
||||
|
||||
@@ -369,6 +368,7 @@ void Model::DrawPrimitives()
|
||||
{
|
||||
// render the diffuse texture
|
||||
DISPLAY->SetTexture( 0, mat.diffuse.GetCurrentTexture() );
|
||||
Actor::SetTextureRenderStates(); // set Actor-specified render states
|
||||
DISPLAY->SetSphereEnvironmentMapping( mat.diffuse.m_bSphereMapped );
|
||||
DrawMesh( i );
|
||||
|
||||
@@ -376,6 +376,8 @@ void Model::DrawPrimitives()
|
||||
if( mat.alpha.GetCurrentTexture() )
|
||||
{
|
||||
DISPLAY->SetTexture( 0, mat.alpha.GetCurrentTexture() );
|
||||
Actor::SetTextureRenderStates(); // set Actor-specified render states
|
||||
|
||||
DISPLAY->SetSphereEnvironmentMapping( mat.alpha.m_bSphereMapped );
|
||||
// UGLY: This overrides the Actor's BlendMode
|
||||
DISPLAY->SetBlendMode( BLEND_ADD );
|
||||
@@ -387,12 +389,14 @@ void Model::DrawPrimitives()
|
||||
{
|
||||
// render the diffuse texture with texture unit 1
|
||||
DISPLAY->SetTexture( 0, mat.diffuse.GetCurrentTexture() );
|
||||
Actor::SetTextureRenderStates(); // set Actor-specified render states
|
||||
DISPLAY->SetSphereEnvironmentMapping( mat.diffuse.m_bSphereMapped );
|
||||
|
||||
// render the additive texture with texture unit 2
|
||||
if( mat.alpha.GetCurrentTexture() )
|
||||
{
|
||||
DISPLAY->SetTexture( 1, mat.alpha.GetCurrentTexture() );
|
||||
Actor::SetTextureRenderStates(); // set Actor-specified render states
|
||||
DISPLAY->SetSphereEnvironmentMapping( mat.alpha.m_bSphereMapped );
|
||||
DISPLAY->SetTextureModeAdd();
|
||||
DISPLAY->SetTextureFiltering( true );
|
||||
@@ -450,6 +454,7 @@ void Model::DrawPrimitives()
|
||||
{
|
||||
msMaterial& mat = m_Materials[ pMesh->nMaterialIndex ];
|
||||
DISPLAY->SetTexture( 0, mat.diffuse.GetCurrentTexture() );
|
||||
Actor::SetTextureRenderStates(); // set Actor-specified render states
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -400,6 +400,8 @@ void TexCoordArrayFromRect(float fImageCoords[8], const RectF &rect)
|
||||
|
||||
void Sprite::DrawTexture( const TweenState *state )
|
||||
{
|
||||
Actor::SetGlobalRenderStates(); // set Actor-specified render states
|
||||
|
||||
// bail if cropped all the way
|
||||
if( state->crop.left + state->crop.right >= 1 ||
|
||||
state->crop.top + state->crop.bottom >= 1 )
|
||||
@@ -456,7 +458,7 @@ void Sprite::DrawTexture( const TweenState *state )
|
||||
|
||||
// Must call this after setting the texture or else texture
|
||||
// parameters have no effect.
|
||||
Actor::SetRenderStates(); // set Actor-specified render states
|
||||
Actor::SetTextureRenderStates(); // set Actor-specified render states
|
||||
|
||||
if( m_pTexture )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user