1 #ifndef RAYLIB_CPP_INCLUDE_MODEL_HPP_
2 #define RAYLIB_CPP_INCLUDE_MODEL_HPP_
6 #include "./raylib.hpp"
7 #include "./raylib-cpp-utils.hpp"
16 Model(const ::Model& model) {
20 Model(
const std::string& fileName) {
21 set(::LoadModel(fileName.c_str()));
24 Model(const ::Mesh& mesh) {
25 set(::LoadModelFromMesh(mesh));
37 other.bones =
nullptr;
39 other.materials =
nullptr;
40 other.materialCount = 0;
41 other.meshes =
nullptr;
43 other.bindPose =
nullptr;
46 GETTERSETTER(::
Matrix, Transform, transform)
47 GETTERSETTER(
int, MeshCount, meshCount)
48 GETTERSETTER(
int, MaterialCount, materialCount)
49 GETTERSETTER(::
Mesh *, Meshes, meshes)
50 GETTERSETTER(::
Material *, Materials, materials)
51 GETTERSETTER(
int *, MeshMaterial, meshMaterial)
52 GETTERSETTER(
int, BoneCount, boneCount)
53 GETTERSETTER(::BoneInfo *, Bones, bones)
54 GETTERSETTER(::Transform *, BindPoe, bindPose)
71 other.bones =
nullptr;
73 other.materials =
nullptr;
74 other.materialCount = 0;
75 other.meshes =
nullptr;
77 other.bindPose =
nullptr;
86 if (meshes !=
nullptr || materials !=
nullptr) {
97 ::UnloadModelKeepMeshes(*
this);
105 ::SetModelMeshMaterial(
this, meshId, materialId);
113 return ::GetRayCollisionModel(ray, *
this);
120 ::UpdateModelAnimation(*
this, anim, frame);
128 return ::IsModelAnimationValid(*
this, anim);
136 ::
Color tint = {255, 255, 255, 255}) {
137 ::DrawModel(*
this, position, scale, tint);
147 float rotationAngle = 0.0f,
148 ::
Vector3 scale = {1.0f, 1.0f, 1.0f},
149 ::Color tint = {255, 255, 255, 255}) {
150 ::DrawModelEx(*
this, position, rotationAxis, rotationAngle, scale, tint);
159 ::
Color tint = {255, 255, 255, 255}) {
160 ::DrawModelWires(*
this, position, scale, tint);
170 float rotationAngle = 0.0f,
171 ::
Vector3 scale = {1.0f, 1.0f, 1.0f},
172 ::Color tint = {255, 255, 255, 255}) {
173 ::DrawModelWiresEx(*
this, position, rotationAxis, rotationAngle, scale, tint);
181 return ::GetModelBoundingBox(*
this);
188 return ::GetModelBoundingBox(*
this);
192 inline void set(const ::Model& model) {
193 transform = model.transform;
195 meshCount = model.meshCount;
196 materialCount = model.materialCount;
197 meshes = model.meshes;
198 materials = model.materials;
199 meshMaterial = model.meshMaterial;
201 boneCount = model.boneCount;
203 bindPose = model.bindPose;
208 #endif // RAYLIB_CPP_INCLUDE_MODEL_HPP_