summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederico Linhares <fred@linhares.blue>2022-09-08 16:41:40 -0300
committerFrederico Linhares <fred@linhares.blue>2022-09-08 16:41:40 -0300
commit900120ca393fd2eb49ca8c63bcd9b4e0c0aab1a2 (patch)
treed989d51055473eb012149cb118f80b1c465a11c1
parente386b9fd4ebc13a6a04def65585e795f4d39335d (diff)
styl Improve legibility of rotation_3d and vector_3d
-rw-r--r--src/candy_gear.cpp8
-rw-r--r--src/main.cpp8
-rw-r--r--src/model.cpp6
-rw-r--r--src/rotation_3d.cpp (renamed from src/rotation3d.cpp)14
-rw-r--r--src/rotation_3d.hpp (renamed from src/rotation3d.hpp)4
-rw-r--r--src/vector_3d.cpp (renamed from src/vector3d.cpp)17
-rw-r--r--src/vector_3d.hpp (renamed from src/vector3d.hpp)4
7 files changed, 31 insertions, 30 deletions
diff --git a/src/candy_gear.cpp b/src/candy_gear.cpp
index 45d105e..9460b51 100644
--- a/src/candy_gear.cpp
+++ b/src/candy_gear.cpp
@@ -22,8 +22,8 @@
#include <yaml-cpp/yaml.h>
-#include "rotation3d.hpp"
-#include "vector3d.hpp"
+#include "rotation_3d.hpp"
+#include "vector_3d.hpp"
static mrb_value
parse_node(mrb_state *mrb, const YAML::Node &node)
@@ -64,7 +64,7 @@ cg_mCandyGear_set_camera_position(mrb_state *mrb, mrb_value self)
{
std::shared_ptr<glm::vec3> *camera_position;
- mrb_get_args(mrb, "d", &camera_position, &cg_vector3d_type);
+ mrb_get_args(mrb, "d", &camera_position, &cg_vector_3d_type);
cg_core.vk_graphics_pipeline_3d->camera_position = (*camera_position);
return self;
@@ -75,7 +75,7 @@ cg_mCandyGear_set_camera_rotation(mrb_state *mrb, mrb_value self)
{
std::shared_ptr<glm::vec3> *camera_rotation;
- mrb_get_args(mrb, "d", &camera_rotation, &cg_rotation3d_type);
+ mrb_get_args(mrb, "d", &camera_rotation, &cg_rotation_3d_type);
cg_core.vk_graphics_pipeline_3d->camera_rotation = (*camera_rotation);
return self;
diff --git a/src/main.cpp b/src/main.cpp
index d82ba1b..120a7ed 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -21,11 +21,11 @@
#include "core.hpp"
#include "key.hpp"
#include "model.hpp"
-#include "rotation3d.hpp"
+#include "rotation_3d.hpp"
#include "sound.hpp"
#include "sprite.hpp"
#include "texture.hpp"
-#include "vector3d.hpp"
+#include "vector_3d.hpp"
cg_sCore cg_core;
@@ -62,11 +62,11 @@ int main(int argc, char *argv[])
cg_candy_gear_init(cg_core.mrb);
cg_key_init(cg_core.mrb);
cg_model_init(cg_core.mrb);
- cg_rotation3d_init(cg_core.mrb);
+ cg_rotation_3d_init(cg_core.mrb);
cg_sound_init(cg_core.mrb);
cg_sprite_init(cg_core.mrb);
cg_texture_init(cg_core.mrb);
- cg_vector3d_init(cg_core.mrb);
+ cg_vector_3d_init(cg_core.mrb);
main_obj = mrb_obj_iv_inspect(cg_core.mrb, cg_core.mrb->top_self);
sym_init = mrb_intern_cstr(cg_core.mrb, "init");
diff --git a/src/model.cpp b/src/model.cpp
index c0a35d8..45744f6 100644
--- a/src/model.cpp
+++ b/src/model.cpp
@@ -16,9 +16,9 @@
#include "model.hpp"
-#include "rotation3d.hpp"
+#include "rotation_3d.hpp"
#include "texture.hpp"
-#include "vector3d.hpp"
+#include "vector_3d.hpp"
#include "vk/model_instance.hpp"
void
@@ -66,7 +66,7 @@ cg_cModel_draw(mrb_state *mrb, mrb_value self)
std::shared_ptr<glm::vec3> *rotation;
mrb_get_args(
- mrb, "dd", &position, &cg_vector3d_type, &rotation, &cg_rotation3d_type);
+ mrb, "dd", &position, &cg_vector_3d_type, &rotation, &cg_rotation_3d_type);
instance.position = **position;
instance.rotation = **rotation;
diff --git a/src/rotation3d.cpp b/src/rotation_3d.cpp
index d95947b..db0ce5a 100644
--- a/src/rotation3d.cpp
+++ b/src/rotation_3d.cpp
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-#include "rotation3d.hpp"
+#include "rotation_3d.hpp"
-#include "vector3d.hpp"
+#include "vector_3d.hpp"
namespace
{
@@ -32,7 +32,7 @@ pitch_limit(float pitch)
}
void
-cg_free_rotation3d(mrb_state *mrb, void* obj)
+cg_free_rotation_3d(mrb_state *mrb, void* obj)
{
auto ptr = static_cast<std::shared_ptr<glm::vec3>*>(obj);
@@ -40,8 +40,8 @@ cg_free_rotation3d(mrb_state *mrb, void* obj)
mrb_free(mrb, ptr);
}
-const struct mrb_data_type cg_rotation3d_type = {
- "CG_Rotation3D", cg_free_rotation3d};
+const struct mrb_data_type cg_rotation_3d_type = {
+ "CG_Rotation3D", cg_free_rotation_3d};
static mrb_value
cg_cRotation3D_initialize(mrb_state *mrb, mrb_value self)
@@ -58,7 +58,7 @@ cg_cRotation3D_initialize(mrb_state *mrb, mrb_value self)
new(ptr)std::shared_ptr<glm::vec3>(
std::make_shared<glm::vec3>(pitch_limit(pitch), yaw, roll));
- mrb_data_init(self, ptr, &cg_rotation3d_type);
+ mrb_data_init(self, ptr, &cg_rotation_3d_type);
return self;
}
@@ -89,7 +89,7 @@ cg_cRotation3D_baseless_rotation(mrb_state *mrb, mrb_value self)
}
void
-cg_rotation3d_init(mrb_state *mrb)
+cg_rotation_3d_init(mrb_state *mrb)
{
struct RClass *cg_m, *cg_cRotation3D;
diff --git a/src/rotation3d.hpp b/src/rotation_3d.hpp
index 6d3980d..bba4bec 100644
--- a/src/rotation3d.hpp
+++ b/src/rotation_3d.hpp
@@ -19,9 +19,9 @@
#include "core.hpp"
-extern const struct mrb_data_type cg_rotation3d_type;
+extern const struct mrb_data_type cg_rotation_3d_type;
void
-cg_rotation3d_init(mrb_state *mrb);
+cg_rotation_3d_init(mrb_state *mrb);
#endif /* CANDY_GEAR_ROTATION_3D_H */
diff --git a/src/vector3d.cpp b/src/vector_3d.cpp
index a2e0e4c..6417a18 100644
--- a/src/vector3d.cpp
+++ b/src/vector_3d.cpp
@@ -14,16 +14,16 @@
* limitations under the License.
*/
-#include "vector3d.hpp"
+#include "vector_3d.hpp"
#include <memory>
#include <glm/vec3.hpp>
-#include "rotation3d.hpp"
+#include "rotation_3d.hpp"
void
-cg_free_vector3d(mrb_state *mrb, void* obj)
+cg_free_vector_3d(mrb_state *mrb, void* obj)
{
auto ptr = static_cast<std::shared_ptr<glm::vec3>*>(obj);
@@ -31,8 +31,8 @@ cg_free_vector3d(mrb_state *mrb, void* obj)
mrb_free(mrb, ptr);
}
-const struct mrb_data_type cg_vector3d_type = {
- "CG_Vector3D", cg_free_vector3d};
+const struct mrb_data_type cg_vector_3d_type = {
+ "CG_Vector3D", cg_free_vector_3d};
static mrb_value
cg_cVector3D_initialize(mrb_state *mrb, mrb_value self)
@@ -50,7 +50,7 @@ cg_cVector3D_initialize(mrb_state *mrb, mrb_value self)
new(ptr)std::shared_ptr<glm::vec3>(std::make_shared<glm::vec3>(x, y, z));
- mrb_data_init(self, ptr, &cg_vector3d_type);
+ mrb_data_init(self, ptr, &cg_vector_3d_type);
return self;
}
@@ -128,7 +128,8 @@ cg_cVector3D_translate(mrb_state *mrb, mrb_value self)
std::shared_ptr<glm::vec3> *direction, *rotation;
mrb_get_args(
- mrb, "dd", &direction, &cg_vector3d_type, &rotation, &cg_rotation3d_type);
+ mrb, "dd", &direction, &cg_vector_3d_type,
+ &rotation, &cg_rotation_3d_type);
glm::mat4 matrix{1.0f};
glm::vec4 vec{(**direction), 1.0f};
@@ -145,7 +146,7 @@ cg_cVector3D_translate(mrb_state *mrb, mrb_value self)
}
void
-cg_vector3d_init(mrb_state *mrb)
+cg_vector_3d_init(mrb_state *mrb)
{
struct RClass *cg_m, *cg_cVector3D;
diff --git a/src/vector3d.hpp b/src/vector_3d.hpp
index fab6f61..2827813 100644
--- a/src/vector3d.hpp
+++ b/src/vector_3d.hpp
@@ -19,7 +19,7 @@
#include "core.hpp"
-extern const struct mrb_data_type cg_vector3d_type;
+extern const struct mrb_data_type cg_vector_3d_type;
mrb_value
cg_cVector3D_get_x(mrb_state *mrb, mrb_value self);
@@ -29,6 +29,6 @@ mrb_value
cg_cVector3D_get_z(mrb_state *mrb, mrb_value self);
void
-cg_vector3d_init(mrb_state *mrb);
+cg_vector_3d_init(mrb_state *mrb);
#endif /* CANDY_GEAR_VECTOR_3D_H */