1 #pragma once 2 // Description: 3 // Camera to enable 1st person shooter type mouselook. 4 // 5 // Copyright (C) 2001 Frank Becker 6 // 7 // This program is free software; you can redistribute it and/or modify it under 8 // the terms of the GNU General Public License as published by the Free Software 9 // Foundation; either version 2 of the License, or (at your option) any later 10 // version. 11 // 12 // This program is distributed in the hope that it will be useful, but WITHOUT 13 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details 15 // 16 17 #include "GLee.h" 18 #include "Trace.hpp" 19 #include "Direction.hpp" 20 #include "Singleton.hpp" 21 22 class Camera 23 { 24 friend class Singleton<Camera>; 25 26 public: 27 void place( void); 28 void billboard( void); 29 void mouseLook( float dx, float dy); 30 void update( void); 31 void move( Direction::DirectionEnum dir, bool isDown); 32 33 private: ~Camera()34 ~Camera() 35 { 36 XTRACE(); 37 } Camera(void)38 Camera( void): 39 _moveCam( false), 40 _cameraMove(0.0), 41 _cameraX(0.0), 42 _cameraY(0.0), 43 _cameraZ(0.0), 44 _cameraYaw(0.0), 45 _cameraPitch(0.0) 46 { 47 XTRACE(); 48 } 49 50 Camera( const Camera&); 51 Camera &operator=(const Camera&); 52 53 void move( GLfloat stepSize, GLfloat angle); 54 void clampCamera( void); 55 56 bool _moveCam; 57 GLfloat _cameraMove; 58 GLfloat _cameraX; 59 GLfloat _cameraY; 60 GLfloat _cameraZ; 61 GLfloat _cameraYaw; 62 GLfloat _cameraPitch; 63 64 }; 65 66 typedef Singleton<Camera> CameraS; 67