Imported Upstream version 2.81
[platform/upstream/libbullet.git] / Demos / FractureDemo / FractureDemo.h
1 /*\r
2 Bullet Continuous Collision Detection and Physics Library\r
3 Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/\r
4 \r
5 This software is provided 'as-is', without any express or implied warranty.\r
6 In no event will the authors be held liable for any damages arising from the use of this software.\r
7 Permission is granted to anyone to use this software for any purpose, \r
8 including commercial applications, and to alter it and redistribute it freely, \r
9 subject to the following restrictions:\r
10 \r
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.\r
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.\r
13 3. This notice may not be removed or altered from any source distribution.\r
14 */\r
15 #ifndef FRACTURE_DEMO_H\r
16 #define FRACTURE_DEMO_H\r
17 \r
18 #ifdef _WINDOWS\r
19 #include "Win32DemoApplication.h"\r
20 #define PlatformDemoApplication Win32DemoApplication\r
21 #else\r
22 #include "GlutDemoApplication.h"\r
23 #define PlatformDemoApplication GlutDemoApplication\r
24 #endif\r
25 \r
26 #include "LinearMath/btAlignedObjectArray.h"\r
27 \r
28 class btBroadphaseInterface;\r
29 class btCollisionShape;\r
30 class btOverlappingPairCache;\r
31 class btCollisionDispatcher;\r
32 class btConstraintSolver;\r
33 struct btCollisionAlgorithmCreateFunc;\r
34 class btDefaultCollisionConfiguration;\r
35 \r
36 ///FractureDemo shows basic breaking and glueing of objects\r
37 class FractureDemo : public PlatformDemoApplication\r
38 {\r
39 \r
40         //keep the collision shapes, for deletion/cleanup\r
41         btAlignedObjectArray<btCollisionShape*> m_collisionShapes;\r
42 \r
43         btBroadphaseInterface*  m_broadphase;\r
44 \r
45         btCollisionDispatcher*  m_dispatcher;\r
46 \r
47         btConstraintSolver*     m_solver;\r
48 \r
49         btDefaultCollisionConfiguration* m_collisionConfiguration;\r
50 \r
51         void showMessage();\r
52 \r
53         public:\r
54 \r
55         FractureDemo()\r
56         {\r
57         }\r
58         virtual ~FractureDemo()\r
59         {\r
60                 exitPhysics();\r
61         }\r
62         void    initPhysics();\r
63 \r
64         void    exitPhysics();\r
65 \r
66         virtual void clientMoveAndDisplay();\r
67 \r
68         virtual void displayCallback();\r
69                 \r
70         virtual void keyboardUpCallback(unsigned char key, int x, int y);\r
71 \r
72         virtual void    clientResetScene();\r
73 \r
74         static DemoApplication* Create()\r
75         {\r
76                 FractureDemo* demo = new FractureDemo;\r
77                 demo->myinit();\r
78                 demo->initPhysics();\r
79                 return demo;\r
80         }\r
81 \r
82         void    shootBox(const btVector3& destination);\r
83         \r
84 };\r
85 \r
86 #endif //FRACTURE_DEMO_H\r
87 \r