Terminus
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
terminus::Geometry Class Reference

The Geometry class wraps the vertices data of one drawable object. More...

#include <geometry.h>

Public Member Functions

 Geometry (const std::vector< unsigned short > &indexBuffer, const std::vector< Vertex > &vertexBuffer)
 General geometry constructor. More...
 
 Geometry (const std::vector< unsigned short > &indexBuffer, const std::vector< Vertex > &vertexBuffer, const QVector3D &minBBox, const QVector3D &maxBBox)
 
virtual ~Geometry ()
 
virtual const QVector3D & bBoxMin () const
 
virtual const QVector3D & bBoxMax () const
 
virtual void setAttributes (Program &program)
 The geometry specific attributes position, texture coordinate and normal vector are set on the used program. More...
 
virtual void draw (QOpenGLFunctions &gl) const
 By invoking the draw function, both index and vertex buffer are going to be bound and the geometry will be drawn. More...
 

Protected Member Functions

virtual void calculateBBox ()
 
virtual void allocate () const
 
virtual void deallocate () const
 

Protected Attributes

bool m_isOnGPU
 
QOpenGLBuffer * m_vbo
 
QOpenGLBuffer * m_ibo
 
unsigned int m_elementCount
 
std::vector< Vertexm_vertexBuffer
 
std::vector< unsigned short > m_indexBuffer
 
QVector3D m_bBoxMin
 
QVector3D m_bBoxMax
 

Detailed Description

The Geometry class wraps the vertices data of one drawable object.

Vertices data is stored as an index and a vertex buffer. In order to get rendered, a game object has to reference one geometry.

Constructor & Destructor Documentation

terminus::Geometry::Geometry ( const std::vector< unsigned short > &  indexBuffer,
const std::vector< Vertex > &  vertexBuffer 
)

General geometry constructor.

Parameters
indexBuffer
vertexBufferSupplied geometry data will be stored in the respective member. If no BBox values are given, the BBox will be calculated automatically.
terminus::Geometry::Geometry ( const std::vector< unsigned short > &  indexBuffer,
const std::vector< Vertex > &  vertexBuffer,
const QVector3D &  minBBox,
const QVector3D &  maxBBox 
)
terminus::Geometry::~Geometry ( )
virtual

Member Function Documentation

void terminus::Geometry::allocate ( ) const
protectedvirtual
const QVector3D & terminus::Geometry::bBoxMax ( ) const
virtual
const QVector3D & terminus::Geometry::bBoxMin ( ) const
virtual
void terminus::Geometry::calculateBBox ( )
protectedvirtual
void terminus::Geometry::deallocate ( ) const
protectedvirtual
void terminus::Geometry::draw ( QOpenGLFunctions &  gl) const
virtual

By invoking the draw function, both index and vertex buffer are going to be bound and the geometry will be drawn.

Parameters
gl
void terminus::Geometry::setAttributes ( Program program)
virtual

The geometry specific attributes position, texture coordinate and normal vector are set on the used program.

Parameters
program

Member Data Documentation

QVector3D terminus::Geometry::m_bBoxMax
protected
QVector3D terminus::Geometry::m_bBoxMin
protected
unsigned int terminus::Geometry::m_elementCount
protected
QOpenGLBuffer* terminus::Geometry::m_ibo
mutableprotected
std::vector<unsigned short> terminus::Geometry::m_indexBuffer
protected
bool terminus::Geometry::m_isOnGPU
mutableprotected
QOpenGLBuffer* terminus::Geometry::m_vbo
mutableprotected
std::vector<Vertex> terminus::Geometry::m_vertexBuffer
protected

The documentation for this class was generated from the following files: