Beispiel #1
0
CMacroTextureData* FindMacroTexture( const char *pFilename )
{
	int index = g_MacroTextureLookup.Find( pFilename );
	if ( g_MacroTextureLookup.IsValidIndex( index ) )
		return g_MacroTextureLookup[index];
	else
		return NULL;
}
//-----------------------------------------------------------------------------
// FIXME: Need some better understanding of when textures should be added to
// the texture dictionary here. Is it only for files, for example?
// Texture dictionary...
//-----------------------------------------------------------------------------
ITextureInternal *CTextureManager::LoadTexture( const char *pTextureName, const char *pTextureGroupName )
{
	ITextureInternal *pNewTexture = ITextureInternal::CreateFileTexture( pTextureName, pTextureGroupName );
	if ( pNewTexture )
	{
		int iIndex = m_TextureExcludes.Find( pNewTexture->GetName() );
		if ( m_TextureExcludes.IsValidIndex( iIndex ) )
		{
			// mark the new texture as excluded
			int nDimensionsLimit = m_TextureExcludes[iIndex];
			pNewTexture->MarkAsExcluded( ( nDimensionsLimit == 0 ), nDimensionsLimit );
		}

		// Stick the texture onto the board
		pNewTexture->Download();

		// FIXME: If there's been an error loading, we don't also want this error...
	}

	return pNewTexture;
}
int CTextureManager::FindNext( int iIndex, ITextureInternal **pTexInternal )
{
	if ( iIndex == -1 && m_TextureList.Count() )
	{
		iIndex = m_TextureList.First();
	}
	else if ( !m_TextureList.Count() || !m_TextureList.IsValidIndex( iIndex ) )
	{
		*pTexInternal = NULL;
		return -1;
	}

	*pTexInternal = m_TextureList[iIndex];

	iIndex = m_TextureList.Next( iIndex );
	if ( iIndex == m_TextureList.InvalidIndex() )
	{
		// end of list
		iIndex = -1;
	}

	return iIndex;
}