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