A geometry object containing vertices and indices that can be rendered to the screen. More...

#include <Geometry.h>

Inherits IDrawable.

Public Types

typedef std::shared_ptr< VertexVertexDataPtr
 
typedef std::shared_ptr< GLushort > IndexDataPtr
 
typedef std::unordered_map< std::string, PropertiesPtrPropertiesMap
 

Public Member Functions

 Geometry ()
 Constructor. More...
 
virtual ~Geometry ()
 Virtual destructor. More...
 
virtual void initialize (GeometryDataPtr geometryData)
 Initializes the geometry object based on geometry data. More...
 
virtual void draw (GLenum mode=GL_TRIANGLES) override
 Draws the geometry to the screen. More...
 
virtual void drawInstance (const std::string &instanceName, GLenum mode=GL_TRIANGLES) override
 Draws an instance of the geometry to the screen. More...
 
PropertiesPtr addInstance (const std::string &instanceName)
 Creates an instance of this geometry. More...
 
virtual void addInstance (const std::string &instanceName, PropertiesPtr instanceProperties)
 Creates an instance of this geometry. More...
 
virtual PropertiesPtr getInstanceProperties (const std::string &instanceName)
 Get the properties of a geometry instance. More...
 
virtual void removeInstance (const std::string &instanceName)
 Removes an instance. More...
 
virtual void clearInstances ()
 Removes all instances. More...
 
VertexDataPtr getVertexData ()
 Returns a pointer to the vertices of the geometry. More...
 
IndexDataPtr getIndexData ()
 Returns a pointer to the indices of the geometry. More...
 
size_t getNumVertices ()
 Returns the number of vertices in the geometry. More...
 
size_t getNumIndices ()
 Returns the number of indices in the geometry. More...
 
void setVertexData (VertexDataPtr arg)
 Sets the vertices of the geometry. More...
 
void setIndexData (IndexDataPtr arg)
 Sets the indices of the geometry. More...
 
MaterialPtr getMaterial ()
 Returns a pointer to the material of the geometry. More...
 
void setMaterial (MaterialPtr arg)
 Sets the material of the geometry. More...
 
PropertiesPtr getProperties ()
 Returns a pointer to the properties of the geometry. More...
 
void setProperties (PropertiesPtr arg)
 Sets the properties of the geometry. 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 deleteGeometry ()
 Deletes the geometry. More...
 
- Public Member Functions inherited from IDrawable
virtual ~IDrawable ()
 Virtual destructor. More...
 

Protected Member Functions

virtual void initializeVertexBuffer ()
 Initializes a vertex buffer for the geometry data. More...
 
virtual VertexDataPtr allocVertexData (size_t nVertices)
 Allocates the vertex data. More...
 
virtual IndexDataPtr allocIndexData (size_t nIndices)
 Allocates the index data. More...
 
virtual VertexDataPtr copyVertexData (const GeometryData::VboVertices &arg)
 Copies the given vertices into the geometry object. More...
 
virtual IndexDataPtr copyIndexData (const GeometryData::VboIndices &arg)
 Copies the given indices into the geometry object. More...
 
virtual vmml::AABBf createBoundingBoxObjectSpace (const GeometryData::VboVertices &arg)
 Creates an axis-aligned bounding box around the object. More...
 

Detailed Description

A geometry object containing vertices and indices that can be rendered to the screen.

Author
Rahul Mukhi, David Steiner

Member Typedef Documentation

typedef std::shared_ptr< GLushort > Geometry::IndexDataPtr
typedef std::unordered_map< std::string, PropertiesPtr > Geometry::PropertiesMap
typedef std::shared_ptr< Vertex > Geometry::VertexDataPtr

Constructor & Destructor Documentation

Geometry::Geometry ( )
inline

Constructor.

virtual Geometry::~Geometry ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

PropertiesPtr Geometry::addInstance ( const std::string &  instanceName)

Creates an instance of this geometry.

