Imported Upstream version 2.81
[platform/upstream/libbullet.git] / Demos / OpenGL / GL_DialogDynamicsWorld.h
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2009 Erwin Coumans  http://bulletphysics.org
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
17 #ifndef GL_DIALOG_DYNAMICS_WORLD_H
18 #define GL_DIALOG_DYNAMICS_WORLD_H
19
20 class btDiscreteDynamicsWorld;
21 class GL_DialogWindow;
22 class btDefaultCollisionConfiguration;
23 struct btDbvtBroadphase;
24 class btSequentialImpulseConstraintSolver;
25 class btCollisionDispatcher;
26 class btVoronoiSimplexSolver;
27 class btMinkowskiPenetrationDepthSolver;
28 class btCollisionObject;
29 class btTypedConstraint;
30 struct GL_ToggleControl;
31 struct GL_SliderControl;
32
33
34 #include "LinearMath/btAlignedObjectArray.h"
35 #include "LinearMath/btVector3.h"
36
37 class GL_DialogDynamicsWorld
38 {
39
40         btDefaultCollisionConfiguration* m_collisionConfiguration;
41         btDbvtBroadphase* m_broadphase;
42         btSequentialImpulseConstraintSolver* m_constraintSolver;
43         btCollisionDispatcher* m_dispatcher;
44         btVoronoiSimplexSolver* m_simplexSolver;
45         btMinkowskiPenetrationDepthSolver* m_pdSolver;
46
47         btDiscreteDynamicsWorld* m_dynamicsWorld;
48         
49         btCollisionObject*      m_lowerBorder;
50         btCollisionObject*      m_upperBorder;
51         btCollisionObject*      m_leftBorder;
52         btCollisionObject*      m_rightBorder;
53
54         btAlignedObjectArray<GL_DialogWindow*> m_dialogs;
55
56         int     m_screenWidth;
57         int     m_screenHeight;
58
59
60         ///for picking
61         int     m_mouseOldX;
62         int     m_mouseOldY;
63         int     m_mouseButtons;
64         ///constraint for mouse picking
65         btTypedConstraint*              m_pickConstraint;
66
67         btVector3       getRayTo(int x,int y);
68
69 public:
70
71         GL_DialogDynamicsWorld();
72
73         virtual ~GL_DialogDynamicsWorld();
74
75         virtual void    setScreenSize(int width, int height);
76
77         virtual GL_DialogWindow* createDialog(int horPos,int vertPos,int dialogWidth,int dialogHeight, const char* dialogTitle );
78
79         GL_ToggleControl* createToggle(GL_DialogWindow* dialog, const char* toggleText);
80
81         GL_SliderControl* createSlider(GL_DialogWindow* dialog, const char* sliderText, btScalar initialFraction = btScalar(0.5f));
82
83         virtual void    draw(btScalar timeStep);
84
85         virtual bool    mouseFunc(int button, int state, int x, int y);
86
87         virtual void    mouseMotionFunc(int x,int y);
88                 
89 };
90
91 #endif //GL_DIALOG_DYNAMICS_WORLD_H