GUInity
Public Member Functions | Public Attributes | Friends | List of all members
Mesh Class Reference

#include <Mesh.hpp>

Inheritance diagram for Mesh:
Asset SkinnedMesh

Public Member Functions

 Mesh ()
 
 Mesh (float *indices, float *normalPoints, float *uv, unsigned int *triangles, int nPoints, int nTriangles)
 
 Mesh (vector< MeshVertex > vertex, vector< unsigned short > triangles)
 
 Mesh (vector< glm::vec3 > vertices, vector< int > usedIndex, vector< int > usedTris)
 
virtual ~Mesh ()
 
void setScaleFactor (float f)
 
float getScaleFactor ()
 
glm::vec3 getBoundsMin ()
 
glm::vec3 getBoundsMax ()
 
glm::vec3 getAverageCenter ()
 
float getVertexArrayID ()
 
float getVertexBuffer ()
 
float getTrianglesBuffer ()
 
int getTrianglesCount ()
 
int getVerticesCount ()
 
void addVertex (glm::vec3 position, glm::vec2 uv, glm::vec3 normal)
 
void addTriangle (int vertexIndex)
 
void setVertices (vector< MeshVertex > meshVertices)
 
void setTriangles (vector< unsigned short > triangles)
 
void createBuffers ()
 
void calculateBounds ()
 
vector< glm::vec3 > getNonDuplicateMeshVertex ()
 
- Public Member Functions inherited from Asset
 Asset ()
 
virtual ~Asset ()
 
void setAssetID (unsigned int newAssetID)
 
unsigned int getAssetID () const
 
string getPath ()
 
void setPath (string newPath)
 
void setName (string name)
 
string getName ()
 
void setCRC (int crc)
 
int setCRC ()
 

Public Attributes

vector< MeshVertexmeshVertices
 
vector< unsigned short > triangles
 
GLuint vao
 
GLuint ibo
 
GLuint mvbo
 
float scaleFactor
 
glm::vec3 boundsMin
 
glm::vec3 boundsMax
 
glm::vec3 avgCenter
 

Friends

class boost::serialization::access
 

Detailed Description

Mesh is an Asset that represents a 3D Model. The vertexes are indexed, meaning that they're stored once only and can be referenced in several faces (triangles).

Currently supported features: -Vertex Position -Vertex UV -Vertex Normal

Animations are NOT currently supported.

Constructor & Destructor Documentation

Mesh::Mesh ( )

Default Constructor

Mesh::Mesh ( float *  indices,
float *  normalPoints,
float *  uv,
unsigned int *  triangles,
int  nPoints,
int  nTriangles 
)

Constructor from array of indices, normal points, uvs and triangles

Mesh::Mesh ( vector< MeshVertex vertex,
vector< unsigned short >  triangles 
)

Constructor from vector of MeshVertex and triangles

Mesh::Mesh ( vector< glm::vec3 >  vertices,
vector< int >  usedIndex,
vector< int >  usedTris 
)

Constructor from vector of MeshVertex, subset of used Indexes and triangles

Mesh::~Mesh ( )
virtual

Default Destructor

Member Function Documentation

void Mesh::addTriangle ( int  vertexIndex)

Adds a new index to the triangles list

void Mesh::addVertex ( glm::vec3  position,
glm::vec2  uv,
glm::vec3  normal 
)

Adds a new vertex to the mesh

void Mesh::calculateBounds ( )

Calculate mesh bounds

void Mesh::createBuffers ( )

Create OpenGL buffers

glm::vec3 Mesh::getAverageCenter ( )

avgCenter Getter

glm::vec3 Mesh::getBoundsMax ( )

boundsMax Getter

glm::vec3 Mesh::getBoundsMin ( )

boundsMin Getter

vector< glm::vec3 > Mesh::getNonDuplicateMeshVertex ( )

Returns non duplicate mesh vertices based on position only. It does not take into consideration other parameters such as UV or normal. This function was used by the ConvexHull in Math.hpp

float Mesh::getScaleFactor ( )

scaleFactor getter

float Mesh::getTrianglesBuffer ( )

ibo getter

int Mesh::getTrianglesCount ( )

Count of triangles list

Count of triangles list getter

float Mesh::getVertexArrayID ( )

vao getter

float Mesh::getVertexBuffer ( )

mvbo getter

int Mesh::getVerticesCount ( )

Count of Mesh Vertices

void Mesh::setScaleFactor ( float  f)

scaleFactor Setter

Member Data Documentation

glm::vec3 Mesh::avgCenter

Average center of the mesh

glm::vec3 Mesh::boundsMax

Max bounds of the mesh

glm::vec3 Mesh::boundsMin

Min bounds of the mesh

GLuint Mesh::ibo

Triangles array

vector<MeshVertex> Mesh::meshVertices

The vertices data

GLuint Mesh::mvbo

Vertex data array

float Mesh::scaleFactor

Scale factor of the mesh

vector<unsigned short> Mesh::triangles

The mesh triangles

GLuint Mesh::vao

Vertex array


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