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

added camera base class and fixed camera

parent 2c6a0f1f
#pragma once
#include <ACGL/Math/Math.hh>
namespace ACGL{
namespace Scene{
/**
* @brief Common interface for cameras
*/
class CameraBase
{
protected:
CameraBase();
public:
virtual ~CameraBase();
// interface:
virtual glm::vec3 getPosition() const = 0;
virtual glm::mat4 getViewMatrix() const = 0;
virtual glm::mat4 getProjectionMatrix() const = 0;
virtual glm::uvec2 getViewportSize() const = 0;
};
}
}
#pragma once
#include <Common/ClassHelper.hh>
#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);
CLASS_GETTER_SETTER2(glm::vec3, Position)
CLASS_GETTER_SETTER2(glm::mat4, ViewMatrix)
CLASS_GETTER_SETTER2(glm::mat4, ProjectionMatrix)
CLASS_GETTER_SETTER2(glm::uvec2, ViewportSize)
};
}
}
......@@ -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)
{
}
}
}
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