CEL

Public API Reference

propclass/mechsys.h

00001 /*
00002     Crystal Space Entity Layer
00003     Copyright (C) 2005 by Jorrit Tyberghein
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #ifndef __CEL_PF_MECHANICS_SYSTEM__
00021 #define __CEL_PF_MECHANICS_SYSTEM__
00022 
00023 #include "cstypes.h"
00024 #include "csutil/scf.h"
00025 
00026 #include "propclass/mechcommon.h"
00027 #include "csgeom/vector3.h"
00028 class csBox3;
00029 class csOrthoTransform;
00030 class csPlane3;
00031 struct iDynamicSystem;
00032 struct iRigidBody;
00033 struct iSector;
00034 struct iPcMesh;
00035 struct iPcLight;
00036 struct iPcCamera;
00037 struct iPcMechanicsObject;
00038 struct iJoint;
00039 
00053 struct iPcMechanicsSystem : public virtual iBase
00054 {
00055   SCF_INTERFACE (iPcMechanicsSystem, 0, 0, 1);
00056 
00062   virtual void SetDynamicSystem (iDynamicSystem* dynsys) = 0;
00063 
00069   virtual void SetDynamicSystem (const char *dynsysname) = 0;
00070 
00071 
00075   virtual iDynamicSystem* GetDynamicSystem () = 0;
00076 
00081   virtual void SetStepTime (float delta) = 0;
00082 
00086   virtual float GetStepTime () const = 0;
00087   
00093   virtual void SetSimulationSpeed (float simulationspeed) = 0;
00094   
00098   virtual float GetSimulationSpeed () = 0;
00099   
00104   virtual void SetGravity (const csVector3& grav) = 0;
00105 
00109   virtual const csVector3 GetGravity () = 0;
00110 
00123   virtual void AddForceDuration (iPcMechanicsObject* pcobject,
00124         const csVector3& force, bool relative, const csVector3& position,
00125         float seconds) = 0;
00126 
00137   virtual void AddForceFrame (iPcMechanicsObject* pcobject,
00138         const csVector3& force, bool relative, const csVector3& position) = 0;
00139 
00152   virtual void AddForceTagged (iPcMechanicsObject* pcobject,
00153         const csVector3& force, bool relative, const csVector3& position,
00154         uint32 forceid) = 0;
00155 
00163   virtual void RemoveForceTagged (iPcMechanicsObject* pcobject,
00164         uint32 forceid) = 0;
00165 
00172   virtual void ClearForces (iPcMechanicsObject* pcobject) = 0;
00173 
00177   virtual void ClearAllForces () = 0;
00178 
00182   virtual csPtr<iRigidBody> CreateBody () = 0;
00183 
00188   virtual void RemoveBody (iRigidBody* body) = 0;
00189 
00196   virtual void AddBodyToGroup (iRigidBody* body, const char* group) = 0;
00197 
00203   virtual void RemoveBodyFromGroup (iRigidBody* body, const char* group) = 0;
00204 
00208   virtual iJoint* CreateJoint (iRigidBody* body1, iRigidBody* body2) = 0;
00209 
00213   virtual void RemoveJoint (iJoint* joint) = 0;
00214 
00219   virtual void DisableStepFast () = 0;
00224   virtual void EnableStepFast () = 0;
00228   virtual void EnableQuickStep () = 0;
00229 };
00230 
00293 struct iPcMechanicsObject : public virtual iBase
00294 {
00295   SCF_INTERFACE (iPcMechanicsObject, 0, 0, 1);
00296 
00303   virtual void SetMesh (iPcMesh* mesh) = 0;
00304 
00308   virtual iPcMesh* GetMesh () = 0;
00309 
00316   virtual void SetLight (iPcLight* light) = 0;
00317 
00321   virtual iPcLight* GetLight () = 0;
00322 
00329   virtual void SetCamera (iPcCamera* camera) = 0;
00330 
00334   virtual iPcCamera* GetCamera () = 0;
00335 
00342   virtual void SetMechanicsSystem (iPcMechanicsSystem* mechsys) = 0;
00343 
00347   virtual iPcMechanicsSystem* GetMechanicsSystem () = 0;
00348 
00352   virtual iRigidBody* GetBody () = 0;
00353 
00354 
00356   //Object properties.
00357 
00363   virtual void SetFriction (float friction) = 0;
00364 
00370   virtual void SetMass (float mass) = 0;
00371 
00377   virtual void SetElasticity (float elasticity) = 0;
00378 
00384   virtual void SetDensity (float density) = 0;
00385 
00391   virtual void SetSoftness (float softness) = 0;
00392 
00398   virtual void SetLift (const csVector3& lift) = 0;
00399 
00405   virtual void SetDrag (float drag) = 0;
00406 
00411   virtual float GetFriction () = 0;
00412 
00417   virtual float GetMass () = 0;
00418 
00423   virtual float GetElasticity () = 0;
00424 
00429   virtual float GetDensity () = 0;
00430 
00435   virtual float GetSoftness () = 0;
00436 
00441   virtual const csVector3& GetLift () = 0;
00442 
00447   virtual float GetDrag () = 0;
00448 
00449 
00451   //Initial velocities
00452 
00457   virtual void SetLinearVelocity (const csVector3& vel) = 0;
00458 
00463   virtual void SetAngularVelocity (const csVector3& vel) = 0;
00464 
00465 
00467   //Reading velocities
00468 
00472   virtual const csVector3 GetLinearVelocity () = 0;
00473 
00477   virtual const csVector3 GetAngularVelocity () = 0;
00478 
00484   virtual void MakeStatic (bool stat) = 0;
00485 
00489   virtual bool IsStatic () const = 0;
00490 
00495   virtual void SetCollisionCallbackEnabled (bool en) = 0;
00496 
00498   virtual bool IsCollisionCallbackEnabled () const = 0;
00499 
00501   //Colliders
00502 
00508   virtual void AttachColliderBoundingSphere (float radiusadjustment = 0.0f) = 0;
00509 
00516   virtual void AttachColliderSphere (float radius, const csVector3& offset) = 0;
00517 
00524   virtual void AttachColliderCylinder (float length, float radius,
00525         const csOrthoTransform& trans) = 0;
00526 
00531   virtual void AttachColliderBoundingBox (const csVector3& sizeadjustment = csVector3(0)) = 0;
00532 
00538   virtual void AttachColliderBox (const csVector3& size,
00539         const csOrthoTransform& trans) = 0;
00540 
00545   virtual void AttachColliderPlane (const csPlane3& plane) = 0;
00546 
00550   virtual void AttachColliderMesh () = 0;
00551 
00552 
00554   //Forces
00555 
00563   virtual void AddForceOnce (const csVector3& force, bool relative,
00564         const csVector3& position) = 0;
00565 
00574   virtual void AddForceDuration (const csVector3& force, bool relative,
00575         const csVector3& position, float seconds) = 0;
00576 
00584   virtual void AddForceFrame (const csVector3& force, bool relative,
00585         const csVector3& position) = 0;
00586 
00596   virtual uint32 AddForceTagged (const csVector3& force, bool relative, 
00597         const csVector3& position) = 0;
00598 
00603   virtual void RemoveForceTagged (uint32 forceid) = 0;
00604 
00608   virtual void ClearForces () = 0;
00609 
00610 
00612   //Groups and Joints
00613 
00619   virtual void AddToGroup (const char* group) = 0;
00620 
00625   virtual void RemoveFromGroup (const char* group) = 0;
00626 
00630   virtual iJoint* CreateJoint (iPcMechanicsObject* other) = 0;
00631 
00635   virtual csVector3 LocalToWorld(csVector3 local) = 0;
00639   virtual csVector3 WorldToLocal(csVector3 world) = 0;
00640 };
00641 
00655 struct iPcMechanicsJoint : public virtual iBase
00656 {
00657   SCF_INTERFACE (iPcMechanicsJoint, 0, 0, 1);
00658 
00662   virtual iJoint* GetJoint () = 0;
00663 };
00664 
00665 #endif // __CEL_PF_MECHANICS_SYSTEM__
00666 

Generated for CEL: Crystal Entity Layer 1.2 by doxygen 1.4.7