www.pudn.com > Particles1.zip > camera.h
#ifndef _CC_CAMERA_INCLUDED #define _CC_CAMERA_INCLUDED #include// Need to include it here because the GL* types are required #define PI 3.14159265359 #define PIdiv180 3.14159265359/180.0 #include "basics.h" ///////////////////////////////// //Note: All angles in degrees // ///////////////////////////////// class CCamera { private: SF3dVector Position; SF3dVector ViewDir; /*Not used for rendering the camera, but for "moveforwards" So it is not necessary to "actualize" it always. It is only actualized when ViewDirChanged is true and moveforwards is called*/ bool ViewDirChanged; GLfloat RotatedX, RotatedY, RotatedZ; void GetViewDir ( void ); public: CCamera(); //inits the values (Position: (0|0|0) Target: (0|0|-1) ) void Render ( void ); //executes some glRotates and a glTranslate command //Note: You should call glLoadIdentity before using Render void Move ( SF3dVector Direction ); void RotateX ( GLfloat Angle ); void RotateY ( GLfloat Angle ); void RotateZ ( GLfloat Angle ); void RotateXYZ ( SF3dVector Angles ); void MoveForwards ( GLfloat Distance ); void StrafeRight ( GLfloat Distance ); SF3dVector GetPosition(); }; SF3dVector F3dVector ( GLfloat x, GLfloat y, GLfloat z ); SF3dVector AddF3dVectors ( SF3dVector * u, SF3dVector * v); void AddF3dVectorToVector ( SF3dVector * Dst, SF3dVector * V2); #endif