~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h

  • Committer: Bazaar Package Importer
  • Author(s): Lukas Fittl
  • Date: 2006-09-20 01:57:27 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060920015727-gmoqlxwstx9wwqs3
Tags: 2.42a-1ubuntu1
* Merge from Debian unstable (Closes: Malone #55903). Remaining changes:
  - debian/genpot: Add python scripts from Lee June <blender@eyou.com> to
    generate a reasonable PO template from the sources. Since gettext is used
    in a highly nonstandard way, xgettext does not work for this job.
  - debian/rules: Call the scripts, generate po/blender.pot, and clean it up
    in the clean target.
  - Add a proper header to the generated PO template.
* debian/control: Build depend on libavformat-dev >= 3:0.cvs20060823-3.1,
  otherwise this package will FTBFS

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
1
16
#ifndef CCDPHYSICSENVIRONMENT
2
17
#define CCDPHYSICSENVIRONMENT
3
18
 
8
23
 
9
24
 
10
25
 
11
 
class Point2PointConstraint;
12
 
class ToiContactDispatcher;
 
26
class TypedConstraint;
 
27
 
 
28
class CollisionDispatcher;
13
29
class Dispatcher;
14
30
//#include "BroadphaseInterface.h"
15
31
 
16
 
class Vehicle;
 
32
//switch on/off new vehicle support
 
33
#define NEW_BULLET_VEHICLE_SUPPORT 1
 
34
 
 
35
#include "ConstraintSolver/ContactSolverInfo.h"
 
36
 
 
37
class WrapperVehicle;
17
38
class PersistentManifold;
18
39
class BroadphaseInterface;
19
40
class IDebugDraw;
20
41
 
 
42
/// CcdPhysicsEnvironment is experimental mainloop for physics simulation using optional continuous collision detection.
21
43
/// Physics Environment takes care of stepping the simulation and is a container for physics entities.
22
44
/// It stores rigidbodies,constraints, materials etc.
23
45
/// A derived class may be able to 'construct' entities by loading and/or converting
24
46
class CcdPhysicsEnvironment : public PHY_IPhysicsEnvironment
25
47
{
26
48
        SimdVector3 m_gravity;
27
 
        BroadphaseInterface*    m_broadphase;
 
49
        
28
50
        IDebugDraw*     m_debugDrawer;
 
51
        //solver iterations
29
52
        int     m_numIterations;
 
53
        
 
54
        //timestep subdivisions
 
55
        int     m_numTimeSubSteps;
30
56
        int     m_ccdMode;
31
57
        int     m_solverType;
 
58
        int     m_profileTimings;
 
59
        bool m_enableSatCollisionDetection;
 
60
 
 
61
        ContactSolverInfo       m_solverInfo;
32
62
        
 
63
 
33
64
        public:
34
 
                CcdPhysicsEnvironment(ToiContactDispatcher* dispatcher=0, BroadphaseInterface* broadphase=0);
 
65
                CcdPhysicsEnvironment(CollisionDispatcher* dispatcher=0, BroadphaseInterface* broadphase=0);
35
66
 
36
67
                virtual         ~CcdPhysicsEnvironment();
37
68
 
47
78
                }
48
79
 
49
80
                virtual void            setNumIterations(int numIter);
 
81
                virtual void            setNumTimeSubSteps(int numTimeSubSteps)
 
82
                {
 
83
                        m_numTimeSubSteps = numTimeSubSteps;
 
84
                }
50
85
                virtual void            setDeactivationTime(float dTime);
51
86
                virtual void            setDeactivationLinearTreshold(float linTresh) ;
52
87
                virtual void            setDeactivationAngularTreshold(float angTresh) ;
78
113
                        float pivotX,float pivotY,float pivotZ,
79
114
                        float axisX,float axisY,float axisZ);
80
115
            virtual void                removeConstraint(int    constraintid);
81
 
 
 
116
                virtual float           getAppliedImpulse(int   constraintid);
 
117
 
 
118
 
 
119
                virtual void    CallbackTriggers();
 
120
 
 
121
 
 
122
#ifdef NEW_BULLET_VEHICLE_SUPPORT
 
123
                //complex constraint for vehicles
 
124
                virtual PHY_IVehicle*   getVehicleConstraint(int constraintId);
 
125
#else
 
