1 #ifndef RAYLIB_CPP_INCLUDE_MODEL_HPP_
2 #define RAYLIB_CPP_INCLUDE_MODEL_HPP_
6 #include "./raylib.hpp"
7 #include "./raylib-cpp-utils.hpp"
9 #include "./RaylibException.hpp"
17 Model(const ::Model& model) {
21 Model(
const std::string& fileName) {
22 if (!
Load(fileName)) {
27 Model(const ::Mesh& mesh) {
42 other.bones =
nullptr;
44 other.materials =
nullptr;
45 other.materialCount = 0;
46 other.meshes =
nullptr;
48 other.bindPose =
nullptr;
51 GETTERSETTER(::
Matrix, Transform, transform)
52 GETTERSETTER(
int, MeshCount, meshCount)
53 GETTERSETTER(
int, MaterialCount, materialCount)
54 GETTERSETTER(::
Mesh *, Meshes, meshes)
55 GETTERSETTER(::
Material *, Materials, materials)
56 GETTERSETTER(
int *, MeshMaterial, meshMaterial)
57 GETTERSETTER(
int, BoneCount, boneCount)
58 GETTERSETTER(::BoneInfo *, Bones, bones)
59 GETTERSETTER(::Transform *, BindPoe, bindPose)
76 other.bones =
nullptr;
78 other.materials =
nullptr;
79 other.materialCount = 0;
80 other.meshes =
nullptr;
82 other.bindPose =
nullptr;
91 if (meshes !=
nullptr || materials !=
nullptr) {
102 ::UnloadModelKeepMeshes(*
this);
110 ::SetModelMeshMaterial(
this, meshId, materialId);
118 return ::GetRayCollisionModel(ray, *
this);
125 ::UpdateModelAnimation(*
this, anim, frame);
133 return ::IsModelAnimationValid(*
this, anim);
141 ::
Color tint = {255, 255, 255, 255}) {
142 ::DrawModel(*
this, position, scale, tint);
152 float rotationAngle = 0.0f,
153 ::
Vector3 scale = {1.0f, 1.0f, 1.0f},
154 ::Color tint = {255, 255, 255, 255}) {
155 ::DrawModelEx(*
this, position, rotationAxis, rotationAngle, scale, tint);
164 ::
Color tint = {255, 255, 255, 255}) {
165 ::DrawModelWires(*
this, position, scale, tint);
175 float rotationAngle = 0.0f,
176 ::
Vector3 scale = {1.0f, 1.0f, 1.0f},
177 ::Color tint = {255, 255, 255, 255}) {
178 ::DrawModelWiresEx(*
this, position, rotationAxis, rotationAngle, scale, tint);
186 return ::GetModelBoundingBox(*
this);
193 return ::GetModelBoundingBox(*
this);
200 return meshCount > 0 || materialCount > 0 || boneCount > 0;
208 bool Load(
const std::string& fileName) {
209 set(::LoadModel(fileName.c_str()));
218 bool Load(const ::Mesh& mesh) {
219 set(::LoadModelFromMesh(mesh));
224 inline void set(const ::Model& model) {
225 transform = model.transform;
227 meshCount = model.meshCount;
228 materialCount = model.materialCount;
229 meshes = model.meshes;
230 materials = model.materials;
231 meshMaterial = model.meshMaterial;
233 boneCount = model.boneCount;
235 bindPose = model.bindPose;
241 #endif // RAYLIB_CPP_INCLUDE_MODEL_HPP_