Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6727 was 6727, checked in by bottac, 18 years ago
  • Property svn:executable set to *
File size: 2.2 KB
RevLine 
[5942]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:
[6727]12   main-programmer: bottac@ee.ethz.ch
[5942]13*/
14
[5967]15
[6494]16#include "vertex_array_model.h"
[5942]17
[6494]18
[6727]19#define texRate      32
[6494]20#define texRatef     4.0f
[6727]21#define tileSize     128
[6494]22
[5967]23class SDL_Surface;
24class Vector;
[6494]25class Material;
26class PNode;
27class Texture;
28class HeightMap;
[5942]29
[6494]30class Tile
[5942]31{
32public:
[6494]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();
[5942]56void load();
[6494]57void load(int Mode);
58void load(const char*, int Mode);
59void scale( Vector V); 
[6727]60void setAbsCoor(Vector V);
[6494]61float getHeight(float x, float y); 
[6727]62float getNormal(float x, float y);
[5942]63HeightMap();
[5967]64HeightMap(const char*);
[6494]65HeightMap(const char*, const char*);
[5967]66~HeightMap();
67
[6494]68friend class Tile;
69
[5967]70private:
71SDL_Surface* heightMap;
[6494]72SDL_Surface* colourMap;
73unsigned char* heights; 
74unsigned char* colours;
[5967]75
[6494]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;
[6727]81Vector    camCoords;
82Vector offsetCoords; 
[6494]83Material * tmp_mat;
84Material* red_mat;
85Texture* texture;
86const PNode* camera;
87float scaleX ;
88float scaleY ;
89float scaleZ ;
[6727]90float shiftX ; // to be removed
91float shiftY ; // to be removed
92float shiftZ ; // to be removed
93float offsetX;
94float offsetY;
95float offsetZ;
[6494]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}
[5942]113};
Note: See TracBrowser for help on using the repository browser.