Skip to content
Snippets Groups Projects
Commit 93285159 authored by Philip Trettner's avatar Philip Trettner
Browse files

Merge remote-tracking branch 'origin/experimental'

parents cb84f5a7 ae2c3d70
No related branches found
No related tags found
No related merge requests found
#pragma once
#include <ACGL/Math/Math.hh>
namespace ACGL{
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
{
protected:
CameraBase();
public:
virtual ~CameraBase();
/**
* @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 "CameraBase.hh"
namespace ACGL{
namespace Scene{
/**
* @brief A fixed camera
*/
class FixedCamera : public CameraBase
{
private:
glm::vec3 mPosition;
glm::mat4 mViewMatrix;
glm::mat4 mProjectionMatrix;
glm::uvec2 mViewportSize;
public:
/// CAUTION: default ctor with zero values
FixedCamera();
FixedCamera(const glm::vec3 &_pos, const glm::mat4 &_view, const glm::mat4 &_proj, const glm::uvec2 &_viewport);
// 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; }
};
}
}
......@@ -9,6 +9,8 @@
#include <ACGL/Math/Math.hh>
#include <glm/gtx/quaternion.hpp>
#include "CameraBase.hh"
/*
* What you definitly want to set:
* - a position in 3D space (a vec3)
......@@ -46,7 +48,7 @@
namespace ACGL{
namespace Scene{
class GenericCamera
class GenericCamera : public CameraBase
{
public:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
......
#include <ACGL/Scene/CameraBase.hh>
namespace ACGL{
namespace Scene{
CameraBase::CameraBase()
{
}
CameraBase::~CameraBase()
{
}
}
}
#include <ACGL/Scene/FixedCamera.hh>
namespace ACGL{
namespace Scene{
FixedCamera::FixedCamera()
{
}
FixedCamera::FixedCamera(const glm::vec3 &_pos, const glm::mat4 &_view, const glm::mat4 &_proj, const glm::uvec2 &_viewport) :
mPosition(_pos),
mViewMatrix(_view),
mProjectionMatrix(_proj),
mViewportSize(_viewport)
{
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment