2 Bullet Continuous Collision Detection and Physics Library, http://bulletphysics.org
\r
3 Copyright (C) 2006 - 2009 Sony Computer Entertainment Inc.
\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
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
16 #ifndef SPHERES_GRID_DEMO_H
\r
17 #define SPHERES_GRID_DEMO_H
\r
19 #define USE_BULLET_BODIES 0
\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
25 #include "DemoApplication.h"
\r
26 #include "LinearMath/btAlignedObjectArray.h"
\r
27 #include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
\r
29 #include "btParticlesDynamicsWorld.h"
\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
41 ///BasicDemo is good starting point for learning the code base and porting.
\r
42 class ParticlesDemo : public GlutDemoApplication
\r
45 class GL_DialogDynamicsWorld* m_dialogDynamicsWorld;
\r
46 //keep the collision shapes, for deletion/cleanup
\r
47 btAlignedObjectArray<btCollisionShape*> m_collisionShapes;
\r
49 btBroadphaseInterface* m_broadphase;
\r
51 btCollisionDispatcher* m_dispatcher;
\r
53 btConstraintSolver* m_solver;
\r
55 btDefaultCollisionConfiguration* m_collisionConfiguration;
\r
57 btOverlappingPairCache* m_pairCache;
\r
69 int m_GpuCpuTogglePtr;
\r
71 btParticlesDynamicsWorld* m_pWorld;
\r
75 GLuint m_shaderProgram;
\r
77 ParticlesDemo(int argc, char** argv)
\r
81 m_drawGridMode = 0;
\r
82 m_GpuCpuTogglePtr = SIMSTAGE_NONE;
\r
83 m_dialogDynamicsWorld = 0;
\r
85 virtual ~ParticlesDemo()
\r
93 virtual void clientMoveAndDisplay();
\r
95 virtual void displayCallback();
\r
97 virtual void keyboardCallback(unsigned char key, int x, int y);
\r
99 virtual void clientResetScene();
\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
105 static DemoApplication* Create()
\r
107 SpheresGridDemo* demo = new SpheresGridDemo;
\r
109 demo->initPhysics();
\r
110 demo->m_mouseButtons = 0;
\r
111 demo->m_mouseOldX = 0;
\r
112 demo->m_mouseOldY = 0;
\r
117 void outputDebugInfo(int & xOffset,int & yStart, int yIncr);
\r
120 virtual void renderme();
\r
121 virtual void myinit();
\r
122 void init_scene_directly();
\r
127 #endif // PARTICLES_DEMO_H
\r