diff --git a/src/gfx/include/gfx/control.hpp b/src/gfx/include/gfx/control.hpp index 3b28dccf8a7f4a80177b55119eb08ef5aae08b87..36c4bc49f9506d5273e7ec7e03571dfed5540650 100644 --- a/src/gfx/include/gfx/control.hpp +++ b/src/gfx/include/gfx/control.hpp @@ -33,11 +33,11 @@ public: void setStep(float dt); float getSpeed() const { return speed; } - void setSpeed(float new_speed); + void setSpeed(float _speed); void teleport(glm::vec3 new_position) { bound_frame->setPosVec(new_position); } - void keyboard_move(const std::unordered_set<std::string> &pressed_keys); + void keyboardMove(const std::unordered_set<std::string> &pressed_keys); void forward(); void backward(); void left(); diff --git a/src/gfx/include/gfx/ebo.hpp b/src/gfx/include/gfx/ebo.hpp index d366bb32713468c85b98fc3243d6442ecebe8c34..383a9bcf4234a7bc4bdf07003b60b8ee3a23af32 100644 --- a/src/gfx/include/gfx/ebo.hpp +++ b/src/gfx/include/gfx/ebo.hpp @@ -12,10 +12,11 @@ class EBO public: EBO(); ~EBO(); - void Bind(); - void Unbind(); - void Delete(); - void SendData(std::vector<unsigned int> const &indices); + + void bind(); + void unbind(); + void deleteBuffer(); + void sendData(std::vector<unsigned int> const &indices); }; diff --git a/src/gfx/include/gfx/frame.hpp b/src/gfx/include/gfx/frame.hpp index 496bf1e88021ef5a00571aecebebbe3e72b37dca..76d843fcd38ec40f211819372ac20a6d33f18cdd 100644 --- a/src/gfx/include/gfx/frame.hpp +++ b/src/gfx/include/gfx/frame.hpp @@ -12,48 +12,48 @@ class Frame { - glm::vec3 positionVec; - glm::quat rotationQuat; - glm::vec3 scaleVec; + glm::vec3 position_vec; + glm::quat rotation_quat; + glm::vec3 scale_vec; public: - Frame(glm::vec3 position = glm::vec3(0, 0, 0), - glm::vec3 rotation = glm::vec3(0, 0, 0), - glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f)) - : positionVec{position}, scaleVec(scale) + Frame(glm::vec3 _position_vec = glm::vec3(0, 0, 0), + glm::vec3 rotation_vec = glm::vec3(0, 0, 0), + glm::vec3 _scale_vec = glm::vec3(1.0f, 1.0f, 1.0f)) + : position_vec{_position_vec}, scale_vec{_scale_vec} { - setRotationQuat(rotation); + setRotationQuat(rotation_vec); } - Frame(glm::vec3 position, - glm::quat rotation, - glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f)) - : positionVec{position}, rotationQuat{glm::normalize(rotation)}, scaleVec(scale) {} + Frame(glm::vec3 _position_vec, + glm::quat _rotation_quat, + glm::vec3 _scale_vec = glm::vec3(1.0f, 1.0f, 1.0f)) + : position_vec{_position_vec}, rotation_quat{glm::normalize(_rotation_quat)}, scale_vec(_scale_vec) {} - glm::vec3 getPosition() const { return positionVec; } - glm::quat getRotation() const { return rotationQuat; } - glm::vec3 getScale() const { return scaleVec; } + glm::vec3 getPosition() const { return position_vec; } + glm::quat getRotation() const { return rotation_quat; } + glm::vec3 getScale() const { return scale_vec; } - glm::vec3 getRotationAxisX() const { return glm::normalize(glm::column(glm::toMat3(rotationQuat), 0)); } - glm::vec3 getRotationAxisY() const { return glm::normalize(glm::column(glm::toMat3(rotationQuat), 1)); } - glm::vec3 getRotationAxisZ() const { return glm::normalize(glm::column(glm::toMat3(rotationQuat), 2)); } + glm::vec3 getRotationAxisX() const { return glm::normalize(glm::column(glm::toMat3(rotation_quat), 0)); } + glm::vec3 getRotationAxisY() const { return glm::normalize(glm::column(glm::toMat3(rotation_quat), 1)); } + glm::vec3 getRotationAxisZ() const { return glm::normalize(glm::column(glm::toMat3(rotation_quat), 2)); } - glm::mat4 getTranslationMat() const { return glm::translate(glm::mat4(1.0f), positionVec); } - glm::mat4 getRotationMat() const { return glm::toMat4(rotationQuat); } - glm::mat4 getScaleMat() const { return glm::scale(glm::mat4(1.0f), scaleVec); } + glm::mat4 getTranslationMat() const { return glm::translate(glm::mat4(1.0f), position_vec); } + glm::mat4 getRotationMat() const { return glm::toMat4(rotation_quat); } + glm::mat4 getScaleMat() const { return glm::scale(glm::mat4(1.0f), scale_vec); } glm::mat4 getModelMat() const { return getTranslationMat() * getRotationMat() * getScaleMat(); } glm::mat4 getViewMat() const { return glm::inverse(getModelMat()); } - void setPosVec(glm::vec3 new_position) { positionVec = new_position; } - void translatePosVec(glm::vec3 direction) { positionVec += direction; } - void setRotationQuat(glm::vec3 new_rotation) { rotationQuat = glm::normalize(glm::tquat(glm::radians(new_rotation))); } - void setRotationQuat(glm::quat new_rotation) { rotationQuat = glm::normalize(new_rotation); } - void rotateRotationQuat(glm::vec3 rotation) { rotationQuat = glm::normalize(glm::tquat(glm::radians(rotation)) * rotationQuat); } - void rotateRotationQuat(glm::quat rotation) { rotationQuat = glm::normalize(rotation * rotationQuat); } - void setScale(glm::vec3 new_scale) { scaleVec = new_scale; } + void setPosVec(glm::vec3 _position_vec) { position_vec = _position_vec; } + void translatePosVec(glm::vec3 direction) { position_vec += direction; } + void setRotationQuat(glm::vec3 rotation_vec) { rotation_quat = glm::normalize(glm::tquat(glm::radians(rotation_vec))); } + void setRotationQuat(glm::quat _rotation_quat) { rotation_quat = glm::normalize(_rotation_quat); } + void rotateRotationQuat(glm::vec3 added_rotation) { rotation_quat = glm::normalize(glm::tquat(glm::radians(added_rotation)) * rotation_quat); } + void rotateRotationQuat(glm::quat added_rotation) { rotation_quat = glm::normalize(added_rotation * rotation_quat); } + void setScale(glm::vec3 _scale_vec) { scale_vec = _scale_vec; } - void normalizeQuat() { rotationQuat = glm::normalize(rotationQuat); } + void normalizeQuat() { rotation_quat = glm::normalize(rotation_quat); } }; #endif \ No newline at end of file diff --git a/src/gfx/src/control.cpp b/src/gfx/src/control.cpp index 2703b8377926fdc4f3f08a1e1380514e98b43df7..c1ae9e0318d6bba5cf4e3d8608453576f61bb696 100644 --- a/src/gfx/src/control.cpp +++ b/src/gfx/src/control.cpp @@ -4,9 +4,9 @@ void Controller::setStep(float dt) { step = speed * dt; } -void Controller::setSpeed(float new_speed) +void Controller::setSpeed(float _speed) { - speed = new_speed; + speed = _speed; } void Controller::setup(float dt, frame_ptr frame) @@ -15,7 +15,7 @@ void Controller::setup(float dt, frame_ptr frame) setStep(dt); } -void Controller::keyboard_move(const std::unordered_set<std::string> &pressed_keys) +void Controller::keyboardMove(const std::unordered_set<std::string> &pressed_keys) { if (pressed_keys.contains("W")) forward(); diff --git a/src/gfx/src/ebo.cpp b/src/gfx/src/ebo.cpp index 1156c62d06b32f9d84c2d19ac084702f76f4bca5..27aecd7fb8f37258db418a52021b016ac1fbde66 100644 --- a/src/gfx/src/ebo.cpp +++ b/src/gfx/src/ebo.cpp @@ -10,23 +10,23 @@ EBO::EBO() EBO::~EBO() { - Delete(); + deleteBuffer(); } -void EBO::Bind() +void EBO::bind() { ASSUMPTION(ID != 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ID); ASSUMPTION(glGetError() == GL_NO_ERROR); } -void EBO::Unbind() +void EBO::unbind() { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); ASSUMPTION(glGetError() == GL_NO_ERROR); } -void EBO::Delete() +void EBO::deleteBuffer() { if (ID != 0) { @@ -36,7 +36,7 @@ void EBO::Delete() } } -void EBO::SendData(std::vector<unsigned int> const &indices) +void EBO::sendData(std::vector<unsigned int> const &indices) { ASSUMPTION(ID != 0); glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(unsigned int), &indices.front(), GL_STATIC_DRAW); diff --git a/src/gfx/src/vao.cpp b/src/gfx/src/vao.cpp index 90790ff2c1125a62031913195e86d054d3876a53..c5b65fbc5a25ce0c59dffbb63cd20a012adf155b 100644 --- a/src/gfx/src/vao.cpp +++ b/src/gfx/src/vao.cpp @@ -63,8 +63,8 @@ void VAO::BindNormals() void VAO::BindIndices() { _EBO = std::make_shared<EBO>(); - _EBO->Bind(); - _EBO->SendData(indices); + _EBO->bind(); + _EBO->sendData(indices); } void VAO::BindBuffers() diff --git a/src/studio/src/simulator.cpp b/src/studio/src/simulator.cpp index e57fb50737b7e99f08c453c39ee7ab02b0ffa451..87bcb031408f61f06a1018d25fa8b62fe68c3654 100644 --- a/src/studio/src/simulator.cpp +++ b/src/studio/src/simulator.cpp @@ -328,13 +328,13 @@ void Simulator::process_input() for (auto &controller : obj_controls) { controller->setup(timer().dt(), selection->getFrame()); - controller->keyboard_move(keyboard().down()); + controller->keyboardMove(keyboard().down()); } } else { cam_controls[active_camera_type]->setStep(timer().dt()); - cam_controls[active_camera_type]->keyboard_move(keyboard().down()); + cam_controls[active_camera_type]->keyboardMove(keyboard().down()); } int fill_mode = keyboard().down().contains("X") ? GL_LINE : GL_FILL; // MTO DO: put elsewhere