14 #include "vmmlib/aabb.hpp"
47 virtual void draw(GLenum mode = GL_TRIANGLES)
override;
53 virtual void drawInstance(
const std::string &instanceName, GLenum mode = GL_TRIANGLES)
override;
138 glDeleteBuffers(1, &_vertexBuffer);
139 _initialized =
false;
177 bool _initialized =
false;
178 GLuint _indexBuffer = 0, _vertexBuffer = 0;
179 size_t _nIndices = 0, _nVertices = 0;
181 VertexDataPtr _vertexData =
nullptr;
182 IndexDataPtr _indexData =
nullptr;
187 vmml::AABBf _boundingBox;
189 PropertiesMap _instances;
virtual void initializeVertexBuffer()
Initializes a vertex buffer for the geometry data.
Definition: Geometry.cpp:121
std::vector< GLushort > VboIndices
Definition: GeometryData.h:128
IndexDataPtr getIndexData()
Returns a pointer to the indices of the geometry.
Definition: Geometry.h:86
std::shared_ptr< Properties > PropertiesPtr
Definition: Properties.h:179
virtual VertexDataPtr copyVertexData(const GeometryData::VboVertices &arg)
Copies the given vertices into the geometry object.
Definition: Geometry.cpp:103
void setMaterial(MaterialPtr arg)
Sets the material of the geometry.
Definition: Geometry.h:113
void setVertexData(VertexDataPtr arg)
Sets the vertices of the geometry.
Definition: Geometry.h:99
void setProperties(PropertiesPtr arg)
Sets the properties of the geometry.
Definition: Geometry.h:122
Geometry()
Constructor.
Definition: Geometry.h:31
std::vector< Vertex > VboVertices
Definition: GeometryData.h:127
virtual IndexDataPtr copyIndexData(const GeometryData::VboIndices &arg)
Copies the given indices into the geometry object.
Definition: Geometry.cpp:112
void setIndexData(IndexDataPtr arg)
Sets the indices of the geometry.
Definition: Geometry.h:104
PropertiesPtr addInstance(const std::string &instanceName)
Creates an instance of this geometry.
Definition: Geometry.cpp:55
virtual PropertiesPtr getInstanceProperties(const std::string &instanceName)
Get the properties of a geometry instance.
Definition: Geometry.cpp:69
virtual void draw(GLenum mode=GL_TRIANGLES) override
Draws the geometry to the screen.
Definition: Geometry.cpp:18
An interface for drawable objects.
Definition: IDrawable.h:9
virtual void removeInstance(const std::string &instanceName)
Removes an instance.
Definition: Geometry.cpp:75
MaterialPtr getMaterial()
Returns a pointer to the material of the geometry.
Definition: Geometry.h:108
A geometry object containing vertices and indices that can be rendered to the screen.
Definition: Geometry.h:19
virtual ~Geometry()
Virtual destructor.
Definition: Geometry.h:35
std::shared_ptr< GeometryData > GeometryDataPtr
Definition: GeometryData.h:138
virtual VertexDataPtr allocVertexData(size_t nVertices)
Allocates the vertex data.
Definition: Geometry.cpp:87
std::unordered_map< std::string, PropertiesPtr > PropertiesMap
Definition: Geometry.h:25
virtual void initialize(GeometryDataPtr geometryData)
Initializes the geometry object based on geometry data.
Definition: Geometry.cpp:5
virtual void drawInstance(const std::string &instanceName, GLenum mode=GL_TRIANGLES) override
Draws an instance of the geometry to the screen.
Definition: Geometry.cpp:34
virtual IndexDataPtr allocIndexData(size_t nIndices)
Allocates the index data.
Definition: Geometry.cpp:95
VertexDataPtr getVertexData()
Returns a pointer to the vertices of the geometry.
Definition: Geometry.h:82
size_t getNumIndices()
Returns the number of indices in the geometry.
Definition: Geometry.h:94
virtual vmml::AABBf createBoundingBoxObjectSpace(const GeometryData::VboVertices &arg)
Creates an axis-aligned bounding box around the object.
Definition: Geometry.cpp:130
virtual void deleteGeometry()
Deletes the geometry.
Definition: Geometry.h:135
std::shared_ptr< GLushort > IndexDataPtr
Definition: Geometry.h:24
vmml::AABBf & getBoundingBoxObjectSpace()
Returns the bounding box of the geometry in object space.
Definition: Geometry.h:126
void setBoundingBoxObjectSpace(vmml::AABBf arg)
Sets the bounding box of the geometry in object space.
Definition: Geometry.h:131
size_t getNumVertices()
Returns the number of vertices in the geometry.
Definition: Geometry.h:90
virtual void clearInstances()
Removes all instances.
Definition: Geometry.cpp:80
PropertiesPtr getProperties()
Returns a pointer to the properties of the geometry.
Definition: Geometry.h:117
std::shared_ptr< Material > MaterialPtr
Definition: Material.h:135
std::shared_ptr< Geometry > GeometryPtr
Definition: Geometry.h:192
std::shared_ptr< Vertex > VertexDataPtr
Definition: Geometry.h:23