From 2ab7fc663e6c1430d5500ca83689b8ba40396d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C5=A0toura=C4=8D?= <525032@mail.muni.cz> Date: Fri, 11 Aug 2023 09:24:49 +0200 Subject: [PATCH] applied name conv. to aabb, cam_control, camera --- naming_convention.txt | 11 +++++++++++ src/gfx/include/gfx/aabb.hpp | 4 ++-- src/gfx/include/gfx/cam_control.hpp | 4 ++-- src/gfx/include/gfx/camera.hpp | 4 ++-- src/gfx/src/aabb.cpp | 24 ++++++++++++------------ src/gfx/src/cam_control.cpp | 2 +- src/gfx/src/camera.cpp | 6 +++--- src/studio/src/simulator.cpp | 2 +- 8 files changed, 34 insertions(+), 23 deletions(-) create mode 100644 naming_convention.txt diff --git a/naming_convention.txt b/naming_convention.txt new file mode 100644 index 0000000..7f38de2 --- /dev/null +++ b/naming_convention.txt @@ -0,0 +1,11 @@ +variables - snake_case +functions - snake_case + +classes - PascalCase +attributes - snake_case +private / protected methods - cammelCase +public methods - cammelCase + +When a parameter is used to overwrite an attribute, +their names should match with the parameter being +preceded by an underscore ( sens -> _sens). diff --git a/src/gfx/include/gfx/aabb.hpp b/src/gfx/include/gfx/aabb.hpp index d222de0..65c78f3 100644 --- a/src/gfx/include/gfx/aabb.hpp +++ b/src/gfx/include/gfx/aabb.hpp @@ -16,11 +16,11 @@ class AABB std::pair<glm::vec3, glm::vec3> LH; std::array<glm::vec3, 8> full_bbox; - void find_LH(std::vector<float> const &_vertices); + void findLH(std::vector<float> const &vertices); void getFullAABB(); public: - AABB(std::vector<float> const &_vertices); + AABB(std::vector<float> const &vertices); std::pair<glm::vec3, glm::vec3> const &getLH() const { return LH; } std::vector<float> getVertices() const; std::vector<unsigned int> getIndices() const; diff --git a/src/gfx/include/gfx/cam_control.hpp b/src/gfx/include/gfx/cam_control.hpp index 0f8ab10..36aa781 100644 --- a/src/gfx/include/gfx/cam_control.hpp +++ b/src/gfx/include/gfx/cam_control.hpp @@ -24,9 +24,9 @@ public: glm::vec2 getSens() const { return sens; } void setSens(float x_size, float y_size); - void setSensMultiplier(float multiplier) { sens_multiplier = multiplier; } + void setSensMultiplier(float _sens_multiplier) { sens_multiplier = _sens_multiplier; } - void process_mouse(const osi::Mouse &mouse, const osi::Window &window, bool &editor_running); + void processMouse(const osi::Mouse &mouse, const osi::Window &window, bool &editor_running); }; #endif \ No newline at end of file diff --git a/src/gfx/include/gfx/camera.hpp b/src/gfx/include/gfx/camera.hpp index 769c87d..e8e831a 100644 --- a/src/gfx/include/gfx/camera.hpp +++ b/src/gfx/include/gfx/camera.hpp @@ -24,10 +24,10 @@ public: Camera(float _FOV, frame_weak_ptr _frame); float getFOV() const; - void setFOV(float fov); + void setFOV(float _FOV); glm::vec2 getWindowSize() const; - void setWindowSize(glm::u32vec2 size); + void setWindowSize(glm::u32vec2 _window_size); frame_ptr getFrame() const { diff --git a/src/gfx/src/aabb.cpp b/src/gfx/src/aabb.cpp index a72d2c5..374839a 100644 --- a/src/gfx/src/aabb.cpp +++ b/src/gfx/src/aabb.cpp @@ -1,26 +1,26 @@ #include <gfx/aabb.hpp> -AABB::AABB(std::vector<float> const &_vertices) +AABB::AABB(std::vector<float> const &vertices) { - find_LH(_vertices); + findLH(vertices); getFullAABB(); } -void AABB::find_LH(std::vector<float> const &_vertices) +void AABB::findLH(std::vector<float> const &vertices) { - LH.first = glm::vec3(_vertices[0], _vertices[1], _vertices[2]); - LH.second = glm::vec3(_vertices[0], _vertices[1], _vertices[2]); + LH.first = glm::vec3(vertices[0], vertices[1], vertices[2]); + LH.second = glm::vec3(vertices[0], vertices[1], vertices[2]); - for (std::size_t i = 3; i < _vertices.size() - 2; i += 3) + for (std::size_t i = 3; i < vertices.size() - 2; i += 3) { LH.first = glm::min(LH.first, - glm::vec3(_vertices[i], - _vertices[i + 1], - _vertices[i + 2])); + glm::vec3(vertices[i], + vertices[i + 1], + vertices[i + 2])); LH.second = glm::max(LH.second, - glm::vec3(_vertices[i], - _vertices[i + 1], - _vertices[i + 2])); + glm::vec3(vertices[i], + vertices[i + 1], + vertices[i + 2])); } } diff --git a/src/gfx/src/cam_control.cpp b/src/gfx/src/cam_control.cpp index 15035c2..7d824d1 100644 --- a/src/gfx/src/cam_control.cpp +++ b/src/gfx/src/cam_control.cpp @@ -27,7 +27,7 @@ void CameraController::setSens(float x_size, float y_size) } -void CameraController::process_mouse(const osi::Mouse &mouse, const osi::Window &window, bool &editor_running) +void CameraController::processMouse(const osi::Mouse &mouse, const osi::Window &window, bool &editor_running) { if (window.is_minimized()) return; diff --git a/src/gfx/src/camera.cpp b/src/gfx/src/camera.cpp index 92164dc..fa6ad66 100644 --- a/src/gfx/src/camera.cpp +++ b/src/gfx/src/camera.cpp @@ -4,14 +4,14 @@ Camera::Camera(float _FOV, frame_weak_ptr _frame) : FOV{_FOV}, frame{_frame} {} float Camera::getFOV() const { return FOV; } -void Camera::setFOV(float fov) { FOV = fov <= 120 ? fov : 120; } +void Camera::setFOV(float _FOV) { FOV = _FOV <= 120 ? _FOV : 120; } glm::vec2 Camera::getWindowSize() const { return window_size; } -void Camera::setWindowSize(glm::u32vec2 size) +void Camera::setWindowSize(glm::u32vec2 _window_size) { - window_size = size; + window_size = _window_size; } \ No newline at end of file diff --git a/src/studio/src/simulator.cpp b/src/studio/src/simulator.cpp index 1bdd05b..e57fb50 100644 --- a/src/studio/src/simulator.cpp +++ b/src/studio/src/simulator.cpp @@ -630,7 +630,7 @@ void Simulator::add_object() void Simulator::process_mouse() { - cam_controls[active_camera_type]->process_mouse(mouse(), window(), editor_running); + cam_controls[active_camera_type]->processMouse(mouse(), window(), editor_running); switch(control_state) { case state::select: -- GitLab