diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 843798f2d0..253ca9d688 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -418,16 +418,17 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties { - RageMatrix m; - RageMatrixTranslateAndScale( &m, - m_pTempState->pos.x, - m_pTempState->pos.y, - m_pTempState->pos.z, - m_pTempState->scale.x * m_baseScale.x, - m_pTempState->scale.y * m_baseScale.y, - m_pTempState->scale.z * m_baseScale.z ); - - DISPLAY->PreMultMatrix( m ); + if( m_pTempState->pos.x != 0 || m_pTempState->pos.y != 0 || m_pTempState->pos.z != 0 ) + { + RageMatrix m; + RageMatrixTranslate( + &m, + m_pTempState->pos.x, + m_pTempState->pos.y, + m_pTempState->pos.z + ); + DISPLAY->PreMultMatrix( m ); + } } { @@ -442,7 +443,23 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties { RageMatrix m; RageMatrixRotationXYZ( &m, fRotateX, fRotateY, fRotateZ ); + DISPLAY->PreMultMatrix( m ); + } + } + { + const float fScaleX = m_pTempState->scale.x * m_baseScale.x; + const float fScaleY = m_pTempState->scale.y * m_baseScale.y; + const float fScaleZ = m_pTempState->scale.z * m_baseScale.z; + + if( fScaleX != 1 || fScaleY != 1 || fScaleZ != 1 ) + { + RageMatrix m; + RageMatrixScale( + &m, + fScaleX, + fScaleY, + fScaleZ ); DISPLAY->PreMultMatrix( m ); } } diff --git a/stepmania/src/RageMath.cpp b/stepmania/src/RageMath.cpp index 60c9c665fc..518c7fb036 100644 --- a/stepmania/src/RageMath.cpp +++ b/stepmania/src/RageMath.cpp @@ -191,9 +191,30 @@ void RageMatrixSkewX( RageMatrix* pOut, float fAmount ) * RageMatrixScaling( &scale, fScaleX, float fScaleY, float fScaleZ ); * RageMatrixMultiply( pOut, &translate, &scale ); */ -void RageMatrixTranslateAndScale( RageMatrix* pOut, - float fTransX, float fTransY, float fTransZ, - float fScaleX, float fScaleY, float fScaleZ ) +void RageMatrixTranslate( RageMatrix* pOut, float fTransX, float fTransY, float fTransZ ) +{ + pOut->m00 = 1; + pOut->m01 = 0; + pOut->m02 = 0; + pOut->m03 = 0; + + pOut->m10 = 0; + pOut->m11 = 1; + pOut->m12 = 0; + pOut->m13 = 0; + + pOut->m20 = 0; + pOut->m21 = 0; + pOut->m22 = 1; + pOut->m23 = 0; + + pOut->m30 = fTransX; + pOut->m31 = fTransY; + pOut->m32 = fTransZ; + pOut->m33 = 1; +} + +void RageMatrixScale( RageMatrix* pOut, float fScaleX, float fScaleY, float fScaleZ ) { pOut->m00 = fScaleX; pOut->m01 = 0; @@ -210,9 +231,9 @@ void RageMatrixTranslateAndScale( RageMatrix* pOut, pOut->m22 = fScaleZ; pOut->m23 = 0; - pOut->m30 = fTransX; - pOut->m31 = fTransY; - pOut->m32 = fTransZ; + pOut->m30 = 0; + pOut->m31 = 0; + pOut->m32 = 0; pOut->m33 = 1; } diff --git a/stepmania/src/RageMath.h b/stepmania/src/RageMath.h index 6c0e833d4f..700ecd1552 100644 --- a/stepmania/src/RageMath.h +++ b/stepmania/src/RageMath.h @@ -27,7 +27,8 @@ void RageMatrixMultiply( RageMatrix* pOut, const RageMatrix* pA, const RageMatri void RageMatrixTranslation( RageMatrix* pOut, float x, float y, float z ); void RageMatrixScaling( RageMatrix* pOut, float x, float y, float z ); void RageMatrixSkewX( RageMatrix* pOut, float fAmount ); -void RageMatrixTranslateAndScale( RageMatrix* pOut, float fTransX, float fTransY, float fTransZ, float fScaleX, float fScaleY, float fScaleZ ); +void RageMatrixTranslate( RageMatrix* pOut, float fTransX, float fTransY, float fTransZ ); +void RageMatrixScale( RageMatrix* pOut, float fScaleX, float fScaleY, float fScaleZ ); void RageMatrixRotationX( RageMatrix* pOut, float fTheta ); void RageMatrixRotationY( RageMatrix* pOut, float fTheta ); void RageMatrixRotationZ( RageMatrix* pOut, float fTheta );