Clutter Engine 0.0.1
Loading...
Searching...
No Matches
clt::Mesh Class Reference

Class representing a 3D mesh with associated textures and shaders. More...

#include <Mesh.h>

Public Member Functions

 Mesh ()
 Default constructor.
 
 Mesh (const float *pVertices, u32 pVerticeCount, bool tesselate)
 Constructs a mesh from a raw vertex array.
 
 Mesh (const float *pVertices, u32 pVerticeCount, ShaderProgram *pShader, bool isTesselated)
 Constructs a mesh from a raw vertex array and a shader.
 
 Mesh (std::vector< Vertex > pVertices, ShaderProgram *pShader, bool isTesselated)
 Constructs a mesh from a vector of vertices and a shader.
 
 Mesh (std::vector< Vertex > pVertices, bool tesselate)
 Constructs a mesh from a vector of vertices.
 
 ~Mesh ()=default
 Destructor.
 
void Unload ()
 Unloads the mesh and releases resources.
 
TextureGetTexture (int pTextureIndex)
 Gets a texture by index.
 
bool HasTexture (Texture *pTextureIndex)
 Checks if the mesh has a specific texture.
 
VertexArrayGetVAO ()
 Gets the mesh's Vertex Array Object.
 
ShaderProgramGetShader ()
 Gets the mesh's shader program.
 
void AddTexture (Texture *pTexture)
 Adds a texture to the mesh.
 
void SetTexture (Texture *texture, size_t &index)
 Sets a texture at a specific index.
 
void SetTexture (std::string &texture, size_t &index)
 Sets a texture by name at a specific index.
 
void SetTextureTiling (Vector2 tiling)
 Sets the tiling factor for the mesh's textures.
 
Vector2 GetTextureTiling () const
 Gets the tiling factor for the mesh's textures.
 
bool GetTesselated () const
 Checks if tessellation is enabled for the mesh.
 
void SetMesh (VertexArray *pVAO)
 Sets the mesh's Vertex Array Object.
 
void SetMesh (const float *pVertices, u32 pVerticeCount, const u32 *pIndices, u32 pIndexCount)
 Sets the mesh data from raw vertex and index arrays.
 

Detailed Description

Class representing a 3D mesh with associated textures and shaders.

Constructor & Destructor Documentation

◆ Mesh() [1/4]

Mesh::Mesh ( const float * pVertices,
u32 pVerticeCount,
bool tesselate )

Constructs a mesh from a raw vertex array.

Parameters
pVerticesPointer to the vertex data.
pVerticeCountNumber of vertices.
tesselateWhether tessellation is enabled.

◆ Mesh() [2/4]

Mesh::Mesh ( const float * pVertices,
u32 pVerticeCount,
ShaderProgram * pShader,
bool isTesselated )

Constructs a mesh from a raw vertex array and a shader.

Parameters
pVerticesPointer to the vertex data.
pVerticeCountNumber of vertices.
pShaderPointer to the shader program.
isTesselatedWhether tessellation is enabled.

◆ Mesh() [3/4]

Mesh::Mesh ( std::vector< Vertex > pVertices,
ShaderProgram * pShader,
bool isTesselated )

Constructs a mesh from a vector of vertices and a shader.

Parameters
pVerticesVector of vertices.
pShaderPointer to the shader program.
isTesselatedWhether tessellation is enabled.

◆ Mesh() [4/4]

Mesh::Mesh ( std::vector< Vertex > pVertices,
bool tesselate )

Constructs a mesh from a vector of vertices.

Parameters
pVerticesVector of vertices.
tesselateWhether tessellation is enabled.

Member Function Documentation

◆ AddTexture()

void Mesh::AddTexture ( Texture * pTexture)

Adds a texture to the mesh.

Parameters
pTexturePointer to the texture to add.

◆ GetShader()

ShaderProgram & clt::Mesh::GetShader ( )
inline

Gets the mesh's shader program.

Returns
Reference to the ShaderProgram.

◆ GetTesselated()

bool clt::Mesh::GetTesselated ( ) const
inline

Checks if tessellation is enabled for the mesh.

Returns
True if tessellation is enabled, false otherwise.

◆ GetTexture()

Texture * Mesh::GetTexture ( int pTextureIndex)

Gets a texture by index.

Parameters
pTextureIndexIndex of the texture.
Returns
Pointer to the texture.

◆ GetTextureTiling()

Vector2 clt::Mesh::GetTextureTiling ( ) const
inline

Gets the tiling factor for the mesh's textures.

Returns
The tiling factor.

◆ GetVAO()

VertexArray & clt::Mesh::GetVAO ( )
inline

Gets the mesh's Vertex Array Object.

Returns
Reference to the VertexArray.

◆ HasTexture()

bool clt::Mesh::HasTexture ( Texture * pTextureIndex)
inline

Checks if the mesh has a specific texture.

Parameters
pTextureIndexPointer to the texture to check.
Returns
True if the texture exists, false otherwise.

◆ SetMesh() [1/2]

void Mesh::SetMesh ( const float * pVertices,
u32 pVerticeCount,
const u32 * pIndices,
u32 pIndexCount )

Sets the mesh data from raw vertex and index arrays.

Parameters
pVerticesPointer to the vertex data.
pVerticeCountNumber of vertices.
pIndicesPointer to the index data.
pIndexCountNumber of indices.

◆ SetMesh() [2/2]

void Mesh::SetMesh ( VertexArray * pVAO)

Sets the mesh's Vertex Array Object.

Parameters
pVAOPointer to the VertexArray.

◆ SetTexture() [1/2]

void Mesh::SetTexture ( std::string & texture,
size_t & index )

Sets a texture by name at a specific index.

Parameters
textureName of the texture.
indexIndex to set the texture at.

◆ SetTexture() [2/2]

void Mesh::SetTexture ( Texture * texture,
size_t & index )

Sets a texture at a specific index.

Parameters
texturePointer to the texture.
indexIndex to set the texture at.

◆ SetTextureTiling()

void clt::Mesh::SetTextureTiling ( Vector2 tiling)
inline

Sets the tiling factor for the mesh's textures.

Parameters
tilingThe tiling factor.

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