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

Model type. More...

Public Member Functions

 Model (const ::Mesh &mesh)
 
 Model (const ::Model &model)
 
 Model (const Model &)=delete
 
 Model (const raylib::Mesh &mesh)=delete
 The Model constructor with a Mesh() is removed. More...
 
 Model (const std::string &fileName)
 
 Model (Model &&other)
 
void Draw (::Vector3 position, ::Vector3 rotationAxis, float rotationAngle=0.0f, ::Vector3 scale={1.0f, 1.0f, 1.0f}, ::Color tint={255, 255, 255, 255}) const
 Draw a model with extended parameters.
 
void Draw (::Vector3 position, float scale=1.0f, ::Color tint={255, 255, 255, 255}) const
 Draw a model (with texture if set)
 
void DrawPoints (::Vector3 position, ::Vector3 rotationAxis, float rotationAngle=0.0f, ::Vector3 scale={1.0f, 1.0f, 1.0f}, ::Color tint={255, 255, 255, 255})
 Draw a model as points.
 
void DrawPoints (::Vector3 position, float scale=1.0f, ::Color tint={255, 255, 255, 255})
 Draw a model as points.
 
void DrawWires (::Vector3 position, ::Vector3 rotationAxis, float rotationAngle=0.0f, ::Vector3 scale={1.0f, 1.0f, 1.0f}, ::Color tint={255, 255, 255, 255}) const
 Draw a model wires (with texture if set) with extended parameters.
 
void DrawWires (::Vector3 position, float scale=1.0f, ::Color tint={255, 255, 255, 255}) const
 Draw a model wires (with texture if set)
 
::Transform * GetBindPose () const
 Retrieves the bindPose value for the object. More...
 
int GetBoneCount () const
 Retrieves the boneCount value for the object. More...
 
::BoneInfo * GetBones () const
 Retrieves the bones value for the object. More...
 
BoundingBox GetBoundingBox () const
 Compute model bounding box limits (considers all meshes)
 
int GetMaterialCount () const
 Retrieves the materialCount value for the object. More...
 
::MaterialGetMaterials () const
 Retrieves the materials value for the object. More...
 
int GetMeshCount () const
 Retrieves the meshCount value for the object. More...
 
::MeshGetMeshes () const
 Retrieves the meshes value for the object. More...
 
int * GetMeshMaterial () const
 Retrieves the meshMaterial value for the object. More...
 
::Matrix GetTransform () const
 Retrieves the transform value for the object. More...
 
bool IsModelAnimationValid (const ::ModelAnimation &anim) const
 Check model animation skeleton match.
 
bool IsValid () const
 Determines whether or not the Model has data in it.
 
void Load (const ::Mesh &mesh)
 Loads a Model from the given Mesh. More...
 
void Load (const std::string &fileName)
 Loads a Model from the given file. More...
 
 operator BoundingBox () const
 Compute model bounding box limits (considers all meshes)
 
Modeloperator= (const ::Model &model)
 
Modeloperator= (const Model &)=delete
 
Modeloperator= (Model &&other) noexcept
 
void SetBindPose (::Transform *value)
 Sets the bindPose value for the object. More...
 
void SetBoneCount (int value)
 Sets the boneCount value for the object. More...
 
void SetBones (::BoneInfo *value)
 Sets the bones value for the object. More...
 
void SetMaterialCount (int value)
 Sets the materialCount value for the object. More...
 
void SetMaterials (::Material *value)
 Sets the materials value for the object. More...
 
void SetMeshCount (int value)
 Sets the meshCount value for the object. More...
 
void SetMeshes (::Mesh *value)
 Sets the meshes value for the object. More...
 
void SetMeshMaterial (int *value)
 Sets the meshMaterial value for the object. More...
 
ModelSetMeshMaterial (int meshId, int materialId)
 Set material for a mesh.
 
void SetTransform (::Matrix value)
 Sets the transform value for the object. More...
 
void Unload ()
 Unload model (including meshes) from memory (RAM and/or VRAM)
 
ModelUpdateAnimation (const ::ModelAnimation &anim, int frame)
 Update model animation pose.
 
ModelUpdateAnimationBones (const ::ModelAnimation &anim, int frame)
 Update model animation pose.
 

Protected Member Functions

void set (const ::Model &model)
 

Detailed Description

Model type.

Definition at line 15 of file Model.hpp.

Constructor & Destructor Documentation

◆ Model()

raylib::Model::Model ( const raylib::Mesh mesh)
delete

The Model constructor with a Mesh() is removed.

Use raylib::MeshUnmanaged or ::Mesh instead, as raylib will take ownership of the data.

