Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/resources/src/lib/graphics/importer/height_map.h @ 8284

Last change on this file since 8284 was 7221, checked in by bensch, 19 years ago

orxonox/trunk: merged the std-branche back, it runs on windows and Linux

svn merge https://svn.orxonox.net/orxonox/branches/std . -r7202:HEAD

  • 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();
40float x;
41float z;
42virtual ~Tile();
43
44
45
46private:
47HeightMap* hmref;
48VertexArrayModel* highResModel;
49VertexArrayModel* lowResModel;
50int highRes;
51int lowRes;
52void load(int i1, int j1, int i2, int i2, HeightMap* hm, VertexArrayModel* model, int Res);
53};
54
55class HeightMap : public VertexArrayModel
56{
57public:
58void draw();
59void load();
60void load(int Mode);
61void load(const std::string&, int Mode);
62void scale( Vector V);
63void setAbsCoor(Vector V);
64float getHeight(float x, float y);
65float getNormal(float x, float y);
66HeightMap();
67HeightMap(const std::string&);
68HeightMap(const std::string&, const std::string&);
69virtual ~HeightMap();
70
71friend class Tile;
72
73private:
74SDL_Surface* heightMap;
75SDL_Surface* colourMap;
76unsigned char* heights;
77unsigned char* colours;
78
79void generateNormalVectorField();
80void drawRect(int xBottomLeft, int yBottomLeft, int xTopRight, int yTopRight );
81void fixBoarder(int xBottomLeft, int yBottomLeft, int xTopRight, int yTopRight);
82Vector  **  normalVectorField ;
83Tile    ***  tiles;
84Vector    camCoords;
85Vector offsetCoords;
86Material * tmp_mat;
87Material* red_mat;
88Texture* texture;
89const PNode* camera;
90float scaleX ;
91float scaleY ;
92float scaleZ ;
93float shiftX ; // to be removed
94float shiftY ; // to be removed
95float shiftZ ; // to be removed
96float offsetX;
97float offsetY;
98float offsetZ;
99int   cmScaleX;
100int   cmScaleY;
101bool  hasColourMap;
102
103inline int abs(int val)
104{
105 if(val < 0) val = -val;
106 return val;
107}
108inline int max(int x, int y)
109{
110 return (x>y)? x:y;
111}
112inline int min(int x, int y)
113{
114return (x<y)? x: y;
115}
116};
Note: See TracBrowser for help on using the repository browser.