1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-10-05 16:47:19 +02:00
openrw/rwengine/include/render/ViewCamera.hpp

32 lines
560 B
C++
Raw Normal View History

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;
glm::vec3 position;
glm::quat rotation;
2014-06-15 03:12:45 +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
{
}
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