|
Blender
V2.59
|
00001 /* 00002 * $Id: PHY_IPhysicsController.h 35072 2011-02-22 12:42:55Z jesterking $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00021 * All rights reserved. 00022 * 00023 * The Original Code is: all of this file. 00024 * 00025 * Contributor(s): none yet. 00026 * 00027 * ***** END GPL LICENSE BLOCK ***** 00028 */ 00029 00034 #ifndef PHY_IPHYSICSCONTROLLER_H 00035 #define PHY_IPHYSICSCONTROLLER_H 00036 00037 #include "PHY_IController.h" 00038 00039 class PHY_IMotionState; 00040 class PHY_IPhysicsEnvironment; 00041 00046 class PHY_IPhysicsController : public PHY_IController 00047 { 00048 00049 public: 00050 virtual ~PHY_IPhysicsController(); 00054 virtual bool SynchronizeMotionStates(float time)=0; 00059 virtual void WriteMotionStateToDynamics(bool nondynaonly)=0; 00060 virtual void WriteDynamicsToMotionState()=0; 00061 virtual class PHY_IMotionState* GetMotionState() = 0; 00062 // controller replication 00063 virtual void PostProcessReplica(class PHY_IMotionState* motionstate,class PHY_IPhysicsController* parentctrl)=0; 00064 00065 // kinematic methods 00066 virtual void RelativeTranslate(float dlocX,float dlocY,float dlocZ,bool local)=0; 00067 virtual void RelativeRotate(const float drot[12],bool local)=0; 00068 virtual void getOrientation(float &quatImag0,float &quatImag1,float &quatImag2,float &quatReal)=0; 00069 virtual void setOrientation(float quatImag0,float quatImag1,float quatImag2,float quatReal)=0; 00070 virtual void setPosition(float posX,float posY,float posZ)=0; 00071 virtual void getPosition(PHY__Vector3& pos) const=0; 00072 virtual void setScaling(float scaleX,float scaleY,float scaleZ)=0; 00073 00074 // physics methods 00075 virtual void ApplyTorque(float torqueX,float torqueY,float torqueZ,bool local)=0; 00076 virtual void ApplyForce(float forceX,float forceY,float forceZ,bool local)=0; 00077 virtual void SetAngularVelocity(float ang_velX,float ang_velY,float ang_velZ,bool local)=0; 00078 virtual void SetLinearVelocity(float lin_velX,float lin_velY,float lin_velZ,bool local)=0; 00079 virtual void resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ) = 0; 00080 00081 virtual void applyImpulse(float attachX,float attachY,float attachZ, float impulseX,float impulseY,float impulseZ)=0; 00082 virtual void SetActive(bool active)=0; 00083 00084 // reading out information from physics 00085 virtual void GetLinearVelocity(float& linvX,float& linvY,float& linvZ)=0; 00086 virtual void GetVelocity(const float posX,const float posY,const float posZ,float& linvX,float& linvY,float& linvZ)=0; 00087 virtual void getReactionForce(float& forceX,float& forceY,float& forceZ)=0; 00088 00089 // dyna's that are rigidbody are free in orientation, dyna's with non-rigidbody are restricted 00090 virtual void setRigidBody(bool rigid)=0; 00091 00092 virtual PHY_IPhysicsController* GetReplica() {return 0;} 00093 00094 virtual void calcXform() =0; 00095 virtual void SetMargin(float margin) =0; 00096 virtual float GetMargin() const=0; 00097 virtual float GetRadius() const=0; 00098 virtual void SetRadius(float margin) = 0; 00099 00100 virtual float GetLinVelocityMin() const=0; 00101 virtual void SetLinVelocityMin(float val) = 0; 00102 virtual float GetLinVelocityMax() const=0; 00103 virtual void SetLinVelocityMax(float val) = 0; 00104 00105 PHY__Vector3 GetWorldPosition(PHY__Vector3& localpos); 00106 00107 #ifdef WITH_CXX_GUARDEDALLOC 00108 public: 00109 void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:PHY_IPhysicsController"); } 00110 void operator delete( void *mem ) { MEM_freeN(mem); } 00111 #endif 00112 }; 00113 00114 #endif //PHY_IPHYSICSCONTROLLER_H 00115