raylib-cpp
C++ object-oriented wrapper library for raylib.
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
raylib::MeshUnmanaged Class Reference

Vertex data defining a mesh, not managed by C++ RAII. More...

#include <MeshUnmanaged.hpp>

Public Member Functions

 MeshUnmanaged ()
 Default texture constructor. More...
 
 MeshUnmanaged (::Mesh &&mesh)
 
 MeshUnmanaged (const ::Mesh &mesh)
 
raylib::BoundingBox BoundingBox () const
 Compute mesh bounding box limits. More...
 
void Draw (const ::Material &material, ::Matrix *transforms, int instances) const
 Draw multiple mesh instances with material and different transforms. More...
 
void Draw (const ::Material &material, const ::Matrix &transform) const
 Draw a 3d mesh with material and transform. More...
 
void Export (std::string_view fileName)
 Export mesh data to file. More...
 
void ExportCode (const std::string &fileName)
 Export mesh as code file (.h) defining multiple arrays of vertex attributes. More...
 
MeshGenTangents ()
 Compute mesh tangents. More...
 
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...
 
raylib::BoundingBox GetTransformedBoundingBox (::Matrix transform) const
 Compute mesh bounding box limits with respect to the given transformation. 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...
 
bool IsValid ()
 Returns whether or not the Mesh is valid. More...
 
raylib::Model LoadModelFrom () const
 Load model from generated mesh. More...
 
 operator raylib::Model ()
 Load model from generated mesh. More...
 
MeshUnmanagedoperator= (const ::Mesh &mesh)
 
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) More...
 
void UpdateBuffer (int index, void *data, int dataSize, int offset=0)
 Upload mesh vertex data to GPU (VRAM) More...
 
void Upload (bool dynamic=false)
 Upload mesh vertex data to GPU (VRAM) More...
 

Static Public Member Functions

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

Protected Member Functions

void set (const ::Mesh &mesh)
 

Detailed Description

Vertex data defining a mesh, not managed by C++ RAII.

Make sure to Unload() this if needed, otherwise use raylib::Mesh.

See also
raylib::Mesh

Definition at line 21 of file MeshUnmanaged.hpp.

Constructor & Destructor Documentation

◆ MeshUnmanaged() [1/3]

raylib::MeshUnmanaged::MeshUnmanaged ( )
inline

Default texture constructor.

Definition at line 26 of file MeshUnmanaged.hpp.

◆ MeshUnmanaged() [2/3]

raylib::MeshUnmanaged::MeshUnmanaged ( const ::Mesh &  mesh)
inline

Definition at line 46 of file MeshUnmanaged.hpp.

◆ MeshUnmanaged() [3/3]

raylib::MeshUnmanaged::MeshUnmanaged ( ::Mesh &&  mesh)
inline

Definition at line 48 of file MeshUnmanaged.hpp.

Member Function Documentation

◆ BoundingBox()

raylib::BoundingBox raylib::MeshUnmanaged::BoundingBox ( ) const
inline

Compute mesh bounding box limits.

Definition at line 314 of file MeshUnmanaged.hpp.

◆ Cone()

static MeshUnmanaged raylib::MeshUnmanaged::Cone ( float  radius,
float  height,
int  slices 
)
inlinestatic

Generate cone/pyramid mesh.

Definition at line 202 of file MeshUnmanaged.hpp.

◆ Cube()

static MeshUnmanaged raylib::MeshUnmanaged::Cube ( float  width,
float  height,
float  length 
)
inlinestatic

Generate cuboid mesh.

Definition at line 174 of file MeshUnmanaged.hpp.

◆ Cubicmap()

static MeshUnmanaged raylib::MeshUnmanaged::Cubicmap ( const ::Image &  cubicmap,
::Vector3  cubeSize 
)
inlinestatic

Generate cubes-based map mesh from image data.

Definition at line 230 of file MeshUnmanaged.hpp.

◆ Cylinder()

static MeshUnmanaged raylib::MeshUnmanaged::Cylinder ( float  radius,
float  height,
int  slices 
)
inlinestatic

Generate cylinder mesh.

Definition at line 195 of file MeshUnmanaged.hpp.

◆ Draw() [1/2]

void raylib::MeshUnmanaged::Draw ( const ::Material &  material,
::Matrix *  transforms,
int  instances 
) const
inline

Draw multiple mesh instances with material and different transforms.

Definition at line 285 of file MeshUnmanaged.hpp.

◆ Draw() [2/2]

void raylib::MeshUnmanaged::Draw ( const ::Material &  material,
const ::Matrix &  transform 
) const
inline

Draw a 3d mesh with material and transform.

Definition at line 280 of file MeshUnmanaged.hpp.

◆ Export()

void raylib::MeshUnmanaged::Export ( std::string_view  fileName)
inline

Export mesh data to file.

Exceptions
raylib::RaylibExceptionThrows if failed to export the Mesh.

Definition at line 294 of file MeshUnmanaged.hpp.

◆ ExportCode()

