From ae2c3d70bc11aa3fc9d6d588c12f3c2265b5c9d1 Mon Sep 17 00:00:00 2001 From: Philip Trettner <philip.trettner@rwth-aachen.de> Date: Mon, 1 Jul 2013 23:46:28 +0200 Subject: [PATCH] fixed camera classes --- include/ACGL/Scene/CameraBase.hh | 20 +++++++++++++++++++- include/ACGL/Scene/FixedCamera.hh | 20 +++++++++++++++----- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/include/ACGL/Scene/CameraBase.hh b/include/ACGL/Scene/CameraBase.hh index 7abcee8a..0e43f7ac 100644 --- a/include/ACGL/Scene/CameraBase.hh +++ b/include/ACGL/Scene/CameraBase.hh @@ -7,6 +7,9 @@ namespace Scene{ /** * @brief Common interface for cameras + * + * This interface only contains getter on purpose. + * All logic that wants to modify a camera should know the actual structure of the camera and therefore use the specific subclass. */ class CameraBase { @@ -15,10 +18,25 @@ protected: public: virtual ~CameraBase(); - // interface: + /** + * @brief gets the Position of the camera + * @return a 3-dimensional position in the global coordinate system + */ virtual glm::vec3 getPosition() const = 0; + /** + * @brief gets the ViewMatrix of the camera + * @return a 4x4 matrix containing projection independent camera transforms + */ virtual glm::mat4 getViewMatrix() const = 0; + /** + * @brief gets the ProjectionMatrix of the camera + * @return a 4x4 matrix containing the projection into normalized device coordinates + */ virtual glm::mat4 getProjectionMatrix() const = 0; + /** + * @brief gets the ViewportSize of the current viewport of this camera + * @return the 2-dimensional size of the viewport + */ virtual glm::uvec2 getViewportSize() const = 0; }; diff --git a/include/ACGL/Scene/FixedCamera.hh b/include/ACGL/Scene/FixedCamera.hh index a86923c4..7140e40e 100644 --- a/include/ACGL/Scene/FixedCamera.hh +++ b/include/ACGL/Scene/FixedCamera.hh @@ -1,6 +1,5 @@ #pragma once -#include <Common/ClassHelper.hh> #include "CameraBase.hh" namespace ACGL{ @@ -23,10 +22,21 @@ public: FixedCamera(); FixedCamera(const glm::vec3 &_pos, const glm::mat4 &_view, const glm::mat4 &_proj, const glm::uvec2 &_viewport); - CLASS_GETTER_SETTER2(glm::vec3, Position) - CLASS_GETTER_SETTER2(glm::mat4, ViewMatrix) - CLASS_GETTER_SETTER2(glm::mat4, ProjectionMatrix) - CLASS_GETTER_SETTER2(glm::uvec2, ViewportSize) + // Getter, Setter for Camera Position + virtual glm::vec3 getPosition() const { return mPosition; } + virtual void setPosition(glm::vec3 const& _val) { mPosition = _val; } + + // Getter, Setter for Camera ViewMatrix + virtual glm::mat4 getViewMatrix() const { return mViewMatrix; } + virtual void setViewMatrix(glm::mat4 const& _val) { mViewMatrix = _val; } + + // Getter, Setter for Camera ProjectionMatrix + virtual glm::mat4 getProjectionMatrix() const { return mProjectionMatrix; } + virtual void setProjectionMatrix(glm::mat4 const& _val) { mProjectionMatrix = _val; } + + // Getter, Setter for Camera ViewportSize + virtual glm::uvec2 getViewportSize() const { return mViewportSize; } + virtual void setViewportSize(glm::uvec2 const& _val) { mViewportSize = _val; } }; } -- GitLab