diff options
author | Frederico Linhares <fred@linhares.blue> | 2023-11-09 14:01:22 -0300 |
---|---|---|
committer | Frederico Linhares <fred@linhares.blue> | 2023-11-09 14:01:22 -0300 |
commit | 4a23b9689f6d22597ece6fb8a530a07655f49a6a (patch) | |
tree | 87d9b6ca9f68da6c5711b40944ecf650ce5a6b79 /src | |
parent | 85337fb5aa1ce63023ddd5e284ae6b2ccdbb5e30 (diff) |
feat Allow model's texture to be changed
Diffstat (limited to 'src')
-rw-r--r-- | src/static_model.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/static_model.cpp b/src/static_model.cpp index 25a08c7..5873792 100644 --- a/src/static_model.cpp +++ b/src/static_model.cpp @@ -85,6 +85,18 @@ cg_cStaticModel_set_position(mrb_state *mrb, mrb_value self) } static mrb_value +cg_cStaticModel_set_texture(mrb_state *mrb, mrb_value self) +{ + auto ptr = (std::shared_ptr<VK::StaticModel>*)DATA_PTR(self); + std::shared_ptr<VK::Texture> *texture; + + mrb_get_args(mrb, "d", &texture, &cg_texture_type); + (*ptr)->texture = *texture; + + return self; +} + +static mrb_value cg_cStaticModel_draw(mrb_state *mrb, mrb_value self) { auto ptr = (std::shared_ptr<VK::StaticModel>*)DATA_PTR(self); @@ -115,5 +127,8 @@ cg_static_model_init(mrb_state *mrb) mrb, cg_cStaticModel, "rotation=", cg_cStaticModel_set_rotation, MRB_ARGS_REQ(1)); mrb_define_method( + mrb, cg_cStaticModel, "texture=", cg_cStaticModel_set_texture, + MRB_ARGS_REQ(1)); + mrb_define_method( mrb, cg_cStaticModel, "draw", cg_cStaticModel_draw, MRB_ARGS_NONE()); } |