void raylib::MeshUnmanaged::ExportCode ( const std::string &  fileName)
inline

Export mesh as code file (.h) defining multiple arrays of vertex attributes.

Exceptions
raylib::RaylibExceptionThrows if failed to export the Mesh.

Definition at line 305 of file MeshUnmanaged.hpp.

◆ GenTangents()

Mesh & raylib::MeshUnmanaged::GenTangents ( )
inline

Compute mesh tangents.

Definition at line 347 of file MeshUnmanaged.hpp.

◆ GetAnimNormals()

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

Retrieves the animNormals value for the object.

Returns
The animNormals value of the object.

Definition at line 244 of file MeshUnmanaged.hpp.

◆ GetAnimVertices()

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

Retrieves the animVertices value for the object.

Returns
The animVertices value of the object.

Definition at line 243 of file MeshUnmanaged.hpp.

◆ GetBoneIds()

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

Retrieves the boneIds value for the object.

Returns
The boneIds value of the object.

Definition at line 245 of file MeshUnmanaged.hpp.

◆ GetBoneWeights()

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

Retrieves the boneWeights value for the object.

Returns
The boneWeights value of the object.

Definition at line 246 of file MeshUnmanaged.hpp.

◆ GetColors()

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

Retrieves the colors value for the object.

Returns
The colors value of the object.

Definition at line 241 of file MeshUnmanaged.hpp.

◆ GetIndices()

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

Retrieves the indices value for the object.

Returns
The indices value of the object.

Definition at line 242 of file MeshUnmanaged.hpp.

◆ GetNormals()

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

Retrieves the normals value for the object.

Returns
The normals value of the object.

Definition at line 239 of file MeshUnmanaged.hpp.

◆ GetTangents()

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

Retrieves the tangents value for the object.

Returns
The tangents value of the object.

Definition at line 240 of file MeshUnmanaged.hpp.

◆ GetTexCoords()

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

Retrieves the texcoords value for the object.

Returns
The texcoords value of the object.

Definition at line 237 of file MeshUnmanaged.hpp.

◆ GetTexCoords2()

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

Retrieves the texcoords2 value for the object.

Returns
The texcoords2 value of the object.

Definition at line 238 of file MeshUnmanaged.hpp.

◆ GetTransformedBoundingBox()

raylib::BoundingBox raylib::MeshUnmanaged::GetTransformedBoundingBox ( ::Matrix  transform) const
inline

Compute mesh bounding box limits with respect to the given transformation.

Definition at line 319 of file MeshUnmanaged.hpp.

◆ GetTriangleCount()

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

Retrieves the triangleCount value for the object.

Returns
The triangleCount value of the object.

Definition at line 235 of file MeshUnmanaged.hpp.

◆ GetVaoId()

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

Retrieves the vaoId value for the object.

Returns
The vaoId value of the object.

Definition at line 247 of file MeshUnmanaged.hpp.

◆ GetVboId()

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

Retrieves the vboId value for the object.

Returns
The vboId value of the object.

Definition at line 248 of file MeshUnmanaged.hpp.

◆ GetVertexCount()

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

Retrieves the vertexCount value for the object.

Returns
The vertexCount value of the object.

Definition at line 234 of file MeshUnmanaged.hpp.

◆ GetVertices()

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

Retrieves the vertices value for the object.

Returns
The vertices value of the object.

Definition at line 236 of file MeshUnmanaged.hpp.

◆ Heightmap()

static MeshUnmanaged raylib::MeshUnmanaged::Heightmap ( const ::Image &  heightmap,
::Vector3  size 
)
inlinestatic

Generate heightmap mesh from image data.

Definition at line 223 of file MeshUnmanaged.hpp.

◆ HemiSphere()

static MeshUnmanaged raylib::MeshUnmanaged::HemiSphere ( float  radius,
int  rings,
int  slices 
)
inlinestatic

Generate half-sphere mesh (no bottom cap)

Definition at line 188 of file MeshUnmanaged.hpp.

◆ IsValid()

bool raylib::MeshUnmanaged::IsValid ( )
inline

Returns whether or not the Mesh is valid.

Definition at line 365 of file MeshUnmanaged.hpp.

◆ Knot()

static MeshUnmanaged raylib::MeshUnmanaged::Knot ( float  radius,
float  size,
int  radSeg,
int  sides 
)
inlinestatic

Generate trefoil knot mesh.

Definition at line 216 of file MeshUnmanaged.hpp.

◆ LoadModelFrom()

raylib::Model raylib::MeshUnmanaged::LoadModelFrom ( ) const
inline

Load model from generated mesh.

Definition at line 355 of file MeshUnmanaged.hpp.

◆ operator raylib::Model()

raylib::MeshUnmanaged::operator raylib::Model ( )
inline

Load model from generated mesh.

Definition at line 360 of file MeshUnmanaged.hpp.

◆ operator=()

MeshUnmanaged & raylib::MeshUnmanaged::operator= ( const ::Mesh &  mesh)
inline

Definition at line 250 of file MeshUnmanaged.hpp.

