Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6494 was 6494, checked in by bensch, 18 years ago

orxonox/branches/height_map: copy the heightMap to the trunk_merge-branche

  • Property svn:executable set to *
File size: 2.0 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:
13*/
14
15
16#include "vertex_array_model.h"
17
18
19#define texRate      4
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 shift (Vector V);
61float getHeight(float x, float y); 
62HeightMap();
63HeightMap(const char*);
64HeightMap(const char*, const char*);
65~HeightMap();
66
67friend class Tile;
68
69private:
70SDL_Surface* heightMap;
71SDL_Surface* colourMap;
72unsigned char* heights; 
73unsigned char* colours;
74
75void generateNormalVectorField();
76void drawRect(int xBottomLeft, int yBottomLeft, int xTopRight, int yTopRight );
77void fixBoarder(int xBottomLeft, int yBottomLeft, int xTopRight, int yTopRight);
78Vector  **  normalVectorField ; 
79Tile    ***  tiles;
80Vector     camCoords;
81Material * tmp_mat;
82Material* red_mat;
83Texture* texture;
84const PNode* camera;
85float scaleX ;
86float scaleY ;
87float scaleZ ;
88float shiftX ;
89float shiftY ;
90float shiftZ ;
91int   cmScaleX;
92int   cmScaleY;
93bool  hasColourMap;
94
95inline int abs(int val)
96{
97 if(val < 0) val = -val;
98 return val;
99}
100inline int max(int x, int y)
101{
102 return (x>y)? x:y;
103}
104inline int min(int x, int y)
105{
106return (x<y)? x: y;
107}
108};
Note: See TracBrowser for help on using the repository browser.