NTRT Simulator  v1.1
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgHillyGround.h
Go to the documentation of this file.
1 
19 #ifndef TG_HILLY_GROUND_H
20 #define TG_HILLY_GROUND_H
21 
29 #include "tgBulletGround.h"
30 
31 #include "LinearMath/btScalar.h"
32 #include "LinearMath/btVector3.h"
33 // Forward declarations
34 class btRigidBody;
35 class btTriangleIndexVertexArray;
36 
41 {
42  public:
43 
44  struct Config
45  {
46  public:
47  Config(btVector3 eulerAngles = btVector3(0.0, 0.0, 0.0),
48  btScalar friction = 0.5,
49  btScalar restitution = 0.0,
50  btVector3 size = btVector3(500.0, 1.5, 500.0),
51  btVector3 origin = btVector3(0.0, 0.0, 0.0),
52  size_t nx = 50,
53  size_t ny = 50,
54  double margin = 0.05,
55  double triangleSize = 5.0,
56  double waveHeight = 5.0,
57  double offset = 0.5);
58 
60  btVector3 m_eulerAngles;
61 
63  btScalar m_friction;
64 
66  btScalar m_restitution;
67 
69  btVector3 m_size;
70 
72  btVector3 m_origin;
73 
75  size_t m_nx;
76 
78  size_t m_ny;
79 
81  double m_margin;
82 
85 
87  double m_waveHeight;
88 
90  double m_offset;
91  };
92 
98  tgHillyGround();
99 
103  tgHillyGround(const tgHillyGround::Config& config);
104 
106  virtual ~tgHillyGround() { }
107 
112  virtual btRigidBody* getGroundRigidBody() const;
113 
117  btCollisionShape* hillyCollisionShape();
118 
119  private:
121  Config m_config;
122 
127  btTriangleIndexVertexArray* createMesh(size_t triangleCount, int indices[], size_t vertexCount, btVector3 vertices[]);
128 
132  btCollisionShape *createShape(btTriangleIndexVertexArray * pMesh);
133 
137  void setVertices(btVector3 vertices[]);
138 
142  void setIndices(int indices[]);
143 
144 };
145 
146 #endif // TG_HILLY_GROUND_H
Contains the definition of class tgBulletGround.
virtual btRigidBody * getGroundRigidBody() const
virtual ~tgHillyGround()
btCollisionShape * hillyCollisionShape()