diff --git a/modules/camera/include/vkcv/camera/Camera.hpp b/modules/camera/include/vkcv/camera/Camera.hpp index 44689c70a40d90745118ad01bbe61252e14ef6de..a41d37525e0313e35f2e571428b9838eeeb0d055 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 dd5ead6a51ba7c0ecbf8099043740dfb7472176d..a15eae3d271a67c3d73ecc2a0112db0bb515067d 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 ¢er); + /** + * @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 e45e9c593cda0fee4b4af06005c5bcc53e933af1..d69596cf7ca1954451676784baa8ea4ba7ecb9a3 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 0bfa16fef4c9dce0798164e33640fc775fcb49fa..fb392d1b10d7a01c3cae90ea4858759a372bd58f 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) {