absence_thelab

view src/3deng/camera.h @ 0:1cffe3409164

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 23 Oct 2014 01:46:07 +0300
parents
children
line source
1 #ifndef _CAMERA_H_
2 #define _CAMERA_H_
4 #include <string>
5 #include "switches.h"
6 #include "n3dmath.h"
7 #include "curves.h"
8 #include "typedefs.h"
10 class Camera {
11 private:
12 Vector3 Pos, LookAt, Up;
13 float FOV;
14 float NearClip, FarClip;
15 // transformation matrices for each vector
16 Matrix4x4 PosTranslate, LookTranslate, UpTranslate;
17 Matrix4x4 PosRotate, LookRotate, UpRotate;
18 Matrix4x4 PosScale, LookScale, UpScale;
20 bool FlipRight;
22 const Curve *path, *targpath;
23 dword StartTime, EndTime;
25 public:
26 std::string name;
27 Matrix4x4 CCSmat;
29 Camera();
30 float GetFOV() const {return FOV;}
31 void SetFOV(float FOV) {this->FOV = FOV;}
33 void SetClippingPlanes(float NearClip, float FarClip);
34 void GetClippingPlanes(float *NearClip, float *FarClip) const;
36 void SetCamera(const Vector3 &pos, const Vector3 &lookat, const Vector3 &up);
37 Matrix4x4 &GetCameraMatrix();
39 // camera controls
40 void Move(float x, float y, float z);
41 void MoveTo(float x, float y, float z);
42 void Rotate(float x, float y, float z);
43 void Zoom(float factor);
45 // haphazard additions
46 void SetRightFlipping(bool enable);
47 void SetPosition(const Vector3 &pos);
48 void SetUpVector(const Vector3 &up);
49 void SetTarget(const Vector3 &targ);
51 Vector3 GetViewVector() const;
52 Vector3 GetPosition() const;
53 Vector3 GetUpVector() const;
54 Vector3 GetTargetPosition() const;
56 Base GetCameraBase() const;
58 inline void MoveTarget(float x, float y, float z);
59 inline void MoveTargetTo(float x, float y, float z);
60 inline void RotateTarget(float x, float y, float z);
62 void ResetRotation();
64 void CreateCameraMatrix();
65 void CreateCameraMatrix(Matrix4x4 *matrix, const Vector3 &Pos, const Vector3 &LookAt, const Vector3 &Up) const;
67 void Spin(float rads);
69 void SetCameraPath(const Curve *path, const Curve *tpath, dword StartTime, dword EndTime);
70 void FollowPath(dword time, bool Cycle = false);
71 void FollowPath(float t);
73 dword GetStartTime() const;
74 dword GetEndTime() const;
75 };
77 #endif // _CAMERA_H_