diff options
Diffstat (limited to 'source/gameengine/Physics/common')
-rw-r--r-- | source/gameengine/Physics/common/PHY_DynamicTypes.h | 91 | ||||
-rw-r--r-- | source/gameengine/Physics/common/PHY_ICharacter.h | 39 | ||||
-rw-r--r-- | source/gameengine/Physics/common/PHY_IController.h | 63 | ||||
-rw-r--r-- | source/gameengine/Physics/common/PHY_IGraphicController.h | 60 | ||||
-rw-r--r-- | source/gameengine/Physics/common/PHY_IMotionState.h | 68 | ||||
-rw-r--r-- | source/gameengine/Physics/common/PHY_IPhysicsController.h | 154 | ||||
-rw-r--r-- | source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h | 226 | ||||
-rw-r--r-- | source/gameengine/Physics/common/PHY_IVehicle.h | 69 | ||||
-rw-r--r-- | source/gameengine/Physics/common/PHY_Pro.h | 68 |
9 files changed, 0 insertions, 838 deletions
diff --git a/source/gameengine/Physics/common/PHY_DynamicTypes.h b/source/gameengine/Physics/common/PHY_DynamicTypes.h deleted file mode 100644 index d10f48ad7a4..00000000000 --- a/source/gameengine/Physics/common/PHY_DynamicTypes.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -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. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -/** \file PHY_DynamicTypes.h - * \ingroup phys - */ - -#ifndef __PHY_DYNAMICTYPES_H__ -#define __PHY_DYNAMICTYPES_H__ - -#include "MT_Vector3.h" - -struct KX_ClientObjectInfo; - -enum -{ - PHY_FH_RESPONSE, - PHY_SENSOR_RESPONSE, /* Touch Sensors */ - PHY_CAMERA_RESPONSE, /* Visibility Culling */ - PHY_OBJECT_RESPONSE, /* Object Dynamic Geometry Response */ - PHY_STATIC_RESPONSE, /* Static Geometry Response */ - PHY_BROADPH_RESPONSE, /* broadphase Response */ - - PHY_NUM_RESPONSE -}; - -typedef struct PHY_CollData { - MT_Vector3 m_point1; /* Point in object1 in world coordinates */ - MT_Vector3 m_point2; /* Point in object2 in world coordinates */ - MT_Vector3 m_normal; /* point2 - point1 */ -} PHY_CollData; - - -typedef bool (*PHY_ResponseCallback)(void *client_data, - void *client_object1, - void *client_object2, - const PHY_CollData *coll_data); -typedef void (*PHY_CullingCallback)(KX_ClientObjectInfo* info, void* param); - - -/// PHY_PhysicsType enumerates all possible Physics Entities. -/// It is mainly used to create/add Physics Objects - -typedef enum PHY_PhysicsType { - PHY_CONVEX_RIGIDBODY=16386, - PHY_CONCAVE_RIGIDBODY=16399, - PHY_CONVEX_FIXEDBODY=16388,//'collision object' - PHY_CONCAVE_FIXEDBODY=16401, - PHY_CONVEX_KINEMATICBODY=16387,// - PHY_CONCAVE_KINEMATICBODY=16400, - PHY_CONVEX_PHANTOMBODY=16398, - PHY_CONCAVE_PHANTOMBODY=16402 -} PHY_PhysicsType; - -/// PHY_ConstraintType enumerates all supported Constraint Types -typedef enum PHY_ConstraintType { - PHY_POINT2POINT_CONSTRAINT=1, - PHY_LINEHINGE_CONSTRAINT=2, - PHY_ANGULAR_CONSTRAINT = 3,//hinge without ball socket - PHY_CONE_TWIST_CONSTRAINT = 4, - PHY_VEHICLE_CONSTRAINT=11,//complex 'constraint' that turns a rigidbody into a vehicle - PHY_GENERIC_6DOF_CONSTRAINT=12,//can leave any of the 6 degree of freedom 'free' or 'locked' - -} PHY_ConstraintType; - -typedef enum PHY_ShapeType { - PHY_SHAPE_NONE, - PHY_SHAPE_BOX, - PHY_SHAPE_SPHERE, - PHY_SHAPE_CYLINDER, - PHY_SHAPE_CONE, - PHY_SHAPE_CAPSULE, - PHY_SHAPE_MESH, - PHY_SHAPE_POLYTOPE, - PHY_SHAPE_COMPOUND, - PHY_SHAPE_PROXY -} PHY_ShapeType; - -#endif /* __PHY_DYNAMICTYPES_H__ */ diff --git a/source/gameengine/Physics/common/PHY_ICharacter.h b/source/gameengine/Physics/common/PHY_ICharacter.h deleted file mode 100644 index 1a924904b7d..00000000000 --- a/source/gameengine/Physics/common/PHY_ICharacter.h +++ /dev/null @@ -1,39 +0,0 @@ - -/** \file PHY_ICharacter.h - * \ingroup phys - */ - -#ifndef __PHY_ICHARACTER_H__ -#define __PHY_ICHARACTER_H__ - -//PHY_ICharacter provides a generic interface for "character" controllers - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class PHY_ICharacter -{ -public: - virtual ~PHY_ICharacter() {}; - - virtual void Jump()= 0; - virtual bool OnGround()= 0; - - virtual float GetGravity()= 0; - virtual void SetGravity(float gravity)= 0; - - virtual unsigned char GetMaxJumps() = 0; - virtual void SetMaxJumps(unsigned char maxJumps) = 0; - - virtual unsigned char GetJumpCount() = 0; - - virtual void SetWalkDirection(const class MT_Vector3& dir)=0; - virtual MT_Vector3 GetWalkDirection()=0; - -#ifdef WITH_CXX_GUARDEDALLOC - MEM_CXX_CLASS_ALLOC_FUNCS("GE:PHY_ICharacter") -#endif -}; - -#endif //__PHY_ICHARACTER_H__ diff --git a/source/gameengine/Physics/common/PHY_IController.h b/source/gameengine/Physics/common/PHY_IController.h deleted file mode 100644 index 741fae8d2ad..00000000000 --- a/source/gameengine/Physics/common/PHY_IController.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file PHY_IController.h - * \ingroup phys - */ - -#ifndef __PHY_ICONTROLLER_H__ -#define __PHY_ICONTROLLER_H__ - -#include "PHY_DynamicTypes.h" - -class PHY_IPhysicsEnvironment; - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -/** - * PHY_IController is the abstract simplified Interface to objects - * controlled by the physics engine. This includes the physics objects - * and the graphics object for view frustrum and occlusion culling. - */ -class PHY_IController -{ - public: - virtual ~PHY_IController() {}; - // clientinfo for raycasts for example - virtual void* GetNewClientInfo()=0; - virtual void SetNewClientInfo(void* clientinfo)=0; - virtual void SetPhysicsEnvironment(class PHY_IPhysicsEnvironment *env)=0; - - -#ifdef WITH_CXX_GUARDEDALLOC - MEM_CXX_CLASS_ALLOC_FUNCS("GE:PHY_IController") -#endif -}; - -#endif /* __PHY_ICONTROLLER_H__ */ diff --git a/source/gameengine/Physics/common/PHY_IGraphicController.h b/source/gameengine/Physics/common/PHY_IGraphicController.h deleted file mode 100644 index b047edd93eb..00000000000 --- a/source/gameengine/Physics/common/PHY_IGraphicController.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file PHY_IGraphicController.h - * \ingroup phys - */ - -#ifndef __PHY_IGRAPHICCONTROLLER_H__ -#define __PHY_IGRAPHICCONTROLLER_H__ - -#include "PHY_IController.h" - - -/** - * PHY_IPhysicsController is the abstract simplified Interface to a physical object. - * It contains the IMotionState and IDeformableMesh Interfaces. - */ -class PHY_IGraphicController : public PHY_IController -{ - public: - /** - * SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding') - */ - virtual bool SetGraphicTransform()=0; - virtual void Activate(bool active=true)=0; - virtual void SetLocalAabb(const class MT_Vector3& aabbMin,const class MT_Vector3& aabbMax)=0; - virtual void SetLocalAabb(const float* aabbMin,const float* aabbMax)=0; - - virtual PHY_IGraphicController* GetReplica(class PHY_IMotionState* motionstate) {return 0;} - -#ifdef WITH_CXX_GUARDEDALLOC - MEM_CXX_CLASS_ALLOC_FUNCS("GE:PHY_IController") -#endif -}; - -#endif /* __PHY_IGRAPHICCONTROLLER_H__ */ diff --git a/source/gameengine/Physics/common/PHY_IMotionState.h b/source/gameengine/Physics/common/PHY_IMotionState.h deleted file mode 100644 index e803d658713..00000000000 --- a/source/gameengine/Physics/common/PHY_IMotionState.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file PHY_IMotionState.h - * \ingroup phys - */ - -#ifndef __PHY_IMOTIONSTATE_H__ -#define __PHY_IMOTIONSTATE_H__ - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -/** - * PHY_IMotionState is the Interface to explicitly synchronize the world transformation. - * Default implementations for mayor graphics libraries like OpenGL and DirectX can be provided. - */ -class PHY_IMotionState - -{ - public: - virtual ~PHY_IMotionState() {}; - - virtual void GetWorldPosition(float& posX,float& posY,float& posZ)=0; - virtual void GetWorldScaling(float& scaleX,float& scaleY,float& scaleZ)=0; - virtual void GetWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal)=0; - // ori = array 12 floats, [0..3] = first column + 0, [4..7] = second column, [8..11] = third column - virtual void GetWorldOrientation(float* ori)=0; - virtual void SetWorldOrientation(const float* ori)=0; - - virtual void SetWorldPosition(float posX,float posY,float posZ)=0; - virtual void SetWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal)=0; - - - virtual void CalculateWorldTransformations()=0; - - -#ifdef WITH_CXX_GUARDEDALLOC - MEM_CXX_CLASS_ALLOC_FUNCS("GE:PHY_IMotionState") -#endif -}; - -#endif /* __PHY_IMOTIONSTATE_H__ */ diff --git a/source/gameengine/Physics/common/PHY_IPhysicsController.h b/source/gameengine/Physics/common/PHY_IPhysicsController.h deleted file mode 100644 index 4c6e8c71ef7..00000000000 --- a/source/gameengine/Physics/common/PHY_IPhysicsController.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file PHY_IPhysicsController.h - * \ingroup phys - */ - -#ifndef __PHY_IPHYSICSCONTROLLER_H__ -#define __PHY_IPHYSICSCONTROLLER_H__ - -#include <vector> -#include "PHY_IController.h" - -class PHY_IMotionState; -class PHY_IPhysicsEnvironment; - -class MT_Vector3; -class MT_Point3; -class MT_Matrix3x3; - -class KX_GameObject; -class RAS_MeshObject; - -/** - * PHY_IPhysicsController is the abstract simplified Interface to a physical object. - * It contains the IMotionState and IDeformableMesh Interfaces. - */ -class PHY_IPhysicsController : public PHY_IController -{ - - public: - virtual ~PHY_IPhysicsController() {}; - /** - * SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding') - */ - virtual bool SynchronizeMotionStates(float time)=0; - /** - * WriteMotionStateToDynamics ynchronizes dynas, kinematic and deformable entities (and do 'late binding') - */ - - virtual void WriteMotionStateToDynamics(bool nondynaonly)=0; - virtual void WriteDynamicsToMotionState()=0; - virtual class PHY_IMotionState* GetMotionState() = 0; - // controller replication - virtual void PostProcessReplica(class PHY_IMotionState* motionstate,class PHY_IPhysicsController* parentctrl)=0; - virtual void SetPhysicsEnvironment(class PHY_IPhysicsEnvironment *env)=0; - - // kinematic methods - virtual void RelativeTranslate(const MT_Vector3& dloc,bool local)=0; - virtual void RelativeRotate(const MT_Matrix3x3&,bool local)=0; - virtual MT_Matrix3x3 GetOrientation()=0; - virtual void SetOrientation(const MT_Matrix3x3& orn)=0; - virtual void SetPosition(const MT_Vector3& pos)=0; - virtual void GetPosition(MT_Vector3& pos) const=0; - virtual void SetScaling(const MT_Vector3& scale)=0; - virtual void SetTransform()=0; - - virtual MT_Scalar GetMass()=0; - virtual void SetMass(MT_Scalar newmass)=0; - - // physics methods - virtual void ApplyImpulse(const MT_Point3& attach, const MT_Vector3& impulse,bool local)=0; - virtual void ApplyTorque(const MT_Vector3& torque,bool local)=0; - virtual void ApplyForce(const MT_Vector3& force,bool local)=0; - virtual void SetAngularVelocity(const MT_Vector3& ang_vel,bool local)=0; - virtual void SetLinearVelocity(const MT_Vector3& lin_vel,bool local)=0; - virtual void ResolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ) = 0; - - virtual float GetLinearDamping() const=0; - virtual float GetAngularDamping() const=0; - virtual void SetLinearDamping(float damping)=0; - virtual void SetAngularDamping(float damping)=0; - virtual void SetDamping(float linear, float angular)=0; - - virtual void RefreshCollisions() = 0; - virtual void SuspendDynamics(bool ghost=false)=0; - virtual void RestoreDynamics()=0; - - virtual void SetActive(bool active)=0; - - // reading out information from physics - virtual MT_Vector3 GetLinearVelocity()=0; - virtual MT_Vector3 GetAngularVelocity()=0; - virtual MT_Vector3 GetVelocity(const MT_Point3& pos)=0; - virtual MT_Vector3 GetLocalInertia()=0; - - // dyna's that are rigidbody are free in orientation, dyna's with non-rigidbody are restricted - virtual void SetRigidBody(bool rigid)=0; - - virtual PHY_IPhysicsController* GetReplica() {return 0;} - virtual PHY_IPhysicsController* GetReplicaForSensors() {return 0;} - - virtual void CalcXform() =0; - virtual void SetMargin(float margin) =0; - virtual float GetMargin() const=0; - virtual float GetRadius() const=0; - virtual void SetRadius(float margin) = 0; - - virtual float GetLinVelocityMin() const=0; - virtual void SetLinVelocityMin(float val) = 0; - virtual float GetLinVelocityMax() const=0; - virtual void SetLinVelocityMax(float val) = 0; - - virtual void SetAngularVelocityMin(float val) = 0; - virtual float GetAngularVelocityMin() const = 0; - virtual void SetAngularVelocityMax(float val) = 0; - virtual float GetAngularVelocityMax() const = 0; - - MT_Vector3 GetWorldPosition(MT_Vector3& localpos); - - // Shape control - virtual void AddCompoundChild(PHY_IPhysicsController* child) = 0; - virtual void RemoveCompoundChild(PHY_IPhysicsController* child) = 0; - - - virtual bool IsDynamic() = 0; - virtual bool IsCompound() = 0; - virtual bool IsSuspended() const = 0; - - virtual bool ReinstancePhysicsShape(KX_GameObject *from_gameobj, RAS_MeshObject* from_meshobj) = 0; - - /* Method to replicate rigid body joint contraints for group instances. */ - virtual void ReplicateConstraints(KX_GameObject *gameobj, std::vector<KX_GameObject*> constobj) = 0; - -#ifdef WITH_CXX_GUARDEDALLOC - MEM_CXX_CLASS_ALLOC_FUNCS("GE:PHY_IPhysicsController") -#endif -}; - -#endif /* __PHY_IPHYSICSCONTROLLER_H__ */ diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h deleted file mode 100644 index 72ec7b1edd0..00000000000 --- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h +++ /dev/null @@ -1,226 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file PHY_IPhysicsEnvironment.h - * \ingroup phys - */ - -#ifndef __PHY_IPHYSICSENVIRONMENT_H__ -#define __PHY_IPHYSICSENVIRONMENT_H__ - -#include "PHY_DynamicTypes.h" -#include "MT_Vector2.h" -#include "MT_Vector3.h" -#include "MT_Vector4.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class PHY_IVehicle; -class PHY_ICharacter; -class RAS_MeshObject; -class PHY_IPhysicsController; - - -class RAS_MeshObject; -struct DerivedMesh; -class KX_GameObject; -class KX_Scene; - -struct PHY_ShapeProps; -struct PHY_MaterialProps; -class PHY_IMotionState; -struct bRigidBodyJointConstraint; - -/** - * pass back information from rayTest - */ -struct PHY_RayCastResult -{ - PHY_IPhysicsController* m_controller; - MT_Vector3 m_hitPoint; - MT_Vector3 m_hitNormal; - const RAS_MeshObject* m_meshObject; // !=NULL for mesh object (only for Bullet controllers) - int m_polygon; // index of the polygon hit by the ray, - // only if m_meshObject != NULL - int m_hitUVOK; // !=0 if UV coordinate in m_hitUV is valid - MT_Vector2 m_hitUV; // UV coordinates of hit point -}; - -/** - * This class replaces the ignoreController parameter of rayTest function. - * It allows more sophisticated filtering on the physics controller before computing the ray intersection to save CPU. - * It is only used to its full extend by the Ccd physics environment (Bullet). - */ -class PHY_IRayCastFilterCallback -{ -public: - PHY_IPhysicsController* m_ignoreController; - bool m_faceNormal; - bool m_faceUV; - - virtual ~PHY_IRayCastFilterCallback() - { - } - - virtual bool needBroadphaseRayCast(PHY_IPhysicsController* controller) - { - return true; - } - - virtual void reportHit(PHY_RayCastResult* result) = 0; - - PHY_IRayCastFilterCallback(PHY_IPhysicsController* ignoreController, bool faceNormal=false, bool faceUV=false) - :m_ignoreController(ignoreController), - m_faceNormal(faceNormal), - m_faceUV(faceUV) - { - } - - -#ifdef WITH_CXX_GUARDEDALLOC - MEM_CXX_CLASS_ALLOC_FUNCS("GE:PHY_IRayCastFilterCallback") -#endif -}; - -/** - * Physics Environment takes care of stepping the simulation and is a container for physics entities - * (rigidbodies,constraints, materials etc.) - * A derived class may be able to 'construct' entities by loading and/or converting - */ -class PHY_IPhysicsEnvironment -{ - public: - virtual ~PHY_IPhysicsEnvironment() {} - virtual void BeginFrame() = 0; - virtual void EndFrame() = 0; - /// Perform an integration step of duration 'timeStep'. - virtual bool ProceedDeltaTime(double curTime,float timeStep,float interval)=0; - ///draw debug lines (make sure to call this during the render phase, otherwise lines are not drawn properly) - virtual void DebugDrawWorld() {} - virtual void SetFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep)=0; - //returns 0.f if no fixed timestep is used - virtual float GetFixedTimeStep()=0; - - ///getDebugMode return the actual debug visualization state - virtual int GetDebugMode()const=0; - ///setDebugMode is used to support several ways of debug lines, contact point visualization - virtual void SetDebugMode(int debugMode) {} - ///setNumIterations set the number of iterations for iterative solvers - virtual void SetNumIterations(int numIter) {} - ///setNumTimeSubSteps set the number of divisions of the timestep. Tradeoff quality versus performance. - virtual void SetNumTimeSubSteps(int numTimeSubSteps) {} - virtual int GetNumTimeSubSteps() {return 0; } - ///setDeactivationTime sets the minimum time that an objects has to stay within the velocity tresholds until it gets fully deactivated - virtual void SetDeactivationTime(float dTime) {} - ///setDeactivationLinearTreshold sets the linear velocity treshold, see setDeactivationTime - virtual void SetDeactivationLinearTreshold(float linTresh) {} - ///setDeactivationAngularTreshold sets the angular velocity treshold, see setDeactivationTime - virtual void SetDeactivationAngularTreshold(float angTresh) {} - ///setContactBreakingTreshold sets tresholds to do with contact point management - virtual void SetContactBreakingTreshold(float contactBreakingTreshold) {} - ///continuous collision detection mode, very experimental for Bullet - virtual void SetCcdMode(int ccdMode) {} - ///successive overrelaxation constant, in case PSOR is used, values in between 1 and 2 guarantee converging behavior - virtual void SetSolverSorConstant(float sor) {} - ///setSolverType, internal setting, chooses solvertype, PSOR, Dantzig, impulse based, penalty based - virtual void SetSolverType(int solverType) {} - ///setTau sets the spring constant of a penalty based solver - virtual void SetSolverTau(float tau) {} - ///setDamping sets the damper constant of a penalty based solver - virtual void SetSolverDamping(float damping) {} - ///linear air damping for rigidbodies - virtual void SetLinearAirDamping(float damping) {} - /// penetrationdepth setting - virtual void SetUseEpa(bool epa) {} - - virtual void SetGravity(float x,float y,float z)=0; - virtual void GetGravity(MT_Vector3& grav) = 0; - - virtual int CreateConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type, - float pivotX,float pivotY,float pivotZ, - float axis0X,float axis0Y,float axis0Z, - float axis1X=0,float axis1Y=0,float axis1Z=0, - float axis2X=0,float axis2Y=0,float axis2Z=0,int flag=0 - )=0; - virtual void RemoveConstraintById(int constraintid) = 0; - virtual float GetAppliedImpulse(int constraintid) { return 0.0f; } - - - //complex constraint for vehicles - virtual PHY_IVehicle* GetVehicleConstraint(int constraintId) =0; - - // Character physics wrapper - virtual PHY_ICharacter* GetCharacterController(class KX_GameObject* ob) =0; - - virtual PHY_IPhysicsController* RayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ)=0; - - //culling based on physical broad phase - // the plane number must be set as follow: near, far, left, right, top, botton - // the near plane must be the first one and must always be present, it is used to get the direction of the view - virtual bool CullingTest(PHY_CullingCallback callback, void *userData, MT_Vector4* planeNormals, int planeNumber, int occlusionRes, const int *viewport, float modelview[16], float projection[16]) = 0; - - //Methods for gamelogic collision/physics callbacks - //todo: - virtual void AddSensor(PHY_IPhysicsController* ctrl)=0; - virtual void RemoveSensor(PHY_IPhysicsController* ctrl)=0; - virtual void AddTouchCallback(int response_class, PHY_ResponseCallback callback, void *user)=0; - virtual bool RequestCollisionCallback(PHY_IPhysicsController* ctrl)=0; - virtual bool RemoveCollisionCallback(PHY_IPhysicsController* ctrl)=0; - //These two methods are *solely* used to create controllers for sensor! Don't use for anything else - virtual PHY_IPhysicsController* CreateSphereController(float radius,const MT_Vector3& position) =0; - virtual PHY_IPhysicsController* CreateConeController(float coneradius,float coneheight)=0; - - virtual void SetConstraintParam(int constraintId,int param,float value,float value1) = 0; - virtual float GetConstraintParam(int constraintId,int param) = 0; - - virtual void ExportFile(const char* filename) {}; - - virtual void MergeEnvironment(PHY_IPhysicsEnvironment *other_env) = 0; - - virtual void ConvertObject(KX_GameObject* gameobj, - RAS_MeshObject* meshobj, - DerivedMesh* dm, - KX_Scene* kxscene, - PHY_ShapeProps* shapeprops, - PHY_MaterialProps* smmaterial, - PHY_IMotionState *motionstate, - int activeLayerBitInfo, - bool isCompoundChild, - bool hasCompoundChildren) = 0; - - /* Set the rigid body joints constraints values for converted objects and replicated group instances. */ - virtual void SetupObjectConstraints(KX_GameObject *obj_src, KX_GameObject *obj_dest, - bRigidBodyJointConstraint *dat) {} - -#ifdef WITH_CXX_GUARDEDALLOC - MEM_CXX_CLASS_ALLOC_FUNCS("GE:PHY_IPhysicsEnvironment") -#endif -}; - -#endif /* __PHY_IPHYSICSENVIRONMENT_H__ */ diff --git a/source/gameengine/Physics/common/PHY_IVehicle.h b/source/gameengine/Physics/common/PHY_IVehicle.h deleted file mode 100644 index 7e4a49e923e..00000000000 --- a/source/gameengine/Physics/common/PHY_IVehicle.h +++ /dev/null @@ -1,69 +0,0 @@ - -/** \file PHY_IVehicle.h - * \ingroup phys - */ - -#ifndef __PHY_IVEHICLE_H__ -#define __PHY_IVEHICLE_H__ - -//PHY_IVehicle provides a generic interface for (raycast based) vehicles. Mostly targetting 4 wheel cars and 2 wheel motorbikes. - -class PHY_IMotionState; -#include "PHY_DynamicTypes.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class PHY_IVehicle -{ -public: - virtual ~PHY_IVehicle() {}; - - virtual void AddWheel( - PHY_IMotionState* motionState, - MT_Vector3 connectionPoint, - MT_Vector3 downDirection, - MT_Vector3 axleDirection, - float suspensionRestLength, - float wheelRadius, - bool hasSteering - ) = 0; - - - virtual int GetNumWheels() const = 0; - - virtual void GetWheelPosition(int wheelIndex,float& posX,float& posY,float& posZ) const = 0; - virtual void GetWheelOrientationQuaternion(int wheelIndex,float& quatX,float& quatY,float& quatZ,float& quatW) const = 0; - virtual float GetWheelRotation(int wheelIndex) const = 0; - - virtual int GetUserConstraintId() const =0; - virtual int GetUserConstraintType() const =0; - - //some basic steering/braking/tuning/balancing (bikes) - - virtual void SetSteeringValue(float steering,int wheelIndex) = 0; - - virtual void ApplyEngineForce(float force,int wheelIndex) = 0; - - virtual void ApplyBraking(float braking,int wheelIndex) = 0; - - virtual void SetWheelFriction(float friction,int wheelIndex) = 0; - - virtual void SetSuspensionStiffness(float suspensionStiffness,int wheelIndex) = 0; - - virtual void SetSuspensionDamping(float suspensionStiffness,int wheelIndex) = 0; - - virtual void SetSuspensionCompression(float suspensionStiffness,int wheelIndex) = 0; - - virtual void SetRollInfluence(float rollInfluence,int wheelIndex) = 0; - - virtual void SetCoordinateSystem(int rightIndex,int upIndex,int forwardIndex) =0; - - -#ifdef WITH_CXX_GUARDEDALLOC - MEM_CXX_CLASS_ALLOC_FUNCS("GE:PHY_IVehicle") -#endif -}; - -#endif /* __PHY_IVEHICLE_H__ */ diff --git a/source/gameengine/Physics/common/PHY_Pro.h b/source/gameengine/Physics/common/PHY_Pro.h deleted file mode 100644 index bfe574e73cb..00000000000 --- a/source/gameengine/Physics/common/PHY_Pro.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file PHY_Pro.h - * \ingroup phys - */ - -#ifndef __PHY_PRO_H__ -#define __PHY_PRO_H__ - -#include <MT_Scalar.h> - -// Properties of dynamic objects -struct PHY_ShapeProps { - MT_Scalar m_mass; // Total mass - MT_Scalar m_inertia; // Inertia, should be a tensor some time - MT_Scalar m_lin_drag; // Linear drag (air, water) 0 = concrete, 1 = vacuum, inverted and called dampening in blenders UI - MT_Scalar m_ang_drag; // Angular drag, inverted and called dampening in blenders UI - MT_Scalar m_friction_scaling[3]; // Scaling for anisotropic friction. Component in range [0, 1] - MT_Scalar m_clamp_vel_min; // Clamp the minimum velocity, this ensures an object moves at a minimum speed unless its stationary - MT_Scalar m_clamp_vel_max; // Clamp max velocity - MT_Scalar m_clamp_angvel_min; // Clamp the minimum angular velocity. - MT_Scalar m_clamp_angvel_max; // Clamp the maximum angular velocity. - bool m_do_anisotropic; // Should I do anisotropic friction? - bool m_do_fh; // Should the object have a linear Fh spring? - bool m_do_rot_fh; // Should the object have an angular Fh spring? - MT_Scalar m_step_height; // Max height of climbable steps (Character) - MT_Scalar m_jump_speed; // Velocity of jumps (Character) - MT_Scalar m_fall_speed; // Max velocity of falling (Character) - unsigned char m_max_jumps; // Max ammount of jumps (Character) -}; - - -// Properties of collidable objects (non-ghost objects) -struct PHY_MaterialProps { - MT_Scalar m_restitution; // restitution of energie after a collision 0 = inelastic, 1 = elastic - MT_Scalar m_friction; // Coulomb friction (= ratio between the normal en maximum friction force) - MT_Scalar m_fh_spring; // Spring constant (both linear and angular) - MT_Scalar m_fh_damping; // Damping factor (linear and angular) in range [0, 1] - MT_Scalar m_fh_distance; // The range above the surface where Fh is active. - bool m_fh_normal; // Should the object slide off slopes? -}; - -#endif /* __PHY_PRO_H__ */ |