ObjectManager Class Reference

This class manages all objects in a project and makes sure no object is created twice. More...

#include <ObjectManager.h>

Public Types

typedef std::unordered_map< std::string, ShaderPtrShaderMap
 
typedef std::unordered_map< std::string, TexturePtrTextureMap
 
typedef std::unordered_map< std::string, CubeMapPtrCubeMapMap
 
typedef std::unordered_map< std::string, DepthMapPtrDepthMapMap
 
typedef std::unordered_map< std::string, FontPtrFontMap
 
typedef std::unordered_map< std::string, MaterialPtrMaterialMap
 
typedef std::unordered_map< std::string, PropertiesPtrPropertiesMap
 
typedef std::unordered_map< std::string, ModelPtrModelMap
 
typedef std::unordered_map< std::string, TextSpritePtrTextSpriteMap
 
typedef std::unordered_map< std::string, CameraPtrCameraMap
 
typedef std::unordered_map< std::string, MatrixStackPtrMatrixStackMap
 
typedef std::unordered_map< std::string, LightPtrLightMap
 
typedef std::unordered_map< std::string, FramebufferPtrFramebufferMap
 
typedef std::unordered_map< std::string, DrawablePtrDrawableMap
 

Public Member Functions

 ObjectManager ()
 Constructor. More...
 
virtual ~ObjectManager ()
 Virtual destructor. More...
 
void setShaderVersionDesktop (const std::string &shaderVersionDesktop)
 Set the shader version used on desktop systems. More...
 
void setShaderVersionES (const std::string &shaderVersionES)
 Set the shader version used on mobile devices systems. More...
 
void setAmbientColor (const vmml::Vector3f &ambientColor)
 Set an ambient color for the scene. More...
 
MaterialPtr loadObjMaterial (const std::string &fileName, const std::string &materialName, const std::string &shaderName="", GLuint shaderMaxLights=bRenderer::DEFAULT_SHADER_MAX_LIGHTS(), bool variableNumberOfLights=false, bool ambientLighting=true)
 Load a material. More...
 
MaterialPtr loadObjMaterial (const std::string &fileName, const std::string &materialName, ShaderPtr shader)
 Load a material. More...
 
ModelPtr loadObjModel (const std::string &fileName, bool flipT=false, bool flipZ=false, bool shaderFromFile=false, GLuint shaderMaxLights=bRenderer::DEFAULT_SHADER_MAX_LIGHTS(), bool variableNumberOfLights=false, bool ambientLighting=true, PropertiesPtr properties=nullptr)
 Load a 3D model. More...
 
ModelPtr loadObjModel (const std::string &fileName, bool flipT, bool flipZ, ShaderPtr shader, PropertiesPtr properties=nullptr)
 Load a 3D model. More...
 
ModelPtr loadObjModel (const std::string &fileName, bool flipT, bool flipZ, MaterialPtr material, PropertiesPtr properties=nullptr)
 Load a 3D model. More...
 
TexturePtr loadTexture (const std::string &fileName)
 Load a texture. More...
 
CubeMapPtr loadCubeMap (const std::string &name, const std::vector< std::string > &fileNames)
 Load a cube map. More...
 
