From 0335efc6033906dd6cfc7201fbeca4d021849d74 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20=C5=A0toura=C4=8D?= <525032@mail.muni.cz>
Date: Thu, 14 Sep 2023 16:59:04 +0200
Subject: [PATCH] applied name conv. to object, objectbase, render

---
 src/gfx/include/gfx/object.hpp          | 10 ++++-----
 src/gfx/include/gfx/objectbase.hpp      |  1 -
 src/gfx/include/gfx/render.hpp          |  4 ++--
 src/gfx/src/render.cpp                  | 28 ++++++++++++-------------
 src/studio/include/studio/simulator.hpp |  2 +-
 src/studio/src/simulator.cpp            |  6 +++---
 6 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/src/gfx/include/gfx/object.hpp b/src/gfx/include/gfx/object.hpp
index d607cea..f9fd8c5 100644
--- a/src/gfx/include/gfx/object.hpp
+++ b/src/gfx/include/gfx/object.hpp
@@ -39,18 +39,18 @@ public:
     VAO* getVAO() { return _VAO.get(); }
 
     std::vector<float> const &getVertices() const { return _VAO->getVertices(); }
-    void setVertices(std::vector<float> const &new_vertices) { _VAO->setVertices(new_vertices); }
+    void setVertices(std::vector<float> const &_vertices) { _VAO->setVertices(_vertices); }
 
     std::vector<unsigned int> const &getIndices() const { return _VAO->getIndices(); }
-    void setIndices(std::vector<unsigned int> const &new_indices) { _VAO->setIndices(new_indices); }
+    void setIndices(std::vector<unsigned int> const &_indices) { _VAO->setIndices(_indices); }
 
     std::vector<float> const &getNormals() const { return _VAO->getNormals(); }
-    void setNormals(std::vector<float> const &new_normals) { _VAO->setNormals(new_normals); }
+    void setNormals(std::vector<float> const &_normals) { _VAO->setNormals(_normals); }
 
     std::string getShaderType() const { return shader_type; }
-    void setShaderType(std::string new_type) { shader_type = new_type; }
+    void setShaderType(std::string _shader_type) { shader_type = _shader_type; }
 
-    bool is_selectable() const { return selectable; }
+    bool isSelectable() const { return selectable; }
     void setSelectability(bool _selectable) { selectable = _selectable; }
 
     glm::vec3 getColor() const { return color; }
diff --git a/src/gfx/include/gfx/objectbase.hpp b/src/gfx/include/gfx/objectbase.hpp
index b00081e..8170a9a 100644
--- a/src/gfx/include/gfx/objectbase.hpp
+++ b/src/gfx/include/gfx/objectbase.hpp
@@ -5,7 +5,6 @@
 class ObjectBase
 {
 public:
-    // virtual int polymorph() { return 1; }
     virtual ~ObjectBase() = default;
 };
 
diff --git a/src/gfx/include/gfx/render.hpp b/src/gfx/include/gfx/render.hpp
index 4a823da..dccfa50 100644
--- a/src/gfx/include/gfx/render.hpp
+++ b/src/gfx/include/gfx/render.hpp
@@ -21,11 +21,11 @@ using light_ptr = std::shared_ptr<Light>;
 
 std::vector<float> generate_grid_vertices(int span);
 std::vector<unsigned int> generate_grid_indices(int span);
-void send_matrices_to_shader(Shader &myShader, glm::mat4 &model, glm::mat4 &view, glm::mat4 &projection);
+void send_matrices_to_shader(Shader &my_shader, glm::mat4 &model, glm::mat4 &view, glm::mat4 &projection);
 glm::mat4 get_view_matrix(camera_ptr camera);
 glm::mat4 get_projection_matrix(camera_ptr camera);
 
-void gfx_draw(std::map<std::string, shader_ptr> &myShaders, 
+void gfx_draw(std::map<std::string, shader_ptr> &my_shaders, 
               std::vector<light_ptr> lights,
               camera_ptr camera,
               std::vector<node_ptr> &scene);
diff --git a/src/gfx/src/render.cpp b/src/gfx/src/render.cpp
index e3566db..2aaa445 100644
--- a/src/gfx/src/render.cpp
+++ b/src/gfx/src/render.cpp
@@ -50,20 +50,20 @@ std::vector<unsigned int> generate_grid_indices(int span)
     return indices;
 }
         
-void send_matrices_to_shader(Shader &myShader, glm::mat4 &model, glm::mat4 &view, glm::mat4 &projection)
+void send_matrices_to_shader(Shader &my_shader, glm::mat4 &model, glm::mat4 &view, glm::mat4 &projection)
 {
     // glGetUniformLocation CPU usage high?
-    int modelLoc = glGetUniformLocation(myShader.getID(), "model");
+    int modelLoc = glGetUniformLocation(my_shader.getID(), "model");
     ASSUMPTION(glGetError() == GL_NO_ERROR);
     glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));
     ASSUMPTION(glGetError() == GL_NO_ERROR);
 
-    int viewLoc = glGetUniformLocation(myShader.getID(), "view");
+    int viewLoc = glGetUniformLocation(my_shader.getID(), "view");
     ASSUMPTION(glGetError() == GL_NO_ERROR);
     glUniformMatrix4fv(viewLoc, 1, GL_FALSE, glm::value_ptr(view));
     ASSUMPTION(glGetError() == GL_NO_ERROR);
 
