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

Model type. More...

#include <Model.hpp>

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.
 
 Model (const std::string &fileName)
 
 Model (Model &&other) noexcept
 
ModelBlendAnimation (const ::ModelAnimation &animA, float frameA, const ::ModelAnimation &animB, float frameB, float blend)
 Blend two model animation poses.
 
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 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 skeleton.bindPose value for the object.
 
int GetBoneCount () const
 Retrieves the skeleton.boneCount value for the object.
 
::Matrix * GetBoneMatrices () const
 Retrieves the boneMatrices value for the object.
 
::BoneInfo * GetBones () const
 Retrieves the skeleton.bones value for the object.
 
BoundingBox GetBoundingBox () const
 Compute model bounding box limits (considers all meshes)
 
::ModelAnimPose GetCurrentPose () const
 Retrieves the currentPose value for the object.
 
int GetMaterialCount () const
 Retrieves the materialCount value for the object.
 
::Material * GetMaterials () const
 Retrieves the materials value for the object.
 
int GetMeshCount () const
 Retrieves the meshCount value for the object.
 
::Mesh * GetMeshes () const
 Retrieves the meshes value for the object.
 
int * GetMeshMaterial () const
 Retrieves the meshMaterial value for the object.
 
::Matrix GetTransform () const
 Retrieves the transform value for the object.
 
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.
 
void Load (const std::string &fileName)
 Loads a Model from the given file.
 
 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 skeleton.bindPose value for the object.
 
void SetBoneCount (int value)
 Sets the skeleton.boneCount value for the object.
 
void SetBoneMatrices (::Matrix *value)
 Sets the boneMatrices value for the object.
 
void SetBones (::BoneInfo *value)
 Sets the skeleton.bones value for the object.
 
void SetCurrentPose (::ModelAnimPose value)
 Sets the currentPose value for the object.
 
void SetMaterialCount (int value)
 Sets the materialCount value for the object.
 
void SetMaterials (::Material *value)
 Sets the materials value for the object.
 
void SetMeshCount (int value)
 Sets the meshCount value for the object.
 
void SetMeshes (::Mesh *value)
 Sets the meshes value for the object.
 
void SetMeshMaterial (int *value)
 Sets the meshMaterial value for the object.
 
ModelSetMeshMaterial (int meshId, int materialId)
 Set material for a mesh.
 
void SetTransform (::Matrix value)
 Sets the transform value for the object.
 
void Unload ()
 Unload model (including meshes) from memory (RAM and/or VRAM)
 
