4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21 * All rights reserved.
23 * The Original Code is: all of this file.
25 * Contributor(s): none yet.
27 * ***** END GPL LICENSE BLOCK *****
29 #ifndef _SUMOPhysicsEnvironment
30 #define _SUMOPhysicsEnvironment
32 #include "MT_Scalar.h"
34 #include "PHY_IPhysicsEnvironment.h"
35 class SumoPHYCallbackBridge;
38 * Physics Environment takes care of stepping the simulation and is a container for physics entities (rigidbodies,constraints, materials etc.)
39 * A derived class may be able to 'construct' entities by loading and/or converting
41 class SumoPhysicsEnvironment : public PHY_IPhysicsEnvironment
44 class SM_Scene* m_sumoScene;
46 float m_fixedTimeStep;
47 bool m_useFixedTimeStep;
49 std::vector<SumoPHYCallbackBridge*> m_callbacks;
52 SumoPhysicsEnvironment();
53 virtual ~SumoPhysicsEnvironment();
54 virtual void beginFrame();
55 virtual void endFrame();
56 // Perform an integration step of duration 'timeStep'.
57 virtual bool proceedDeltaTime(double curTime,float timeStep);
58 virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep);
59 virtual float getFixedTimeStep();
61 virtual void setGravity(float x,float y,float z);
62 virtual int createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type,
63 float pivotX,float pivotY,float pivotZ,
64 float axisX,float axisY,float axisZ,
65 float axis1X=0,float axis1Y=0,float axis1Z=0,
66 float axis2X=0,float axis2Y=0,float axis2Z=0
70 virtual void removeConstraint(int constraintid);
72 //complex constraint for vehicles
73 virtual PHY_IVehicle* getVehicleConstraint(int constraintId)
78 virtual PHY_IPhysicsController* rayTest(PHY_IRayCastFilterCallback &filterCallback,float fromX,float fromY,float fromZ, float toX,float toY,float toZ);
82 virtual void addSensor(PHY_IPhysicsController* ctrl);
83 virtual void removeSensor(PHY_IPhysicsController* ctrl);
84 virtual void addTouchCallback(int response_class, PHY_ResponseCallback callback, void *user);
85 virtual void requestCollisionCallback(PHY_IPhysicsController* ctrl);
86 virtual void removeCollisionCallback(PHY_IPhysicsController* ctrl);
87 virtual PHY_IPhysicsController* CreateSphereController(float radius,const PHY__Vector3& position);
88 virtual PHY_IPhysicsController* CreateConeController(float coneradius,float coneheight);
90 virtual void setConstraintParam(int constraintId,int param,float value,float value1)
93 SM_Scene* GetSumoScene()
100 static MT_Scalar PhysicsTicRate;
104 #endif //_SUMOPhysicsEnvironment