From c48ade0eb5d3717b89a09d579276dc26c4595a90 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 21 Apr 2003 01:35:37 +0000 Subject: [PATCH] break rect -> texture coord array into a function --- stepmania/src/Sprite.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index 30ccb8ec2d..ffaf3426f5 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -211,6 +211,13 @@ void Sprite::Update( float fDeltaTime ) } } +static void TexCoordsFromRect(RageVertex *v, const RectF &rect) +{ + v[0].t = RageVector2( rect.left, rect.top ); // top left + v[1].t = RageVector2( rect.left, rect.bottom ); // bottom left + v[2].t = RageVector2( rect.right, rect.bottom ); // bottom right + v[3].t = RageVector2( rect.right, rect.top ); // top right +} void Sprite::DrawPrimitives() { @@ -263,12 +270,7 @@ void Sprite::DrawPrimitives() else { const RectF *pTexCoordRect = GetCurrentTextureCoordRect(); - - v[0].t = RageVector2( pTexCoordRect->left, pTexCoordRect->top ); // top left - v[1].t = RageVector2( pTexCoordRect->left, pTexCoordRect->bottom ); // bottom left - v[2].t = RageVector2( pTexCoordRect->right, pTexCoordRect->bottom ); // bottom right - v[3].t = RageVector2( pTexCoordRect->right, pTexCoordRect->top ); // top right - + TexCoordsFromRect(v, *pTexCoordRect); DISPLAY->EnableTextureWrapping(m_bTextureWrapping); } } @@ -353,6 +355,8 @@ void Sprite::SetCustomTextureCoords( float fTexCoords[8] ) // order: bottom left m_CustomTexCoords[i] = fTexCoords[i]; } +/* Get the current custom texture coordinates. Note that these are independent + * */ void Sprite::GetCustomTextureCoords( float fTexCoordsOut[8] ) // order: bottom left, top left, bottom right, top right { for( int i=0; i<8; i++ )