-    int projectionLoc = glGetUniformLocation(myShader.getID(), "projection");
+    int projectionLoc = glGetUniformLocation(my_shader.getID(), "projection");
     ASSUMPTION(glGetError() == GL_NO_ERROR);
     glUniformMatrix4fv(projectionLoc, 1, GL_FALSE, glm::value_ptr(projection));
     ASSUMPTION(glGetError() == GL_NO_ERROR);
@@ -84,7 +84,7 @@ glm::mat4 get_projection_matrix(camera_ptr camera)
                             100.0f);
 }
 
-void draw_objects(std::map<std::string, shader_ptr> &myShaders, std::vector<light_ptr> lights,
+void draw_objects(std::map<std::string, shader_ptr> &my_shaders, std::vector<light_ptr> lights,
                   camera_ptr camera,
                   const std::vector<node_ptr> &scene,
                   glm::mat4 &view, glm::mat4 &projection)
@@ -98,23 +98,23 @@ void draw_objects(std::map<std::string, shader_ptr> &myShaders, std::vector<ligh
                 continue;
 
             std::string shader_used = obj->getShaderType();
-            myShaders[shader_used]->use();
-            myShaders[shader_used]->setVec3("objectColor",obj->getColor());
+            my_shaders[shader_used]->use();
+            my_shaders[shader_used]->setVec3("objectColor",obj->getColor());
 
             if (shader_used == "lit")
             {
                 // FTO DO: enum promennych z shaderu
                 // Currently 1 light only
-                myShaders[shader_used]->setVec3("lightColor", lights[0]->getColor());
-                myShaders[shader_used]->setVec3("lightPos", lights[0]->getPosition()); 
-                myShaders[shader_used]->setVec3("viewPos", camera->getFrame()->getPosition()); 
+                my_shaders[shader_used]->setVec3("lightColor", lights[0]->getColor());
+                my_shaders[shader_used]->setVec3("lightPos", lights[0]->getPosition()); 
+                my_shaders[shader_used]->setVec3("viewPos", camera->getFrame()->getPosition()); 
             }
             // if (shader_used == "basic") ...
             
             // FTO DO: children maji relativni frame vuci parentum
             glm::mat4 model = node->getFrame()->getModelMat();
 
-            send_matrices_to_shader(*myShaders[shader_used], model, view, projection);
+            send_matrices_to_shader(*my_shaders[shader_used], model, view, projection);
 
             obj->getVAO()->Bind();
 
@@ -125,11 +125,11 @@ void draw_objects(std::map<std::string, shader_ptr> &myShaders, std::vector<ligh
             ASSUMPTION(glGetError() == GL_NO_ERROR);
         }
 
-        draw_objects(myShaders, lights, camera, node->getChildren(), view, projection);
+        draw_objects(my_shaders, lights, camera, node->getChildren(), view, projection);
     }
 }
 
-void gfx_draw(std::map<std::string, shader_ptr> &myShaders, 
+void gfx_draw(std::map<std::string, shader_ptr> &my_shaders, 
               std::vector<light_ptr> lights,
               camera_ptr camera,
               std::vector<node_ptr> &scene)
@@ -163,5 +163,5 @@ void gfx_draw(std::map<std::string, shader_ptr> &myShaders,
     ASSUMPTION(glGetError() == GL_NO_ERROR);
 
     /* DRAW OBJECTS */
-    draw_objects(myShaders, lights, camera, scene, view, projection);
+    draw_objects(my_shaders, lights, camera, scene, view, projection);
 }
diff --git a/src/studio/include/studio/simulator.hpp b/src/studio/include/studio/simulator.hpp
index a34e2b4..b58e4c3 100644
--- a/src/studio/include/studio/simulator.hpp
+++ b/src/studio/include/studio/simulator.hpp
@@ -103,7 +103,7 @@ private:
     std::vector<camera_ptr> active_cameras;
 
     /* SHADERS */
-    std::map<std::string, shader_ptr> myShaders;
+    std::map<std::string, shader_ptr> my_shaders;
 };
 
 }
diff --git a/src/studio/src/simulator.cpp b/src/studio/src/simulator.cpp
index c49f5be..67a7232 100644
--- a/src/studio/src/simulator.cpp
+++ b/src/studio/src/simulator.cpp
@@ -123,7 +123,7 @@ std::vector<float> axis_obj_normals =
 
 Simulator::Simulator()
     : osi::Simulator()
-    , myShaders{{"lit", std::make_shared<Shader>("./data/shaders/lightshader.vert",
+    , my_shaders{{"lit", std::make_shared<Shader>("./data/shaders/lightshader.vert",
                                                  "./data/shaders/lightshader.frag")},
                 {"basic", std::make_shared<Shader>("./data/shaders/basicshader.vert",
                                                    "./data/shaders/basicshader.frag")}}
@@ -174,7 +174,7 @@ void Simulator::present()
         {
             active_cam->setWindowSize(window().size());
         }
-        gfx_draw(myShaders, lights, active_cam, scene);
+        gfx_draw(my_shaders, lights, active_cam, scene);
     }
     
 }
@@ -434,7 +434,7 @@ node_ptr Simulator::find_intersection(glm::vec3 rayPosition, glm::vec3 rayDirect
         for (auto &object : node->getObjects())
         {
             auto obj = dynamic_pointer_cast<Object>(object);
-            if (!obj || !obj->is_selectable())
+            if (!obj || !obj->isSelectable())
                 continue;
             
             auto LH_world = obj->getAABB().getLHWorld(node);
-- 
GitLab