Пример #1
0
	Texture* Texture::CreateOrGetTexture( const std::string& textureName, const std::string& texturePath )
	{
		REQUIRES( !texturePath.empty() );
		REQUIRES( strlen( texturePath.c_str() ) > 0 );
	
		auto iter = sm_texturePool.find( textureName );
		Texture* texture = nullptr;//sm_texturePool[ textureName ];

		if( iter == sm_texturePool.end() )
		{
			texture = new Texture( texturePath );
			sm_texturePool.insert( std::pair< std::string, Texture* >( textureName, texture ) );
		}
		else
			texture = iter->second;

		PROMISES( texture );
		PROMISES( texture->IsLoaded() );
		PROMISES( texture->GetFilePath() == texturePath );	
		return texture;
	}