2013-07-02 09:53:23 +02:00
|
|
|
#ifndef _VIEWCAMERA_HPP_
|
|
|
|
#define _VIEWCAMERA_HPP_
|
|
|
|
#include "ViewFrustum.hpp"
|
|
|
|
#include <glm/gtc/quaternion.hpp>
|
|
|
|
|
|
|
|
class ViewCamera
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
ViewFrustum frustum;
|
|
|
|
|
2014-08-12 22:15:26 +02:00
|
|
|
glm::vec3 position;
|
|
|
|
glm::quat rotation;
|
2014-06-15 03:12:45 +02:00
|
|
|
|
2014-08-12 22:15:26 +02:00
|
|
|
ViewCamera(const glm::vec3& pos = {}, const glm::quat& rot = {})
|
|
|
|
: frustum({0.1f, 5000.f, glm::radians(45.f), 1.f}),
|
|
|
|
position(pos), rotation(rot)
|
2013-07-02 09:53:23 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2014-08-12 22:15:26 +02:00
|
|
|
|
|
|
|
glm::mat4 getView()
|
|
|
|
{
|
|
|
|
auto up = rotation * glm::vec3(0.f, 0.f, 1.f);
|
|
|
|
return glm::lookAt(position,
|
|
|
|
position + rotation * glm::vec3(1.f, 0.f, 0.f),
|
|
|
|
up);
|
|
|
|
}
|
2013-07-02 09:53:23 +02:00
|
|
|
};
|
|
|
|
|
2014-06-15 03:12:45 +02:00
|
|
|
#endif
|