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. More...
 
 Model (const std::string_view fileName)
 
 Model (Model &&other)
 
void Draw (::Vector3 position, ::Vector3 rotationAxis, Degree rotationAngle=0.0f, ::Vector3 scale={1.0f, 1.0f, 1.0f}, ::Color tint={255, 255, 255, 255}) const
 Draw a model with extended parameters. More...
 
void Draw (::Vector3 position, float scale=1.0f, ::Color tint={255, 255, 255, 255}) const
 Draw a model (with texture if set) More...
 
void DrawWires (::Vector3 position, ::Vector3 rotationAxis, Degree 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. More...
 
void DrawWires (::Vector3 position, float scale=1.0f, ::Color tint={255, 255, 255, 255}) const
 Draw a model wires (with texture if set) More...
 
::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) More...
 
int GetMaterialCount () const
 Retrieves the materialCount value for the object. More...
 
::Material * GetMaterials () const
 Retrieves the materials value for the object. More...
 
int GetMeshCount () const
 Retrieves the meshCount value for the object. More...
 
::Mesh * GetMeshes () 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...
 
BoundingBox GetTransformedBoundingBox () const
 Compute model bounding box limits with respect to the Model's transformation (considers all meshes) This function is pretty expensive! More...
 
bool IsModelAnimationValid (const ::ModelAnimation &anim) const
 Check model animation skeleton match. More...
 
bool IsReady () const
 Determines whether or not the Model has data in it. More...
 
void Load (const ::Mesh &mesh)
 Loads a Model from the given Mesh. More...
 
void Load (const std::string_view fileName)
 Loads a Model from the given file. More...
 
 operator BoundingBox () const
 Compute model bounding box limits (considers all meshes) More...
 
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. More...
 
void SetTransform (::Matrix value)
 Sets the transform value for the object. More...
 
void Unload ()
 Unload model (including meshes) from memory (RAM and/or VRAM) More...
 
ModelUpdateAnimation (const ::ModelAnimation &anim, int frame)
 Update model animation pose. More...
 

Protected Member Functions

void set (const ::Model &model)
 

Detailed Description

Model type.

Definition at line 19 of file Model.hpp.

Constructor & Destructor Documentation

◆ Model() [1/6]

raylib::Model::Model ( )
inline

Definition at line 21 of file Model.hpp.

◆ Model() [2/6]

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

Definition at line 30 of file Model.hpp.

◆ Model() [3/6]

raylib::Model::Model ( const std::string_view  fileName)
inline

Definition at line 39 of file Model.hpp.

◆ Model() [4/6]

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

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

◆ Model() [6/6]

raylib::Model::Model ( Model &&  other)
inline

Definition at line 67 of file Model.hpp.

Member Function Documentation

◆ Draw() [1/2]

void raylib::Model::Draw ( ::Vector3  position,
::Vector3  rotationAxis,
Degree  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 163 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 154 of file Model.hpp.

◆ DrawWires() [1/2]

void raylib::Model::DrawWires ( ::Vector3  position,
::Vector3  rotationAxis,
Degree  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 184 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 175 of file Model.hpp.

◆ GetBindPose()

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

Retrieves the bindPose value for the object.

Returns
The bindPose value of the object.

Definition at line 88 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 86 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 87 of file Model.hpp.

◆ GetBoundingBox()

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

Compute model bounding box limits (considers all meshes)

Definition at line 196 of file Model.hpp.

Referenced by operator BoundingBox().

◆ GetMaterialCount()

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

Retrieves the materialCount value for the object.

Returns
The materialCount value of the object.

Definition at line 82 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 84 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 81 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 83 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 85 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 80 of file Model.hpp.

◆ GetTransformedBoundingBox()

BoundingBox Model::GetTransformedBoundingBox ( ) const
inline

Compute model bounding box limits with respect to the Model's transformation (considers all meshes) This function is pretty expensive!

Definition at line 390 of file MeshUnmanaged.hpp.

References GetTransformedBoundingBox().

Referenced by GetTransformedBoundingBox().

◆ IsModelAnimationValid()

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

Check model animation skeleton match.

Definition at line 147 of file Model.hpp.

◆ IsReady()

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

Determines whether or not the Model has data in it.

Definition at line 216 of file Model.hpp.

Referenced by 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 237 of file Model.hpp.

References IsReady().

◆ Load() [2/2]

void raylib::Model::Load ( const std::string_view  fileName)
inline

Loads a Model from the given file.

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

Definition at line 225 of file Model.hpp.

References IsReady().

◆ operator BoundingBox()

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

Compute model bounding box limits (considers all meshes)

Definition at line 209 of file Model.hpp.

References GetBoundingBox().

◆ operator=() [1/2]

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

Definition at line 90 of file Model.hpp.

◆ operator=() [2/2]

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

Definition at line 97 of file Model.hpp.

◆ set()

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

Definition at line 245 of file Model.hpp.

◆ 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 88 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 86 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 87 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 82 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 84 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 81 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 83 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 85 of file Model.hpp.

◆ SetMeshMaterial() [2/2]

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

Set material for a mesh.

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

◆ Unload()

void raylib::Model::Unload ( )
inline

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

Definition at line 120 of file Model.hpp.

Referenced by Model().

◆ UpdateAnimation()

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

Update model animation pose.

Definition at line 139 of file Model.hpp.