From cb9928bac83ed0aaa6adeda9ca2074b94e887b44 Mon Sep 17 00:00:00 2001
From: Vanessa Karolek <vaka1997@uni-koblenz.de>
Date: Tue, 1 Jun 2021 19:07:59 +0200
Subject: [PATCH] [#42][Doc] add documentation to TrackballCamera class, adjust
 documentation of Camera

---
 modules/camera/include/vkcv/camera/Camera.hpp | 10 ++--
 .../include/vkcv/camera/TrackballCamera.hpp   | 54 +++++++++++++++++--
 modules/camera/src/vkcv/camera/Camera.cpp     |  4 +-
 .../src/vkcv/camera/TrackballCamera.cpp       |  4 +-
 4 files changed, 60 insertions(+), 12 deletions(-)

diff --git a/modules/camera/include/vkcv/camera/Camera.hpp b/modules/camera/include/vkcv/camera/Camera.hpp
index 44689c70..a41d3752 100644
--- a/modules/camera/include/vkcv/camera/Camera.hpp
+++ b/modules/camera/include/vkcv/camera/Camera.hpp
@@ -74,11 +74,11 @@ namespace vkcv {
         void getView(glm::vec3 &x, glm::vec3 &y, glm::vec3 &z, glm::vec3 &pos);
 
         /**
-         * @brief Updates the view matrix of the camera with respect to @p deltatime
-         * @param deltatime The time past between frames
-         * @return
+         * @brief Updates the view matrix of the camera with respect to @p deltaTime
+         * @param deltaTime The time that has passed since last update
+         * @return The updated view matrix of the camera
          */
-        glm::mat4 updateView(double deltatime);
+        glm::mat4 updateView(double deltaTime);
 
         /**
          * @brief Sets the view matrix of the camera according to @p position, @p center and @p up
@@ -127,7 +127,7 @@ namespace vkcv {
         
         /**
          * @brief Changes the field of view of the camera with an @p offset in degrees
-         * @param[in] offset in degrees
+         * @param[in] offset The offset in degrees
          */
         void changeFov(double offset);
 
diff --git a/modules/camera/include/vkcv/camera/TrackballCamera.hpp b/modules/camera/include/vkcv/camera/TrackballCamera.hpp
index dd5ead6a..a15eae3d 100644
--- a/modules/camera/include/vkcv/camera/TrackballCamera.hpp
+++ b/modules/camera/include/vkcv/camera/TrackballCamera.hpp
@@ -12,28 +12,76 @@ namespace vkcv {
 
     public:
 
+        /**
+         * @brief The default constructor of the trackball camera
+         */
         TrackballCamera();
 
+        /**
+         * @brief The destructor of the trackball camera (default behavior)
+         */
         ~TrackballCamera();
 
+        /**
+         * @brief Gets the radius of the trackball camera that specifies the distance of the trackball camera to the center point
+         * @return The radius of the trackball camera
+         */
         float getRadius();
 
+        /**
+         * @brief Sets the current radius of the trackball camera to @p radius
+         * @param[in] radius The new radius of the trackball camera
+         */
         void setRadius(float radius);
 
-        glm::vec3 &getCenter();
+        /**
+         * @brief Gets the center point the trackball camera is looking at
+         * @return The center point of the trackball camera
+         */
+        glm::vec3& getCenter();
 
+        /**
+         * @brief Sets the current center point of the trackball camera to @p center
+         * @param[in] center The new center point of the trackball camera
+         */
         void setCenter(const glm::vec3 &center);
 
+        /**
+         * @brief Sets the pitch value of the trackball camera to @p pitch
+         * @param[in] pitch The new pitch value of the trackball camera
+         */
         void setPitch(float pitch);
 
+        /**
+         * @brief Sets the yaw value of the trackball camera to @p yaw
+         * @param[in] yaw The new yaw value of the trackball camera
+         */
         void setYaw(float yaw);
 
-        void changeFov(double fov);
-
+        /**
+         * @brief Changes the field of view of the trackball camera with an @p offset in degrees
+         * @param[in] offset The offset in degrees
+         */
+        void changeFov(double offset);
+
+        /**
+         * @brief Pans the view of the trackball camera according to the pitch and yaw values and additional offsets @p xOffset and @p yOffset (e.g. taken from mouse movement)
+         * @param[in] xOffset The offset added to the yaw value
+         * @param[in] yOffset The offset added to the pitch value
+         */
         void panView(double xOffset, double yOffset);
 
+        /**
+         * @brief Updates the view matrix of the trackball camera with respect to @p deltatime
+         * @param deltaTime The time that has passed since last update
+         * @return The updated view matrix of the trackball camera
+         */
         glm::mat4 updateView(double deltaTime);
 
+        /**
+         * @brief Updates the position of the trackball camera with respect to @p deltaTime
+         * @param[in] deltaTime The time that has passed since last update
+         */
         void updatePosition(double deltaTime);
     };
 
diff --git a/modules/camera/src/vkcv/camera/Camera.cpp b/modules/camera/src/vkcv/camera/Camera.cpp
index e45e9c59..d69596cf 100644
--- a/modules/camera/src/vkcv/camera/Camera.cpp
+++ b/modules/camera/src/vkcv/camera/Camera.cpp
@@ -27,8 +27,8 @@ namespace vkcv {
         m_view = glm::lookAt(position, center, up);
     }
 
-    glm::mat4 Camera::updateView(double deltatime){
-        updatePosition(deltatime);
+    glm::mat4 Camera::updateView(double deltaTime){
+        updatePosition(deltaTime);
         return m_view = glm::lookAt(m_position, m_position + getFront() , m_up);
     }
 
diff --git a/modules/camera/src/vkcv/camera/TrackballCamera.cpp b/modules/camera/src/vkcv/camera/TrackballCamera.cpp
index 0bfa16fe..fb392d1b 100644
--- a/modules/camera/src/vkcv/camera/TrackballCamera.cpp
+++ b/modules/camera/src/vkcv/camera/TrackballCamera.cpp
@@ -53,8 +53,8 @@ namespace vkcv {
         m_yaw = yaw;
     }
 
-    void TrackballCamera::changeFov(double fov) {
-        setRadius(m_radius - fov * m_scrollSensitivity);
+    void TrackballCamera::changeFov(double offset) {
+        setRadius(m_radius - offset * m_scrollSensitivity);
     }
 
     void TrackballCamera::panView(double xOffset, double yOffset) {
-- 
GitLab