Skip to content
Carl Hewett edited this page Jul 13, 2016 · 14 revisions

This class contains and keeps track of all resources (objects, textures, shaders, etc). You can get the game's resource manager with getResourcemanager().

Class ResourceManager

Shader& addShader(string vertexShaderFile, string fragmentShaderFile)

Add (and process) a Shader program. The files are in the shaders directory. The name shader name is automatically generated from the file names. Returns the newly create shader.


Shader& addNamedShader(string name, string vertexShaderFile, string fragmentShaderFile)

Add a Shader, but specify the name to find them later. Same as addShader(). Returns the newly created shader.


Shader& findShader(string shaderName)

Find the shader by name.


clearShaders()

Clear all Shaders from memory.


Texture& addTexture(string textureFile, TextureType type)

Add a Shader and store it on the GPU. See TextureType for information on types. Generates name from file name. Returns the newly create texture.


Texture& addNamedTexture(string textureName, string textureFile)

Same as addTexture(), but with a name instead of an automatically generated one. Returns the newly created texture.


Texture& findTexture(string textureName)

Find the texture by name.


clearTextures()

Clear all Textures, great for freeing vram!


ObjectGeometryGroup& addObjectGeometryGroup(string objectFile)

Add an ObjectGeometryGroup and store it on the GPU. This would be a .obj file containing one or more objects. Generates a name from the file name. Returns the newly create object geometry group. Objects in the object file that have the same name will be modified to have unique names.


ObjectGeometryGroup& addNamedObjectGeometryGroup(string objectGeometryGroupName, string objectFile)

Add an ObjectGeometryGroup and specify a name instead of automatically generating one from the file name. Returns the newly create object geometry group.


ObjectGeometryGroup& addCustomObjectGeometryGroup(ObjectGeometryGroup& customGroupToTrack)

Add an ObjectGeometryGroup that was created from Lua. The only use to this function is to let the resource manager track the object geometry group for us so we can get it back using findObjectGeometryGroup.


ObjectGeometryGroup& findObjectGeometryGroup(string shaderName)

Find the ObjectGeometryGroup by name.


clearObjectGeometryGroups()

Clear all ObjectGeometryGroups from memory.


Sound& addSound(string soundFile, SoundType soundType)

Add a new Sound. See SoundType for more information on each type. The sound's name is generated from the file name.


Sound& addNamedSound(string soundName, string soundFile, SoundType soundType)

Add a new Sound with the specified name.


Sound& findSound(string soundName)

Find the Sound by name.


clearSounds()

Clear the Sounds from memory.

Clone this wiki locally