nuclear@0: #ifndef _CAMERA_H_ nuclear@0: #define _CAMERA_H_ nuclear@0: nuclear@0: #include nuclear@0: #include "switches.h" nuclear@0: #include "n3dmath.h" nuclear@0: #include "curves.h" nuclear@0: #include "typedefs.h" nuclear@0: nuclear@0: class Camera { nuclear@0: private: nuclear@0: Vector3 Pos, LookAt, Up; nuclear@0: float FOV; nuclear@0: float NearClip, FarClip; nuclear@0: // transformation matrices for each vector nuclear@0: Matrix4x4 PosTranslate, LookTranslate, UpTranslate; nuclear@0: Matrix4x4 PosRotate, LookRotate, UpRotate; nuclear@0: Matrix4x4 PosScale, LookScale, UpScale; nuclear@0: nuclear@0: bool FlipRight; nuclear@0: nuclear@0: const Curve *path, *targpath; nuclear@0: dword StartTime, EndTime; nuclear@0: nuclear@0: public: nuclear@0: std::string name; nuclear@0: Matrix4x4 CCSmat; nuclear@0: nuclear@0: Camera(); nuclear@0: float GetFOV() const {return FOV;} nuclear@0: void SetFOV(float FOV) {this->FOV = FOV;} nuclear@0: nuclear@0: void SetClippingPlanes(float NearClip, float FarClip); nuclear@0: void GetClippingPlanes(float *NearClip, float *FarClip) const; nuclear@0: nuclear@0: void SetCamera(const Vector3 &pos, const Vector3 &lookat, const Vector3 &up); nuclear@0: Matrix4x4 &GetCameraMatrix(); nuclear@0: nuclear@0: // camera controls nuclear@0: void Move(float x, float y, float z); nuclear@0: void MoveTo(float x, float y, float z); nuclear@0: void Rotate(float x, float y, float z); nuclear@0: void Zoom(float factor); nuclear@0: nuclear@0: // haphazard additions nuclear@0: void SetRightFlipping(bool enable); nuclear@0: void SetPosition(const Vector3 &pos); nuclear@0: void SetUpVector(const Vector3 &up); nuclear@0: void SetTarget(const Vector3 &targ); nuclear@0: nuclear@0: Vector3 GetViewVector() const; nuclear@0: Vector3 GetPosition() const; nuclear@0: Vector3 GetUpVector() const; nuclear@0: Vector3 GetTargetPosition() const; nuclear@0: nuclear@0: Base GetCameraBase() const; nuclear@0: nuclear@0: inline void MoveTarget(float x, float y, float z); nuclear@0: inline void MoveTargetTo(float x, float y, float z); nuclear@0: inline void RotateTarget(float x, float y, float z); nuclear@0: nuclear@0: void ResetRotation(); nuclear@0: nuclear@0: void CreateCameraMatrix(); nuclear@0: void CreateCameraMatrix(Matrix4x4 *matrix, const Vector3 &Pos, const Vector3 &LookAt, const Vector3 &Up) const; nuclear@0: nuclear@0: void Spin(float rads); nuclear@0: nuclear@0: void SetCameraPath(const Curve *path, const Curve *tpath, dword StartTime, dword EndTime); nuclear@0: void FollowPath(dword time, bool Cycle = false); nuclear@0: void FollowPath(float t); nuclear@0: nuclear@0: dword GetStartTime() const; nuclear@0: dword GetEndTime() const; nuclear@0: }; nuclear@0: nuclear@0: #endif // _CAMERA_H_