CrystalSpace

Public API Reference

ivaria/ode.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2003 by Jorrit Tyberghein, Daniel Duhprey,
00003     Leandro Motta Barros
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., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 
00020 #ifndef __CS_IVARIA_ODE_H__
00021 #define __CS_IVARIA_ODE_H__
00022 
00027 #include "csutil/scf_interface.h"
00028 
00033 struct iODEFrameUpdateCallback : public virtual iBase
00034 {
00035   SCF_INTERFACE(iODEFrameUpdateCallback, 2, 0, 0);
00036 
00038   virtual void Execute (float stepsize) = 0;
00039 };
00040 
00045 struct iODEDynamicState : public virtual iBase
00046 {
00047   SCF_INTERFACE(iODEDynamicState, 2, 0, 0);
00048 
00049 
00051   virtual void SetGlobalERP (float erp) = 0;
00052   virtual float GlobalERP () = 0;
00053 
00055   virtual void SetGlobalCFM (float cfm) = 0;
00056   virtual float GlobalCFM () = 0;
00057 
00059   virtual void EnableStepFast (bool enable) = 0;
00060   virtual bool StepFastEnabled () = 0;
00061   virtual void SetStepFastIterations (int iter) = 0;
00062   virtual int StepFastIterations () = 0;
00063 
00064   virtual void EnableQuickStep (bool enable) = 0;
00065   virtual bool QuickStepEnabled () = 0;
00066   virtual void SetQuickStepIterations (int iter) = 0;
00067   virtual int QuickStepIterations () = 0;
00068 
00084   virtual void EnableFrameRate (bool enable) = 0;
00085   virtual bool FrameRateEnabled () = 0;
00086 
00087   virtual void SetFrameRate (float hz) = 0;
00088   virtual float FrameRate () = 0;
00089 
00090   virtual void SetFrameLimit (float hz) = 0;
00091   virtual float FrameLimit () = 0;
00092 
00093   virtual void AddFrameUpdateCallback (iODEFrameUpdateCallback *cb) = 0;
00094   virtual void RemoveFrameUpdateCallback (iODEFrameUpdateCallback *cb) = 0;
00095 
00101   virtual void EnableEventProcessing (bool enable) = 0;
00102   virtual bool EventProcessingEnabled () = 0;
00103 
00115   virtual void EnableFastObjects (bool enable) = 0;
00116   virtual bool FastObjectsEnabled () = 0;
00117 
00118 };
00119 
00120 struct iODEBallJoint;
00121 struct iODEHingeJoint;
00122 struct iODEHinge2Joint;
00123 struct iODEAMotorJoint;
00124 struct iODEUniversalJoint;
00125 struct iODESliderJoint;
00126 
00132 struct iODEDynamicSystemState : public virtual iBase
00133 {
00134   SCF_INTERFACE(iODEDynamicSystemState, 2, 1, 0);
00135 
00141   virtual void SetERP (float erp) = 0;
00142   virtual float ERP () = 0;
00143 
00149   virtual void SetCFM (float cfm) = 0;
00150   virtual float CFM () = 0;
00151 
00157   virtual void EnableStepFast (bool enable) = 0;
00158   virtual bool StepFastEnabled () = 0;
00159   virtual void SetStepFastIterations (int iter) = 0;
00160   virtual int StepFastIterations () = 0;
00161 
00162   virtual void EnableQuickStep (bool enable) = 0;
00163   virtual bool QuickStepEnabled () = 0;
00164   virtual void SetQuickStepIterations (int iter) = 0;
00165   virtual int QuickStepIterations () = 0;
00166 
00172   virtual void EnableAutoDisable (bool enable) = 0;
00173   virtual bool AutoDisableEnabled () =0;
00183   virtual void SetAutoDisableParams (float linear, float angular, int steps,
00184     float time)=0;
00185 
00202   virtual void EnableFrameRate (bool enable) = 0;
00203   virtual bool FrameRateEnabled () = 0;
00204 
00205   virtual void SetFrameRate (float hz) = 0;
00206   virtual float FrameRate () = 0;
00207 
00208   virtual void SetFrameLimit (float hz) = 0;
00209   virtual float FrameLimit () = 0;
00210 
00211   virtual void AddFrameUpdateCallback (iODEFrameUpdateCallback *cb) = 0;
00212   virtual void RemoveFrameUpdateCallback (iODEFrameUpdateCallback *cb) = 0;
00213 
00227   virtual void EnableFastObjects (bool enable) = 0;
00228   virtual bool FastObjectsEnabled () = 0;
00229 
00231   virtual csPtr<iODEBallJoint> CreateBallJoint () = 0;
00232 
00234   virtual csPtr<iODEHingeJoint> CreateHingeJoint () = 0;
00235 
00237   virtual csPtr<iODEHinge2Joint> CreateHinge2Joint () = 0;
00238 
00240   virtual csPtr<iODEAMotorJoint> CreateAMotorJoint () = 0;
00241 
00243   virtual csPtr<iODEUniversalJoint> CreateUniversalJoint () = 0;
00244 
00246   virtual csPtr<iODESliderJoint> CreateSliderJoint () = 0;
00247 
00249   virtual void RemoveJoint (iODEBallJoint* joint) = 0;
00250 
00252   virtual void RemoveJoint (iODEHingeJoint* joint) = 0;
00253 
00255   virtual void RemoveJoint (iODEAMotorJoint* joint) = 0;
00256 
00258   virtual void RemoveJoint (iODEUniversalJoint* joint) = 0;
00259 
00261   virtual void RemoveJoint (iODESliderJoint* joint) = 0;
00262 
00264   virtual void RemoveJoint (iODEHinge2Joint* joint) = 0;
00265 
00273   virtual void SetContactMaxCorrectingVel (float v) = 0;
00274 
00281   virtual float GetContactMaxCorrectingVel () = 0;
00282 
00292   virtual void SetContactSurfaceLayer (float depth) = 0;
00293 
00303   virtual float GetContactSurfaceLayer () = 0;
00304 
00309   virtual void EnableOldInertia (bool enable) = 0;
00310   virtual bool IsOldInertiaEnabled () const = 0;
00311 };
00312 
00316 enum ODEJointType
00317 {
00318   CS_ODE_JOINT_TYPE_UNKNOWN = -1,
00319   CS_ODE_JOINT_TYPE_BALL,
00320   CS_ODE_JOINT_TYPE_HINGE,
00321   CS_ODE_JOINT_TYPE_SLIDER,
00322   CS_ODE_JOINT_TYPE_CONTACT,
00323   CS_ODE_JOINT_TYPE_UNIVERSAL,
00324   CS_ODE_JOINT_TYPE_HINGE2,
00325   CS_ODE_JOINT_TYPE_FIXED,
00326   CS_ODE_JOINT_TYPE_AMOTOR
00327 };
00328 
00332 struct iODEJointState : public virtual iBase
00333 {
00334   SCF_INTERFACE(iODEJointState, 2, 0, 0);
00335 
00336   virtual ODEJointType GetType() = 0;
00337 
00342   virtual void SetLoStop (const csVector3 &value) = 0;
00343 
00349   virtual void SetHiStop (const csVector3 &value) = 0;
00350 
00352   virtual void SetVel (const csVector3 &value) = 0;
00353 
00359   virtual void SetFMax (const csVector3 &value) = 0;
00360 
00371   virtual void SetFudgeFactor (const csVector3 &value) = 0;
00372 
00378   virtual void SetBounce (const csVector3 &value) = 0;
00379 
00384   virtual void SetCFM (const csVector3 &value) = 0;
00385 
00387   virtual void SetStopERP (const csVector3 &value) = 0;
00388 
00395   virtual void SetStopCFM (const csVector3 &value) = 0;
00396 
00398   virtual void SetSuspensionERP (const csVector3 &value) = 0;
00399 
00401   virtual void SetSuspensionCFM (const csVector3 &value) = 0;
00402 
00404   virtual csVector3 GetLoStop () = 0;
00405 
00407   virtual csVector3 GetHiStop () = 0;
00408 
00410   virtual csVector3 GetVel () = 0;
00411 
00416   virtual csVector3 GetMaxForce () = 0;
00417 
00419   virtual csVector3 GetFudgeFactor () = 0;
00420 
00422   virtual csVector3 GetBounce () = 0;
00423 
00428   virtual csVector3 GetCFM () = 0;
00429 
00431   virtual csVector3 GetStopERP () = 0;
00432 
00434   virtual csVector3 GetStopCFM () = 0;
00435 
00437   virtual csVector3 GetSuspensionERP () = 0;
00438 
00440   virtual csVector3 GetSuspensionCFM () = 0;
00441 
00442 };
00443 
00447 struct iODEGeneralJointState : public virtual iBase
00448 {
00449   SCF_INTERFACE(iODEGeneralJointState, 2, 0, 0);
00450 
00455   virtual void SetLoStop (float value, int axis) = 0;
00456 
00462   virtual void SetHiStop (float value, int axis) = 0;
00463 
00465   virtual void SetVel (float value, int axis) = 0;
00466 
00472   virtual void SetFMax (float value, int axis) = 0;
00473 
00484   virtual void SetFudgeFactor (float value, int axis) = 0;
00485 
00491   virtual void SetBounce (float value, int axis) = 0;
00492 
00497   virtual void SetCFM (float value, int axis) = 0;
00498 
00500   virtual void SetStopERP (float value, int axis) = 0;
00501 
00508   virtual void SetStopCFM (float value, int axis) = 0;
00509 
00511   virtual void SetSuspensionERP (float value, int axis) = 0;
00512 
00514   virtual void SetSuspensionCFM (float value, int axis) = 0;
00515 
00517   virtual float GetLoStop (int axis) = 0;
00518 
00520   virtual float GetHiStop (int axis) = 0;
00521 
00523   virtual float GetVel (int axis) = 0;
00524 
00529   virtual float GetFMax (int axis) = 0;
00530 
00532   virtual float GetFudgeFactor (int axis) = 0;
00533 
00535   virtual float GetBounce (int axis) = 0;
00536 
00541   virtual float GetCFM (int axis) = 0;
00542 
00544   virtual float GetStopERP (int axis) = 0;
00545 
00547   virtual float GetStopCFM (int axis) = 0;
00548 
00550   virtual float GetSuspensionERP (int axis) = 0;
00551 
00553   virtual float GetSuspensionCFM (int axis) = 0;
00554 
00562   virtual void Attach (iRigidBody *body1, iRigidBody *body2) = 0;
00563 
00565   virtual csRef<iRigidBody> GetAttachedBody (int body) = 0;
00566 
00568   virtual csVector3 GetFeedbackForce1 () = 0;
00569 
00571   virtual csVector3 GetFeedbackTorque1 () = 0;
00572 
00574   virtual csVector3 GetFeedbackForce2 () = 0;
00575 
00577   virtual csVector3 GetFeedbackTorque2 () = 0;
00578 
00579 };
00580 
00581 struct iODESliderJoint : public virtual iODEGeneralJointState
00582 {
00583   SCF_INTERFACE(iODESliderJoint, 2, 1, 0);
00584 
00586   virtual void SetSliderAxis (float x, float y, float z) = 0;
00587 
00589   virtual csVector3 GetSliderAxis () = 0;
00590 
00596   virtual float GetSliderPosition () = 0;
00597 
00599   virtual float GetSliderPositionRate () = 0;
00600 };
00601 
00609 struct iODEUniversalJoint : public virtual iODEGeneralJointState
00610 {
00611   SCF_INTERFACE(iODEUniversalJoint, 2, 1, 0);
00612 
00614   virtual void SetUniversalAnchor (float x, float y, float z) = 0;
00615 
00617   virtual void SetUniversalAxis1 (float x, float y, float z) = 0;
00618 
00620   virtual void SetUniversalAxis2 (float x, float y, float z) = 0;
00621 
00627   virtual csVector3 GetUniversalAnchor1 () = 0;
00628 
00634   virtual csVector3 GetUniversalAnchor2 () = 0;
00635 
00637   virtual csVector3 GetUniversalAxis1 () = 0;
00638 
00640   virtual csVector3 GetUniversalAxis2 () = 0;
00641 
00642 };
00643 
00644 enum ODEAMotorMode
00645 {
00646   CS_ODE_AMOTOR_MODE_UNKNOWN = -1,
00647 
00648   CS_ODE_AMOTOR_MODE_USER = 0,
00649   CS_ODE_AMOTOR_MODE_EULER,
00650 
00651   CS_ODE_AMOTOR_MODE_LAST
00652 };
00653 
00665 struct iODEAMotorJoint : public virtual iODEGeneralJointState
00666 {
00667   SCF_INTERFACE(iODEAMotorJoint, 2, 1, 0);
00668 
00678   virtual void SetAMotorMode (ODEAMotorMode mode) = 0;
00679 
00683   virtual ODEAMotorMode GetAMotorMode () = 0;
00684 
00691   virtual void SetAMotorNumAxes (int axis_num) = 0;
00692 
00697   virtual int GetAMotorNumAxes () = 0;
00698 
00708   virtual void SetAMotorAxis (int axis_num, int rel_orient, float x, float y,
00709         float z) = 0;
00710 
00719   virtual void SetAMotorAxis (int axis_num, int rel_orient,
00720         const csVector3 &axis) = 0;
00721 
00725   virtual csVector3 GetAMotorAxis (int axis_num) = 0;
00726 
00733   virtual int GetAMotorAxisRelOrientation (int axis_num) = 0;
00734 
00742   virtual void SetAMotorAngle (int axis_num, float angle) = 0;
00743 
00749   virtual float GetAMotorAngle (int axis_num) = 0;
00750 
00756   virtual float GetAMotorAngleRate (int axis_num) = 0;
00757 };
00758 
00763 struct iODEHinge2Joint : public virtual iODEGeneralJointState
00764 {
00765   SCF_INTERFACE(iODEHinge2Joint, 2, 1, 0);
00766 
00771   virtual void SetHingeAnchor (const csVector3 &pos) = 0;
00772 
00776   virtual void SetHingeAxis1 (const csVector3 &axis) = 0;
00777 
00781   virtual void SetHingeAxis2 (const csVector3 &axis) = 0;
00782 
00783 
00788   virtual csVector3 GetHingeAnchor1 () = 0;
00789 
00794   virtual csVector3 GetHingeAnchor2 () = 0;
00795 
00799   virtual csVector3 GetHingeAxis1 () = 0;
00800 
00804   virtual csVector3 GetHingeAxis2 () = 0;
00805 
00812   virtual float GetHingeAngle () = 0;
00813 
00817   virtual float GetHingeAngleRate1 () = 0;
00818 
00822   virtual float GetHingeAngleRate2 () = 0;
00823 
00827   virtual csVector3 GetAnchorError () = 0;
00828 
00829 };
00830 
00834 struct iODEHingeJoint : public virtual iODEGeneralJointState
00835 {
00836   SCF_INTERFACE(iODEHingeJoint, 2, 1, 0);
00837 
00842   virtual void SetHingeAnchor (const csVector3 &pos) = 0;
00843 
00847   virtual void SetHingeAxis (const csVector3 &axis) = 0;
00848 
00853   virtual csVector3 GetHingeAnchor1 () = 0;
00854 
00859   virtual csVector3 GetHingeAnchor2 () = 0;
00860 
00864   virtual csVector3 GetHingeAxis () = 0;
00865 
00872   virtual float GetHingeAngle () = 0;
00873 
00877   virtual float GetHingeAngleRate () = 0;
00878 
00882   virtual csVector3 GetAnchorError () = 0;
00883 
00884 };
00885 
00889 struct iODEBallJoint : public virtual iBase
00890 {
00891   SCF_INTERFACE(iODEBallJoint, 2, 0, 0);
00892 
00897   virtual void SetBallAnchor (const csVector3 &pos) = 0;
00898 
00903   virtual csVector3 GetBallAnchor1 () = 0;
00904 
00909   virtual csVector3 GetBallAnchor2 () = 0;
00910 
00914   virtual csVector3 GetAnchorError () = 0;
00915 
00923   virtual void Attach (iRigidBody *body1, iRigidBody *body2) = 0;
00924 
00926   virtual csRef<iRigidBody> GetAttachedBody (int body) = 0;
00927 
00929   virtual csVector3 GetFeedbackForce1 () = 0;
00930 
00932   virtual csVector3 GetFeedbackTorque1 () = 0;
00933 
00935   virtual csVector3 GetFeedbackForce2 () = 0;
00936 
00938   virtual csVector3 GetFeedbackTorque2 () = 0;
00939 };
00940 
00941 #endif // __CS_IVARIA_ODE_H__

Generated for Crystal Space 1.2.1 by doxygen 1.5.3