NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgHillyGround.h
Go to the documentation of this file.
1 
19 #ifndef CORE_TERRAIN_TG_HILLY_GROUND_H
20 #define CORE_TERRAIN_TG_HILLY_GROUND_H
21 
29 #include "tgBulletGround.h"
30 
31 #include "LinearMath/btScalar.h"
32 #include "LinearMath/btVector3.h"
33 
34 // std::size_t
35 #include <cstddef>
36 
37 // Forward declarations
38 class btRigidBody;
39 class btTriangleIndexVertexArray;
40 
45 {
46  public:
47 
48  struct Config
49  {
50  public:
51  Config(btVector3 eulerAngles = btVector3(0.0, 0.0, 0.0),
52  double friction = 0.5,
53  double restitution = 0.0,
54  btVector3 size = btVector3(500.0, 1.5, 500.0),
55  btVector3 origin = btVector3(0.0, 0.0, 0.0),
56  std::size_t nx = 50,
57  std::size_t ny = 50,
58  double margin = 0.05,
59  double triangleSize = 5.0,
60  double waveHeight = 5.0,
61  double offset = 0.5);
62 
64  btVector3 m_eulerAngles;
65 
67  btScalar m_friction;
68 
70  btScalar m_restitution;
71 
73  btVector3 m_size;
74 
76  btVector3 m_origin;
77 
79  std::size_t m_nx;
80 
82  std::size_t m_ny;
83 
85  double m_margin;
86 
89 
91  double m_waveHeight;
92 
94  double m_offset;
95  };
96 
102  tgHillyGround();
103 
107  tgHillyGround(const tgHillyGround::Config& config);
108 
110  virtual ~tgHillyGround();
111 
116  virtual btRigidBody* getGroundRigidBody() const;
117 
121  btCollisionShape* hillyCollisionShape();
122 
123  private:
125  Config m_config;
126 
131  btTriangleIndexVertexArray* createMesh(std::size_t triangleCount, int indices[], std::size_t vertexCount, btVector3 vertices[]);
132 
136  btCollisionShape *createShape(btTriangleIndexVertexArray * pMesh);
137 
141  void setVertices(btVector3 vertices[]);
142 
146  void setIndices(int indices[]);
147 
148  // Store this so we can delete it later
149  btTriangleIndexVertexArray* m_pMesh;
150  btVector3 * m_vertices;
151  int * m_pIndices;
152 
153 };
154 
155 #endif // TG_HILLY_GROUND_H
Contains the definition of class tgBulletGround.
virtual ~tgHillyGround()
virtual btRigidBody * getGroundRigidBody() const
btCollisionShape * hillyCollisionShape()