[4597] | 1 | /*! |
---|
[5039] | 2 | * @file terrain.h |
---|
[4836] | 3 | * Defines and handles the terrain of the World |
---|
[3329] | 4 | |
---|
[4836] | 5 | @todo implement it |
---|
[3559] | 6 | |
---|
| 7 | The terrain should either be build from a Model a OBJModel or from a HeightMap. |
---|
[3245] | 8 | */ |
---|
[1853] | 9 | |
---|
[3559] | 10 | #ifndef _TERRAIN_H |
---|
| 11 | #define _TERRAIN_H |
---|
[1853] | 12 | |
---|
[3559] | 13 | #include "world_entity.h" |
---|
[9919] | 14 | #include <ode/ode.h> |
---|
[1853] | 15 | |
---|
[5405] | 16 | // FORWARD DECLARATION |
---|
[4889] | 17 | class SpatialSeparation; |
---|
[6956] | 18 | class HeightMap; |
---|
| 19 | class Material; |
---|
[3543] | 20 | |
---|
[3564] | 21 | //! A simple method to call a desired debug world. |
---|
| 22 | enum DebugTerrain {TERRAIN_DAVE, TERRAIN_BENSCH}; |
---|
| 23 | |
---|
| 24 | |
---|
[3559] | 25 | //! A Class to handle Terrain of orxonox |
---|
[4597] | 26 | class Terrain : public WorldEntity |
---|
[3559] | 27 | { |
---|
[9869] | 28 | ObjectListDeclaration(Terrain); |
---|
[9919] | 29 | |
---|
[1904] | 30 | public: |
---|
[4607] | 31 | Terrain(const TiXmlElement* root = NULL); |
---|
[7221] | 32 | Terrain(const std::string& fileName); |
---|
[3564] | 33 | Terrain(DebugTerrain debugTerrain); |
---|
[4746] | 34 | virtual ~Terrain(); |
---|
[4597] | 35 | |
---|
[9919] | 36 | void go(); |
---|
| 37 | void checkCollisionTerrain(WorldEntity* worldEntity); /*!< WorldEntities use this function to check wheter they collided with the BspEntity. |
---|
| 38 | If a collision has been detected, the collides-function of worldEntity will be called.*/ |
---|
| 39 | |
---|
[4746] | 40 | void init(); |
---|
[6512] | 41 | virtual void loadParams(const TiXmlElement* root); |
---|
[4607] | 42 | |
---|
[7221] | 43 | void loadVegetation(const std::string& vegetationFile); |
---|
[5465] | 44 | |
---|
[7221] | 45 | void loadHeightMap(const std::string& heightMapFile, const std::string& colorMap); |
---|
| 46 | void loadTexture(const std::string& textureName); |
---|
[7046] | 47 | void setScale(float x, float y, float z); |
---|
[6956] | 48 | |
---|
[3564] | 49 | void buildDebugTerrain(DebugTerrain debugTerrain); |
---|
[7046] | 50 | |
---|
[6956] | 51 | float getHeight(float x, float y); |
---|
[5500] | 52 | virtual void draw() const; |
---|
[3245] | 53 | |
---|
[4919] | 54 | public: |
---|
| 55 | SpatialSeparation* ssp; |
---|
| 56 | |
---|
[3245] | 57 | private: |
---|
[5465] | 58 | Model* vegetation; |
---|
[9869] | 59 | int modelList; |
---|
[9919] | 60 | bool loaded; |
---|
[6956] | 61 | HeightMap* heightMap; |
---|
| 62 | Material* heightMapMaterial; |
---|
[7046] | 63 | Vector terrainScale; |
---|
[9919] | 64 | unsigned int* Ind; |
---|
| 65 | |
---|
| 66 | dTriMeshDataID ODE_Geometry; //!< ODE Geometry Data of the static model |
---|
| 67 | dGeomID ODE_Geom_ID; //!< ID of ODE Geometry Data |
---|
| 68 | dWorldID world; |
---|
| 69 | dSpaceID space; |
---|
| 70 | dJointGroupID contactgroup; |
---|
| 71 | dContact contact[300]; |
---|
[1853] | 72 | }; |
---|
| 73 | |
---|
[3559] | 74 | #endif /* _TERRAIN_H */ |
---|