◆ Plane() [1/2]

static MeshUnmanaged raylib::MeshUnmanaged::Plane ( float  width,
float  length,
int  resX,
int  resZ 
)
inlinestatic

Generate plane mesh (with subdivisions)

Definition at line 69 of file MeshUnmanaged.hpp.

◆ Plane() [2/2]

static MeshUnmanaged raylib::MeshUnmanaged::Plane ( float  width,
float  length,
int  resX,
int  resZ,
float  textureScale 
)
inlinestatic

Definition at line 73 of file MeshUnmanaged.hpp.

◆ Poly()

static MeshUnmanaged raylib::MeshUnmanaged::Poly ( int  sides,
float  radius 
)
inlinestatic

Load meshes from model file.

Generate polygonal mesh

Definition at line 62 of file MeshUnmanaged.hpp.

◆ set()

void raylib::MeshUnmanaged::set ( const ::Mesh &  mesh)
inlineprotected

Definition at line 368 of file MeshUnmanaged.hpp.

◆ SetAnimNormals()

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

Sets the animNormals value for the object.

Parameters
valueThe value of which to set animNormals to.

Definition at line 244 of file MeshUnmanaged.hpp.

◆ SetAnimVertices()

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

Sets the animVertices value for the object.

Parameters
valueThe value of which to set animVertices to.

Definition at line 243 of file MeshUnmanaged.hpp.

◆ SetBoneIds()

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

Sets the boneIds value for the object.

Parameters
valueThe value of which to set boneIds to.

Definition at line 245 of file MeshUnmanaged.hpp.

◆ SetBoneWeights()

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

Sets the boneWeights value for the object.

Parameters
valueThe value of which to set boneWeights to.

Definition at line 246 of file MeshUnmanaged.hpp.

◆ SetColors()

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

Sets the colors value for the object.

Parameters
valueThe value of which to set colors to.

Definition at line 241 of file MeshUnmanaged.hpp.

◆ SetIndices()

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

Sets the indices value for the object.

Parameters
valueThe value of which to set indices to.

Definition at line 242 of file MeshUnmanaged.hpp.

◆ SetNormals()

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

Sets the normals value for the object.

Parameters
valueThe value of which to set normals to.

Definition at line 239 of file MeshUnmanaged.hpp.

◆ SetTangents()

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

Sets the tangents value for the object.

Parameters
valueThe value of which to set tangents to.

Definition at line 240 of file MeshUnmanaged.hpp.

◆ SetTexCoords()

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

Sets the texcoords value for the object.

Parameters
valueThe value of which to set texcoords to.

Definition at line 237 of file MeshUnmanaged.hpp.

◆ SetTexCoords2()

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

Sets the texcoords2 value for the object.

Parameters
valueThe value of which to set texcoords2 to.

Definition at line 238 of file MeshUnmanaged.hpp.

◆ SetTriangleCount()

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

Sets the triangleCount value for the object.

Parameters
valueThe value of which to set triangleCount to.

Definition at line 235 of file MeshUnmanaged.hpp.

◆ SetVaoId()

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

Sets the vaoId value for the object.

Parameters
valueThe value of which to set vaoId to.

Definition at line 247 of file MeshUnmanaged.hpp.

◆ SetVboId()

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

Sets the vboId value for the object.

Parameters
valueThe value of which to set vboId to.

Definition at line 248 of file MeshUnmanaged.hpp.

◆ SetVertexCount()

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

Sets the vertexCount value for the object.

Parameters
valueThe value of which to set vertexCount to.

Definition at line 234 of file MeshUnmanaged.hpp.

◆ SetVertices()

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

Sets the vertices value for the object.

Parameters
valueThe value of which to set vertices to.

Definition at line 236 of file MeshUnmanaged.hpp.

◆ Sphere()

static MeshUnmanaged raylib::MeshUnmanaged::Sphere ( float  radius,
int  rings,
int  slices 
)
inlinestatic

Generate sphere mesh (standard sphere)

Definition at line 181 of file MeshUnmanaged.hpp.

◆ Torus()

static MeshUnmanaged raylib::MeshUnmanaged::Torus ( float  radius,
float  size,
int  radSeg,
int  sides 
)
inlinestatic

Generate torus mesh.

Definition at line 209 of file MeshUnmanaged.hpp.

◆ Unload()

void raylib::MeshUnmanaged::Unload ( )
inline

Unload mesh from memory (RAM and/or VRAM)

Definition at line 258 of file MeshUnmanaged.hpp.

◆ UpdateBuffer()

void raylib::MeshUnmanaged::UpdateBuffer ( int  index,
void *  data,
int  dataSize,
int  offset = 0 
)
inline

Upload mesh vertex data to GPU (VRAM)

Definition at line 273 of file MeshUnmanaged.hpp.

◆ Upload()

void raylib::MeshUnmanaged::Upload ( bool  dynamic = false)
inline

Upload mesh vertex data to GPU (VRAM)

Definition at line 268 of file MeshUnmanaged.hpp.