Commit ae2c3d70 authored by Philip Trettner's avatar Philip Trettner
Browse files

fixed camera classes

parent 6bd62675
......@@ -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;
};
......
#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; }
};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment