System manager for saving and accessing external texture resources. More...

#include <TextureAssets.h>

Detailed Description

System manager for saving and accessing external texture resources.

The TextureAssets is a singleton that allows the user to resuse saved external texture resources throughout their project.

Textures are saved via the Load() functions in the IonEngine::LoadResources() function. They can then be accessed by using the Get() functions and the associated key that the user defined upon loading.

Public Types

typedef std::string TextureKey
 

Static Public Member Functions

static void Load (const TextureKey &Texture_Map_Key, const char *Texture_File_Path)
 Function saves a texture created from the desired path. More...
 
static void Load (const TextureKey &Model_Map_Key)
 Function saves all textures from a loaded model. More...
 
static Texture * Get (const TextureKey &Texture_Map_Key)
 Function returns texture pointer based off of the passed in key. More...
 
static Texture * Get (const TextureKey &Model_Map_Key, int Texture_Number)
 Function returns texture pointer that is associated with a loaded Model. More...
 

Member Typedef Documentation

typedef std::string TextureAssets::TextureKey

Typedef of an std::string for an easier to read name.

Member Function Documentation

static Texture* TextureAssets::Get ( const TextureKey Texture_Map_Key)
inlinestatic

Function returns texture pointer based off of the passed in key.

This Get() function uses it's Texture_Map_Key parameter to search the texture map and return the texture saved under the same key string.

Parameters
Texture_Map_KeyAn std::string for use as a key to access the stored texture
Returns
Pointer to texture at stored key
static Texture* TextureAssets::Get ( const TextureKey Model_Map_Key,
int  Texture_Number 
)
inlinestatic

Function returns texture pointer that is associated with a loaded Model.

This Get() function uses it's Model_Map_Key parameter and Texture_Number parameter to grab a specific texture that is associated with a model.

NOTE: In order to use this function, the texture key that is stored MUST BE THE SAME as it's file name. The Load(const TextureKey& Model_Map_Key) function will automatically do this, but if the textures are indivudually loaded with keys that are different from their file names, then this function will not work.

Parameters
Model_Map_KeyAn std::string for use as a key to access the stored model.
Texture_NumberAn integer to access the specified texture tied to the model.
Returns
pointer to texture
static void TextureAssets::Load ( const TextureKey Texture_Map_Key,
const char *  Texture_File_Path 
)
inlinestatic

Function saves a texture created from the desired path.

This Load() function creates and stores a texture pointer based off of the Texture_File_Path parameter. The Texture_Map_Key parameter is a key string for access later when using the Get() command.

NOTE: The file paths start within the "Assets" directory of the root project directory

Parameters
Texture_Map_KeyAn std::string for use as a storage key
Texture_File_PathA char string to the file path (starting in the "Assets" directory)
static void TextureAssets::Load ( const TextureKey Model_Map_Key)
inlinestatic

Function saves all textures from a loaded model.

This Load() function creates and stores a texture pointer based off of all the textures associated with a specified model. This function accesses the model via the ModelManager and the specified Model_Map_Key string. All textures loaded via this function will use the file name of the textures as the TextureKey string for later access.

Alternatively, the user can individually call the Load(const TextureKey& Texture_Map_Key, const char* Texture_File_Path) function multiple times in order to specify the key string name of each texture.

Parameters
Model_Map_KeyAn std::string for use as a key to access the stored model.