2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
11 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
15 #ifndef TEST_CONCAVE_DEMO_H
16 #define TEST_CONCAVE_DEMO_H
20 #include "Win32DemoApplication.h"
21 #define PlatformDemoApplication Win32DemoApplication
23 #include "GlutDemoApplication.h"
24 #define PlatformDemoApplication GlutDemoApplication
27 class btTriangleIndexVertexArray;
28 class btDefaultCollisionConfiguration;
30 //#define BULLET_TRIANGLE_COLLISION 1
31 #define BULLET_GIMPACT 1
32 //#define BULLET_GIMPACT_CONVEX_DECOMPOSITION 1
34 #define TEST_GIMPACT_TORUS
38 #include "BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h"
39 #ifdef BULLET_GIMPACT_CONVEX_DECOMPOSITION
40 #include "../Extras/GIMPACTUtils/btGImpactConvexDecompositionShape.h"
46 #include "BulletCollision/Gimpact/btConcaveConcaveCollisionAlgorithm.h"
47 #include "BulletCollision/Gimpact/btGIMPACTMeshShape.h"
53 class btConstraintSolver;
54 struct btCollisionAlgorithmCreateFunc;
56 ///GimpactConcaveDemo shows usage of static concave triangle meshes
57 ///It also shows per-triangle material (friction/restitution) through CustomMaterialCombinerCallback
58 class GimpactConcaveDemo : public PlatformDemoApplication
65 m_trimeshShape2(NULL),
66 m_indexVertexArrays(NULL),
67 m_indexVertexArrays2(NULL),
73 m_gimpactCollisionCreateFunc(NULL),
74 m_collisionConfiguration(NULL),
79 m_constraintSolver(NULL)
83 virtual ~GimpactConcaveDemo();
86 void initGImpactCollision();
89 virtual void clientMoveAndDisplay();
91 virtual void displayCallback();
93 virtual void clientResetScene();
95 virtual void renderme();
96 virtual void keyboardCallback(unsigned char key, int x, int y);
99 void shootTrimesh(const btVector3& destination);
102 unsigned int m_steps_done;
104 #ifdef BULLET_GIMPACT
105 btCollisionShape *m_trimeshShape;
106 btCollisionShape *m_trimeshShape2;
109 btGIMPACTMeshData * m_trimeshShape;
110 btGIMPACTMeshData * m_trimeshShape2;
112 btCollisionShape * createTorusShape();
113 btCollisionShape * createBunnyShape();
117 //keep the collision shapes, for deletion/cleanup
118 btAlignedObjectArray<btCollisionShape*> m_collisionShapes;
120 btTriangleIndexVertexArray *m_indexVertexArrays;
121 btTriangleIndexVertexArray *m_indexVertexArrays2;
123 btVector3 kinTorusTran;
124 btQuaternion kinTorusRot;
125 btRigidBody *kinematicTorus;
128 btCollisionAlgorithmCreateFunc* m_gimpactCollisionCreateFunc;
130 btDefaultCollisionConfiguration* m_collisionConfiguration;
131 btCollisionDispatcher* m_dispatcher;
132 btBroadphaseInterface* m_broadphase;
133 btConstraintSolver* m_constraintSolver;
135 static DemoApplication* Create()
137 GimpactConcaveDemo* demo = new GimpactConcaveDemo();
144 #endif //CONCAVE_DEMO_H