| 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 | |
|---|
| 21 | //! A simple method to call a desired debug world. |
|---|
| 22 | enum DebugTerrain {TERRAIN_DAVE, TERRAIN_BENSCH}; |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | //! A Class to handle Terrain of orxonox |
|---|
| 26 | class Terrain : public WorldEntity |
|---|
| 27 | { |
|---|
| 28 | |
|---|
| 29 | public: |
|---|
| 30 | Terrain(const TiXmlElement* root = NULL); |
|---|
| 31 | Terrain(const std::string& fileName); |
|---|
| 32 | Terrain(DebugTerrain debugTerrain); |
|---|
| 33 | virtual ~Terrain(); |
|---|
| 34 | |
|---|
| 35 | virtual int writeBytes(const byte* data, int length, int sender); |
|---|
| 36 | virtual int readBytes(byte* data, int maxLength, int * reciever); |
|---|
| 37 | virtual void writeDebug() const; |
|---|
| 38 | virtual void readDebug() const; |
|---|
| 39 | |
|---|
| 40 | void init(); |
|---|
| 41 | virtual void loadParams(const TiXmlElement* root); |
|---|
| 42 | |
|---|
| 43 | void loadVegetation(const std::string& vegetationFile); |
|---|
| 44 | |
|---|
| 45 | void loadHeightMap(const std::string& heightMapFile, const std::string& colorMap); |
|---|
| 46 | void loadTexture(const std::string& textureName); |
|---|
| 47 | void setScale(float x, float y, float z); |
|---|
| 48 | |
|---|
| 49 | void buildDebugTerrain(DebugTerrain debugTerrain); |
|---|
| 50 | |
|---|
| 51 | float getHeight(float x, float y); |
|---|
| 52 | virtual void draw() const; |
|---|
| 53 | |
|---|
| 54 | public: |
|---|
| 55 | SpatialSeparation* ssp; |
|---|
| 56 | |
|---|
| 57 | private: |
|---|
| 58 | Model* vegetation; |
|---|
| 59 | int objectList; |
|---|
| 60 | |
|---|
| 61 | HeightMap* heightMap; |
|---|
| 62 | Material* heightMapMaterial; |
|---|
| 63 | Vector terrainScale; |
|---|
| 64 | }; |
|---|
| 65 | |
|---|
| 66 | #endif /* _TERRAIN_H */ |
|---|