RtB/src/RenderCamera.hpp

53 lines
1.8 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();
int getRenderMode();
void setRenderMode(int mode);
Vec3 getPosition();
void setPosition(float x, float y, float z);
float getPitch();
void setPitch(float pitch);
float getYaw();
void setYaw(float yaw);
float getSize();
Mat4 getModelview();
private:
int render_mode; // 0 = perspective, 1 = orthogonal
Vec3 position; // The camera's coordinates in 3D space
float pitch, yaw; // The camera's basic orientation
float fov_angle; // The vertical FOV angle, used for perspective
float size; // The vertical units on screen, used for orthogonal
float near, far; // wherever you are
int width, height; // width/height of the projection
RenderView *render_view; // RenderView to render the scene to
Mat4 p_matrix; // Our camera's projection matrix
Mat4 mv_matrix; // modelview matrix
int flags; // set flags, such as DIRTY
};
#endif