1 | /*! |
---|
2 | * @file terrain.h |
---|
3 | * Defines and handles the terrain of the World |
---|
4 | |
---|
5 | @todo implement it |
---|
6 | |
---|
7 | The terrain should either be build from a Model a OBJModel or from a HeightMap. |
---|
8 | */ |
---|
9 | |
---|
10 | #ifndef _TERRAIN_H |
---|
11 | #define _TERRAIN_H |
---|
12 | |
---|
13 | #include "world_entity.h" |
---|
14 | #include "vector.h" |
---|
15 | |
---|
16 | // FORWARD DECLARATION |
---|
17 | class SpatialSeparation; |
---|
18 | class HeightMap; |
---|
19 | class Material; |
---|
20 | class BspManager; |
---|
21 | |
---|
22 | //! A simple method to call a desired debug world. |
---|
23 | enum DebugTerrain {TERRAIN_DAVE, TERRAIN_BENSCH}; |
---|
24 | |
---|
25 | |
---|
26 | //! A Class to handle Terrain of orxonox |
---|
27 | class Terrain : public WorldEntity |
---|
28 | { |
---|
29 | |
---|
30 | public: |
---|
31 | Terrain(const TiXmlElement* root = NULL); |
---|
32 | Terrain(const std::string& fileName); |
---|
33 | Terrain(DebugTerrain debugTerrain); |
---|
34 | virtual ~Terrain(); |
---|
35 | |
---|
36 | virtual int writeBytes(const byte* data, int length, int sender); |
---|
37 | virtual int readBytes(byte* data, int maxLength, int * reciever); |
---|
38 | virtual void writeDebug() const; |
---|
39 | virtual void readDebug() const; |
---|
40 | |
---|
41 | void init(); |
---|
42 | virtual void loadParams(const TiXmlElement* root); |
---|
43 | |
---|
44 | void loadVegetation(const std::string& vegetationFile); |
---|
45 | |
---|
46 | void loadHeightMap(const std::string& heightMapFile, const std::string& colorMap); |
---|
47 | void loadTexture(const std::string& textureName); |
---|
48 | void setScale(float x, float y, float z); |
---|
49 | |
---|
50 | void buildDebugTerrain(DebugTerrain debugTerrain); |
---|
51 | |
---|
52 | float getHeight(float x, float y); |
---|
53 | virtual void draw() const; |
---|
54 | |
---|
55 | public: |
---|
56 | SpatialSeparation* ssp; |
---|
57 | |
---|
58 | private: |
---|
59 | Model* vegetation; |
---|
60 | int objectList; |
---|
61 | |
---|
62 | HeightMap* heightMap; |
---|
63 | BspManager* bspManager; |
---|
64 | Material* heightMapMaterial; |
---|
65 | Vector terrainScale; |
---|
66 | }; |
---|
67 | |
---|
68 | #endif /* _TERRAIN_H */ |
---|