Initialize libbullet git in 2.0_beta.
[platform/upstream/libbullet.git] / Demos / ConvexDecompositionDemo / ConvexDecompositionDemo.h
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
4
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:
10
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.
14 */
15 #ifndef CONVEX_DECOMPOSITION_DEMO_H
16 #define CONVEX_DECOMPOSITION_DEMO_H
17
18
19 #ifdef _WINDOWS
20 #include "Win32DemoApplication.h"
21 #define PlatformDemoApplication Win32DemoApplication
22 #else
23 #include "GlutDemoApplication.h"
24 #define PlatformDemoApplication GlutDemoApplication
25 #endif
26
27 #include "LinearMath/btAlignedObjectArray.h"
28
29 class btBroadphaseInterface;
30 class btCollisionShape;
31 class btOverlappingPairCache;
32 class btCollisionDispatcher;
33 class btConstraintSolver;
34 struct btCollisionAlgorithmCreateFunc;
35 class btDefaultCollisionConfiguration;
36 class btTriangleMesh;
37
38 ///ConvexDecompositionDemo shows automatic convex decomposition of a concave mesh
39 class ConvexDecompositionDemo : public PlatformDemoApplication
40 {
41
42         void setupEmptyDynamicsWorld();
43 public:
44
45
46         //keep the collision shapes, for deletion/cleanup
47         btAlignedObjectArray<btCollisionShape*> m_collisionShapes;
48
49         btAlignedObjectArray<btTriangleMesh*> m_trimeshes;
50
51         btBroadphaseInterface*  m_broadphase;
52
53         btCollisionDispatcher*  m_dispatcher;
54
55         btConstraintSolver*     m_solver;
56         
57         btDefaultCollisionConfiguration* m_collisionConfiguration;
58
59
60         virtual void initPhysics();
61
62         void    initPhysics(const char* filename);
63
64         void    exitPhysics();
65
66         virtual ~ConvexDecompositionDemo()
67         {
68                 exitPhysics();
69         }
70
71         virtual void clientMoveAndDisplay();
72
73         virtual void displayCallback();
74
75         static DemoApplication* Create()
76         {
77                 ConvexDecompositionDemo* demo = new ConvexDecompositionDemo();
78                 demo->myinit();
79                 demo->initPhysics("file.obj");
80                 return demo;
81         }       
82         
83         
84 };
85
86 #endif //CONVEX_DECOMPOSITION_DEMO_H
87
88