1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-20 09:21:44 +02:00
openrw/rwengine/include/render/ViewCamera.hpp
Daniel Evans ba7eb63941 Refactor and cleanup camera control.
rwengine
+ Make renderWorld() take a ViewCamera parameter.
+ add rotation and getView to ViewCamera
+ correct directions for vehicle and character movement.

rwgame
+ Remove GenericState
+ Add State::getCamera() to control the ViewCamera used for rendering
+ Clean up state camera control
+ Remove now unused view parameters from main
2014-08-12 21:15:26 +01:00

32 lines
560 B
C++

#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;
ViewCamera(const glm::vec3& pos = {}, const glm::quat& rot = {})
: frustum({0.1f, 5000.f, glm::radians(45.f), 1.f}),
position(pos), rotation(rot)
{
}
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);
}
};
#endif