raylib-cpp
C++ object-oriented wrapper library for raylib.
Public Member Functions | Static Public Member Functions | List of all members
raylib::Mesh Class Reference

Vertex data definning a mesh. More...

Public Member Functions

 Mesh (const ::Mesh &mesh)
 
 Mesh (const Mesh &)=delete
 Load meshes from model file.
 
 Mesh (int vertexCount, int triangleCount)
 
 Mesh (Mesh &&other)
 
raylib::BoundingBox BoundingBox () const
 Compute mesh bounding box limits.
 
void Draw (const ::Material &material, ::Matrix *transforms, int instances)
 Draw multiple mesh instances with material and different transforms.
 
void Draw (const ::Material &material, const ::Matrix &transform)
 Draw a 3d mesh with material and transform.
 
bool Export (const std::string &fileName)
 Export mesh data to file.
 
MeshGenBinormals ()
 Compute mesh binormals (aka bitangent)
 
MeshGenTangents ()
 Compute mesh tangents.
 
float * GetAnimNormals () const
 Retrieves the animNormals value for the object. More...
 
float * GetAnimVertices () const
 Retrieves the animVertices value for the object. More...
 
unsigned char * GetBoneIds () const
 Retrieves the boneIds value for the object. More...
 
float * GetBoneWeights () const
 Retrieves the boneWeights value for the object. More...
 
unsigned char * GetColors () const
 Retrieves the colors value for the object. More...
 
unsigned short * GetIndices () const
 Retrieves the indices value for the object. More...
 
float * GetNormals () const
 Retrieves the normals value for the object. More...
 
float * GetTangents () const
 Retrieves the tangents value for the object. More...
 
float * GetTexCoords () const
 Retrieves the texcoords value for the object. More...
 
float * GetTexCoords2 () const
 Retrieves the texcoords2 value for the object. More...
 
int GetTriangleCount () const
 Retrieves the triangleCount value for the object. More...
 
unsigned int GetVaoId () const
 Retrieves the vaoId value for the object. More...
 
unsigned int * GetVboId () const
 Retrieves the vboId value for the object. More...
 
int GetVertexCount () const
 Retrieves the vertexCount value for the object. More...
 
float * GetVertices () const
 Retrieves the vertices value for the object. More...
 
raylib::Model LoadModelFrom () const
 Load model from generated mesh.
 
 operator raylib::BoundingBox ()
 Compute mesh bounding box limits.
 
 operator raylib::Model ()
 Load model from generated mesh.
 
Meshoperator= (const ::Mesh &mesh)
 
Meshoperator= (const Mesh &)=delete
 
Meshoperator= (Mesh &&other)
 
void SetAnimNormals (float *value)
 Sets the animNormals value for the object. More...
 
void SetAnimVertices (float *value)
 Sets the animVertices value for the object. More...
 
void SetBoneIds (unsigned char *value)
 Sets the boneIds value for the object. More...
 
void SetBoneWeights (float *value)
 Sets the boneWeights value for the object. More...
 
void SetColors (unsigned char *value)
 Sets the colors value for the object. More...
 
void SetIndices (unsigned short *value)
 Sets the indices value for the object. More...
 
void SetNormals (float *value)
 Sets the normals value for the object. More...
 
void SetTangents (float *value)
 Sets the tangents value for the object. More...
 
void SetTexCoords (float *value)
 Sets the texcoords value for the object. More...
 
void SetTexCoords2 (float *value)
 Sets the texcoords2 value for the object. More...
 
void SetTriangleCount (int value)
 Sets the triangleCount value for the object. More...
 
void SetVaoId (unsigned int value)
 Sets the vaoId value for the object. More...
 
void SetVboId (unsigned int *value)
 Sets the vboId value for the object. More...
 
void SetVertexCount (int value)
 Sets the vertexCount value for the object. More...
 
void SetVertices (float *value)
 Sets the vertices value for the object. More...
 
void Unload ()
 Unload mesh from memory (RAM and/or VRAM)
 
void UpdateBuffer (int index, void *data, int dataSize, int offset=0)
 Upload mesh vertex data to GPU (VRAM)
 
