view.hh (1150B)
1 #ifndef _VIEW_HH_ 2 #define _VIEW_HH_ 3 4 #include "all_includes.hh" 5 6 class Camera { 7 public : 8 Vertex cameraCenter; 9 Vertex cameraSight; 10 11 private : 12 float xAngle; 13 float yAngle; 14 int moveSensitivity; 15 float mouseSensitivity; 16 bool up; 17 bool down; 18 bool left; 19 bool right; 20 bool pageUp; 21 bool pageDown; 22 bool autoPilot; 23 24 public : 25 Camera(Vertex pos, float xA, float yA, int moveSensitivity, float mouseSensitivity); 26 void setCamera(); 27 void mouseMotion(const SDL_MouseMotionEvent &event); 28 void keyboard(const SDL_KeyboardEvent &event); 29 void animation(int elapsedTime); 30 std::ostream& print(std::ostream& os) const; 31 friend std::ostream& operator<<(std::ostream& os, const Camera& c) { return c.print(os); } 32 33 private : 34 int takeScreenshot(const char * filename); 35 }; 36 37 38 class View { 39 private : 40 Chose* root; 41 42 public : 43 Camera camera; 44 private: 45 Lod lod; 46 GLfloat fogColor[4]; 47 48 public : 49 View(Chose* root); 50 void initWindow(); 51 void mainLoop(); 52 void renderScene(int lastTime, int currentTime); 53 void displayAxes(); 54 55 static void setColor(unsigned char r, unsigned char g, unsigned char b); 56 57 private : 58 void setLight(); 59 void setSkybox(); 60 }; 61 62 #endif