Changeset 7466 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- May 1, 2006, 10:43:09 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/height_map.h
r7221 r7466 11 11 ### File Specific: 12 12 main-programmer: bottac@ee.ethz.ch 13 14 review: patrick boenzli, patrick@orxonox.ethz.ch 13 15 */ 14 16 … … 28 30 class HeightMap; 29 31 32 33 //!< one part of the height map 30 34 class Tile 31 35 { 32 public:33 void draw();34 void drawHighRes();35 void drawLowRes();36 int getRes(); 37 int setHighRes(bool b);38 Tile(int i1, int j1, int i2, int j2, HeightMap* hm );39 Tile(); 40 float x;41 float z;42 virtual ~Tile();36 public: 37 Tile(); 38 Tile(int i1, int j1, int i2, int j2, HeightMap* hm) ; 39 virtual ~Tile(); 40 41 int getRes(); 42 int setHighRes(bool b); 43 44 void draw(); 45 void drawHighRes(); 46 void drawLowRes(); 43 47 44 48 49 private: 50 void load(int i1, int j1, int i2, int i2, HeightMap* hm, VertexArrayModel* model, int Res); 45 51 46 private: 47 HeightMap* hmref; 48 VertexArrayModel* highResModel; 49 VertexArrayModel* lowResModel; 50 int highRes; 51 int lowRes; 52 void load(int i1, int j1, int i2, int i2, HeightMap* hm, VertexArrayModel* model, int Res); 52 53 public: 54 float x; 55 float z; 56 57 58 private: 59 HeightMap* hmref; //!< 60 VertexArrayModel* highResModel; //!< 61 VertexArrayModel* lowResModel; //!< 62 int highRes; //!< 63 int lowRes; //!< 53 64 }; 54 65 66 67 //!< the height map representation itself 55 68 class HeightMap : public VertexArrayModel 56 69 { 57 public: 58 void draw(); 59 void load(); 60 void load(int Mode); 61 void load(const std::string&, int Mode); 62 void scale( Vector V); 63 void setAbsCoor(Vector V); 64 float getHeight(float x, float y); 65 float getNormal(float x, float y); 66 HeightMap(); 67 HeightMap(const std::string&); 68 HeightMap(const std::string&, const std::string&); 69 virtual ~HeightMap(); 70 friend class Tile; 70 71 71 friend class Tile; 72 public: 73 HeightMap(); 74 HeightMap(const std::string&); 75 HeightMap(const std::string&, const std::string&); 76 virtual ~HeightMap(); 72 77 73 private: 74 SDL_Surface* heightMap; 75 SDL_Surface* colourMap; 76 unsigned char* heights; 77 unsigned char* colours; 78 void setAbsCoor(Vector V); 79 float getHeight(float x, float y); 80 float getNormal(float x, float y); 78 81 79 void generateNormalVectorField(); 80 void drawRect(int xBottomLeft, int yBottomLeft, int xTopRight, int yTopRight ); 81 void fixBoarder(int xBottomLeft, int yBottomLeft, int xTopRight, int yTopRight); 82 Vector ** normalVectorField ; 83 Tile *** tiles; 84 Vector camCoords; 85 Vector offsetCoords; 86 Material * tmp_mat; 87 Material* red_mat; 88 Texture* texture; 89 const PNode* camera; 90 float scaleX ; 91 float scaleY ; 92 float scaleZ ; 93 float shiftX ; // to be removed 94 float shiftY ; // to be removed 95 float shiftZ ; // to be removed 96 float offsetX; 97 float offsetY; 98 float offsetZ; 99 int cmScaleX; 100 int cmScaleY; 101 bool hasColourMap; 82 void load(); 83 void load(int Mode); 84 void load(const std::string&, int Mode); 85 void scale( Vector V); 102 86 103 inline int abs(int val) 104 { 105 if(val < 0) val = -val; 106 return val; 107 } 108 inline int max(int x, int y) 109 { 110 return (x>y)? x:y; 111 } 112 inline int min(int x, int y) 113 { 114 return (x<y)? x: y; 115 } 87 void draw(); 88 89 90 private: 91 void generateNormalVectorField(); 92 void drawRect(int xBottomLeft, int yBottomLeft, int xTopRight, int yTopRight ); 93 void fixBoarder(int xBottomLeft, int yBottomLeft, int xTopRight, int yTopRight); 94 95 /** helper function absolute value @param val value*/ 96 inline int abs(int val) { return (val<0)?-val:val; } 97 /** returns the max of two numbers @param x value 1 @param y value 2*/ 98 inline int max(int x, int y) { return (x>y)? x:y; } 99 /** returns the min of two numbers @param x value 1 @param y value 2*/ 100 inline int min(int x, int y) { return (x<y)? x: y; } 101 102 103 private: 104 SDL_Surface* heightMap; 105 SDL_Surface* colourMap; 106 unsigned char* heights; 107 unsigned char* colours; 108 109 Vector** normalVectorField; 110 Tile*** tiles; 111 Vector camCoords; 112 Vector offsetCoords; 113 Material* tmp_mat; 114 Material* red_mat; 115 Texture* texture; 116 const PNode* camera; 117 118 float scaleX ; 119 float scaleY ; 120 float scaleZ ; 121 float shiftX ; // to be removed 122 float shiftY ; // to be removed 123 float shiftZ ; // to be removed 124 float offsetX; 125 float offsetY; 126 float offsetZ; 127 int cmScaleX; 128 int cmScaleY; 129 bool hasColourMap; 116 130 };
Note: See TracChangeset
for help on using the changeset viewer.