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 
00283 struct iPcMechanicsObject : public virtual iBase
00284 {
00285   SCF_INTERFACE (iPcMechanicsObject, 0, 0, 1);
00286 
00293   virtual void SetMesh (iPcMesh* mesh) = 0;
00294 
00298   virtual iPcMesh* GetMesh () = 0;
00299 
00306   virtual void SetLight (iPcLight* light) = 0;
00307 
00311   virtual iPcLight* GetLight () = 0;
00312 
00319   virtual void SetCamera (iPcCamera* camera) = 0;
00320 
00324   virtual iPcCamera* GetCamera () = 0;
00325 
00332   virtual void SetMechanicsSystem (iPcMechanicsSystem* mechsys) = 0;
00333 
00337   virtual iPcMechanicsSystem* GetMechanicsSystem () = 0;
00338 
00342   virtual iRigidBody* GetBody () = 0;
00343 
00344 
00346   //Object properties.
00347 
00353   virtual void SetFriction (float friction) = 0;
00354 
00360   virtual void SetMass (float mass) = 0;
00361 
00367   virtual void SetElasticity (float elasticity) = 0;
00368 
00374   virtual void SetDensity (float density) = 0;
00375 
00381   virtual void SetSoftness (float softness) = 0;
00382 
00388   virtual void SetLift (const csVector3& lift) = 0;
00389 
00395   virtual void SetDrag (float drag) = 0;
00396 
00401   virtual float GetFriction () = 0;
00402 
00407   virtual float GetMass () = 0;
00408 
00413   virtual float GetElasticity () = 0;
00414 
00419   virtual float GetDensity () = 0;
00420 
00425   virtual float GetSoftness () = 0;
00426 
00431   virtual const csVector3& GetLift () = 0;
00432 
00437   virtual float GetDrag () = 0;
00438 
00439 
00441   //Initial velocities
00442 
00447   virtual void SetLinearVelocity (const csVector3& vel) = 0;
00448 
00453   virtual void SetAngularVelocity (const csVector3& vel) = 0;
00454 
00455 
00457   //Reading velocities
00458 
00462   virtual const csVector3 GetLinearVelocity () = 0;
00463 
00467   virtual const csVector3 GetAngularVelocity () = 0;
00468 
00474   virtual void MakeStatic (bool stat) = 0;
00475   
00479   virtual bool IsStatic () const = 0;
00480 
00485   virtual void SetCollisionCallbackEnabled (bool en) = 0;
00486 
00488   virtual bool IsCollisionCallbackEnabled () const = 0;
00489 
00491   //Colliders
00492 
00498   virtual void AttachColliderBoundingSphere (float radiusadjustment = 0.0f) = 0;
00499 
00506   virtual void AttachColliderSphere (float radius, const csVector3& offset) = 0;
00507 
00514   virtual void AttachColliderCylinder (float length, float radius,
00515         const csOrthoTransform& trans) = 0;
00516 
00521   virtual void AttachColliderBoundingBox (const csVector3& sizeadjustment = csVector3(0)) = 0;
00522 
00528   virtual void AttachColliderBox (const csVector3& size,
00529         const csOrthoTransform& trans) = 0;
00530 
00535   virtual void AttachColliderPlane (const csPlane3& plane) = 0;
00536 
00540   virtual void AttachColliderMesh () = 0;
00541 
00542 
00544   //Forces
00545 
00553   virtual void AddForceOnce (const csVector3& force, bool relative,
00554         const csVector3& position) = 0;
00555 
00564   virtual void AddForceDuration (const csVector3& force, bool relative,
00565         const csVector3& position, float seconds) = 0;
00566 
00574   virtual void AddForceFrame (const csVector3& force, bool relative,
00575         const csVector3& position) = 0;
00576 
00586   virtual uint32 AddForceTagged (const csVector3& force, bool relative, 
00587         const csVector3& position) = 0;
00588 
00593   virtual void RemoveForceTagged (uint32 forceid) = 0;
00594 
00598   virtual void ClearForces () = 0;
00599 
00600 
00602   //Groups and Joints
00603 
00609   virtual void AddToGroup (const char* group) = 0;
00610 
00615   virtual void RemoveFromGroup (const char* group) = 0;
00616 
00620   virtual iJoint* CreateJoint (iPcMechanicsObject* other) = 0;
00621 
00625   virtual csVector3 LocalToWorld(csVector3 local) = 0;
00629   virtual csVector3 WorldToLocal(csVector3 world) = 0;
00630 };
00631 
00645 struct iPcMechanicsJoint : public virtual iBase
00646 {
00647   SCF_INTERFACE (iPcMechanicsJoint, 0, 0, 1);
00648 
00652   virtual iJoint* GetJoint () = 0;
00653 };
00654 
00655 #endif // __CEL_PF_MECHANICS_SYSTEM__
00656 

Generated for CEL: Crystal Entity Layer by doxygen 1.4.7