Initialize libbullet git in 2.0_beta.
[platform/upstream/libbullet.git] / Demos / Gpu3dDemo / BasicDemo3d.h
1 /*
2 Bullet Continuous Collision Detection and Physics Library, http://bulletphysics.org
3 Copyright (C) 2006, 2007 Sony Computer Entertainment Inc. 
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
16 #ifndef BASIC_DEMO3D_H
17 #define BASIC_DEMO3D_H
18
19 #include "GlutDemoApplication.h"
20 #include "LinearMath/btAlignedObjectArray.h"
21 #include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
22
23 class btBroadphaseInterface;
24 class btCollisionShape;
25 class btOverlappingPairCache;
26 class btCollisionDispatcher;
27 class btConstraintSolver;
28 struct btCollisionAlgorithmCreateFunc;
29 class btDefaultCollisionConfiguration;
30
31 ///BasicDemo is good starting point for learning the code base and porting.
32 class BasicDemo3D : public GlutDemoApplication
33 {
34
35         //keep the collision shapes, for deletion/cleanup
36         btAlignedObjectArray<btCollisionShape*> m_collisionShapes;
37
38         btBroadphaseInterface*  m_broadphase;
39
40         btCollisionDispatcher*  m_dispatcher;
41
42         btConstraintSolver*     m_solver;
43
44         btDefaultCollisionConfiguration* m_collisionConfiguration;
45
46         int m_mouseButtons;
47         int m_mouseOldX;
48         int m_mouseOldY;
49
50         public:
51
52         BasicDemo3D()
53         {
54         }
55         virtual ~BasicDemo3D()
56         {
57                 exitPhysics();
58         }
59         void    initPhysics();
60
61         void    exitPhysics();
62
63         virtual void clientMoveAndDisplay();
64
65         virtual void displayCallback();
66
67         virtual void keyboardCallback(unsigned char key, int x, int y);
68         virtual void mouseFunc(int button, int state, int x, int y);
69         virtual void    mouseMotionFunc(int x,int y);
70
71         virtual void clientResetScene();
72
73         static DemoApplication* Create()
74         {
75                 BasicDemo3D* demo = new BasicDemo3D;
76                 demo->myinit();
77                 demo->initPhysics();
78                 demo->m_mouseButtons = 0;
79                 demo->m_mouseOldX = 0;
80                 demo->m_mouseOldY = 0;
81                 return demo;
82         }
83
84         void DrawConstraintInfo();
85         void outputDebugInfo(int & xOffset,int & yStart, int  yIncr);
86         virtual void renderme();
87         
88         void setWireMode(bool wireOnOff);
89 };
90
91
92 #endif //BASIC_DEMO3D_H
93