Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/models/models_first_person_maze.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int main(void)

raylib::Image imMap("resources/cubicmap.png"); // Load cubicmap image (RAM)
raylib::Texture cubicmap(imMap); // Convert image to texture to display (VRAM)
raylib::MeshUnmanaged mesh = raylib::MeshUnmanaged::Cubicmap(imMap, Vector3{ 1.0f, 1.0f, 1.0f }); // Use MeshUnmanaged, Mesh will be handled by Model
raylib::MeshUnmanaged mesh = raylib::Mesh::Cubicmap(imMap, Vector3{ 1.0f, 1.0f, 1.0f }); // Use MeshUnmanaged, Mesh will be handled by Model
raylib::Model model(mesh);

// NOTE: By default each cube is mapped to one part of texture atlas
Expand Down
9 changes: 9 additions & 0 deletions include/Model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ class Model : public ::Model {
Load(mesh);
}

/*
* Overloaded constructor to catch when passing in a `raylib::Mesh`. It expects a `raylib::MeshUnmanaged or `::Mesh`.
*
* @throws raylib::RaylibException Since the model takes ownership of the Mesh, a `::Mesh` or `raylib::UnmanagedMesh` is required here.
*/
Model(const raylib::Mesh& mesh) {
throw raylib::RaylibException("Model(mesh) constructor expects a ::Mesh or raylib::MeshUnmanaged, as it takes ownership of the Mesh itself.");
}

~Model() {
Unload();
}
Expand Down