Basic Renderer
|
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, ShaderPtr > | ShaderMap |
typedef std::unordered_map< std::string, TexturePtr > | TextureMap |
typedef std::unordered_map< std::string, CubeMapPtr > | CubeMapMap |
typedef std::unordered_map< std::string, DepthMapPtr > | DepthMapMap |
typedef std::unordered_map< std::string, FontPtr > | FontMap |
typedef std::unordered_map< std::string, MaterialPtr > | MaterialMap |
typedef std::unordered_map< std::string, PropertiesPtr > | PropertiesMap |
typedef std::unordered_map< std::string, ModelPtr > | ModelMap |
typedef std::unordered_map< std::string, TextSpritePtr > | TextSpriteMap |
typedef std::unordered_map< std::string, CameraPtr > | CameraMap |
typedef std::unordered_map< std::string, MatrixStackPtr > | MatrixStackMap |
typedef std::unordered_map< std::string, LightPtr > | LightMap |
typedef std::unordered_map< std::string, FramebufferPtr > | FramebufferMap |
typedef std::unordered_map< std::string, DrawablePtr > | DrawableMap |
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... | |
This class manages all objects in a project and makes sure no object is created twice.
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 |
|
inline |
Constructor.
|
inlinevirtual |
Virtual destructor.
bool ObjectManager::addCamera | ( | const std::string & | name, |
CameraPtr | ptr | ||
) |
Add a camera (returns true if successful)
[in] | name | Name of the camera |
[in] | ptr | A pointer to the object to be added |
bool ObjectManager::addCubeMap | ( | const std::string & | name, |
CubeMapPtr | ptr | ||
) |
Add a cube map (returns true if successful)
[in] | name | Name of the cube map |
[in] | ptr | A pointer to the object to be added |
bool ObjectManager::addDepthMap | ( | const std::string & | name, |
DepthMapPtr | ptr | ||
) |
Add a depth map (returns true if successful)
[in] | name | Name of the depth map |
[in] | ptr | A pointer to the object to be added |
bool ObjectManager::addDrawable | ( | const std::string & | name, |
DrawablePtr | ptr | ||
) |
Add a drawable (returns true if successful)
[in] | name | Name of the drawable |
[in] | ptr | A pointer to the object to be added |
bool ObjectManager::addFont | ( | const std::string & | name, |
FontPtr | ptr | ||
) |
Add a font (returns true if successful)
[in] | name | Name of the font |
[in] | ptr | A pointer to the object to be added |
bool ObjectManager::addFramebuffer | ( | const std::string & | name, |
FramebufferPtr | ptr | ||
) |
Add a framebuffer (returns true if successful)
[in] | name | Name of the framebuffer |
[in] | ptr | A pointer to the object to be added |
bool ObjectManager::addLight | ( | const std::string & | name, |
LightPtr | ptr | ||
) |
Add a light (returns true if successful)
[in] | name | Name of the light |
[in] | ptr | A pointer to the object to be added |
bool ObjectManager::addMaterial | ( | const std::string & | name, |
MaterialPtr | ptr | ||
) |
Add a material (returns true if successful)
[in] | name | Name of the material |
[in] | ptr | A pointer to the object to be added |
bool ObjectManager::addMatrixStack | ( | const std::string & | name, |
MatrixStackPtr | ptr | ||
) |
Add a matrix stack (returns true if successful)
[in] | name | Name of the matrix stack |
[in] | ptr | A pointer to the object to be added |
bool ObjectManager::addModel | ( | const std::string & | name, |
ModelPtr | ptr | ||
) |
Add a 3D model (returns true if successful)
[in] | name | Name of the model |
[in] | ptr | A pointer to the object to be added |
bool ObjectManager::addProperties | ( | const std::string & | name, |
PropertiesPtr | ptr | ||
) |
Add properties (returns true if successful)
[in] | name | Name of the properties |
[in] | ptr | A pointer to the object to be added |
bool ObjectManager::addShader | ( | const std::string & | name, |
ShaderPtr | ptr | ||
) |
Add a shader (returns true if successful)
[in] | name | Name of the shader |
bool ObjectManager::addTextSprite | ( | const std::string & | name, |
TextSpritePtr | ptr | ||
) |
Add a text sprite (returns true if successful)
[in] | name | Name of the text sprite |
[in] | ptr | A pointer to the object to be added |
bool ObjectManager::addTexture | ( | const std::string & | name, |
TexturePtr | ptr | ||
) |
Add a texture (returns true if successful)
[in] | name | Name of the texture |
[in] | ptr | A pointer to the object to be added |
void ObjectManager::clear | ( | bool | del | ) |
Clear all objects.
[in] | del | Set true if the OpenGL objects should be deleted |
CameraPtr ObjectManager::createCamera | ( | const std::string & | name | ) |
Create a camera.
[in] | name | Name of the camera |
CameraPtr ObjectManager::createCamera | ( | const std::string & | name, |
const vmml::Vector3f & | position, | ||
const vmml::Vector3f & | rotationAxes | ||
) |
Create a camera.
[in] | name | Name of the camera |
[in] | position | Position of the camera |
[in] | rotationAxes | Rotation axes of the camera |
CameraPtr ObjectManager::createCamera | ( | const std::string & | name, |
GLfloat | fov, | ||
GLfloat | aspect, | ||
GLfloat | near, | ||
GLfloat | far | ||
) |
Create a camera.
[in] | name | Name of the camera |
[in] | fov | Field of view |
[in] | aspect | Aspect ratio |
[in] | near | Near clipping plane |
[in] | far | Far 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.
[in] | name | Name of the camera |
[in] | position | Position of the camera |
[in] | rotationAxes | Rotation axes of the camera |
[in] | fov | Field of view |
[in] | aspect | Aspect ratio |
[in] | near | Near clipping plane |
[in] | far | Far clipping plane |
CubeMapPtr ObjectManager::createCubeMap | ( | const std::string & | name, |
const std::vector< TextureData > & | data | ||
) |
Create a cube map.
[in] | name | The raw name of the cube map |
[in] | data | The 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)
[in] | name | The raw name of the cube map |
[in] | width | Sets width and height since cube maps must use square sizes |
[in] | format | |
[in] | imageData | Image 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.
[in] | name | The 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.
[in] | name | Name of the framebuffer |
FramebufferPtr ObjectManager::createFramebuffer | ( | const std::string & | name, |
GLint | width, | ||
GLint | height | ||
) |
Create a framebuffer with a custom size.
[in] | name | Name of the framebuffer |
[in] | width | |
[in] | height |
LightPtr ObjectManager::createLight | ( | const std::string & | name | ) |
Create a light.
[in] | name | Name of the light |
LightPtr ObjectManager::createLight | ( | const std::string & | name, |
const vmml::Vector3f & | position, | ||
const vmml::Vector3f & | color | ||
) |
Create a light.
[in] | name | Name of the light |
[in] | position | Position of the light |
[in] | color | Color 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.
[in] | name | Name of the light |
[in] | position | Position of the light |
[in] | color | Color of the light for both diffuse and specular lighting |
[in] | intensity | Intensity of the light |
[in] | attenuation | Attenuation of the light |
[in] | radius | Radius 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.
[in] | name | Name of the light |
[in] | position | Position of the light |
[in] | diffuseColor | Color of the light for diffuse lighting |
[in] | specularColor | Color of the light for specular lighting |
[in] | intensity | Intensity of the light |
[in] | attenuation | Attenuation of the light |
[in] | radius | Radius of the light (clamps the light at a certain distance) |
MaterialPtr ObjectManager::createMaterial | ( | const std::string & | name, |
ShaderPtr | shader | ||
) |
Create empty material.
[in] | name | Name of the material |
[in] | shader |
MaterialPtr ObjectManager::createMaterial | ( | const std::string & | name, |
const MaterialData & | materialData, | ||
ShaderPtr | shader | ||
) |
Create a material.
[in] | name | Name 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.
[in] | name | Name of the material and the shader |
[in] | materialData | |
[in] | shaderFromFile | Set true if for every material a shader file with the same name should be loaded |
[in] | shaderMaxLights | (optional) |
[in] | variableNumberOfLights | 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] | ambientLighting | Set true if the shader supports ambient lighting (optional) |
[in] | isText | Set true if the shader should be used for displaying text (optional) |
MatrixStackPtr ObjectManager::createMatrixStack | ( | const std::string & | name | ) |
Create a matrix stack.
[in] | name | Name 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.
[in] | name | The raw name of the model |
[in] | modelData | |
[in] | shaderFromFile | Set true if for every material a shader file with the same name should be loaded |
[in] | maxLights | The maximum number of light sources to be used (optional) |
[in] | variableNumberOfLights | 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] | ambientLighting | Set true if the shader supports ambient lighting (optional) |
[in] | properties | Properties 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.
[in] | name | The raw name of the model |
[in] | modelData | |
[in] | shader | |
[in] | properties | Properties 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.
[in] | name | The raw name of the model |
[in] | modelData | |
[in] | material | |
[in] | properties | Properties that will be passed to the shader of the model (optional) |
PropertiesPtr ObjectManager::createProperties | ( | const std::string & | name | ) |
Create properties.
[in] | name | Name of the properties |
ShaderPtr ObjectManager::createShader | ( | const std::string & | name, |
const IShaderData & | shaderData | ||
) |
Create a shader.
[in] | name | The 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.
[in] | name | The raw name of the sprite |
[in] | material | |
[in] | flipT | Flip T axis of texture (optional) |
[in] | properties | Properties 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.
[in] | name | The raw name of the sprite |
[in] | textureFileName | The filename of the texture that should be loaded and displayed |
[in] | shader | |
[in] | flipT | Flip T axis of texture (optional) |
[in] | properties | Properties 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.
[in] | name | The raw name of the sprite |
[in] | textureFileName | The filename of the texture that should be loaded and displayed |
[in] | shaderMaxLights | The maximum number of light sources to be used (optional) |
[in] | variableNumberOfLights | Set 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] | flipT | Flip T axis of texture (optional) |
[in] | properties | Properties 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.
[in] | name | The raw name of the sprite |
[in] | color | The color of the text |
[in] | text | The string to be displayed |
[in] | font | The font to be used to display the string |
[in] | properties | Properties 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.
[in] | name | The raw name of the sprite |
[in] | material | |
[in] | text | The string to be displayed |
[in] | font | The font to be used to display the string |
[in] | properties | Properties that will be passed to the shader of the model (optional) |
TexturePtr ObjectManager::createTexture | ( | const std::string & | name, |
const TextureData & | textureData | ||
) |
Create a texture.
[in] | name | The 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)
[in] | name | The 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.
[in] | shaderName | Name of the shader |
[in] | shaderMaxLights | The maximum number of light sources to be used |
[in] | ambientLighting | Set true if the shader should support ambient lighting |
[in] | materialData | All necessary information for the shader is read from the material data |
[in] | variableNumberOfLights | Set 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] | isText | Set true if the shader should be used for displaying text |
ShaderPtr ObjectManager::generateShader | ( | const std::string & | shaderName, |
const ShaderGeneratorSettings & | shaderGeneratorSettings | ||
) |
Generate a shader.
[in] | shaderName | Name of the shader |
[in] | shaderGeneratorSettings | The 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.
[in] | name | Name of the camera |
CubeMapPtr ObjectManager::getCubeMap | ( | const std::string & | name | ) |
Get a cube map.
[in] | name | Name of the cube map |
DepthMapPtr ObjectManager::getDepthMap | ( | const std::string & | name | ) |
Get a depth map.
[in] | name | Name of the depth map |
DrawablePtr ObjectManager::getDrawable | ( | const std::string & | name | ) |
Get a drawable.
[in] | name | Name of the drawable |
FontPtr ObjectManager::getFont | ( | const std::string & | name | ) |
Get a font.
[in] | name | Name of the font |
FramebufferPtr ObjectManager::getFramebuffer | ( | const std::string & | name | ) |
Get a framebuffer.
[in] | name | Name of the framebuffer |
LightPtr ObjectManager::getLight | ( | const std::string & | name | ) |
Get a light.
[in] | name | Name of the light |
MaterialPtr ObjectManager::getMaterial | ( | const std::string & | name | ) |
Get a material.
[in] | name | Name of the material |
MatrixStackPtr ObjectManager::getMatrixStack | ( | const std::string & | name | ) |
Get a matrix stack.
[in] | name | Name of the matrix stack |
ModelPtr ObjectManager::getModel | ( | const std::string & | name | ) |
Get a 3D model.
[in] | name | Name of the model |
PropertiesPtr ObjectManager::getProperties | ( | const std::string & | name | ) |
Get properties.
[in] | name | Name of the properties |
ShaderPtr ObjectManager::getShader | ( | const std::string & | name | ) |
Get a shader.
[in] | name | Name 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.
[in] | name | Name of the text sprite |
TexturePtr ObjectManager::getTexture | ( | const std::string & | name | ) |
Get a texture.
[in] | name | Name of the texture |
CubeMapPtr ObjectManager::loadCubeMap | ( | const std::string & | name, |
const std::vector< std::string > & | fileNames | ||
) |
Load a cube map.
[in] | fileNames | File 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)
[in] | fileName | File name including extension |
[in] | fontPixelSize | The 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.
[in] | fileName | File name including extension |
[in] | materialName | Name of the material |
[in] | shaderName | Name of the shader (optional, if left empty, the material name will be used) |
[in] | maxLights | The maximum number of light sources to be used (optional) |
[in] | variableNumberOfLights | 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] | ambientLighting | Set true if the shader supports ambient lighting (optional) |
MaterialPtr ObjectManager::loadObjMaterial | ( | const std::string & | fileName, |
const std::string & | materialName, | ||
ShaderPtr | shader | ||
) |
Load a material.
[in] | fileName | File name including extension |
[in] | materialName | Name of the material |
[in] | shader | Custom 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.
[in] | fileName | File name including extension |
[in] | flipT | Flip T axis of texture (optional) |
[in] | flipZ | Flip Z axis of the geometry (optional) |
[in] | shaderFromFile | Set true if for every material a shader file with the same name should be loaded (optional) |
[in] | maxLights | The maximum number of light sources to be used (optional) |
[in] | variableNumberOfLights | 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] | ambientLighting | Set true if the shader supports ambient lighting (optional) |
[in] | properties | Properties 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.
[in] | fileName | File name including extension |
[in] | flipT | Flip T axis of texture |
[in] | flipZ | Flip Z axis of the geometry |
[in] | shader | Custom shader for the model |
[in] | properties | Properties 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.
[in] | fileName | File name including extension |
[in] | flipT | Flip T axis of texture |
[in] | flipZ | Flip Z axis of the geometry |
[in] | material | Custom material for the model |
[in] | properties | Properties 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.
[in] | shaderName | Name of the shader |
[in] | maxLights | The maximum number of light sources to be used (optional) |
[in] | variableNumberOfLights | 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] | ambientLighting | Set true if the shader supports ambient lighting (optional) |
[in] | diffuseLighting | Set true if the shader supports diffuse lighting (optional) |
[in] | specularLighting | Set true if the shader supports specular lighting (optional) |
[in] | cubicReflectionMap | Set 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.
[in] | fileName | File name including extension |
void ObjectManager::removeCamera | ( | const std::string & | name | ) |
Remove a camera.
[in] | name | Name of the camera |
void ObjectManager::removeCubeMap | ( | const std::string & | name, |
bool | del | ||
) |
Remove a cube map.
[in] | name | Name of the cube map |
[in] | del | Set true if the OpenGL object should be deleted |
void ObjectManager::removeDepthMap | ( | const std::string & | name, |
bool | del | ||
) |
Remove a depth map.
[in] | name | Name of the depth map |
[in] | del | Set true if the OpenGL object should be deleted |
void ObjectManager::removeDrawable | ( | const std::string & | name | ) |
Remove a drawable.
[in] | name | Name of the drawable |
void ObjectManager::removeFont | ( | const std::string & | name, |
bool | del | ||
) |
Remove a font.
[in] | name | Name of the font |
[in] | del | Set true if the OpenGL object should be deleted |
void ObjectManager::removeFramebuffer | ( | const std::string & | name, |
bool | del | ||
) |
Remove a framebuffer.
[in] | name | Name of the framebuffer |
[in] | del | Set true if the OpenGL object should be deleted |
void ObjectManager::removeLight | ( | const std::string & | name | ) |
Remove a light.
[in] | name | Name of the light |
void ObjectManager::removeMaterial | ( | const std::string & | name | ) |
Remove a material.
[in] | name | Name of the material |
void ObjectManager::removeMatrixStack | ( | const std::string & | name | ) |
Remove a matrix stack.
[in] | name | Name of the matrix stack |
void ObjectManager::removeModel | ( | const std::string & | name, |
bool | del | ||
) |
Remove a 3D model.
[in] | name | Name of the model |
[in] | del | Set true if the OpenGL object should be deleted |
void ObjectManager::removeProperties | ( | const std::string & | name | ) |
Remove properties.
[in] | name | Name of the properties |
void ObjectManager::removeShader | ( | const std::string & | name, |
bool | del | ||
) |
Remove a shader.
[in] | name | Name of the shader |
[in] | del | Set true if the OpenGL object should be deleted |
void ObjectManager::removeTextSprite | ( | const std::string & | name, |
bool | del | ||
) |
Remove a text sprite.
[in] | name | Name of the text sprite |
[in] | del | Set true if the OpenGL object should be deleted |
void ObjectManager::removeTexture | ( | const std::string & | name, |
bool | del | ||
) |
Remove a texture.
[in] | name | Name of the texture |
[in] | del | Set true if the OpenGL object should be deleted |
void ObjectManager::setAmbientColor | ( | const vmml::Vector3f & | ambientColor | ) |
Set an ambient color for the scene.
[in] | ambientColor | Ambient color for the scene |
void ObjectManager::setShaderVersionDesktop | ( | const std::string & | shaderVersionDesktop | ) |
Set the shader version used on desktop systems.
[in] | shaderVersionDesktop | The 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.
[in] | shaderVersionES | The shader version used on mobile devices systems, e.g. "#version 100" |