//----------------------------------------------------------------------------------------------- STATIC Texture* Texture::CreateOrGetTexture( const std::string& imageFilePath ) { Texture* texture = GetTextureByName( imageFilePath ); if( !texture ) { texture = new Texture( imageFilePath ); } return texture; }
//--------------------------------------------------------------------------- // Finds the named Texture among the registry of those already loaded; if // found, returns that Texture*. If not, attempts to load that texture, // and returns a Texture* just created (or nullptr if unable to load file). // STATIC Texture* Texture::CreateOrGetTexture(const std::string& imageFilePath) { Texture* texture = GetTextureByName(imageFilePath); if (texture != nullptr) { return texture; } else { texture = new Texture(imageFilePath); Texture::s_textureRegistry[imageFilePath] = texture; return texture; } }