AireEngine
A 3D Open-World Game Engine
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Aire::Mesh Class Reference

A class for a 3D indexed triangular mesh. More...

#include <mesh.h>

Inheritance diagram for Aire::Mesh:
Inheritance graph
[legend]
Collaboration diagram for Aire::Mesh:
Collaboration graph
[legend]

Public Member Functions

 Mesh (std::vector< Vertex > vertices, std::vector< unsigned int > indices, MaterialPtr &handle)
 
 Mesh (std::vector< Vertex > vertices, std::vector< unsigned int > indices, MaterialPtr &handle, MeshHandle &meshHandle)
 
void render (ShaderProgram &shader)
 
unsigned intgetVBO ()
 
unsigned intgetEB0 ()
 
std::vector< VertexgetVertice ()
 
std::vector< unsigned intgetIndices ()
 
MaterialPtr getMaterial ()
 
uint32_t getSize ()
 
MeshHandle getMeshHandle ()
 
void translate (glm::mat4 &modelMatrix, glm::vec3 direction)
 
void scale (glm::mat4 &modelMatrix, float val)
 
void rotate (glm::mat4 &modelMatrix, float degree, glm::vec3 direction)
 
- Public Member Functions inherited from Aire::Resource
 Resource ()
 Default constructor.
 
virtual ~Resource ()
 Default destructor.
 
bool isLoadToGpu ()
 
ResourceState getState ()
 
void setState (ResourceState state)
 

Public Attributes

std::vector< Vertexvertices
 Mesh vertices.
 
std::vector< unsigned intindices
 Mesh indices.
 
unsigned int VAO
 

Additional Inherited Members

- Protected Attributes inherited from Aire::Resource
ResourceState resourceState
 

Detailed Description

A class for a 3D indexed triangular mesh.

Constructor & Destructor Documentation

◆ Mesh() [1/2]

Aire::Mesh::Mesh ( std::vector< Vertex > vertices,
std::vector< unsigned int > indices,
MaterialPtr & handle )
inline

Create a new mesh, given its geometric data

Parameters
verticesThe list of mesh vertices
indicesThe list of mesh indices. All faces are triangles, so every three consecutive indices define a face.
handleMaterial to assign to the mesh

◆ Mesh() [2/2]

Aire::Mesh::Mesh ( std::vector< Vertex > vertices,
std::vector< unsigned int > indices,
MaterialPtr & handle,
MeshHandle & meshHandle )
inline

Create a new mesh with a pre-defined handle

Parameters
verticesThe list of mesh vertices
indicesThe list of mesh indices. All faces are triangles, so every three consecutive indices define a face.
handleMaterial to assign to the mesh
meshHandlePre-defined handle for the mesh

Member Function Documentation

◆ getEB0()

unsigned int * Aire::Mesh::getEB0 ( )
Returns
The mesh Element Buffer Object

◆ getIndices()

std::vector< unsigned int > Mesh::getIndices ( )
Returns
The list of indices

◆ getMaterial()

MaterialPtr Aire::Mesh::getMaterial ( )
Returns
The mesh material

◆ getMeshHandle()

MeshHandle Aire::Mesh::getMeshHandle ( )
Returns
A handle to the mesh

◆ getSize()

uint32_t Aire::Mesh::getSize ( )
virtual
Returns
The mesh size in memory (in Bytes)

Implements Aire::Resource.

◆ getVBO()

unsigned int * Aire::Mesh::getVBO ( )
Returns
The mesh Vertex Buffer Object

◆ getVertice()

std::vector< Vertex > Aire::Mesh::getVertice ( )
Returns
The list of vertices

◆ render()

void Aire::Mesh::render ( ShaderProgram & shader)
inline

Render the mesh

Parameters
shaderShader program to use for rendering
Here is the call graph for this function:

◆ rotate()

void Aire::Mesh::rotate ( glm::mat4 & modelMatrix,
float degree,
glm::vec3 direction )

Apply rotation on an existing model matrix

Parameters
modelMatrixThe model matrix
degreeThe degrees of rotation to apply to the model matrix
directionThe rotation direction

◆ scale()

void Aire::Mesh::scale ( glm::mat4 & modelMatrix,
float val )

Apply scale on an existing model matrix

Parameters
modelMatrixThe model matrix
valThe scale to apply to the model matrix

◆ translate()

void Aire::Mesh::translate ( glm::mat4 & modelMatrix,
glm::vec3 direction )

Apply translation on an existing model matrix

Parameters
modelMatrixThe model matrix
directionThe translation to apply to the model matrix

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