From cda57e7c5df7836b2723664202d1e5c12d298b22 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Tue, 23 Sep 2003 05:39:24 +0000 Subject: [PATCH] fix Model bugs exposed by use in NoteDisplay --- stepmania/src/Model.cpp | 20 ++++++++++++++++++-- stepmania/src/NoteDisplay.cpp | 3 ++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/stepmania/src/Model.cpp b/stepmania/src/Model.cpp index 431e455626..5dc067c628 100644 --- a/stepmania/src/Model.cpp +++ b/stepmania/src/Model.cpp @@ -590,10 +590,21 @@ void Model::DrawPrimitives() if(m_Meshes.empty()) return; // bail early + /* Don't if we're fully transparent */ + if( m_temp.diffuse[0].a <= 0.001f ) + return; + Actor::SetRenderStates(); // set Actor-specified render states DISPLAY->Scale( 1, -1, 1 ); // flip Y so positive is up + + ////////////////////// + // render the diffuse pass + ////////////////////// + + DISPLAY->SetTextureModeModulate(); + for (int i = 0; i < (int)m_Meshes.size(); i++) { msMesh *pMesh = &m_Meshes[i]; @@ -657,8 +668,13 @@ void Model::DrawPrimitives() DISPLAY->DrawIndexedTriangles( &TempVertices[0], pMesh->Vertices.size(), (Uint16*)&pMesh->Triangles[0], pMesh->Triangles.size()*3 ); } - DISPLAY->SetZBuffer( false ); - + ////////////////////// + // render the glow pass + ////////////////////// + if( m_temp.glow.a > 0.0001f ) + { + // TODO: Support glow. + } } void Model::SetDefaultAnimation( CString sAnimation, float fPlayRate ) diff --git a/stepmania/src/NoteDisplay.cpp b/stepmania/src/NoteDisplay.cpp index c6d03b630a..68ce84d57d 100644 --- a/stepmania/src/NoteDisplay.cpp +++ b/stepmania/src/NoteDisplay.cpp @@ -266,7 +266,8 @@ void NoteDisplay::Load( int iColNum, PlayerNumber pn, CString NoteSkin, float fY void NoteDisplay::SetActiveFrame( float fNoteBeat, Actor &actorToSet, float fAnimationLengthInBeats, bool bVivid, bool bNoteColor ) { const int iNumFrames = actorToSet.GetNumStates(); - ASSERT( iNumFrames ); + if( iNumFrames == 0 ) // Model with no textures + return; float fSongBeat = GAMESTATE->m_fSongBeat; float fPrecentIntoAnimation = fmodf(fSongBeat,fAnimationLengthInBeats) / fAnimationLengthInBeats;