Basic Renderer
|
A 3d model that can be rendered to the screen. More...
#include <Model.h>
Inherits IDrawable.
Inherited by Sprite.
Public Types | |
typedef std::unordered_map< std::string, GeometryPtr > | GroupMap |
typedef std::shared_ptr< std::unordered_map< ShaderPtr, PropertiesPtr > > | InstanceMapPtr |
typedef std::unordered_map< std::string, InstanceMapPtr > | InstancesMap |
Public Member Functions | |
Model () | |
Constructor. More... | |
Model (ObjectManager *o, const ModelData &modelData, GLuint shaderMaxLights, bool variableNumberOfLights, bool shaderFromFile, bool ambientLighting, PropertiesPtr properties=nullptr) | |
Constructor. More... | |
Model (ObjectManager *o, const ModelData &modelData, ShaderPtr shader, PropertiesPtr properties=nullptr) | |
Constructor. More... | |
Model (const ModelData &modelData, MaterialPtr material, PropertiesPtr properties=nullptr) | |
Constructor. More... | |
virtual | ~Model () |
Virtual destructor. More... | |
virtual void | draw (GLenum mode=GL_TRIANGLES) override |
Draws the model to the screen. More... | |
virtual void | draw (const std::string &geometryName, GLenum mode=GL_TRIANGLES) |
Draws the specified group of geometry to the screen. More... | |
virtual void | drawInstance (const std::string &instanceName, GLenum mode=GL_TRIANGLES) override |
Draws an instance of the model to the screen. More... | |
virtual InstanceMapPtr | addInstance (const std::string &instanceName) |
Creates an instance of this model and associated geometry. More... | |
virtual PropertiesPtr | getInstanceProperties (const std::string &instanceName, const std::string &geometryName) |
Get the properties of a geometry instance. More... | |
virtual InstanceMapPtr | getInstanceProperties (const std::string &instanceName) |
Get the instance properties for every shader used in the model. More... | |
virtual void | removeInstance (const std::string &instanceName) |
Removes an instance of the model and associated geometry. More... | |
virtual void | clearInstances () |
Removes all instances of the model and associated geometry. More... | |
MaterialPtr | getMaterial () |
Returns the material of the model. More... | |
void | setMaterial (MaterialPtr arg) |
Sets the material of the model. More... | |
PropertiesPtr | getProperties () |
Returns the properties of the model. More... | |
void | setProperties (PropertiesPtr arg) |
Sets the properties of the model. More... | |
GroupMap & | getGroups () |
Returns the groups of geometry of the model. More... | |
vmml::AABBf & | getBoundingBoxObjectSpace () |
Returns the bounding box of the geometry in object space. More... | |
void | setBoundingBoxObjectSpace (vmml::AABBf arg) |
Sets the bounding box of the geometry in object space. More... | |
virtual void | addGeometry (const std::string &name, GeometryPtr geometry) |
Adds geometry to the model. More... | |
virtual void | removeGeometry (const std::string &name) |
Removes geometry from the model. More... | |
virtual void | deleteModelGeometry () |
Deletes all geometry of the model. More... | |
Public Member Functions inherited from IDrawable | |
virtual | ~IDrawable () |
Virtual destructor. More... | |
A 3d model that can be rendered to the screen.
typedef std::unordered_map< std::string, GeometryPtr > Model::GroupMap |
typedef std::shared_ptr< std::unordered_map< ShaderPtr, PropertiesPtr > > Model::InstanceMapPtr |
typedef std::unordered_map< std::string, InstanceMapPtr > Model::InstancesMap |
|
inline |
Constructor.
Model::Model | ( | ObjectManager * | o, |
const ModelData & | modelData, | ||
GLuint | shaderMaxLights, | ||
bool | variableNumberOfLights, | ||
bool | shaderFromFile, | ||
bool | ambientLighting, | ||
PropertiesPtr | properties = nullptr |
||
) |
Constructor.
[in] | o | Object management |
[in] | modelData | |
[in] | shaderMaxLights | The maximum light sources to be used |
[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] | shaderFromFile | Set true if for every material a shader file with the same name should be loaded |
[in] | ambientLighting | Set true if the shader supports ambient lighting |
[in] | properties | Properties that will be passed to the shader of the model (optional) |
Model::Model | ( | ObjectManager * | o, |
const ModelData & | modelData, | ||
ShaderPtr | shader, | ||
PropertiesPtr | properties = nullptr |
||
) |
Constructor.
[in] | o | Object management |
[in] | modelData | |
[in] | shader | |
[in] | properties | Properties that will be passed to the shader of the model (optional) |
Model::Model | ( | const ModelData & | modelData, |
MaterialPtr | material, | ||
PropertiesPtr | properties = nullptr |
||
) |
Constructor.
[in] | modelData | |
[in] | material | |
[in] | properties | Properties that will be passed to the shader of the model (optional) |
|
inlinevirtual |
Virtual destructor.
|
virtual |
Adds geometry to the model.
[in] | name | Name of the geometry |
[in] | geometry | A pointer to the geometry |
|
virtual |
Creates an instance of this model and associated geometry.
All geometry that belong to this model get additional properties
[in] | instanceName | Name of the instance |
|
virtual |
Removes all instances of the model and associated geometry.
|
inlinevirtual |
Deletes all geometry of the model.
|
overridevirtual |
|
virtual |
Draws the specified group of geometry to the screen.
[in] | geometryName | Name of the group to draw |
[in] | mode |
|
overridevirtual |
Draws an instance of the model to the screen.
[in] | instanceName | |
[in] | mode |
Implements IDrawable.
|
inline |
Returns the bounding box of the geometry in object space.
|
inline |
Returns the groups of geometry of the model.
|
virtual |
Get the properties of a geometry instance.
[in] | instanceName | Name of the instance |
[in] | geometryName | Name of the geometry |
|
virtual |
Get the instance properties for every shader used in the model.
[in] | instanceName | Name of the instance |
|
inline |
Returns the material of the model.
|
inline |
Returns the properties of the model.
|
inlinevirtual |
Removes geometry from the model.
[in] | name | Name of the geometry |
|
virtual |
Removes an instance of the model and associated geometry.
[in] | instanceName | Name of the instance |
|
inline |
Sets the bounding box of the geometry in object space.
[in] | arg | The bounding box for the geometry in object space |
|
inline |
Sets the material of the model.
[in] | arg | The material for the model |
|
inline |
Sets the properties of the model.
[in] | arg | The properties for the model |