Waterflow
Visualize water in terrain
src/program.h
Go to the documentation of this file.
00001 
00002 
00003 
00004 #ifndef PROGRAM_H
00005 #define PROGRAM_H
00006 
00007 #ifdef __APPLE__
00008 #   include <OpenGL/gl3.h>
00009 #   include <SDL2/SDL.h>
00010 #else
00011 #   ifdef  __linux__
00012 #       define GL_GLEXT_PROTOTYPES
00013 #       include <GL/gl.h>
00014 #       include <GL/glu.h>
00015 #       include <GL/glx.h>
00016 #       include <GL/glext.h>
00017 #       include <SDL2/SDL.h>
00018 #   else
00019 #       include "glew.h"
00020 #       include "Windows/sdl2/SDL.h"
00021 #       include "SDL_image.h"
00022 #       include "sdlTexture.h"
00023 #   endif
00024 #endif
00025 
00026 #include "shallowGPU.h"
00027 #include "camera.h"
00028 #include "readData.h"
00029 #include "myDrawable.h"
00030 #include "voxel.h"
00031 #include "heightField.h"
00032 #include "xmlParsing.h"
00033 #include "fileHandler.h"
00034 
00035 #include "AntTweakBar.h"
00036 
00042 class Program {
00043 private:
00044     // Screen stuff
00045     SDL_Window *screen;         
00046     SDL_GLContext glcontext;    
00047 
00048     int screenW; 
00049     int screenH; 
00050 
00051     // States
00052     bool isRunning;     
00053     bool mouseHidden;   
00054 
00055     // Time variables
00056     GLfloat currentTime;    
00057     GLfloat deltaTime;      
00058     GLfloat FPS;            
00059 
00060     GLfloat dtSim;          
00061 
00062     //AntTweakBar variabels
00063     TwBar *antBar;              
00064     float heightAtPos;          
00065     float heightAtClickData;    
00066     float heighAtClickProj;     
00067     double objX;                
00068     double objZ;                
00069 
00070     // myDrawables:
00071     myDrawable *skycube;        
00072     myDrawable *terrain;        
00073     myDrawable *waterTerrain;   
00074 
00075     // Datahandler for terrain data
00076     DataHandler* dataHandler;   
00077     //XML data
00078     init_Data_struct* init_data;    
00079 
00080     // File handlers for save and load simulation data
00081     FileHandler* heightData;    
00082     FileHandler* velocityData;  
00083 
00084     //Voxgrid
00085     Voxelgrid* voxs;    
00086     //HeightField
00087     HeightField* hf;    
00088     //ShallowWater
00089     ShallowGPU* sgpu;   
00090 
00091     // References to shader programs:
00092     GLuint terrainshader;       
00093     GLuint skyshader;           
00094     GLuint watershader;         
00095     GLuint depthshader;         
00096     GLuint shallowwatershader;  
00097 
00098     // Camera variables:
00099     Camera* cam; 
00100 
00101     GLuint simCase; 
00102     
00103     bool sim; 
00104 
00105 public:
00108     Program(GLuint simCase);
00109 
00111     ~Program();
00112 
00118     int exec();
00119     
00125     bool init();
00126     
00134     void handleEvent(SDL_Event* event);
00135 
00141     void handleKeypress(SDL_Event* event);
00142 
00149     void handleMouseMove(SDL_Event* event);
00150 
00159     void handleMouseButton(SDL_Event* event);
00160 
00167     void checkKeys();
00168 
00173     void timeUpdate();
00174 
00179     void update();
00180 
00184     void display();
00185 
00189     void clean();
00190 
00192     int testVoxels();
00193 };
00194 
00195 #endif // PROGRAM_H
 All Classes Files Functions Variables Enumerations