Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/height_map_merge/src/lib/graphics/importer/height_map.h @ 6745

Last change on this file since 6745 was 6745, checked in by bottac, 18 years ago
  • Property svn:executable set to *
File size: 2.2 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: bottac@ee.ethz.ch
13*/
14
15
16#include "vertex_array_model.h"
17
18
19#define texRate      32
20#define texRatef     4.0f
21#define tileSize     64
22
23class SDL_Surface;
24class Vector;
25class Material;
26class PNode;
27class Texture;
28class HeightMap;
29
30class Tile
31{
32public:
33void draw();
34void drawHighRes();
35void drawLowRes();
36int getRes();
37int setHighRes(bool b);
38Tile(int i1, int j1, int i2, int j2, HeightMap* hm ) ;
39Tile();
40~Tile();
41
42
43
44private:
45VertexArrayModel* highResModel;
46VertexArrayModel* lowResModel; 
47int highRes;
48int lowRes;
49void load(int i1, int j1, int i2, int i2, HeightMap* hm, VertexArrayModel* model, int Res);
50};
51
52class HeightMap : public VertexArrayModel
53{
54public:
55void draw();
56void load();
57void load(int Mode);
58void load(const char*, int Mode);
59void scale( Vector V); 
60void setAbsCoor(Vector V);
61float getHeight(float x, float y); 
62float getNormal(float x, float y);
63HeightMap();
64HeightMap(const char*);
65HeightMap(const char*, const char*);
66~HeightMap();
67
68friend class Tile;
69
70private:
71SDL_Surface* heightMap;
72SDL_Surface* colourMap;
73unsigned char* heights; 
74unsigned char* colours;
75
76void generateNormalVectorField();
77void drawRect(int xBottomLeft, int yBottomLeft, int xTopRight, int yTopRight );
78void fixBoarder(int xBottomLeft, int yBottomLeft, int xTopRight, int yTopRight);
79Vector  **  normalVectorField ; 
80Tile    ***  tiles;
81Vector    camCoords;
82Vector offsetCoords; 
83Material * tmp_mat;
84Material* red_mat;
85Texture* texture;
86const PNode* camera;
87float scaleX ;
88float scaleY ;
89float scaleZ ;
90float shiftX ; // to be removed
91float shiftY ; // to be removed
92float shiftZ ; // to be removed
93float offsetX;
94float offsetY;
95float offsetZ;
96int   cmScaleX;
97int   cmScaleY;
98bool  hasColourMap;
99
100inline int abs(int val)
101{
102 if(val < 0) val = -val;
103 return val;
104}
105inline int max(int x, int y)
106{
107 return (x>y)? x:y;
108}
109inline int min(int x, int y)
110{
111return (x<y)? x: y;
112}
113};
Note: See TracBrowser for help on using the repository browser.