ModelUpdateAnimation (const ::ModelAnimation &anim, float 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() [1/6]

raylib::Model::Model ( )
inline

Definition at line 17 of file Model.hpp.

◆ Model() [2/6]

raylib::Model::Model ( const ::Model &  model)
inline

Definition at line 24 of file Model.hpp.

◆ Model() [3/6]

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

Definition at line 31 of file Model.hpp.

◆ Model() [4/6]

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

Definition at line 38 of file Model.hpp.

◆ Model() [5/6]

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().

◆ ~Model()

raylib::Model::~Model ( )
inline

Definition at line 49 of file Model.hpp.

◆ Model() [6/6]

raylib::Model::Model ( Model &&  other)
inlinenoexcept

Definition at line 53 of file Model.hpp.

Member Function Documentation

◆ BlendAnimation()

Model & raylib::Model::BlendAnimation ( const ::ModelAnimation &  animA,
float  frameA,
const ::ModelAnimation &  animB,
float  frameB,
float  blend 
)
inline

Blend two model animation poses.

Definition at line 140 of file Model.hpp.

◆ Draw() [1/2]

void raylib::Model::Draw ( ::Vector3  position,
::Vector3  rotationAxis,
float  rotationAngle = 0.0f,
::Vector3  scale = {1.0f, 1.0f, 1.0f},
::Color  tint = {255, 255, 255, 255} 
) const
inline

Draw a model with extended parameters.

Definition at line 160 of file Model.hpp.

◆ Draw() [2/2]

void raylib::Model::Draw ( ::Vector3  position,
float  scale = 1.0f,
::Color  tint = {255, 255, 255, 255} 
) const
inline

Draw a model (with texture if set)

Definition at line 153 of file Model.hpp.

◆ DrawWires() [1/2]

void raylib::Model::DrawWires ( ::Vector3  position,
::Vector3  rotationAxis,
float  rotationAngle = 0.0f,
::Vector3  scale = {1.0f, 1.0f, 1.0f},
::Color  tint = {255, 255, 255, 255} 
) const
inline

Draw a model wires (with texture if set) with extended parameters.

Definition at line 179 of file Model.hpp.

◆ DrawWires() [2/2]

void raylib::Model::DrawWires ( ::Vector3  position,
float  scale = 1.0f,
::Color  tint = {255, 255, 255, 255} 
) const
inline

Draw a model wires (with texture if set)

Definition at line 172 of file Model.hpp.

◆ GetBindPose()

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

Retrieves the skeleton.bindPose value for the object.

Returns
The skeleton.bindPose value of the object.

Definition at line 77 of file Model.hpp.

◆ GetBoneCount()

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

Retrieves the skeleton.boneCount value for the object.

Returns
The skeleton.boneCount value of the object.

Definition at line 75 of file Model.hpp.

◆ GetBoneMatrices()

::Matrix * raylib::Model::GetBoneMatrices ( ) const
inline

Retrieves the boneMatrices value for the object.

Returns
The boneMatrices value of the object.

Definition at line 79 of file Model.hpp.

◆ GetBones()

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

Retrieves the skeleton.bones value for the object.

Returns
The skeleton.bones value of the object.

Definition at line 76 of file Model.hpp.

◆ GetBoundingBox()

BoundingBox raylib::Model::GetBoundingBox ( ) const
inline

Compute model bounding box limits (considers all meshes)

Definition at line 191 of file Model.hpp.

◆ GetCurrentPose()

::ModelAnimPose raylib::Model::GetCurrentPose ( ) const
inline

Retrieves the currentPose value for the object.

Returns
The currentPose value of the object.

Definition at line 78 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 71 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 73 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 70 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 72 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 74 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 69 of file Model.hpp.

◆ IsModelAnimationValid()

bool raylib::Model::IsModelAnimationValid ( const ::ModelAnimation &  anim) const
inline

Check model animation skeleton match.

Definition at line 148 of file Model.hpp.

◆ IsValid()

bool raylib::Model::IsValid ( ) const
inline

Determines whether or not the Model has data in it.

Definition at line 201 of file Model.hpp.

Referenced by Load(), and Load().

◆ 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 220 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 208 of file Model.hpp.

References IsValid().

◆ operator BoundingBox()

raylib::Model::operator BoundingBox ( ) const
inlineexplicit

Compute model bounding box limits (considers all meshes)

Definition at line 196 of file Model.hpp.

◆ operator=() [1/2]

Model & raylib::Model::operator= ( const ::Model &  model)
inline

Definition at line 81 of file Model.hpp.

◆ operator=() [2/2]

Model & raylib::Model::operator= ( Model &&  other)
inlinenoexcept

Definition at line 88 of file Model.hpp.

◆ set()

void raylib::Model::set ( const ::Model &  model)
inlineprotected

Definition at line 227 of file Model.hpp.

◆ SetBindPose()

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

Sets the skeleton.bindPose value for the object.

Parameters
valueThe value of which to set skeleton.bindPose to.

Definition at line 77 of file Model.hpp.

◆ SetBoneCount()

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

Sets the skeleton.boneCount value for the object.

Parameters
valueThe value of which to set skeleton.boneCount to.

Definition at line 75 of file Model.hpp.

◆ SetBoneMatrices()

void raylib::Model::SetBoneMatrices ( ::Matrix *  value)
inline

Sets the boneMatrices value for the object.

Parameters
valueThe value of which to set boneMatrices to.

Definition at line 79 of file Model.hpp.

◆ SetBones()

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

Sets the skeleton.bones value for the object.

Parameters
valueThe value of which to set skeleton.bones to.

Definition at line 76 of file Model.hpp.

◆ SetCurrentPose()

void raylib::Model::SetCurrentPose ( ::ModelAnimPose  value)
inline

Sets the currentPose value for the object.

Parameters
valueThe value of which to set currentPose to.

Definition at line 78 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 71 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 73 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 70 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 72 of file Model.hpp.

◆ SetMeshMaterial() [1/2]

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 74 of file Model.hpp.

◆ SetMeshMaterial() [2/2]

Model & raylib::Model::SetMeshMaterial ( int  meshId,
int  materialId 
)
inline

Set material for a mesh.

Definition at line 124 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 69 of file Model.hpp.

◆ Unload()

void raylib::Model::Unload ( )
inline

Unload model (including meshes) from memory (RAM and/or VRAM)

Definition at line 113 of file Model.hpp.

Referenced by Model().

◆ UpdateAnimation()

Model & raylib::Model::UpdateAnimation ( const ::ModelAnimation &  anim,
float  frame 
)
inline

Update model animation pose.

Definition at line 132 of file Model.hpp.