diff options
author | Frederico Linhares <fred@linhares.blue> | 2024-02-06 17:37:20 -0300 |
---|---|---|
committer | Frederico Linhares <fred@linhares.blue> | 2024-03-23 19:12:24 -0300 |
commit | bf240d7eeaa89657462b705849fde56e54e237db (patch) | |
tree | 0bd3f9826dd2d4d88f9da1ec77ba8f1b27b41be1 /src/static_model.cpp | |
parent | 8d7e40e0b2b592efc7bcf7101ee362ec61f1989f (diff) |
refa Use quaternion for orientation
Diffstat (limited to 'src/static_model.cpp')
-rw-r--r-- | src/static_model.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/static_model.cpp b/src/static_model.cpp index 5873792..eb9e4c9 100644 --- a/src/static_model.cpp +++ b/src/static_model.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 Frederico de Oliveira Linhares * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,10 @@ #include "static_model.hpp" -#include "vector_3d.hpp" -#include "rotation_3d.hpp" +#include "orientation_3d.hpp" #include "static_mesh.hpp" #include "texture.hpp" +#include "vector_3d.hpp" #include "vk/static_model.hpp" void @@ -40,13 +40,13 @@ cg_cStaticModel_initialize(mrb_state *mrb, mrb_value self) std::shared_ptr<VK::StaticMesh> *static_mesh; std::shared_ptr<VK::Texture> *texture; std::shared_ptr<glm::vec3> *position; - std::shared_ptr<glm::vec3> *rotation; + std::shared_ptr<glm::quat> *orientation; std::shared_ptr<VK::StaticModel> *ptr; mrb_get_args( mrb, "dddd", &static_mesh, &cg_static_mesh_type, &texture, - &cg_texture_type, &position, &cg_vector_3d_type, &rotation, - &cg_rotation_3d_type); + &cg_texture_type, &position, &cg_vector_3d_type, &orientation, + &cg_orientation_3d_type); ptr = (std::shared_ptr<VK::StaticModel>*)DATA_PTR(self); if(ptr) mrb_free(mrb, ptr); ptr = (std::shared_ptr<VK::StaticModel>*)mrb_malloc( @@ -54,20 +54,20 @@ cg_cStaticModel_initialize(mrb_state *mrb, mrb_value self) new(ptr)std::shared_ptr<VK::StaticModel>( std::make_shared<VK::StaticModel>( - *static_mesh, *texture, *position, *rotation)); + *static_mesh, *texture, *position, *orientation)); mrb_data_init(self, ptr, &cg_static_model_type); return self; } static mrb_value -cg_cStaticModel_set_rotation(mrb_state *mrb, mrb_value self) +cg_cStaticModel_set_orientation(mrb_state *mrb, mrb_value self) { auto ptr = (std::shared_ptr<VK::StaticModel>*)DATA_PTR(self); - std::shared_ptr<glm::vec3> *rotation; + std::shared_ptr<glm::quat> *orientation; - mrb_get_args(mrb, "d", &rotation, &cg_rotation_3d_type); - (*ptr)->rotation = *rotation; + mrb_get_args(mrb, "d", &orientation, &cg_orientation_3d_type); + (*ptr)->orientation = *orientation; return self; } @@ -124,7 +124,7 @@ cg_static_model_init(mrb_state *mrb) mrb, cg_cStaticModel, "position=", cg_cStaticModel_set_position, MRB_ARGS_REQ(1)); mrb_define_method( - mrb, cg_cStaticModel, "rotation=", cg_cStaticModel_set_rotation, + mrb, cg_cStaticModel, "orientation=", cg_cStaticModel_set_orientation, MRB_ARGS_REQ(1)); mrb_define_method( mrb, cg_cStaticModel, "texture=", cg_cStaticModel_set_texture, |