Waterflow
Visualize water in terrain
src/readData.h
Go to the documentation of this file.
00001 
00002 
00003 
00004 #ifndef READDATA_H
00005 #define READDATA_H
00006 
00007 #include "loadobj.h"
00008 #include "glm.hpp"
00009 #include <vector>
00010 
00017 struct mapdata {
00018     int ncols;                  
00019     int nrows;                  
00020     int nelem;                  
00021     float xllcorner;            
00022     float yllcorner;            
00023     float cellsize;             
00024     float NODATA_value;         
00025     float max_value;            
00026     float min_value;            
00027     std::vector<float> data;    
00028 };
00029 
00036 class DataHandler
00037 {
00038 private:
00039     mapdata* readdata;          
00040     GLuint terrainBufferID;     
00041     GLfloat terrainScale;       
00042 
00048     void readDEM(const char* inputfile);
00049     
00054     void normConvCompute();
00055 
00056 public:
00064     DataHandler(const char* inputfile);
00065 
00067     ~DataHandler();
00068 
00073     float* getData() { return &readdata->data[0]; }
00074 
00077     int getDataWidth() { return readdata->ncols; }
00078 
00081     int getDataHeight() { return readdata->nrows; }
00082 
00085     int getElem() { return readdata->nelem; }
00086 
00089     GLfloat getTerrainScale() { return terrainScale; }
00090         
00093     GLuint getHeightBuffer() { return terrainBufferID; }
00094 
00102     float getCoord(int col, int row);
00103 
00112     GLfloat giveHeight(GLfloat x, GLfloat z);
00113 };
00114 
00115 #endif // READDATA_H
 All Classes Files Functions Variables Enumerations