126
                virtual class PHY_IVehicle*     getVehicleConstraint(int constraintId)
 
127
                {
 
128
                        return 0;
 
129
                }
 
130
#endif //NEW_BULLET_VEHICLE_SUPPORT
 
131
 
 
132
                TypedConstraint*        getConstraintById(int constraintId);
82
133
 
83
134
                virtual PHY_IPhysicsController* rayTest(PHY_IPhysicsController* ignoreClient, float fromX,float fromY,float fromZ, float toX,float toY,float toZ, 
84
135
                                                                                float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ);
85
136
 
86
137
 
87
138
                //Methods for gamelogic collision/physics callbacks
88
 
                //todo:
89
 
                virtual void addSensor(PHY_IPhysicsController* ctrl) {};
90
 
                virtual void removeSensor(PHY_IPhysicsController* ctrl){};
91
 
                virtual void addTouchCallback(int response_class, PHY_ResponseCallback callback, void *user){};
92
 
                virtual void requestCollisionCallback(PHY_IPhysicsController* ctrl){};
93
 
                virtual PHY_IPhysicsController* CreateSphereController(float radius,const PHY__Vector3& position) {return 0;};
94
 
                virtual PHY_IPhysicsController* CreateConeController(float coneradius,float coneheight){ return 0;};
 
139
                virtual void addSensor(PHY_IPhysicsController* ctrl);
 
140
                virtual void removeSensor(PHY_IPhysicsController* ctrl);
 
141
                virtual void addTouchCallback(int response_class, PHY_ResponseCallback callback, void *user);
 
142
                virtual void requestCollisionCallback(PHY_IPhysicsController* ctrl);
 
143
                virtual void removeCollisionCallback(PHY_IPhysicsController* ctrl);
 
144
 
 
145
                virtual PHY_IPhysicsController* CreateSphereController(float radius,const PHY__Vector3& position);
 
146
                virtual PHY_IPhysicsController* CreateConeController(float coneradius,float coneheight);
95
147
        
96
148
 
97
149
                virtual int     getNumContactPoints();
106
158
 
107
159
                void    removeCcdPhysicsController(CcdPhysicsController* ctrl);
108
160
 
109
 
                BroadphaseInterface*    GetBroadphase() { return m_broadphase; }
110
 
 
111
 
                Dispatcher* GetDispatcher();
 
161
                BroadphaseInterface*    GetBroadphase();
 
162
 
 
163
                CollisionDispatcher* GetDispatcher();
 
164
                
 
165
                const CollisionDispatcher* GetDispatcher() const;
 
166
 
 
167
                bool    IsSatCollisionDetectionEnabled() const
 
168
                {
 
169
                        return m_enableSatCollisionDetection;
 
170
                }
 
171
 
 
172
                void    EnableSatCollisionDetection(bool enableSat)
 
173
                {
 
174
                        m_enableSatCollisionDetection = enableSat;
 
175
                }
 
176
 
 
177
                void    UpdateAabbs(float       timeStep);
112
178
 
113
179
                int     GetNumControllers();
114
180
 
118
184
 
119
185
                const PersistentManifold*       GetManifold(int index) const;
120
186
 
 
187
                std::vector<TypedConstraint*> m_constraints;
 
188
 
121
189
        private:
122
190
                
123
 
                void    UpdateActivationState();        
 
191
                
124
192
                void    SyncMotionStates(float timeStep);
125
193
                
126
194
                std::vector<CcdPhysicsController*> m_controllers;
127
 
 
128
 
                std::vector<Point2PointConstraint*> m_p2pConstraints;
129
 
 
130
 
                std::vector<Vehicle*>   m_vehicles;
131
 
 
132
 
                class ToiContactDispatcher* m_dispatcher;
 
195
                
 
196
                std::vector<CcdPhysicsController*> m_triggerControllers;
 
197
 
 
198
                PHY_ResponseCallback    m_triggerCallbacks[PHY_NUM_RESPONSE];
 
199
                void*                   m_triggerCallbacksUserPtrs[PHY_NUM_RESPONSE];
 
200
                
 
201
                std::vector<WrapperVehicle*>    m_wrapperVehicles;
 
202
 
 
203
                class CollisionWorld*   m_collisionWorld;
 
204
                
 
205
                class ConstraintSolver* m_solver;
133
206
 
134
207
                bool    m_scalingPropagated;
135
208