Imported Upstream version 2.81
[platform/upstream/libbullet.git] / Demos / ConcaveConvexcastDemo / ConcaveConvexcastDemo.h
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
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 #ifndef CONCAVE_CONVEXCAST_DEMO_H
16 #define CONCAVE_CONVEXCAST_DEMO_H
17
18 #include "GlutDemoApplication.h"
19 #include "LinearMath/btAlignedObjectArray.h"
20
21 class btBroadphaseInterface;
22 class btCollisionShape;
23 class btOverlappingPairCache;
24 class btCollisionDispatcher;
25 class btConstraintSolver;
26 struct btCollisionAlgorithmCreateFunc;
27 class btDefaultCollisionConfiguration;
28 class btTriangleIndexVertexArray;
29
30 ///ConcaveRaycaseDemo shows usage of static concave triangle meshes
31 ///It also shows per-triangle material (friction/restitution) through CustomMaterialCombinerCallback
32 class ConcaveConvexcastDemo : public GlutDemoApplication
33 {
34
35         //keep the collision shapes, for deletion/cleanup
36         btAlignedObjectArray<btCollisionShape*> m_collisionShapes;
37
38         btTriangleIndexVertexArray* m_indexVertexArrays;
39
40         btBroadphaseInterface*  m_broadphase;
41
42         btCollisionDispatcher*  m_dispatcher;
43
44         btConstraintSolver*     m_solver;
45
46         btDefaultCollisionConfiguration* m_collisionConfiguration;
47
48         bool    m_animatedMesh;
49
50         public:
51
52         ConcaveConvexcastDemo() : m_animatedMesh(true)
53         {
54
55         }
56         void    initPhysics();
57
58         void    exitPhysics();
59
60         virtual ~ConcaveConvexcastDemo()
61         {
62                 exitPhysics();
63         }
64
65         virtual void clientMoveAndDisplay();
66
67         virtual void displayCallback();
68         
69         //to show refit works
70         void    setVertexPositions(float waveheight, float offset);
71         
72         virtual void keyboardCallback(unsigned char key, int x, int y);
73         
74         static DemoApplication* Create()
75         {
76                 ConcaveConvexcastDemo* demo = new ConcaveConvexcastDemo();
77                 demo->myinit();
78                 demo->initPhysics();
79                 return demo;
80         };
81 };
82
83 #endif //CONCAVE_CONVEXCAST_DEMO_H
84