RtB/src/RenderCamera.hpp

45 lines
1.4 KiB
C++

/* ================================================================
RenderCamera
----------------
This header file describes the RenderCamera class.
A RenderCamera is the object responsible for providing a rendering position,
orientation, and perspective transformations. A RenderCamera exists within a
RenderScene and outputs all data to the friend class, RenderView.
================================================================ */
#ifndef RENDERCAMERA_HPP
#define RENDERCAMERA_HPP
#include "common.hpp"
#include "RenderView.hpp"
#include "Vec.hpp"
#include "Mat4.hpp"
class RenderCamera {
friend class RenderScene;
public:
RenderCamera();
~RenderCamera();
enum Flags {
DIRTY = (1 << 1)
};
int setRenderView(RenderView *view);
RenderView* getRenderView();
void updateProjection(int width, int height);
void doRefresh();
void setPosition(float x, float y, float z);
void setPitch(float pitch);
void setYaw(float yaw);
private:
Vec3 position; // The camera's coordinates in 3D space
float pitch, yaw; //
float fov_ratio;
float near, far; // wherever you are
int render_mode; // 0 = perspective, 1 = orthogonal
RenderView *render_view; // RenderView to render the scene to
Mat4 p_matrix; // Our camera's projection matrix
Mat4 mv_matrix; // modelview matrix
int width, height;
int flags;
};
#endif