void Upload (bool dynamic=false)
 Upload mesh vertex data to GPU (VRAM)
 

Static Public Member Functions

::Mesh Cube (float width, float height, float length)
 Generate cuboid mesh.
 
::Mesh Cubicmap (const ::Image &cubicmap, ::Vector3 cubeSize)
 Generate cubes-based map mesh from image data.
 
::Mesh Cylinder (float radius, float height, int slices)
 Generate cylinder mesh.
 
::Mesh Heightmap (const ::Image &heightmap, ::Vector3 size)
 Generate heightmap mesh from image data.
 
::Mesh HemiSphere (float radius, int rings, int slices)
 Generate half-sphere mesh (no bottom cap)
 
::Mesh Knot (float radius, float size, int radSeg, int sides)
 Generate trefoil knot mesh.
 
::Mesh Plane (float width, float length, int resX, int resZ)
 Generate plane mesh (with subdivisions)
 
::Mesh Poly (int sides, float radius)
 Generate polygonal mesh.
 
::Mesh Sphere (float radius, int rings, int slices)
 Generate sphere mesh (standard sphere)
 
::Mesh Torus (float radius, float size, int radSeg, int sides)
 Generate torus mesh.
 

Detailed Description

Vertex data definning a mesh.

Definition at line 16 of file Mesh.hpp.

Member Function Documentation

◆ GetAnimNormals()

float* raylib::Mesh::GetAnimNormals ( ) const
inline

Retrieves the animNormals value for the object.

Returns
The animNormals value of the object.

Definition at line 151 of file Mesh.hpp.

◆ GetAnimVertices()

float* raylib::Mesh::GetAnimVertices ( ) const
inline

Retrieves the animVertices value for the object.

Returns
The animVertices value of the object.

Definition at line 150 of file Mesh.hpp.

◆ GetBoneIds()

unsigned char* raylib::Mesh::GetBoneIds ( ) const
inline

Retrieves the boneIds value for the object.

Returns
The boneIds value of the object.

Definition at line 152 of file Mesh.hpp.

◆ GetBoneWeights()

float* raylib::Mesh::GetBoneWeights ( ) const
inline

Retrieves the boneWeights value for the object.

Returns
The boneWeights value of the object.

Definition at line 153 of file Mesh.hpp.

◆ GetColors()

unsigned char* raylib::Mesh::GetColors ( ) const
inline

Retrieves the colors value for the object.

Returns
The colors value of the object.

Definition at line 148 of file Mesh.hpp.

◆ GetIndices()

unsigned short* raylib::Mesh::GetIndices ( ) const
inline

Retrieves the indices value for the object.

Returns
The indices value of the object.

Definition at line 149 of file Mesh.hpp.

◆ GetNormals()

float* raylib::Mesh::GetNormals ( ) const
inline

Retrieves the normals value for the object.

Returns
The normals value of the object.

Definition at line 146 of file Mesh.hpp.

◆ GetTangents()

float* raylib::Mesh::GetTangents ( ) const
inline

Retrieves the tangents value for the object.

Returns
The tangents value of the object.

Definition at line 147 of file Mesh.hpp.

◆ GetTexCoords()

float* raylib::Mesh::GetTexCoords ( ) const
inline

Retrieves the texcoords value for the object.

Returns
The texcoords value of the object.

Definition at line 144 of file Mesh.hpp.

◆ GetTexCoords2()

float* raylib::Mesh::GetTexCoords2 ( ) const
inline

Retrieves the texcoords2 value for the object.

Returns
The texcoords2 value of the object.

Definition at line 145 of file Mesh.hpp.

◆ GetTriangleCount()

int raylib::Mesh::GetTriangleCount ( ) const
inline

Retrieves the triangleCount value for the object.

Returns
The triangleCount value of the object.

Definition at line 142 of file Mesh.hpp.

◆ GetVaoId()

unsigned int raylib::Mesh::GetVaoId ( ) const
inline

Retrieves the vaoId value for the object.

Returns
The vaoId value of the object.

Definition at line 154 of file Mesh.hpp.

◆ GetVboId()

unsigned int* raylib::Mesh::GetVboId ( ) const
inline

