Imported Upstream version 2.81
[platform/upstream/libbullet.git] / Demos / ParticlesOpenCL / ParticlesDemo.h
1 /*\r
2 Bullet Continuous Collision Detection and Physics Library, http://bulletphysics.org\r
3 Copyright (C) 2006 - 2009 Sony Computer Entertainment Inc. \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 \r
16 #ifndef SPHERES_GRID_DEMO_H\r
17 #define SPHERES_GRID_DEMO_H\r
18 \r
19 #define USE_BULLET_BODIES 0\r
20 \r
21 ///enable one or both options (NVidia profiler doesn't support multi-OpenCL context)\r
22 #define INTEGRATION_DEMO 1\r
23 #define SPHERES_DEMO 1\r
24 \r
25 #include "DemoApplication.h"\r
26 #include "LinearMath/btAlignedObjectArray.h"\r
27 #include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"\r
28 \r
29 #include "btParticlesDynamicsWorld.h"\r
30 \r
31 class btBroadphaseInterface;\r
32 class btCollisionShape;\r
33 class btOverlappingPairCache;\r
34 class btCollisionDispatcher;\r
35 class btConstraintSolver;\r
36 struct btCollisionAlgorithmCreateFunc;\r
37 class btDefaultCollisionConfiguration;\r
38 #include "../OpenGL/GlutDemoApplication.h"\r
39 \r
40 \r
41 ///BasicDemo is good starting point for learning the code base and porting.\r
42 class ParticlesDemo : public GlutDemoApplication\r
43 {\r
44 \r
45         class GL_DialogDynamicsWorld* m_dialogDynamicsWorld;\r
46         //keep the collision shapes, for deletion/cleanup\r
47         btAlignedObjectArray<btCollisionShape*> m_collisionShapes;\r
48 \r
49         btBroadphaseInterface*  m_broadphase;\r
50 \r
51         btCollisionDispatcher*  m_dispatcher;\r
52 \r
53         btConstraintSolver*     m_solver;\r
54 \r
55         btDefaultCollisionConfiguration* m_collisionConfiguration;\r
56 \r
57         btOverlappingPairCache* m_pairCache;\r
58 \r
59         int m_mouseButtons;\r
60         int m_mouseOldX;\r
61         int m_mouseOldY;\r
62 \r
63         int m_argc;\r
64         char** m_argv;\r
65 \r
66         public:\r
67 \r
68                 int m_drawGridMode;\r
69                 int m_GpuCpuTogglePtr;\r
70 \r
71         btParticlesDynamicsWorld* m_pWorld;\r
72         \r
73 \r
74         // shader\r
75         GLuint                          m_shaderProgram;\r
76 \r
77         ParticlesDemo(int argc, char** argv)\r
78         {\r
79                 m_argc = argc;\r
80                 m_argv = argv;\r
81                 m_drawGridMode = 0; \r
82                 m_GpuCpuTogglePtr = SIMSTAGE_NONE;\r
83                 m_dialogDynamicsWorld = 0;\r
84         }\r
85         virtual ~ParticlesDemo()\r
86         {\r
87                 exitPhysics();\r
88         }\r
89         void    initPhysics();\r
90 \r
91         void    exitPhysics();\r
92 \r
93         virtual void clientMoveAndDisplay();\r
94 \r
95         virtual void displayCallback();\r
96 \r
97         virtual void keyboardCallback(unsigned char key, int x, int y);\r
98 \r
99         virtual void clientResetScene();\r
100 \r
101         virtual void mouseFunc(int button, int state, int x, int y);\r
102         virtual void    mouseMotionFunc(int x,int y);\r
103         virtual void reshape(int w, int h);\r
104 /*\r
105         static DemoApplication* Create()\r
106         {\r
107                 SpheresGridDemo* demo = new SpheresGridDemo;\r
108                 demo->myinit();\r
109                 demo->initPhysics();\r
110                 demo->m_mouseButtons = 0;\r
111                 demo->m_mouseOldX = 0;\r
112                 demo->m_mouseOldY = 0;\r
113                 return demo;\r
114         }\r
115 */\r
116 \r
117         void outputDebugInfo(int & xOffset,int & yStart, int  yIncr);\r
118         \r
119 \r
120         virtual void renderme();\r
121         virtual void myinit();\r
122         void init_scene_directly();\r
123 \r
124 };\r
125 \r
126 \r
127 #endif // PARTICLES_DEMO_H\r
128 \r