rtsCameraController.h
2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include "rtsLinearAlgebra.h"
#ifndef _RTSMATH_H
#define _RTSMATH_H
#define CAMERA_UP -1
#define CAMERA_DOWN 1
#define CAMERA_LEFT -1
#define CAMERA_RIGHT 1
struct rtsCameraState
{
point3D<float> position;
point3D<float> lookat;
vector3D<float> up;
float pers_view_angle;
float ortho_width;
float ortho_height;
float near_plane;
float far_plane;
};
class rtsCamera
{
//members
rtsCameraState m_camera_state;
public:
//methods
void RotateUpDown(double degrees);
void RotateLeftRight(double degrees);
void Pan(double x, double y);
void Yaw(double degrees);
void Pitch(double degrees);
void Forward(double distance);
void ScaleForward(double factor, double min = 0, double max = 999999);
void DollyLeftRight(double distance);
void DollyUpDown(double distance);
void Zoom(double angle);
void LookAt(point3D<float> point);
void Position(point3D<float> point);
void Up(vector3D<float> up);
void DollyPosition(point3D<float> point); //moves the camera but keeps the current orientation
//get methods
rtsCameraState getState();
vector3D<float> getViewVector();
vector3D<float> getUpVector();
point3D<float> getPosition();
point3D<float> getLookAtPoint();
double getViewAngle(){return m_camera_state.pers_view_angle;}
double getNearPlane(){return m_camera_state.near_plane;}
double getFarPlane(){return m_camera_state.far_plane;}
double getOrthoWidth(){return m_camera_state.ortho_width;}
double getOrthoHeight(){return m_camera_state.ortho_height;}
//set methods
void setState(rtsCameraState camera_state);
//initialization methods
//int SetPosition(double x, double y, double z);
//int OrthogonalCamera(double width, double height, double near, double far);
//int LookAt(double x, double y, double z); //looks at a point in space
//int SetUpVector(double x, double y, double z);
/*int InitializePerspectiveCamera(double position_x, double position_y, double position_z,
double lookat_x, double lookat_y, double lookat_z,
double up_x, double up_y, double up_z,
double angle, double near_dist, double far_dist);*/
//int InitializeCamera(); //initializes a camera to defaults
rtsCamera();
rtsCamera(rtsCameraState initial_state);
~rtsCamera();
};
#endif