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, 0, 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 }; 00305 00309 enum ODEJointType 00310 { 00311 CS_ODE_JOINT_TYPE_UNKNOWN = -1, 00312 CS_ODE_JOINT_TYPE_BALL, 00313 CS_ODE_JOINT_TYPE_HINGE, 00314 CS_ODE_JOINT_TYPE_SLIDER, 00315 CS_ODE_JOINT_TYPE_CONTACT, 00316 CS_ODE_JOINT_TYPE_UNIVERSAL, 00317 CS_ODE_JOINT_TYPE_HINGE2, 00318 CS_ODE_JOINT_TYPE_FIXED, 00319 CS_ODE_JOINT_TYPE_AMOTOR 00320 }; 00321 00325 struct iODEJointState : public virtual iBase 00326 { 00327 SCF_INTERFACE(iODEJointState, 2, 0, 0); 00328 00329 virtual ODEJointType GetType() = 0; 00330 00335 virtual void SetLoStop (const csVector3 &value) = 0; 00336 00342 virtual void SetHiStop (const csVector3 &value) = 0; 00343 00345 virtual void SetVel (const csVector3 &value) = 0; 00346 00352 virtual void SetFMax (const csVector3 &value) = 0; 00353 00364 virtual void SetFudgeFactor (const csVector3 &value) = 0; 00365 00371 virtual void SetBounce (const csVector3 &value) = 0; 00372 00377 virtual void SetCFM (const csVector3 &value) = 0; 00378 00380 virtual void SetStopERP (const csVector3 &value) = 0; 00381 00388 virtual void SetStopCFM (const csVector3 &value) = 0; 00389 00391 virtual void SetSuspensionERP (const csVector3 &value) = 0; 00392 00394 virtual void SetSuspensionCFM (const csVector3 &value) = 0; 00395 00397 virtual csVector3 GetLoStop () = 0; 00398 00400 virtual csVector3 GetHiStop () = 0; 00401 00403 virtual csVector3 GetVel () = 0; 00404 00409 virtual csVector3 GetMaxForce () = 0; 00410 00412 virtual csVector3 GetFudgeFactor () = 0; 00413 00415 virtual csVector3 GetBounce () = 0; 00416 00421 virtual csVector3 GetCFM () = 0; 00422 00424 virtual csVector3 GetStopERP () = 0; 00425 00427 virtual csVector3 GetStopCFM () = 0; 00428 00430 virtual csVector3 GetSuspensionERP () = 0; 00431 00433 virtual csVector3 GetSuspensionCFM () = 0; 00434 00435 }; 00436 00440 struct iODEGeneralJointState : public virtual iBase 00441 { 00442 SCF_INTERFACE(iODEGeneralJointState, 2, 0, 0); 00443 00448 virtual void SetLoStop (float value, int axis) = 0; 00449 00455 virtual void SetHiStop (float value, int axis) = 0; 00456 00458 virtual void SetVel (float value, int axis) = 0; 00459 00465 virtual void SetFMax (float value, int axis) = 0; 00466 00477 virtual void SetFudgeFactor (float value, int axis) = 0; 00478 00484 virtual void SetBounce (float value, int axis) = 0; 00485 00490 virtual void SetCFM (float value, int axis) = 0; 00491 00493 virtual void SetStopERP (float value, int axis) = 0; 00494 00501 virtual void SetStopCFM (float value, int axis) = 0; 00502 00504 virtual void SetSuspensionERP (float value, int axis) = 0; 00505 00507 virtual void SetSuspensionCFM (float value, int axis) = 0; 00508 00510 virtual float GetLoStop (int axis) = 0; 00511 00513 virtual float GetHiStop (int axis) = 0; 00514 00516 virtual float GetVel (int axis) = 0; 00517 00522 virtual float GetFMax (int axis) = 0; 00523 00525 virtual float GetFudgeFactor (int axis) = 0; 00526 00528 virtual float GetBounce (int axis) = 0; 00529 00534 virtual float GetCFM (int axis) = 0; 00535 00537 virtual float GetStopERP (int axis) = 0; 00538 00540 virtual float GetStopCFM (int axis) = 0; 00541 00543 virtual float GetSuspensionERP (int axis) = 0; 00544 00546 virtual float GetSuspensionCFM (int axis) = 0; 00547 00555 virtual void Attach (iRigidBody *body1, iRigidBody *body2) = 0; 00556 00558 virtual csRef<iRigidBody> GetAttachedBody (int body) = 0; 00559 00561 virtual csVector3 GetFeedbackForce1 () = 0; 00562 00564 virtual csVector3 GetFeedbackTorque1 () = 0; 00565 00567 virtual csVector3 GetFeedbackForce2 () = 0; 00568 00570 virtual csVector3 GetFeedbackTorque2 () = 0; 00571 00572 }; 00573 00574 struct iODESliderJoint : public iODEGeneralJointState 00575 { 00576 SCF_INTERFACE(iODESliderJoint, 2, 0, 0); 00577 00579 virtual void SetSliderAxis (float x, float y, float z) = 0; 00580 00582 virtual csVector3 GetSliderAxis () = 0; 00583 00589 virtual float GetSliderPosition () = 0; 00590 00592 virtual float GetSliderPositionRate () = 0; 00593 }; 00594 00602 struct iODEUniversalJoint : public iODEGeneralJointState 00603 { 00604 SCF_INTERFACE(iODEUniversalJoint, 2, 0, 0); 00605 00607 virtual void SetUniversalAnchor (float x, float y, float z) = 0; 00608 00610 virtual void SetUniversalAxis1 (float x, float y, float z) = 0; 00611 00613 virtual void SetUniversalAxis2 (float x, float y, float z) = 0; 00614 00620 virtual csVector3 GetUniversalAnchor1 () = 0; 00621 00627 virtual csVector3 GetUniversalAnchor2 () = 0; 00628 00630 virtual csVector3 GetUniversalAxis1 () = 0; 00631 00633 virtual csVector3 GetUniversalAxis2 () = 0; 00634 00635 }; 00636 00637 enum ODEAMotorMode 00638 { 00639 CS_ODE_AMOTOR_MODE_UNKNOWN = -1, 00640 00641 CS_ODE_AMOTOR_MODE_USER = 0, 00642 CS_ODE_AMOTOR_MODE_EULER, 00643 00644 CS_ODE_AMOTOR_MODE_LAST 00645 }; 00646 00658 struct iODEAMotorJoint : public iODEGeneralJointState 00659 { 00660 SCF_INTERFACE(iODEAMotorJoint, 2, 0, 0); 00661 00671 virtual void SetAMotorMode (ODEAMotorMode mode) = 0; 00672 00676 virtual ODEAMotorMode GetAMotorMode () = 0; 00677 00684 virtual void SetAMotorNumAxes (int axis_num) = 0; 00685 00690 virtual int GetAMotorNumAxes () = 0; 00691 00701 virtual void SetAMotorAxis (int axis_num, int rel_orient, float x, float y, 00702 float z) = 0; 00703 00712 virtual void SetAMotorAxis (int axis_num, int rel_orient, 00713 const csVector3 &axis) = 0; 00714 00718 virtual csVector3 GetAMotorAxis (int axis_num) = 0; 00719 00726 virtual int GetAMotorAxisRelOrientation (int axis_num) = 0; 00727 00735 virtual void SetAMotorAngle (int axis_num, float angle) = 0; 00736 00742 virtual float GetAMotorAngle (int axis_num) = 0; 00743 00749 virtual float GetAMotorAngleRate (int axis_num) = 0; 00750 }; 00751 00756 struct iODEHinge2Joint : public iODEGeneralJointState 00757 { 00758 SCF_INTERFACE(iODEHinge2Joint, 2, 0, 0); 00759 00764 virtual void SetHingeAnchor (const csVector3 &pos) = 0; 00765 00769 virtual void SetHingeAxis1 (const csVector3 &axis) = 0; 00770 00774 virtual void SetHingeAxis2 (const csVector3 &axis) = 0; 00775 00776 00781 virtual csVector3 GetHingeAnchor1 () = 0; 00782 00787 virtual csVector3 GetHingeAnchor2 () = 0; 00788 00792 virtual csVector3 GetHingeAxis1 () = 0; 00793 00797 virtual csVector3 GetHingeAxis2 () = 0; 00798 00805 virtual float GetHingeAngle () = 0; 00806 00810 virtual float GetHingeAngleRate1 () = 0; 00811 00815 virtual float GetHingeAngleRate2 () = 0; 00816 00820 virtual csVector3 GetAnchorError () = 0; 00821 00822 }; 00823 00827 struct iODEHingeJoint : public iODEGeneralJointState 00828 { 00829 SCF_INTERFACE(iODEHingeJoint, 2, 0, 0); 00830 00835 virtual void SetHingeAnchor (const csVector3 &pos) = 0; 00836 00840 virtual void SetHingeAxis (const csVector3 &axis) = 0; 00841 00846 virtual csVector3 GetHingeAnchor1 () = 0; 00847 00852 virtual csVector3 GetHingeAnchor2 () = 0; 00853 00857 virtual csVector3 GetHingeAxis () = 0; 00858 00865 virtual float GetHingeAngle () = 0; 00866 00870 virtual float GetHingeAngleRate () = 0; 00871 00875 virtual csVector3 GetAnchorError () = 0; 00876 00877 }; 00878 00882 struct iODEBallJoint : public virtual iBase 00883 { 00884 SCF_INTERFACE(iODEBallJoint, 2, 0, 0); 00885 00890 virtual void SetBallAnchor (const csVector3 &pos) = 0; 00891 00896 virtual csVector3 GetBallAnchor1 () = 0; 00897 00902 virtual csVector3 GetBallAnchor2 () = 0; 00903 00907 virtual csVector3 GetAnchorError () = 0; 00908 00916 virtual void Attach (iRigidBody *body1, iRigidBody *body2) = 0; 00917 00919 virtual csRef<iRigidBody> GetAttachedBody (int body) = 0; 00920 00922 virtual csVector3 GetFeedbackForce1 () = 0; 00923 00925 virtual csVector3 GetFeedbackTorque1 () = 0; 00926 00928 virtual csVector3 GetFeedbackForce2 () = 0; 00929 00931 virtual csVector3 GetFeedbackTorque2 () = 0; 00932 }; 00933 00934 #endif // __CS_IVARIA_ODE_H__
Generated for Crystal Space by doxygen 1.4.7