FontPtr loadFont (const std::string &fileName, GLuint fontPixelSize)
 Load a font (e.g. TrueType fonts (TTF) or OpenType fonts (OTF) More...
 
ShaderPtr loadShaderFile (const std::string &shaderName, GLuint shaderMaxLights=bRenderer::DEFAULT_SHADER_MAX_LIGHTS(), bool variableNumberOfLights=false, bool ambientLighting=true, bool diffuseLighting=true, bool specularLighting=true, bool cubicReflectionMap=false)
 Load a shader. More...
 
ShaderPtr generateShader (const std::string &shaderName, GLuint shaderMaxLights, bool ambientLighting, const MaterialData &materialData, bool variableNumberOfLights, bool isText)
 Generate a shader. More...
 
ShaderPtr generateShader (const std::string &shaderName, const ShaderGeneratorSettings &shaderGeneratorSettings)
 Generate a shader. More...
 
MaterialPtr createMaterial (const std::string &name, ShaderPtr shader)
 Create empty material. More...
 
MaterialPtr createMaterial (const std::string &name, const MaterialData &materialData, ShaderPtr shader)
 Create a material. More...
 
MaterialPtr createMaterialShaderCombination (const std::string &name, const MaterialData &materialData, bool shaderFromFile, GLuint shaderMaxLights=bRenderer::DEFAULT_SHADER_MAX_LIGHTS(), bool variableNumberOfLights=false, bool ambientLighting=true, bool isText=false)
 Create a material and a shader fitting its characteristics. More...
 
PropertiesPtr createProperties (const std::string &name)
 Create properties. More...
 
ModelPtr createModel (const std::string &name, const ModelData &modelData, bool shaderFromFile, GLuint shaderMaxLights=bRenderer::DEFAULT_SHADER_MAX_LIGHTS(), bool variableNumberOfLights=false, bool ambientLighting=true, PropertiesPtr properties=nullptr)
 Create a model. More...
 
ModelPtr createModel (const std::string &name, const ModelData &modelData, ShaderPtr shader, PropertiesPtr properties=nullptr)
 Create a model. More...
 
ModelPtr createModel (const std::string &name, const ModelData &modelData, MaterialPtr material, PropertiesPtr properties=nullptr)
 Create a model. More...
 
ModelPtr createSprite (const std::string &name, MaterialPtr material, bool flipT=false, PropertiesPtr properties=nullptr)
 Create a sprite. More...
 
ModelPtr createSprite (const std::string &name, const std::string &textureFileName, ShaderPtr shader, bool flipT=false, PropertiesPtr properties=nullptr)
 Create a sprite. More...
 
ModelPtr createSprite (const std::string &name, const std::string &textureFileName, GLuint shaderMaxLights=0, bool variableNumberOfLights=false, bool flipT=false, PropertiesPtr properties=nullptr)
 Create a sprite. More...
 
TextSpritePtr createTextSprite (const std::string &name, vmml::Vector3f color, const std::string &text, FontPtr font, PropertiesPtr properties=nullptr)
 Create a text sprite to display strings on the screen. More...
 
TextSpritePtr createTextSprite (const std::string &name, MaterialPtr material, const std::string &text, FontPtr font, PropertiesPtr properties=nullptr)
 Create a text sprite to display strings on the screen. More...
 
TexturePtr createTexture (const std::string &name, const TextureData &textureData)
 Create a texture. More...
 
TexturePtr createTexture (const std::string &name, GLsizei width, GLsizei height, GLenum format=GL_RGBA, ImageDataPtr imageData=nullptr)
 Create a texture (allows for creating empty textures e.g. for binding to a framebuffer) More...
 
CubeMapPtr createCubeMap (const std::string &name, const std::vector< TextureData > &data)
 Create a cube map. More...
 
CubeMapPtr createCubeMap (const std::string &name, GLsizei width, GLenum format=GL_RGBA, const std::vector< ImageDataPtr > &imageData={})
 Create a cube map. More...
 
DepthMapPtr createDepthMap (const std::string &name, GLint width, GLint height)
 Create a depth map. More...
 
ShaderPtr createShader (const std::string &name, const IShaderData &shaderData)
 Create a shader. More...
 
CameraPtr createCamera (const std::string &name)
 Create a camera. More...
 
CameraPtr createCamera (const std::string &name, const vmml::Vector3f &position, const vmml::Vector3f &rotationAxes)
 Create a camera. More...
 
CameraPtr createCamera (const std::string &name, GLfloat fov, GLfloat aspect, GLfloat near, GLfloat far)
 Create a camera. More...
 
CameraPtr createCamera (const std::string &name, const vmml::Vector3f &position, const vmml::Vector3f &rotationAxes, GLfloat fov, GLfloat aspect, GLfloat near, GLfloat far)
 Create a camera. More...
 
MatrixStackPtr createMatrixStack (const std::string &name)
 Create a matrix stack. More...
 
LightPtr createLight (const std::string &name)
 Create a light. More...
 
LightPtr createLight (const std::string &name, const vmml::Vector3f &position, const vmml::Vector3f &color)
 Create a light. More...
 
LightPtr createLight (const std::string &name, const vmml::Vector3f &position, const vmml::Vector3f &color, GLfloat intensity, GLfloat attenuation, GLfloat radius)
 Create a light. More...
 
LightPtr createLight (const std::string &name, const vmml::Vector3f &position, const vmml::Vector3f &diffuseColor, const vmml::Vector3f &specularColor, GLfloat intensity, GLfloat attenuation, GLfloat radius)
 Create a light. More...
 
FramebufferPtr createFramebuffer (const std::string &name)
 Create a framebuffer that adjusts its size automatically according to the viewport size. More...
 
FramebufferPtr createFramebuffer (const std::string &name, GLint width, GLint height)
 Create a framebuffer with a custom size. More...
 
bool addShader (const std::string &name, ShaderPtr ptr)
 Add a shader (returns true if successful) More...
 
bool addTexture (const std::string &name, TexturePtr ptr)
 Add a texture (returns true if successful) More...
 
bool addCubeMap (const std::string &name, CubeMapPtr ptr)
 Add a cube map (returns true if successful) More...
 
bool addDepthMap (const std::string &name, DepthMapPtr ptr)
 Add a depth map (returns true if successful) More...
 
bool addFont (const std::string &name, FontPtr ptr)
 Add a font (returns true if successful) More...
 
bool addMaterial (const std::string &name, MaterialPtr ptr)
 Add a material (returns true if successful) More...
 
bool addProperties (const std::string &name, PropertiesPtr ptr)
 Add properties (returns true if successful) More...
 
bool addModel (const std::string &name, ModelPtr ptr)
 Add a 3D model (returns true if successful) More...
 
bool addTextSprite (const std::string &name, TextSpritePtr ptr)
 Add a text sprite (returns true if successful) More...
 
bool addCamera (const std::string &name, CameraPtr ptr)
 Add a camera (returns true if successful) More...
 
bool addMatrixStack (const std::string &name, MatrixStackPtr ptr)
 Add a matrix stack (returns true if successful) More...
 
bool addLight (const std::string &name, LightPtr ptr)
 Add a light (returns true if successful) More...
 
bool addFramebuffer (const std::string &name, FramebufferPtr ptr)
 Add a framebuffer (returns true if successful) More...
 
bool addDrawable (const std::string &name, DrawablePtr ptr)
 Add a drawable (returns true if successful) More...
 
ShaderPtr getShader (const std::string &name)
 Get a shader. More...
 
TexturePtr getTexture (const std::string &name)
 Get a texture. More...
 
CubeMapPtr getCubeMap (const std::string &name)
 Get a cube map. More...
 
DepthMapPtr getDepthMap (const std::string &name)
 Get a depth map. More...
 
FontPtr getFont (const std::string &name)
 Get a font. More...
 
MaterialPtr getMaterial (const std::string &name)
 Get a material. More...
 
PropertiesPtr getProperties (const std::string &name)
 Get properties. More...
 
ModelPtr getModel (const std::string &name)
 Get a 3D model. More...
 
TextSpritePtr getTextSprite (const std::string &name)
 Get a text sprite. More...
 
CameraPtr getCamera (const std::string &name)
 Get a camera. More...
 
MatrixStackPtr getMatrixStack (const std::string &name)
 Get a matrix stack. More...
 
LightPtr getLight (const std::string &name)
 Get a light. More...
 
FramebufferPtr getFramebuffer (const std::string &name)
 Get a framebuffer. More...
 
DrawablePtr getDrawable (const std::string &name)
 Get a drawable. More...
 
std::string getShaderVersionDesktop ()
 Get the shader version used on desktop systems. More...
 
std::string getShaderVersionES ()
 Get the shader version used on mobile devices systems. More...
 
vmml::Vector3f getAmbientColor ()
 Get the ambient color of the scene. More...
 
void removeShader (const std::string &name, bool del)
 Remove a shader. More...
 
void removeTexture (const std::string &name, bool del)
 Remove a texture. More...
 
void removeCubeMap (const std::string &name, bool del)
 Remove a cube map. More...
 
void removeDepthMap (const std::string &name, bool del)
 Remove a depth map. More...
 
void removeFont (const std::string &name, bool del)
 Remove a font. More...
 
void removeMaterial (const std::string &name)
 Remove a material. More...
 
void removeProperties (const std::string &name)
 Remove properties. More...
 
void removeModel (const std::string &name, bool del)
 Remove a 3D model. More...
 
void removeTextSprite (const std::string &name, bool del)
 Remove a text sprite. More...
 
void removeCamera (const std::string &name)
 Remove a camera. More...
 
void removeMatrixStack (const std::string &name)
 Remove a matrix stack. More...
 
void removeLight (const std::string &name)
 Remove a light. More...
 
void removeFramebuffer (const std::string &name, bool del)
 Remove a framebuffer. More...
 
void removeDrawable (const std::string &name)
 Remove a drawable. More...
 
void clear (bool del)
 Clear all objects. More...
 

Detailed Description

This class manages all objects in a project and makes sure no object is created twice.

Author
Benjamin Buergisser

Member Typedef Documentation

typedef std::unordered_map< std::string, CameraPtr > ObjectManager::CameraMap
typedef std::unordered_map< std::string, CubeMapPtr > ObjectManager::CubeMapMap
typedef std::unordered_map< std::string, DepthMapPtr > ObjectManager::DepthMapMap
typedef std::unordered_map< std::string, DrawablePtr > ObjectManager::DrawableMap
typedef std::unordered_map< std::string, FontPtr > ObjectManager::FontMap
typedef std::unordered_map< std::string, FramebufferPtr > ObjectManager::FramebufferMap
typedef std::unordered_map< std::string, LightPtr > ObjectManager::LightMap
typedef std::unordered_map< std::string, MaterialPtr > ObjectManager::MaterialMap
typedef std::unordered_map< std::string, MatrixStackPtr > ObjectManager::MatrixStackMap
typedef std::unordered_map< std::string, ModelPtr > ObjectManager::ModelMap
typedef std::unordered_map< std::string, PropertiesPtr > ObjectManager::PropertiesMap
typedef std::unordered_map< std::string, ShaderPtr > ObjectManager::ShaderMap
typedef std::unordered_map< std::string, TextSpritePtr > ObjectManager::TextSpriteMap
typedef std::unordered_map< std::string, TexturePtr > ObjectManager::TextureMap

Constructor & Destructor Documentation

ObjectManager::ObjectManager ( )
inline

Constructor.

virtual ObjectManager::~ObjectManager ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

bool ObjectManager::addCamera ( const std::string &  name,
CameraPtr  ptr 
)

Add a camera (returns true if successful)

Parameters
[in]nameName of the camera
[in]ptrA pointer to the object to be added
bool ObjectManager::addCubeMap ( const std::string &  name,
CubeMapPtr  ptr 
)

Add a cube map (returns true if successful)

Parameters
[in]nameName of the cube map
[in]ptrA pointer to the object to be added
bool ObjectManager::addDepthMap ( const std::string &  name,
DepthMapPtr  ptr 
)

Add a depth map (returns true if successful)

Parameters
[in]nameName of the depth map
[in]ptrA pointer to the object to be added
bool ObjectManager::addDrawable ( const std::string &  name,
DrawablePtr  ptr 
)

Add a drawable (returns true if successful)

Parameters
[in]nameName of the drawable
[in]ptrA pointer to the object to be added
bool ObjectManager::addFont ( const std::string &  name,
FontPtr  ptr 
)

Add a font (returns true if successful)

Parameters
[in]nameName of the font
[in]ptrA pointer to the object to be added
bool ObjectManager::addFramebuffer ( const std::string &  name,
FramebufferPtr  ptr 
)

Add a framebuffer (returns true if successful)

Parameters
[in]nameName of the framebuffer
[in]ptrA pointer to the object to be added
bool ObjectManager::addLight ( const std::string &  name,
LightPtr  ptr 
)

Add a light (returns true if successful)

Parameters
[in]nameName of the light
[in]ptrA pointer to the object to be added
bool ObjectManager::addMaterial ( const std::string &  name,
MaterialPtr  ptr 
)

Add a material (returns true if successful)

Parameters
[in]nameName of the material
[in]ptrA pointer to the object to be added
bool ObjectManager::addMatrixStack ( const std::string &  name,
MatrixStackPtr  ptr 
)

Add a matrix stack (returns true if successful)

Parameters
[in]nameName of the matrix stack
[in]ptrA pointer to the object to be added
bool ObjectManager::addModel ( const std::string &  name,
ModelPtr  ptr 
)

Add a 3D model (returns true if successful)

Parameters
[in]nameName of the model
[in]ptrA pointer to the object to be added
bool ObjectManager::addProperties ( const std::string &  name,
PropertiesPtr  ptr 
)

Add properties (returns true if successful)

Parameters
[in]nameName of the properties
[in]ptrA pointer to the object to be added
bool ObjectManager::addShader ( const std::string &  name,
ShaderPtr  ptr 
)

Add a shader (returns true if successful)

Parameters
[in]nameName of the shader
bool ObjectManager::addTextSprite ( const std::string &  name,
TextSpritePtr  ptr 
)

Add a text sprite (returns true if successful)

Parameters
[in]nameName of the text sprite
[in]ptrA pointer to the object to be added
bool ObjectManager::addTexture ( const std::string &  name,
TexturePtr  ptr 
)

Add a texture (returns true if successful)

Parameters
[in]nameName of the texture
[in]ptrA pointer to the object to be added
void ObjectManager::clear ( bool  del)

Clear all objects.

Parameters
[in]delSet true if the OpenGL objects should be deleted
CameraPtr ObjectManager::createCamera ( const std::string &  name)

Create a camera.

Parameters
[in]nameName of the camera
CameraPtr ObjectManager::createCamera ( const std::string &  name,
const vmml::Vector3f &  position,
const vmml::Vector3f &  rotationAxes 
)

Create a camera.

Parameters
[in]nameName of the camera
[in]positionPosition of the camera
[in]rotationAxesRotation axes of the camera
CameraPtr ObjectManager::createCamera ( const std::string &  name,
GLfloat  fov,
GLfloat  aspect,
GLfloat  near,
GLfloat  far 
)

Create a camera.

Parameters
[in]nameName of the camera
[in]fovField of view
[in]aspectAspect ratio
[in]nearNear clipping plane
[in]farFar clipping plane
CameraPtr ObjectManager::createCamera ( const std::string &  name,
const vmml::Vector3f &  position,
const vmml::Vector3f &  rotationAxes,
GLfloat  fov,
GLfloat  aspect,
GLfloat  near,
GLfloat  far 
)

Create a camera.

Parameters
[in]nameName of the camera
[in]positionPosition of the camera
[in]rotationAxesRotation axes of the camera
[in]fovField of view
[in]aspectAspect ratio
[in]nearNear clipping plane
[in]farFar clipping plane
CubeMapPtr ObjectManager::createCubeMap ( const std::string &  name,
const std::vector< TextureData > &  data 
)

Create a cube map.

Parameters
[in]nameThe raw name of the cube map
[in]dataThe texture data to be used (size needs to be 6) in the following order: right, left, top, bottom, front, back
CubeMapPtr ObjectManager::createCubeMap ( const std::string &  name,
GLsizei  width,
GLenum  format = GL_RGBA,
const std::vector< ImageDataPtr > &  imageData = {} 
)

Create a cube map.

Allows for specifying no image data for empty cube maps (e.g. to attach to a framebuffer)

Parameters
[in]nameThe raw name of the cube map
[in]widthSets width and height since cube maps must use square sizes
[in]format
[in]imageDataImage data for each face of the cube (size needs to be 6) in the following order: right, left, top, bottom, front, back
DepthMapPtr ObjectManager::createDepthMap ( const std::string &  name,
GLint  width,
GLint  height 
)

Create a depth map.

Parameters
[in]nameThe raw name of the depth map
[in]width
[in]height
FramebufferPtr ObjectManager::createFramebuffer ( const std::string &  name)

Create a framebuffer that adjusts its size automatically according to the viewport size.

Parameters
[in]nameName of the framebuffer
FramebufferPtr ObjectManager::createFramebuffer ( const std::string &  name,
GLint  width,
GLint  height 
)

Create a framebuffer with a custom size.

Parameters
[in]nameName of the framebuffer
[in]width
[in]height
LightPtr ObjectManager::createLight ( const std::string &  name)

Create a light.

Parameters
[in]nameName of the light
LightPtr ObjectManager::createLight ( const std::string &  name,
const vmml::Vector3f &  position,
const vmml::Vector3f &  color 
)

Create a light.

Parameters
[in]nameName of the light
[in]positionPosition of the light
[in]colorColor of the light for both diffuse and specular lighting
LightPtr ObjectManager::createLight ( const std::string &  name,
const vmml::Vector3f &  position,
const vmml::Vector3f &  color,
GLfloat  intensity,
GLfloat  attenuation,
GLfloat  radius 
)

Create a light.

Parameters
[in]nameName of the light
[in]positionPosition of the light
[in]colorColor of the light for both diffuse and specular lighting
[in]intensityIntensity of the light
[in]attenuationAttenuation of the light
[in]radiusRadius of the light (clamps the light at a certain distance)
LightPtr ObjectManager::createLight ( const std::string &  name,
const vmml::Vector3f &  position,
const vmml::Vector3f &  diffuseColor,
const vmml::Vector3f &  specularColor,
GLfloat  intensity,
GLfloat  attenuation,
GLfloat  radius 
)

Create a light.

Parameters
[in]nameName of the light
[in]positionPosition of the light
[in]diffuseColorColor of the light for diffuse lighting
[in]specularColorColor of the light for specular lighting
[in]intensityIntensity of the light
[in]attenuationAttenuation of the light
[in]radiusRadius of the light (clamps the light at a certain distance)
MaterialPtr ObjectManager::createMaterial ( const std::string &  name,
ShaderPtr  shader 
)

Create empty material.

Parameters
[in]nameName of the material
[in]shader
MaterialPtr ObjectManager::createMaterial ( const std::string &  name,
const MaterialData materialData,
ShaderPtr  shader 
)

Create a material.

Parameters
[in]nameName of the material
[in]materialData
[in]shader
MaterialPtr ObjectManager::createMaterialShaderCombination ( const std::string &  name,
const MaterialData materialData,
bool  shaderFromFile,
GLuint  shaderMaxLights = bRenderer::DEFAULT_SHADER_MAX_LIGHTS(),
bool  variableNumberOfLights = false,
bool  ambientLighting = true,
bool  isText = false 
)

Create a material and a shader fitting its characteristics.

Parameters
[in]nameName of the material and the shader
[in]materialData
[in]shaderFromFileSet true if for every material a shader file with the same name should be loaded
[in]shaderMaxLights(optional)
[in]variableNumberOfLightsTrue if the number of lights may vary, otherwise the number of lights has to be the same as specified as maximum number of lights (optional)
[in]ambientLightingSet true if the shader supports ambient lighting (optional)
[in]isTextSet true if the shader should be used for displaying text (optional)
MatrixStackPtr ObjectManager::createMatrixStack ( const std::string &  name)

Create a matrix stack.

Parameters
[in]nameName of the matrix stack
ModelPtr ObjectManager::createModel ( const std::string &  name,
const ModelData modelData,
bool  shaderFromFile,
GLuint  shaderMaxLights = bRenderer::DEFAULT_SHADER_MAX_LIGHTS(),
bool  variableNumberOfLights = false,
bool  ambientLighting = true,
PropertiesPtr  properties = nullptr 
)

Create a model.

Parameters
[in]nameThe raw name of the model
[in]modelData
[in]shaderFromFileSet true if for every material a shader file with the same name should be loaded
[in]maxLightsThe maximum number of light sources to be used (optional)
[in]variableNumberOfLightsTrue if the number of lights may vary, otherwise the number of lights has to be the same as specified as maximum number of lights (optional)
[in]ambientLightingSet true if the shader supports ambient lighting (optional)
[in]propertiesProperties that will be passed to the shader of the model (optional)
ModelPtr ObjectManager::createModel ( const std::string &  name,
const ModelData modelData,
ShaderPtr  shader,
PropertiesPtr  properties = nullptr 
)

Create a model.

Parameters
[in]nameThe raw name of the model
[in]modelData
[in]shader
[in]propertiesProperties that will be passed to the shader of the model (optional)
ModelPtr ObjectManager::createModel ( const std::string &  name,
const ModelData modelData,
MaterialPtr  material,
PropertiesPtr  properties = nullptr 
)

Create a model.

Parameters
[in]nameThe raw name of the model
[in]modelData
[in]material
[in]propertiesProperties that will be passed to the shader of the model (optional)
PropertiesPtr ObjectManager::createProperties ( const std::string &  name)

Create properties.

Parameters
[in]nameName of the properties
ShaderPtr ObjectManager::createShader ( const std::string &  name,
const IShaderData shaderData 
)

Create a shader.

Parameters
[in]nameThe raw name of the shader
[in]shaderData
ModelPtr ObjectManager::createSprite ( const std::string &  name,
MaterialPtr  material,
bool  flipT = false,
PropertiesPtr  properties = nullptr 
)

Create a sprite.

Parameters
[in]nameThe raw name of the sprite
[in]material
[in]flipTFlip T axis of texture (optional)
[in]propertiesProperties that will be passed to the shader of the model (optional)
ModelPtr ObjectManager::createSprite ( const std::string &  name,
const std::string &  textureFileName,
ShaderPtr  shader,
bool  flipT = false,
PropertiesPtr  properties = nullptr 
)

Create a sprite.

Parameters
[in]nameThe raw name of the sprite
[in]textureFileNameThe filename of the texture that should be loaded and displayed
[in]shader
[in]flipTFlip T axis of texture (optional)
[in]propertiesProperties that will be passed to the shader of the model (optional)
ModelPtr ObjectManager::createSprite ( const std::string &  name,
const std::string &  textureFileName,
GLuint  shaderMaxLights = 0,
bool  variableNumberOfLights = false,
bool  flipT = false,
PropertiesPtr  properties = nullptr 
)

Create a sprite.

Parameters
[in]nameThe raw name of the sprite
[in]textureFileNameThe filename of the texture that should be loaded and displayed
[in]shaderMaxLightsThe maximum number of light sources to be used (optional)
[in]variableNumberOfLightsSet true if the number of lights may vary, otherwise the number of lights has to be the same as specified as maximum number of lights (optional)
[in]flipTFlip T axis of texture (optional)
[in]propertiesProperties that will be passed to the shader of the model (optional)
TextSpritePtr ObjectManager::createTextSprite ( const std::string &  name,
vmml::Vector3f  color,
const std::string &  text,
FontPtr  font,
PropertiesPtr  properties = nullptr 
)

Create a text sprite to display strings on the screen.

Parameters
[in]nameThe raw name of the sprite
[in]colorThe color of the text
[in]textThe string to be displayed
[in]fontThe font to be used to display the string
[in]propertiesProperties that will be passed to the shader of the model (optional)
TextSpritePtr ObjectManager::createTextSprite ( const std::string &  name,
MaterialPtr  material,
const std::string &  text,
FontPtr  font,
PropertiesPtr  properties = nullptr 
)

Create a text sprite to display strings on the screen.

Parameters
[in]nameThe raw name of the sprite
[in]material
[in]textThe string to be displayed
[in]fontThe font to be used to display the string
[in]propertiesProperties that will be passed to the shader of the model (optional)
TexturePtr ObjectManager::createTexture ( const std::string &  name,
const TextureData textureData 
)

Create a texture.

Parameters
[in]nameThe raw name of the texture
[in]textureData
TexturePtr ObjectManager::createTexture ( const std::string &  name,
GLsizei  width,
GLsizei  height,
GLenum  format = GL_RGBA,
ImageDataPtr  imageData = nullptr 
)

Create a texture (allows for creating empty textures e.g. for binding to a framebuffer)

Parameters
[in]nameThe raw name of the texture
[in]width
[in]height
[in]format
[in]imageData
ShaderPtr ObjectManager::generateShader ( const std::string &  shaderName,
GLuint  shaderMaxLights,
bool  ambientLighting,
const MaterialData materialData,
bool  variableNumberOfLights,
bool  isText 
)

Generate a shader.

Parameters
[in]shaderNameName of the shader
[in]shaderMaxLightsThe maximum number of light sources to be used
[in]ambientLightingSet true if the shader should support ambient lighting
[in]materialDataAll necessary information for the shader is read from the material data
[in]variableNumberOfLightsSet true if the number of lights may vary, otherwise the number of lights has to be the same as specified as maximum number of lights
[in]isTextSet true if the shader should be used for displaying text
ShaderPtr ObjectManager::generateShader ( const std::string &  shaderName,
const ShaderGeneratorSettings shaderGeneratorSettings 
)

Generate a shader.

Parameters
[in]shaderNameName of the shader
[in]shaderGeneratorSettingsThe settings defining the abilities the generated shader should have
vmml::Vector3f ObjectManager::getAmbientColor ( )

Get the ambient color of the scene.

CameraPtr ObjectManager::getCamera ( const std::string &  name)

Get a camera.

Parameters
[in]nameName of the camera
CubeMapPtr ObjectManager::getCubeMap ( const std::string &  name)

Get a cube map.

Parameters
[in]nameName of the cube map
DepthMapPtr ObjectManager::getDepthMap ( const std::string &  name)

Get a depth map.

Parameters
[in]nameName of the depth map
DrawablePtr ObjectManager::getDrawable ( const std::string &  name)

Get a drawable.

Parameters
[in]nameName of the drawable
FontPtr ObjectManager::getFont ( const std::string &  name)

Get a font.

Parameters
[in]nameName of the font
FramebufferPtr ObjectManager::getFramebuffer ( const std::string &  name)

Get a framebuffer.

Parameters
[in]nameName of the framebuffer
LightPtr ObjectManager::getLight ( const std::string &  name)

Get a light.

Parameters
[in]nameName of the light
MaterialPtr ObjectManager::getMaterial ( const std::string &  name)

Get a material.

Parameters
[in]nameName of the material
MatrixStackPtr ObjectManager::getMatrixStack ( const std::string &  name)

Get a matrix stack.

Parameters
[in]nameName of the matrix stack
ModelPtr ObjectManager::getModel ( const std::string &  name)

Get a 3D model.

Parameters
[in]nameName of the model
PropertiesPtr ObjectManager::getProperties ( const std::string &  name)

Get properties.

Parameters
[in]nameName of the properties
ShaderPtr ObjectManager::getShader ( const std::string &  name)

Get a shader.

Parameters
[in]nameName of the shader
std::string ObjectManager::getShaderVersionDesktop ( )

Get the shader version used on desktop systems.

std::string ObjectManager::getShaderVersionES ( )

Get the shader version used on mobile devices systems.

TextSpritePtr ObjectManager::getTextSprite ( const std::string &  name)

Get a text sprite.

Parameters
[in]nameName of the text sprite
TexturePtr ObjectManager::getTexture ( const std::string &  name)

Get a texture.

Parameters
[in]nameName of the texture
CubeMapPtr ObjectManager::loadCubeMap ( const std::string &  name,
const std::vector< std::string > &  fileNames 
)

Load a cube map.

Parameters
[in]fileNamesFile names including extension (size needs to be 6) in the following order: left, right, bottom, top, front, back
FontPtr ObjectManager::loadFont ( const std::string &  fileName,
GLuint  fontPixelSize 
)

Load a font (e.g. TrueType fonts (TTF) or OpenType fonts (OTF)

Parameters
[in]fileNameFile name including extension
[in]fontPixelSizeThe nominal font size in pixels (the characters may vary in size)
MaterialPtr ObjectManager::loadObjMaterial ( const std::string &  fileName,
const std::string &  materialName,
const std::string &  shaderName = "",
GLuint  shaderMaxLights = bRenderer::DEFAULT_SHADER_MAX_LIGHTS(),
bool  variableNumberOfLights = false,
bool  ambientLighting = true 
)

Load a material.

Parameters
[in]fileNameFile name including extension
[in]materialNameName of the material
[in]shaderNameName of the shader (optional, if left empty, the material name will be used)
[in]maxLightsThe maximum number of light sources to be used (optional)
[in]variableNumberOfLightsTrue if the number of lights may vary, otherwise the number of lights has to be the same as specified as maximum number of lights (optional)
[in]ambientLightingSet true if the shader supports ambient lighting (optional)
MaterialPtr ObjectManager::loadObjMaterial ( const std::string &  fileName,
const std::string &  materialName,
ShaderPtr  shader 
)

Load a material.

Parameters
[in]fileNameFile name including extension
[in]materialNameName of the material
[in]shaderCustom shader for the model
ModelPtr ObjectManager::loadObjModel ( const std::string &  fileName,
bool  flipT = false,
bool  flipZ = false,
bool  shaderFromFile = false,
GLuint  shaderMaxLights = bRenderer::DEFAULT_SHADER_MAX_LIGHTS(),
bool  variableNumberOfLights = false,
bool  ambientLighting = true,
PropertiesPtr  properties = nullptr 
)

Load a 3D model.

Parameters
[in]fileNameFile name including extension
[in]flipTFlip T axis of texture (optional)
[in]flipZFlip Z axis of the geometry (optional)
[in]shaderFromFileSet true if for every material a shader file with the same name should be loaded (optional)
[in]maxLightsThe maximum number of light sources to be used (optional)
[in]variableNumberOfLightsTrue if the number of lights may vary, otherwise the number of lights has to be the same as specified as maximum number of lights
[in]ambientLightingSet true if the shader supports ambient lighting (optional)
[in]propertiesProperties that will be passed to the shader of the model (optional)

This function will automatically create one shader for every material of the model

ModelPtr ObjectManager::loadObjModel ( const std::string &  fileName,
bool  flipT,
bool  flipZ,
ShaderPtr  shader,
PropertiesPtr  properties = nullptr 
)

Load a 3D model.

Parameters
[in]fileNameFile name including extension
[in]flipTFlip T axis of texture
[in]flipZFlip Z axis of the geometry
[in]shaderCustom shader for the model
[in]propertiesProperties that will be passed to the shader of the model (optional)
ModelPtr ObjectManager::loadObjModel ( const std::string &  fileName,
bool  flipT,
bool  flipZ,
MaterialPtr  material,
PropertiesPtr  properties = nullptr 
)

Load a 3D model.

Parameters
[in]fileNameFile name including extension
[in]flipTFlip T axis of texture
[in]flipZFlip Z axis of the geometry
[in]materialCustom material for the model
[in]propertiesProperties that will be passed to the shader of the model (optional)
ShaderPtr ObjectManager::loadShaderFile ( const std::string &  shaderName,
GLuint  shaderMaxLights = bRenderer::DEFAULT_SHADER_MAX_LIGHTS(),
bool  variableNumberOfLights = false,
bool  ambientLighting = true,
bool  diffuseLighting = true,
bool  specularLighting = true,
bool  cubicReflectionMap = false 
)

Load a shader.

Parameters
[in]shaderNameName of the shader
[in]maxLightsThe maximum number of light sources to be used (optional)
[in]variableNumberOfLightsTrue if the number of lights may vary, otherwise the number of lights has to be the same as specified as maximum number of lights (optional)
[in]ambientLightingSet true if the shader supports ambient lighting (optional)
[in]diffuseLightingSet true if the shader supports diffuse lighting (optional)
[in]specularLightingSet true if the shader supports specular lighting (optional)
[in]cubicReflectionMapSet true if the shader supports a cubic reflection map (optional)

If no shaders with the chosen name exist or no name is passed to the function the default shader will be used.

TexturePtr ObjectManager::loadTexture ( const std::string &  fileName)

Load a texture.

Parameters
[in]fileNameFile name including extension
void ObjectManager::removeCamera ( const std::string &  name)

Remove a camera.

Parameters
[in]nameName of the camera
void ObjectManager::removeCubeMap ( const std::string &  name,
bool  del 
)

Remove a cube map.

Parameters
[in]nameName of the cube map
[in]delSet true if the OpenGL object should be deleted
void ObjectManager::removeDepthMap ( const std::string &  name,
bool  del 
)

Remove a depth map.

Parameters
[in]nameName of the depth map
[in]delSet true if the OpenGL object should be deleted
void ObjectManager::removeDrawable ( const std::string &  name)

Remove a drawable.

Parameters
[in]nameName of the drawable
void ObjectManager::removeFont ( const std::string &  name,
bool  del 
)

Remove a font.

Parameters
[in]nameName of the font
[in]delSet true if the OpenGL object should be deleted
void ObjectManager::removeFramebuffer ( const std::string &  name,
bool  del 
)

Remove a framebuffer.

Parameters
[in]nameName of the framebuffer
[in]delSet true if the OpenGL object should be deleted
void ObjectManager::removeLight ( const std::string &  name)

Remove a light.

Parameters
[in]nameName of the light
void ObjectManager::removeMaterial ( const std::string &  name)

Remove a material.

Parameters
[in]nameName of the material
void ObjectManager::removeMatrixStack ( const std::string &  name)

Remove a matrix stack.

Parameters
[in]nameName of the matrix stack
void ObjectManager::removeModel ( const std::string &  name,
bool  del 
)

Remove a 3D model.

Parameters
[in]nameName of the model
[in]delSet true if the OpenGL object should be deleted
void ObjectManager::removeProperties ( const std::string &  name)

Remove properties.

Parameters
[in]nameName of the properties
void ObjectManager::removeShader ( const std::string &  name,
bool  del 
)

Remove a shader.

Parameters
[in]nameName of the shader
[in]delSet true if the OpenGL object should be deleted
void ObjectManager::removeTextSprite ( const std::string &  name,
bool  del 
)

Remove a text sprite.

Parameters
[in]nameName of the text sprite
[in]delSet true if the OpenGL object should be deleted
void ObjectManager::removeTexture ( const std::string &  name,
bool  del 
)

Remove a texture.

Parameters
[in]nameName of the texture
[in]delSet true if the OpenGL object should be deleted
void ObjectManager::setAmbientColor ( const vmml::Vector3f &  ambientColor)

Set an ambient color for the scene.

Parameters
[in]ambientColorAmbient color for the scene
void ObjectManager::setShaderVersionDesktop ( const std::string &  shaderVersionDesktop)

Set the shader version used on desktop systems.

Parameters
[in]shaderVersionDesktopThe shader version used on desktop systems, e.g. "#version 120"
void ObjectManager::setShaderVersionES ( const std::string &  shaderVersionES)

Set the shader version used on mobile devices systems.

Parameters
[in]shaderVersionESThe shader version used on mobile devices systems, e.g. "#version 100"