Retrieves the vboId value for the object.

Returns
The vboId value of the object.

Definition at line 155 of file Mesh.hpp.

◆ GetVertexCount()

int raylib::Mesh::GetVertexCount ( ) const
inline

Retrieves the vertexCount value for the object.

Returns
The vertexCount value of the object.

Definition at line 141 of file Mesh.hpp.

◆ GetVertices()

float* raylib::Mesh::GetVertices ( ) const
inline

Retrieves the vertices value for the object.

Returns
The vertices value of the object.

Definition at line 143 of file Mesh.hpp.

◆ SetAnimNormals()

void raylib::Mesh::SetAnimNormals ( float *  value)
inline

Sets the animNormals value for the object.

Parameters
valueThe value of which to set animNormals to.

Definition at line 151 of file Mesh.hpp.

◆ SetAnimVertices()

void raylib::Mesh::SetAnimVertices ( float *  value)
inline

Sets the animVertices value for the object.

Parameters
valueThe value of which to set animVertices to.

Definition at line 150 of file Mesh.hpp.

◆ SetBoneIds()

void raylib::Mesh::SetBoneIds ( unsigned char *  value)
inline

Sets the boneIds value for the object.

Parameters
valueThe value of which to set boneIds to.

Definition at line 152 of file Mesh.hpp.

◆ SetBoneWeights()

void raylib::Mesh::SetBoneWeights ( float *  value)
inline

Sets the boneWeights value for the object.

Parameters
valueThe value of which to set boneWeights to.

Definition at line 153 of file Mesh.hpp.

◆ SetColors()

void raylib::Mesh::SetColors ( unsigned char *  value)
inline

Sets the colors value for the object.

Parameters
valueThe value of which to set colors to.

Definition at line 148 of file Mesh.hpp.

◆ SetIndices()

void raylib::Mesh::SetIndices ( unsigned short *  value)
inline

Sets the indices value for the object.

Parameters
valueThe value of which to set indices to.

Definition at line 149 of file Mesh.hpp.

◆ SetNormals()

void raylib::Mesh::SetNormals ( float *  value)
inline

Sets the normals value for the object.

Parameters
valueThe value of which to set normals to.

Definition at line 146 of file Mesh.hpp.

◆ SetTangents()

void raylib::Mesh::SetTangents ( float *  value)
inline

Sets the tangents value for the object.

Parameters
valueThe value of which to set tangents to.

Definition at line 147 of file Mesh.hpp.

◆ SetTexCoords()

void raylib::Mesh::SetTexCoords ( float *  value)
inline

Sets the texcoords value for the object.

Parameters
valueThe value of which to set texcoords to.

Definition at line 144 of file Mesh.hpp.

◆ SetTexCoords2()

void raylib::Mesh::SetTexCoords2 ( float *  value)
inline

Sets the texcoords2 value for the object.

Parameters
valueThe value of which to set texcoords2 to.

Definition at line 145 of file Mesh.hpp.

◆ SetTriangleCount()

void raylib::Mesh::SetTriangleCount ( int  value)
inline

Sets the triangleCount value for the object.

Parameters
valueThe value of which to set triangleCount to.

Definition at line 142 of file Mesh.hpp.

◆ SetVaoId()

void raylib::Mesh::SetVaoId ( unsigned int  value)
inline

Sets the vaoId value for the object.

Parameters
valueThe value of which to set vaoId to.

Definition at line 154 of file Mesh.hpp.

◆ SetVboId()

void raylib::Mesh::SetVboId ( unsigned int *  value)
inline

Sets the vboId value for the object.

Parameters
valueThe value of which to set vboId to.

Definition at line 155 of file Mesh.hpp.

◆ SetVertexCount()

void raylib::Mesh::SetVertexCount ( int  value)
inline

Sets the vertexCount value for the object.

Parameters
valueThe value of which to set vertexCount to.

Definition at line 141 of file Mesh.hpp.

◆ SetVertices()

void raylib::Mesh::SetVertices ( float *  value)
inline

Sets the vertices value for the object.

Parameters
valueThe value of which to set vertices to.

Definition at line 143 of file Mesh.hpp.