See also
raylib::MeshUnmanaged

References Unload().

Member Function Documentation

◆ GetBindPose()

::Transform* raylib::Model::GetBindPose ( ) const
inline

Retrieves the bindPose value for the object.

Returns
The bindPose value of the object.

Definition at line 74 of file Model.hpp.

◆ GetBoneCount()

int raylib::Model::GetBoneCount ( ) const
inline

Retrieves the boneCount value for the object.

Returns
The boneCount value of the object.

Definition at line 72 of file Model.hpp.

◆ GetBones()

::BoneInfo* raylib::Model::GetBones ( ) const
inline

Retrieves the bones value for the object.

Returns
The bones value of the object.

Definition at line 73 of file Model.hpp.

◆ GetMaterialCount()

int raylib::Model::GetMaterialCount ( ) const
inline

Retrieves the materialCount value for the object.

Returns
The materialCount value of the object.

Definition at line 68 of file Model.hpp.

◆ GetMaterials()

::Material* raylib::Model::GetMaterials ( ) const
inline

Retrieves the materials value for the object.

Returns
The materials value of the object.

Definition at line 70 of file Model.hpp.

◆ GetMeshCount()

int raylib::Model::GetMeshCount ( ) const
inline

Retrieves the meshCount value for the object.

Returns
The meshCount value of the object.

Definition at line 67 of file Model.hpp.

◆ GetMeshes()

::Mesh* raylib::Model::GetMeshes ( ) const
inline

Retrieves the meshes value for the object.

Returns
The meshes value of the object.

Definition at line 69 of file Model.hpp.

◆ GetMeshMaterial()

int* raylib::Model::GetMeshMaterial ( ) const
inline

Retrieves the meshMaterial value for the object.

Returns
The meshMaterial value of the object.

Definition at line 71 of file Model.hpp.

◆ GetTransform()

::Matrix raylib::Model::GetTransform ( ) const
inline

Retrieves the transform value for the object.

Returns
The transform value of the object.

Definition at line 66 of file Model.hpp.

◆ Load() [1/2]

void raylib::Model::Load ( const ::Mesh mesh)
inline

Loads a Model from the given Mesh.

Exceptions
raylib::RaylibExceptionThrows if failed to load the Modal.

Definition at line 227 of file Model.hpp.

References IsValid().

◆ Load() [2/2]

void raylib::Model::Load ( const std::string &  fileName)
inline

Loads a Model from the given file.

Exceptions
raylib::RaylibExceptionThrows if failed to load the Modal.

Definition at line 215 of file Model.hpp.

References IsValid().

◆ SetBindPose()

void raylib::Model::SetBindPose ( ::Transform *  value)
inline

Sets the bindPose value for the object.

Parameters
valueThe value of which to set bindPose to.

Definition at line 74 of file Model.hpp.

◆ SetBoneCount()

void raylib::Model::SetBoneCount ( int  value)
inline

Sets the boneCount value for the object.

Parameters
valueThe value of which to set boneCount to.

Definition at line 72 of file Model.hpp.

◆ SetBones()

void raylib::Model::SetBones ( ::BoneInfo *  value)
inline

Sets the bones value for the object.

Parameters
valueThe value of which to set bones to.

Definition at line 73 of file Model.hpp.

◆ SetMaterialCount()

void raylib::Model::SetMaterialCount ( int  value)
inline

Sets the materialCount value for the object.

Parameters
valueThe value of which to set materialCount to.

Definition at line 68 of file Model.hpp.

◆ SetMaterials()

void raylib::Model::SetMaterials ( ::Material value)
inline

Sets the materials value for the object.

Parameters
valueThe value of which to set materials to.

Definition at line 70 of file Model.hpp.

◆ SetMeshCount()

void raylib::Model::SetMeshCount ( int  value)
inline

Sets the meshCount value for the object.

Parameters
valueThe value of which to set meshCount to.

Definition at line 67 of file Model.hpp.

◆ SetMeshes()

void raylib::Model::SetMeshes ( ::Mesh value)
inline

Sets the meshes value for the object.

Parameters
valueThe value of which to set meshes to.

Definition at line 69 of file Model.hpp.

◆ SetMeshMaterial()

void raylib::Model::SetMeshMaterial ( int *  value)
inline

Sets the meshMaterial value for the object.

Parameters
valueThe value of which to set meshMaterial to.

Definition at line 71 of file Model.hpp.

◆ SetTransform()

void raylib::Model::SetTransform ( ::Matrix  value)
inline

Sets the transform value for the object.

Parameters
valueThe value of which to set transform to.

Definition at line 66 of file Model.hpp.