Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

HeightMapLoader.h

Go to the documentation of this file.
00001 #ifndef _HEIGHTMAPLOADER_H_
00002 #define _HEIGHTMAPLOADER_H_
00003 
00004 #include <vector>
00005 using namespace std;
00006 
00007 #include <GL/gl.h>
00008 
00009 #include "SDL.h"
00010 #include "SDL_image.h"
00011 
00012 #include "Vector2.h"
00013 #include "Vector3.h"
00014 #include "VectorMath.h"
00015 #include "FileLoader.h"
00016 
00022 class HeightMapLoader : public FileLoader
00023 {
00024  public:
00025   HeightMapLoader(string filename, int width, int height);
00026   virtual ~HeightMapLoader();
00027 
00031   virtual void load();
00032 
00036   int getHeight(int x, int z);
00041   virtual int getHeight2(int x, int z);
00042   int getScaleSize() { return _scaleSize; }
00043 
00044   int getWidthDimension() { return _width * _scaleSize; }
00045   int getHeightDimension() { return _height * _scaleSize; }
00046 
00047  protected:
00052   void buildTriangles();
00053   void buildSquares();
00057   void decimate();
00058   void decimate2();
00059   void decimate3();
00060   void decimateRepeat();
00061   void triangulate();
00062   vector <int > findIndiciesAtVerticie(Vector3 v);
00063 
00064   int _width;
00065   int _height;
00066   
00067   //unsigned char *_data; // holds the heights
00068   int *_data;
00069 
00070   int _scaleSize;
00071   int _scaleHeight;
00072 
00073   vector < Vector3 > _facesTmp;
00074 };
00075 
00076 #endif

Generated on Wed Apr 21 11:10:53 2004 for naturecalls by doxygen1.2.18