Parameters
[in]instanceNameName of the instance
void Geometry::addInstance ( const std::string &  instanceName,
PropertiesPtr  instanceProperties 
)
virtual

Creates an instance of this geometry.

Parameters
[in]instanceNameName of the instance
[in]instancePropertiesProperties for the instance
Geometry::IndexDataPtr Geometry::allocIndexData ( size_t  nIndices)
protectedvirtual

Allocates the index data.

Geometry::VertexDataPtr Geometry::allocVertexData ( size_t  nVertices)
protectedvirtual

Allocates the vertex data.

void Geometry::clearInstances ( )
virtual

Removes all instances.

Geometry::IndexDataPtr Geometry::copyIndexData ( const GeometryData::VboIndices arg)
protectedvirtual

Copies the given indices into the geometry object.

Parameters
[in]argThe indices that should be used in the geometry
Geometry::VertexDataPtr Geometry::copyVertexData ( const GeometryData::VboVertices arg)
protectedvirtual

Copies the given vertices into the geometry object.

Parameters
[in]argThe vertices that should be used in the geometry
vmml::AABBf Geometry::createBoundingBoxObjectSpace ( const GeometryData::VboVertices arg)
protectedvirtual

Creates an axis-aligned bounding box around the object.

Parameters
[in]argThe vertices that should be used in the geometry
virtual void Geometry::deleteGeometry ( )
inlinevirtual

Deletes the geometry.

void Geometry::draw ( GLenum  mode = GL_TRIANGLES)
overridevirtual

Draws the geometry to the screen.

Parameters
[in]mode

Implements IDrawable.

void Geometry::drawInstance ( const std::string &  instanceName,
GLenum  mode = GL_TRIANGLES 
)
overridevirtual

Draws an instance of the geometry to the screen.

Parameters
[in]instanceName
[in]mode

Implements IDrawable.

vmml::AABBf& Geometry::getBoundingBoxObjectSpace ( )
inline

Returns the bounding box of the geometry in object space.

IndexDataPtr Geometry::getIndexData ( )
inline

Returns a pointer to the indices of the geometry.

PropertiesPtr Geometry::getInstanceProperties ( const std::string &  instanceName)
virtual

Get the properties of a geometry instance.

Parameters
[in]instanceNameName of the instance
MaterialPtr Geometry::getMaterial ( )
inline

Returns a pointer to the material of the geometry.

size_t Geometry::getNumIndices ( )
inline

Returns the number of indices in the geometry.

size_t Geometry::getNumVertices ( )
inline

Returns the number of vertices in the geometry.

PropertiesPtr Geometry::getProperties ( )
inline

Returns a pointer to the properties of the geometry.

VertexDataPtr Geometry::getVertexData ( )
inline

Returns a pointer to the vertices of the geometry.

void Geometry::initialize ( GeometryDataPtr  geometryData)
virtual

Initializes the geometry object based on geometry data.

Parameters
[in]geometryData
void Geometry::initializeVertexBuffer ( )
protectedvirtual

Initializes a vertex buffer for the geometry data.

void Geometry::removeInstance ( const std::string &  instanceName)
virtual

Removes an instance.

Parameters
[in]instanceNameName of the instance
void Geometry::setBoundingBoxObjectSpace ( vmml::AABBf  arg)
inline

Sets the bounding box of the geometry in object space.

Parameters
[in]argThe bounding box for the geometry in object space
void Geometry::setIndexData ( IndexDataPtr  arg)
inline

Sets the indices of the geometry.

Parameters
[in]argThe new indices that should be used for the geometry
void Geometry::setMaterial ( MaterialPtr  arg)
inline

Sets the material of the geometry.

Parameters
[in]argThe new material that should be used for the geometry
void Geometry::setProperties ( PropertiesPtr  arg)
inline

Sets the properties of the geometry.

Parameters
[in]argThe properties for the geometry
void Geometry::setVertexData ( VertexDataPtr  arg)
inline

Sets the vertices of the geometry.

Parameters
[in]argThe new vertices that should be used for the geometry