Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/ODE/src/world_entities/terrain.h @ 10293

Last change on this file since 10293 was 9919, checked in by bottac, 18 years ago

CrPhysicsFullWalk on Static Models and BSP Patches almost working. libODE≥0.7 required.
Screenshot: http://people.ee.ethz.ch/~bottac/Collision_ODE/

File size: 1.9 KB
Line 
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  <ode/ode.h>
15
16// FORWARD DECLARATION
17class SpatialSeparation;
18class HeightMap;
19class Material;
20
21//! A simple method to call a desired debug world.
22enum DebugTerrain {TERRAIN_DAVE, TERRAIN_BENSCH};
23
24
25//! A Class to handle Terrain of orxonox
26class Terrain : public WorldEntity
27{
28  ObjectListDeclaration(Terrain);
29 
30 public:
31  Terrain(const TiXmlElement* root = NULL);
32  Terrain(const std::string& fileName);
33  Terrain(DebugTerrain debugTerrain);
34  virtual ~Terrain();
35
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
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                 modelList;
60   bool loaded;
61   HeightMap*          heightMap;
62   Material*           heightMapMaterial;
63   Vector              terrainScale;
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];
72};
73
74#endif /* _TERRAIN_H */
Note: See TracBrowser for help on using the repository browser.