Waterflow
Visualize water in terrain
src/camera.h
Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 #ifndef CAMERA_H
00007 #define CAMERA_H
00008 
00009 #ifdef __APPLE__
00010 #   include <OpenGL/gl3.h>
00011 #   include <SDL2/SDL.h>
00012 #else
00013 #   ifdef  __linux__
00014 #       define GL_GLEXT_PROTOTYPES
00015 #       include <GL/gl.h>
00016 #       include <GL/glu.h>
00017 #       include <GL/glx.h>
00018 #       include <GL/glext.h>
00019 #       include <SDL2/SDL.h>
00020 #   else
00021 #       include "glew.h"
00022 #       include "Windows/sdl2/SDL.h"
00023 #   endif
00024 #endif
00025 
00026 #include "glm.hpp"
00027 #include "readData.h"
00028 
00031 class Camera {
00032 private:
00033     int x;                      
00034     float fi;                   
00035     float theta;                
00036     float rotSpeed;             
00037     int *screenW;               
00038     int *screenH;               
00039     GLfloat speed;              
00040     GLfloat drawDistance;       
00041     bool isFrozen;              
00042     int terrW;                  
00043     int terrH;                  
00044     int xzLim;                  
00045     int yLimLo;                 
00046     int yLimHi;                 
00047     DataHandler* terrain;       
00048     glm::vec3 position;         
00049     glm::vec3 lookAtPos;        
00050     glm::vec3 up;               
00051     glm::mat4 WTVMatrix;        
00052     glm::mat4 VTPMatrix;        
00053     bool unlocked;              
00054 
00061     bool isInCollisionBox(glm::vec3 transVec, bool xz);
00062 public:
00074     Camera(glm::vec3 startPos, int* initScreenW, int* initScreenH, int tH, int tW, int xzL, int yLL, int yLH, DataHandler* terr);
00075 
00077     void unlock();
00078 
00083     void rotate(char direction, GLfloat angle);
00084 
00090     void translate(GLfloat dx, GLfloat dy, GLfloat dz);
00091 
00095     void forward(GLfloat d);
00096 
00100     void strafe(GLfloat d);
00101 
00107     void jump(GLfloat d);
00108 
00110     void updateWTV();
00111 
00113     void updateVTP();
00114 
00118     void uploadCamData(GLuint program);
00119 
00121     void toggleFrozen();
00122 
00127     void changeLookAtPos(int xrel, int yrel);
00128 
00131     glm::mat4* getWTV(); 
00132 
00135     glm::mat4* getVTP();
00136 
00139     glm::vec3* getPos();
00140 
00143     GLfloat getSpeed();
00144 
00147     GLfloat* getSpeedPtr();
00148 
00151     GLfloat getRotSpeed();
00152 
00155     GLfloat* getRotSpeedPtr();
00156 };
00157 
00158 #endif // CAMERA_H
 All Classes Files Functions Variables Enumerations