void RageTexture::CreateFrameRects() { GetFrameDimensionsFromFileName(GetID().filename, &m_iFramesWide, &m_iFramesHigh); m_TextureCoordRects.clear(); for (int j = 0; j < m_iFramesHigh; j++) { for (int i = 0; i < m_iFramesWide; i++) { RectF frect((i + 0) / (float)m_iFramesWide * m_iImageWidth / (float)m_iTextureWidth, (j + 0) / (float)m_iFramesHigh * m_iImageHeight / (float)m_iTextureHeight, (i + 1) / (float)m_iFramesWide * m_iImageWidth / (float)m_iTextureWidth, (j + 1) / (float)m_iFramesHigh * m_iImageHeight / (float)m_iTextureHeight); m_TextureCoordRects.push_back(frect); } } }
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; j<m_iFramesHigh; j++ ) // traverse along Y { for( int i=0; i<m_iFramesWide; i++ ) // traverse along X (important that this is the inner loop) { RectF frect( (i+0)/(float)m_iFramesWide*m_iImageWidth /(float)m_iTextureWidth, // these will all be between 0.0 and 1.0 (j+0)/(float)m_iFramesHigh*m_iImageHeight/(float)m_iTextureHeight, (i+1)/(float)m_iFramesWide*m_iImageWidth /(float)m_iTextureWidth, (j+1)/(float)m_iFramesHigh*m_iImageHeight/(float)m_iTextureHeight ); m_TextureCoordRects.push_back( frect ); // the index of this array element will be (i + j*m_iFramesWide) //LOG->Trace( "Adding frect%d %f %f %f %f", (i + j*m_iFramesWide), frect.left, frect.top, frect.right, frect.bottom ); } } }
int RageTexture::GetFrameCountFromFileName( CString sPath ) { int wide, high; GetFrameDimensionsFromFileName(sPath, &wide, &high ); return wide*high; }
int RageTexture::GetFrameCountFromFileName( CString sPath ) { int iWide, iHigh; GetFrameDimensionsFromFileName( sPath, &iWide, &iHigh ); return iWide * iHigh; }