#include "global.h" #include "RageTexture.h" #include "RageUtil.h" #include "RageTextureManager.h" #include RageTexture::RageTexture( RageTextureID name ): m_ID(name) { // LOG->Trace( "RageTexture::RageTexture()" ); m_iRefCount = 1; m_bWasUsed = false; // SetActualID(); m_iSourceWidth = m_iSourceHeight = 0; m_iTextureWidth = m_iTextureHeight = 0; m_iImageWidth = m_iImageHeight = 0; m_iFramesWide = m_iFramesHigh = 0; } /* Set the initial ActualID; this is what the actual texture will start * from. */ //void RageTexture::SetActualID() //{ // m_ActualID = m_ID; // // /* Texture color depth preference can be overridden. */ // if(m_ID.iColorDepth == -1) // m_ActualID.iColorDepth = TEXTUREMAN->GetTextureColorDepth(); // // /* The max texture size can never be higher than the preference, // * since it might be set to something to fix driver problems. */ // m_ActualID.iMaxSize = min(m_ActualID.iMaxSize, TEXTUREMAN->GetMaxTextureResolution()); //} RageTexture::~RageTexture() { } void RageTexture::CreateFrameRects() { GetFrameDimensionsFromFileName( GetID().filename, &m_iFramesWide, &m_iFramesHigh ); /////////////////////////////////// // Fill in the m_FrameRects with the bounds of each frame in the animation. /////////////////////////////////// m_TextureCoordRects.clear(); for( int j=0; jTrace( "Adding frect%d %f %f %f %f", (i + j*m_iFramesWide), frect.left, frect.top, frect.right, frect.bottom ); } } } void RageTexture::GetFrameDimensionsFromFileName( CString sPath, int* piFramesWide, int* piFramesHigh ) { *piFramesWide = *piFramesHigh = 1; // set default values in case we don't find the dimension in the file name sPath.MakeLower(); const CString sFName = SetExtension( sPath, "" ); CStringArray arrayBits; split( sFName, " ", arrayBits, false ); /* XXX: allow dims to be in parens */ for( unsigned i=0; i