NTRT Simulator  v1.1
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgWorldBulletPhysicsImpl.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012, United States Government, as represented by the
3  * Administrator of the National Aeronautics and Space Administration.
4  * All rights reserved.
5  *
6  * The NASA Tensegrity Robotics Toolkit (NTRT) v1 platform is licensed
7  * under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * http://www.apache.org/licenses/LICENSE-2.0.
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15  * either express or implied. See the License for the specific language
16  * governing permissions and limitations under the License.
17 */
18 
19 
20 #ifndef TG_WORLDBULLETPHYSICSIMPL_H
21 #define TG_WORLDBULLETPHYSICSIMPL_H
22 
30 // This application
31 #include "tgWorld.h"
32 #include "tgWorldImpl.h"
33 #include "LinearMath/btAlignedObjectArray.h"
34 
35 
36 
37 // Forward declarations
38 class btCollisionShape;
39 class btTypedConstraint;
40 class btDynamicsWorld;
41 class btRigidBody;
43 class btBroadphaseInterface;
44 class btDispatcher;
45 class tgBulletGround;
46 class tgHillyGround;
47 
53 {
54  public:
55 
64  tgBulletGround* ground);
65 
68 
74  virtual void step(double dt);
75 
80  btDynamicsWorld& dynamicsWorld() const
81  {
82  return *m_pDynamicsWorld;
83  }
84 
90  void addCollisionShape(btCollisionShape* pShape);
91 
96  void deleteCollisionShape(btCollisionShape* pShape);
97 
103  void addConstraint(btTypedConstraint* pConstaint);
104 private:
105 
110  void removeCollisionShapes();
111 
116  void removeConstraints();
117 
123  btDynamicsWorld* createDynamicsWorld() const;
124 
126  bool invariant() const;
127 
128  private:
129 
131  IntermediateBuildProducts * const m_pIntermediateBuildProducts;
132 
133 
134 
137  btDynamicsWorld* m_pDynamicsWorld;
138 
139  /*
140  * A btAlignedObjectArray of collision shapes for easy reference. Does not affect
141  * physics or rendering unles the shape is placed into the dynamics
142  * world. Bullet encourages reuse of collision shapes when possible
143  * for efficiency.
144  */
145  btAlignedObjectArray<btCollisionShape*> m_collisionShapes;
146 
147  /*
148  * A vector of constraints for easy reference. Does not affect
149  * physics or rendering unles the constraint is placed into the dynamics
150  * world.
151  */
152  btAlignedObjectArray<btTypedConstraint*> m_constraints;
153 };
154 
155 #endif // TG_WORLDBULLETPHYSICSIMPL_H
Contains the definition of class tgWorldImpl.
btDynamicsWorld & dynamicsWorld() const
tgWorldBulletPhysicsImpl(const tgWorld::Config &config, tgBulletGround *ground)
void addConstraint(btTypedConstraint *pConstaint)
Contains the definition of class tgWorld $Id$.
void addCollisionShape(btCollisionShape *pShape)
void deleteCollisionShape(btCollisionShape *pShape)