summaryrefslogtreecommitdiff
path: root/src/model.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/model.cpp')
-rw-r--r--src/model.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/model.cpp b/src/model.cpp
index 6a6e470..b5c4185 100644
--- a/src/model.cpp
+++ b/src/model.cpp
@@ -16,13 +16,14 @@
#include "model.hpp"
+#include "mesh.hpp"
#include "rotation_3d.hpp"
#include "texture.hpp"
#include "vector_3d.hpp"
#include "vk/model_instance.hpp"
void
-cg_free_model(mrb_state *mrb, void* obj)
+cg_free_model(mrb_state *mrb, void *obj)
{
auto ptr = static_cast<std::shared_ptr<VK::Model>*>(obj);
@@ -35,32 +36,27 @@ const struct mrb_data_type cg_model_type = { "CG_Model", cg_free_model };
static mrb_value
cg_cModel_initialize(mrb_state *mrb, mrb_value self)
{
- const char *file_path;
-
- mrb_sym id_at_texture;
- mrb_value texture_v;
-
+ std::shared_ptr<VK::Mesh> *mesh;
std::shared_ptr<VK::Texture> *texture;
std::shared_ptr<VK::Model> *ptr;
- mrb_get_args(mrb, "zd", &file_path, &texture, &cg_texture_type);
+ mrb_get_args(mrb, "dd", &mesh, &cg_mesh_type, &texture, &cg_texture_type);
ptr = (std::shared_ptr<VK::Model>*)DATA_PTR(self);
if(ptr) mrb_free(mrb, ptr);
ptr = (std::shared_ptr<VK::Model>*)mrb_malloc(
mrb, sizeof(std::shared_ptr<VK::Model>));
- std::string path{file_path};
new(ptr)std::shared_ptr<VK::Model>(
- std::make_shared<VK::Model>(path, *texture));
+ std::make_shared<VK::Model>(*mesh, *texture));
- mrb_data_init(self, ptr, &cg_model_type);
+ mrb_data_init(self, ptr, &cg_mesh_type);
return self;
}
static mrb_value
cg_cModel_draw(mrb_state *mrb, mrb_value self)
{
- auto *ptr = (std::shared_ptr<VK::Model>*)DATA_PTR(self);
+ auto ptr = (std::shared_ptr<VK::Model>*)DATA_PTR(self);
VK::ModelInstance instance;
std::shared_ptr<glm::vec3> *position;
std::shared_ptr<glm::vec3> *rotation;