Loading external resources into the game. More...

Collaboration diagram for Resources:

Detailed Description

Loading external resources into the game.

The user is able to load external resources into the game via the LoadResources.cpp an its IonEngine::LoadResources() function. Inside the function the user can use the Asset Manager classes to load resources from the Assets folder. The Asset Managers include:

These three can be used like so for loading assets:

LoadResources.cpp:

{
//---------------------------------------------------------------------------------------------------------
// Load the Models
//---------------------------------------------------------------------------------------------------------
// Model from file ( .azul format)
ModelAssets::Load("modelSphere", "Models/Sphere.azul");
ModelAssets::Load("modelTankBody", "Models/Tank/Tank_Body.azul");
ModelAssets::Load("modelTankTurret_Barrel", "Models/Tank/Tank_Turret.azul");
ModelAssets::Load("modelTankTurret", "Models/Tank/Tank_Turret_noBarrel.azul");
ModelAssets::Load("modelTankBarrel", "Models/Tank/Tank_Barrel.azul");
ModelAssets::Load("modelAxis", "Models/Axis.azul");
//---------------------------------------------------------------------------------------------------------
// Load the Textures
//---------------------------------------------------------------------------------------------------------
// Direct loads
TextureAssets::Load("Tex_SkyBox", "Textures/SkyBox.tga");
TextureAssets::Load("TexSandGrass", "Textures/sandgrass.tga");
TextureAssets::Load("TexGrass", "Textures/grass.tga");
TextureAssets::Load("TexSand", "Textures/sand.tga");
TextureAssets::Load("TexHardGround", "Textures/hardground.tga");
TextureAssets::Load("TexWinScreen", "Textures/ScreenOverlay/WinScreen.tga");
TextureAssets::Load("TexLoseScreen", "Textures/ScreenOverlay/LoseScreen.tga");
TextureAssets::Load("TexMainScreen", "Textures/ScreenOverlay/MenuLogo.tga");
//---------------------------------------------------------------------------------------------------------
// Load Images
//---------------------------------------------------------------------------------------------------------
ImageManager::Load("WinScreenImage", TextureAssets::Get("TexWinScreen"));
ImageManager::Load("LoseScreenImage", TextureAssets::Get("TexLoseScreen"));
ImageManager::Load("MainScreenImage", TextureAssets::Get("TexMainScreen"));
//---------------------------------------------------------------------------------------------------------
// Load the Shaders
//---------------------------------------------------------------------------------------------------------
ShaderAssets::Load("SHADER_TEXTURE", new ShaderTexture());
ShaderAssets::Load("SHADER_TEXTURE_LIGHT", new ShaderTextureLight());
ShaderAssets::Load("SHADER_COLOR", new ShaderColor());
ShaderAssets::Load("SHADER_COLOR_LIGHT", new ShaderColorLight());
ShaderAssets::Load("SHADER_COLOR_VARY", new ShaderColorVary());
//---------------------------------------------------------------------------------------------------------
// Load the SkyBoxes
//---------------------------------------------------------------------------------------------------------
SkyBoxAssets::Load("SkyBox", 5000, ShaderAssets::Get("SHADER_TEXTURE"), TextureAssets::Get("Tex_SkyBox"));
//---------------------------------------------------------------------------------------------------------
// Load the Terrains
//---------------------------------------------------------------------------------------------------------
TerrainAssets::Load("Terrain_Grass", L"Textures/HeightMaps/LevelOne.tga", ShaderAssets::Get("SHADER_TEXTURE_LIGHT"),
Color::White, 5000, 150, 10, TextureAssets::Get("TexGrass"));
TerrainAssets::Load("Terrain_Sand", L"Textures/HeightMaps/LevelTwo.tga", ShaderAssets::Get("SHADER_TEXTURE_LIGHT"),
Color::White, 5000, 100, 10, TextureAssets::Get("TexSand"));
TerrainAssets::Load("Terrain_Rock", L"Textures/HeightMaps/LevelThree.tga", ShaderAssets::Get("SHADER_TEXTURE_LIGHT"),
Color::White, 5000, 200, 10, TextureAssets::Get("TexHardGround"));
}

As you can see, the Asset Managers use their Load() functions to create and store instances of objects based off the given file path under a specified key. Later, these objects can be retrived using the Asset Managers' Get() functions with the spefified key. That would look something like this:

Tank.cpp

Tank::Tank()
{
Vect LightColor(1.50f, 1.50f, 1.50f, 1.0f);
Vect LightPos(1.0f, 1.0f, 1.0f, 1.0f);
pGObj_Tank_Body = new GraphicsObject_Texture_Light(ModelAssets::Get("modelTankBody"), ShaderAssets::Get("SHADER_TEXTURE_LIGHT"),
TextureAssets::Get("TexTankTreads"), TextureAssets::Get("TexTankBody"), TextureAssets::Get("TexTankBody"), Color::White);
pGObj_Tank_Turret = new GraphicsObject_Texture_Light(ModelAssets::Get("modelTankTurret"), ShaderAssets::Get("SHADER_TEXTURE_LIGHT"),
TextureAssets::Get("TexTankBody"), TextureAssets::Get("TexTankBody"), TextureAssets::Get("TexTankBody"), Color::White);
}

Classes

class  ImageAssets
 System manager for saving and accessing Images from external resources. More...
 
class  ModelAssets
 System manager for saving and accessing external model resources. More...
 
class  ShaderAssets
 System manager for saving and accessing external shader resources. More...
 
class  SkyBoxAssets
 System manager for for creating and accessing SkyBox objects from external resources. More...
 
class  TerrainAssets
 System manager for for creating and accessing Terrain objects from external resources. More...
 
class  TextureAssets
 System manager for saving and accessing external texture resources. More...
 

Functions

void IonEngine::LoadResources ()
 Public engine function for loading assets/resources. More...
 

Function Documentation

void IonEngine::LoadResources ( )
private

Public engine function for loading assets/resources.

Within the LoadResources() function the user is able to load external resources like Models, Textures, Shaders, etc using the appropriate Asset Managers (ModelAssets, TextureAssets, ImageAssets, ShaderAssets, TerrainAssets, and SkyBoxAssets).