ivaria/ode.h Source File (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
    00046 struct iODEDynamicState : public virtual iBase
    00047 {
    00048   SCF_INTERFACE(iODEDynamicState, 2, 0, 0);
    00049
    00050
    00052   virtual void SetGlobalERP (float erp) = 0;
    00053   virtual float GlobalERP () = 0;
    00054
    00056   virtual void SetGlobalCFM (float cfm) = 0;
    00057   virtual float GlobalCFM () = 0;
    00058
    00060   virtual void EnableStepFast (bool enable) = 0;
    00061   virtual bool StepFastEnabled () = 0;
    00062   virtual void SetStepFastIterations (int iter) = 0;
    00063   virtual int StepFastIterations () = 0;
    00064
    00065   virtual void EnableQuickStep (bool enable) = 0;
    00066   virtual bool QuickStepEnabled () = 0;
    00067   virtual void SetQuickStepIterations (int iter) = 0;
    00068   virtual int QuickStepIterations () = 0;
    00069
    00085   virtual void EnableFrameRate (bool enable) = 0;
    00086   virtual bool FrameRateEnabled () = 0;
    00087
    00088   virtual void SetFrameRate (float hz) = 0;
    00089   virtual float FrameRate () = 0;
    00090
    00091   virtual void SetFrameLimit (float hz) = 0;
    00092   virtual float FrameLimit () = 0;
    00093
    00094   virtual void AddFrameUpdateCallback (iODEFrameUpdateCallback *cb) = 0;
    00095   virtual void RemoveFrameUpdateCallback (iODEFrameUpdateCallback *cb) = 0;
    00096
    00102   virtual void EnableEventProcessing (bool enable) = 0;
    00103   virtual bool EventProcessingEnabled () = 0;
    00104
    00116   virtual void EnableFastObjects (bool enable) = 0;
    00117   virtual bool FastObjectsEnabled () = 0;
    00118
    00119 };
    00120
    00121 struct iODEBallJoint;
    00122 struct iODEHingeJoint;
    00123 struct iODEHinge2Joint;
    00124 struct iODEAMotorJoint;
    00125 struct iODEUniversalJoint;
    00126 struct iODESliderJoint;
    00127
    00134 struct iODEDynamicSystemState : public virtual iBase
    00135 {
    00136   SCF_INTERFACE(iODEDynamicSystemState, 2, 1, 0);
    00137
    00143   virtual void SetERP (float erp) = 0;
    00144   virtual float ERP () = 0;
    00145
    00151   virtual void SetCFM (float cfm) = 0;
    00152   virtual float CFM () = 0;
    00153
    00159   virtual void EnableStepFast (bool enable) = 0;
    00160   virtual bool StepFastEnabled () = 0;
    00161   virtual void SetStepFastIterations (int iter) = 0;
    00162   virtual int StepFastIterations () = 0;
    00163
    00164   virtual void EnableQuickStep (bool enable) = 0;
    00165   virtual bool QuickStepEnabled () = 0;
    00166   virtual void SetQuickStepIterations (int iter) = 0;
    00167   virtual int QuickStepIterations () = 0;
    00168
    00174   virtual void EnableAutoDisable (bool enable) = 0;
    00175   virtual bool AutoDisableEnabled () =0;
    00185   virtual void SetAutoDisableParams (float linear, float angular, int steps,
    00186     float time)=0;
    00187
    00204   virtual void EnableFrameRate (bool enable) = 0;
    00205   virtual bool FrameRateEnabled () = 0;
    00206
    00207   virtual void SetFrameRate (float hz) = 0;
    00208   virtual float FrameRate () = 0;
    00209
    00210   virtual void SetFrameLimit (float hz) = 0;
    00211   virtual float FrameLimit () = 0;
    00212
    00213   virtual void AddFrameUpdateCallback (iODEFrameUpdateCallback *cb) = 0;
    00214   virtual void RemoveFrameUpdateCallback (iODEFrameUpdateCallback *cb) = 0;
    00215
    00229   virtual void EnableFastObjects (bool enable) = 0;
    00230   virtual bool FastObjectsEnabled () = 0;
    00231
    00233   virtual csPtr<iODEBallJoint> CreateBallJoint () = 0;
    00234
    00236   virtual csPtr<iODEHingeJoint> CreateHingeJoint () = 0;
    00237
    00239   virtual csPtr<iODEHinge2Joint> CreateHinge2Joint () = 0;
    00240
    00242   virtual csPtr<iODEAMotorJoint> CreateAMotorJoint () = 0;
    00243
    00245   virtual csPtr<iODEUniversalJoint> CreateUniversalJoint () = 0;
    00246
    00248   virtual csPtr<iODESliderJoint> CreateSliderJoint () = 0;
    00249
    00251   virtual void RemoveJoint (iODEBallJoint* joint) = 0;
    00252
    00254   virtual void RemoveJoint (iODEHingeJoint* joint) = 0;
    00255
    00257   virtual void RemoveJoint (iODEAMotorJoint* joint) = 0;
    00258
    00260   virtual void RemoveJoint (iODEUniversalJoint* joint) = 0;
    00261
    00263   virtual void RemoveJoint (iODESliderJoint* joint) = 0;
    00264
    00266   virtual void RemoveJoint (iODEHinge2Joint* joint) = 0;
    00267
    00275   virtual void SetContactMaxCorrectingVel (float v) = 0;
    00276
    00283   virtual float GetContactMaxCorrectingVel () = 0;
    00284
    00294   virtual void SetContactSurfaceLayer (float depth) = 0;
    00295
    00305   virtual float GetContactSurfaceLayer () = 0;
    00306
    00311   virtual void EnableOldInertia (bool enable) = 0;
    00312   virtual bool IsOldInertiaEnabled () const = 0;
    00313 };
    00314
    00318 enum ODEJointType
    00319 {
    00320   CS_ODE_JOINT_TYPE_UNKNOWN = -1,
    00321   CS_ODE_JOINT_TYPE_BALL,
    00322   CS_ODE_JOINT_TYPE_HINGE,
    00323   CS_ODE_JOINT_TYPE_SLIDER,
    00324   CS_ODE_JOINT_TYPE_CONTACT,
    00325   CS_ODE_JOINT_TYPE_UNIVERSAL,
    00326   CS_ODE_JOINT_TYPE_HINGE2,
    00327   CS_ODE_JOINT_TYPE_FIXED,
    00328   CS_ODE_JOINT_TYPE_AMOTOR
    00329 };
    00330
    00334 struct iODEJointState : public virtual iBase
    00335 {
    00336   SCF_INTERFACE(iODEJointState, 2, 0, 0);
    00337
    00338   virtual ODEJointType GetType() = 0;
    00339
    00344   virtual void SetLoStop (const csVector3 &value) = 0;
    00345
    00351   virtual void SetHiStop (const csVector3 &value) = 0;
    00352
    00354   virtual void SetVel (const csVector3 &value) = 0;
    00355
    00361   virtual void SetFMax (const csVector3 &value) = 0;
    00362
    00373   virtual void SetFudgeFactor (const csVector3 &value) = 0;
    00374
    00380   virtual void SetBounce (const csVector3 &value) = 0;
    00381
    00386   virtual void SetCFM (const csVector3 &value) = 0;
    00387
    00389   virtual void SetStopERP (const csVector3 &value) = 0;
    00390
    00397   virtual void SetStopCFM (const csVector3 &value) = 0;
    00398
    00400   virtual void SetSuspensionERP (const csVector3 &value) = 0;
    00401
    00403   virtual void SetSuspensionCFM (const csVector3 &value) = 0;
    00404
    00406   virtual csVector3 GetLoStop () = 0;
    00407
    00409   virtual csVector3 GetHiStop () = 0;
    00410
    00412   virtual csVector3 GetVel () = 0;
    00413
    00418   virtual csVector3 GetMaxForce () = 0;
    00419
    00421   virtual csVector3 GetFudgeFactor () = 0;
    00422
    00424   virtual csVector3 GetBounce () = 0;
    00425
    00430   virtual csVector3 GetCFM () = 0;
    00431
    00433   virtual csVector3 GetStopERP () = 0;
    00434
    00436   virtual csVector3 GetStopCFM () = 0;
    00437
    00439   virtual csVector3 GetSuspensionERP () = 0;
    00440
    00442   virtual csVector3 GetSuspensionCFM () = 0;
    00443
    00444 };
    00445
    00449 struct iODEGeneralJointState : public virtual iBase
    00450 {
    00451   SCF_INTERFACE(iODEGeneralJointState, 2, 0, 0);
    00452
    00457   virtual void SetLoStop (float value, int axis) = 0;
    00458
    00464   virtual void SetHiStop (float value, int axis) = 0;
    00465
    00467   virtual void SetVel (float value, int axis) = 0;
    00468
    00474   virtual void SetFMax (float value, int axis) = 0;
    00475
    00486   virtual void SetFudgeFactor (float value, int axis) = 0;
    00487
    00493   virtual void SetBounce (float value, int axis) = 0;
    00494
    00499   virtual void SetCFM (float value, int axis) = 0;
    00500
    00502   virtual void SetStopERP (float value, int axis) = 0;
    00503
    00510   virtual void SetStopCFM (float value, int axis) = 0;
    00511
    00513   virtual void SetSuspensionERP (float value, int axis) = 0;
    00514
    00516   virtual void SetSuspensionCFM (float value, int axis) = 0;
    00517
    00519   virtual float GetLoStop (int axis) = 0;
    00520
    00522   virtual float GetHiStop (int axis) = 0;
    00523
    00525   virtual float GetVel (int axis) = 0;
    00526
    00531   virtual float GetFMax (int axis) = 0;
    00532
    00534   virtual float GetFudgeFactor (int axis) = 0;
    00535
    00537   virtual float GetBounce (int axis) = 0;
    00538
    00543   virtual float GetCFM (int axis) = 0;
    00544
    00546   virtual float GetStopERP (int axis) = 0;
    00547
    00549   virtual float GetStopCFM (int axis) = 0;
    00550
    00552   virtual float GetSuspensionERP (int axis) = 0;
    00553
    00555   virtual float GetSuspensionCFM (int axis) = 0;
    00556
    00564   virtual void Attach (iRigidBody *body1, iRigidBody *body2) = 0;
    00565
    00567   virtual csRef<iRigidBody> GetAttachedBody (int body) = 0;
    00568
    00570   virtual csVector3 GetFeedbackForce1 () = 0;
    00571
    00573   virtual csVector3 GetFeedbackTorque1 () = 0;
    00574
    00576   virtual csVector3 GetFeedbackForce2 () = 0;
    00577
    00579   virtual csVector3 GetFeedbackTorque2 () = 0;
    00580
    00581 };
    00582
    00583 struct iODESliderJoint : public virtual iODEGeneralJointState
    00584 {
    00585   SCF_INTERFACE(iODESliderJoint, 2, 1, 0);
    00586
    00588   virtual void SetSliderAxis (float x, float y, float z) = 0;
    00589
    00591   virtual csVector3 GetSliderAxis () = 0;
    00592
    00598   virtual float GetSliderPosition () = 0;
    00599
    00601   virtual float GetSliderPositionRate () = 0;
    00602 };
    00603
    00611 struct iODEUniversalJoint : public virtual iODEGeneralJointState
    00612 {
    00613   SCF_INTERFACE(iODEUniversalJoint, 2, 1, 0);
    00614
    00616   virtual void SetUniversalAnchor (float x, float y, float z) = 0;
    00617
    00619   virtual void SetUniversalAxis1 (float x, float y, float z) = 0;
    00620
    00622   virtual void SetUniversalAxis2 (float x, float y, float z) = 0;
    00623
    00629   virtual csVector3 GetUniversalAnchor1 () = 0;
    00630
    00636   virtual csVector3 GetUniversalAnchor2 () = 0;
    00637
    00639   virtual csVector3 GetUniversalAxis1 () = 0;
    00640
    00642   virtual csVector3 GetUniversalAxis2 () = 0;
    00643
    00644 };
    00645
    00646 enum ODEAMotorMode
    00647 {
    00648   CS_ODE_AMOTOR_MODE_UNKNOWN = -1,
    00649
    00650   CS_ODE_AMOTOR_MODE_USER = 0,
    00651   CS_ODE_AMOTOR_MODE_EULER,
    00652
    00653   CS_ODE_AMOTOR_MODE_LAST
    00654 };
    00655
    00667 struct iODEAMotorJoint : public virtual iODEGeneralJointState
    00668 {
    00669   SCF_INTERFACE(iODEAMotorJoint, 2, 1, 0);
    00670
    00680   virtual void SetAMotorMode (ODEAMotorMode mode) = 0;
    00681
    00685   virtual ODEAMotorMode GetAMotorMode () = 0;
    00686
    00693   virtual void SetAMotorNumAxes (int axis_num) = 0;
    00694
    00699   virtual int GetAMotorNumAxes () = 0;
    00700
    00710   virtual void SetAMotorAxis (int axis_num, int rel_orient, float x, float y,
    00711         float z) = 0;
    00712
    00721   virtual void SetAMotorAxis (int axis_num, int rel_orient,
    00722         const csVector3 &axis) = 0;
    00723
    00727   virtual csVector3 GetAMotorAxis (int axis_num) = 0;
    00728
    00735   virtual int GetAMotorAxisRelOrientation (int axis_num) = 0;
    00736
    00744   virtual void SetAMotorAngle (int axis_num, float angle) = 0;
    00745
    00751   virtual float GetAMotorAngle (int axis_num) = 0;
    00752
    00758   virtual float GetAMotorAngleRate (int axis_num) = 0;
    00759 };
    00760
    00765 struct iODEHinge2Joint : public virtual iODEGeneralJointState
    00766 {
    00767   SCF_INTERFACE(iODEHinge2Joint, 2, 1, 0);
    00768
    00773   virtual void SetHingeAnchor (const csVector3 &pos) = 0;
    00774
    00778   virtual void SetHingeAxis1 (const csVector3 &axis) = 0;
    00779
    00783   virtual void SetHingeAxis2 (const csVector3 &axis) = 0;
    00784
    00785
    00790   virtual csVector3 GetHingeAnchor1 () = 0;
    00791
    00796   virtual csVector3 GetHingeAnchor2 () = 0;
    00797
    00801   virtual csVector3 GetHingeAxis1 () = 0;
    00802
    00806   virtual csVector3 GetHingeAxis2 () = 0;
    00807
    00814   virtual float GetHingeAngle () = 0;
    00815
    00819   virtual float GetHingeAngleRate1 () = 0;
    00820
    00824   virtual float GetHingeAngleRate2 () = 0;
    00825
    00829   virtual csVector3 GetAnchorError () = 0;
    00830
    00831 };
    00832
    00836 struct iODEHingeJoint : public virtual iODEGeneralJointState
    00837 {
    00838   SCF_INTERFACE(iODEHingeJoint, 2, 1, 0);
    00839
    00844   virtual void SetHingeAnchor (const csVector3 &pos) = 0;
    00845
    00849   virtual void SetHingeAxis (const csVector3 &axis) = 0;
    00850
    00855   virtual csVector3 GetHingeAnchor1 () = 0;
    00856
    00861   virtual csVector3 GetHingeAnchor2 () = 0;
    00862
    00866   virtual csVector3 GetHingeAxis () = 0;
    00867
    00874   virtual float GetHingeAngle () = 0;
    00875
    00879   virtual float GetHingeAngleRate () = 0;
    00880
    00884   virtual csVector3 GetAnchorError () = 0;
    00885
    00886 };
    00887
    00891 struct iODEBallJoint : public virtual iBase
    00892 {
    00893   SCF_INTERFACE(iODEBallJoint, 2, 0, 0);
    00894
    00899   virtual void SetBallAnchor (const csVector3 &pos) = 0;
    00900
    00905   virtual csVector3 GetBallAnchor1 () = 0;
    00906
    00911   virtual csVector3 GetBallAnchor2 () = 0;
    00912
    00916   virtual csVector3 GetAnchorError () = 0;
    00917
    00925   virtual void Attach (iRigidBody *body1, iRigidBody *body2) = 0;
    00926
    00928   virtual csRef<iRigidBody> GetAttachedBody (int body) = 0;
    00929
    00931   virtual csVector3 GetFeedbackForce1 () = 0;
    00932
    00934   virtual csVector3 GetFeedbackTorque1 () = 0;
    00935
    00937   virtual csVector3 GetFeedbackForce2 () = 0;
    00938
    00940   virtual csVector3 GetFeedbackTorque2 () = 0;
    00941 };
    00942
    00943 #endif // __CS_IVARIA_ODE_H__