6 #include <unordered_map>
23 typedef std::unordered_map< std::string, GeometryPtr >
GroupMap;
24 typedef std::shared_ptr< std::unordered_map< ShaderPtr, PropertiesPtr > >
InstanceMapPtr;
25 typedef std::unordered_map< std::string, InstanceMapPtr >
InstancesMap;
66 virtual void draw(GLenum mode = GL_TRIANGLES)
override;
72 virtual void draw(
const std::string &geometryName, GLenum mode = GL_TRIANGLES);
78 virtual void drawInstance(
const std::string &instanceName, GLenum mode = GL_TRIANGLES)
override;
86 virtual InstanceMapPtr
addInstance(
const std::string &instanceName);
119 for (
auto i = _groups.begin(); i != _groups.end(); ++i)
121 i->second->setMaterial(_material);
136 for (
auto i = _groups.begin(); i != _groups.end(); ++i)
138 i->second->setProperties(_properties);
170 for (
auto i = _groups.begin(); i != _groups.end(); ++i)
172 i->second->deleteGeometry();
184 vmml::AABBf _boundingBox;
185 InstancesMap _instances;
GroupMap & getGroups()
Returns the groups of geometry of the model.
Definition: Model.h:144
virtual void draw(GLenum mode=GL_TRIANGLES) override
Draws the model to the screen.
Definition: Model.cpp:65
PropertiesPtr getProperties()
Returns the properties of the model.
Definition: Model.h:127
A 3d model that can be rendered to the screen.
Definition: Model.h:19
void setMaterial(MaterialPtr arg)
Sets the material of the model.
Definition: Model.h:115
virtual void removeGeometry(const std::string &name)
Removes geometry from the model.
Definition: Model.h:164
std::shared_ptr< Shader > ShaderPtr
Definition: Shader.h:211
std::shared_ptr< Properties > PropertiesPtr
Definition: Properties.h:179
virtual void clearInstances()
Removes all instances of the model and associated geometry.
Definition: Model.cpp:133
vmml::AABBf & getBoundingBoxObjectSpace()
Returns the bounding box of the geometry in object space.
Definition: Model.h:148
virtual ~Model()
Virtual destructor.
Definition: Model.h:61
virtual PropertiesPtr getInstanceProperties(const std::string &instanceName, const std::string &geometryName)
Get the properties of a geometry instance.
Definition: Model.cpp:110
std::unordered_map< std::string, GeometryPtr > GroupMap
Definition: Model.h:23
virtual void deleteModelGeometry()
Deletes all geometry of the model.
Definition: Model.h:168
An interface for drawable objects.
Definition: IDrawable.h:9
void setBoundingBoxObjectSpace(vmml::AABBf arg)
Sets the bounding box of the geometry in object space.
Definition: Model.h:153
virtual void removeInstance(const std::string &instanceName)
Removes an instance of the model and associated geometry.
Definition: Model.cpp:122
virtual void addGeometry(const std::string &name, GeometryPtr geometry)
Adds geometry to the model.
Definition: Model.cpp:144
virtual void drawInstance(const std::string &instanceName, GLenum mode=GL_TRIANGLES) override
Draws an instance of the model to the screen.
Definition: Model.cpp:78
Model()
Constructor.
Definition: Model.h:31
virtual InstanceMapPtr addInstance(const std::string &instanceName)
Creates an instance of this model and associated geometry.
Definition: Model.cpp:86
void setProperties(PropertiesPtr arg)
Sets the properties of the model.
Definition: Model.h:132
std::shared_ptr< std::unordered_map< ShaderPtr, PropertiesPtr > > InstanceMapPtr
Definition: Model.h:24
This class manages all objects in a project and makes sure no object is created twice.
Definition: ObjectManager.h:32
std::unordered_map< std::string, InstanceMapPtr > InstancesMap
Definition: Model.h:25
Definition: ModelData.h:11
MaterialPtr getMaterial()
Returns the material of the model.
Definition: Model.h:110
std::shared_ptr< Model > ModelPtr
Definition: Model.h:188
std::shared_ptr< Material > MaterialPtr
Definition: Material.h:135
std::shared_ptr< Geometry > GeometryPtr
Definition: Geometry.h:192