Panda3D
|
00001 // Filename: odeWorld.I 00002 // Created by: joswilso (27Dec06) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 //////////////////////////////////////////////////////////////////// 00016 // Function: OdeWorld::is_empty 00017 // Access: Published 00018 // Description: Returns true if the ID is 0, meaning the OdeWorld 00019 // does not point to a valid world. It is an error to 00020 // call a method on an empty world. 00021 // Note that an empty OdeWorld also evaluates to False. 00022 //////////////////////////////////////////////////////////////////// 00023 INLINE bool OdeWorld:: 00024 is_empty() const { 00025 return (_id == 0); 00026 } 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Function: OdeWorld::get_id 00030 // Access: Published 00031 // Description: Returns the underlying dWorldID. 00032 //////////////////////////////////////////////////////////////////// 00033 INLINE dWorldID OdeWorld:: 00034 get_id() const { 00035 return _id; 00036 } 00037 00038 INLINE void OdeWorld:: 00039 set_gravity(dReal x, dReal y, dReal z) { 00040 dWorldSetGravity(_id, x, y, z); 00041 } 00042 00043 INLINE void OdeWorld:: 00044 set_gravity(const LVecBase3f &vec) { 00045 dWorldSetGravity(_id, vec[0], vec[1], vec[2]); 00046 } 00047 00048 INLINE LVecBase3f OdeWorld:: 00049 get_gravity() const { 00050 dVector3 gravity; 00051 dWorldGetGravity(_id, gravity); 00052 00053 return LVecBase3f(gravity[0],gravity[1],gravity[2]); 00054 } 00055 00056 INLINE void OdeWorld:: 00057 set_erp(dReal erp) { 00058 dWorldSetERP(_id, erp); 00059 } 00060 00061 INLINE dReal OdeWorld:: 00062 get_erp() const { 00063 return dWorldGetERP(_id); 00064 } 00065 00066 INLINE void OdeWorld:: 00067 set_cfm(dReal cfm) { 00068 dWorldSetCFM(_id, cfm); 00069 } 00070 00071 INLINE dReal OdeWorld:: 00072 get_cfm() const { 00073 return dWorldGetCFM(_id); 00074 } 00075 00076 INLINE void OdeWorld:: 00077 step(dReal stepsize) { 00078 dWorldStep(_id, stepsize); 00079 } 00080 00081 INLINE LVecBase3f OdeWorld:: 00082 impulse_to_force(dReal stepsize, \ 00083 dReal ix, dReal iy, dReal iz){ 00084 dVector3 force; 00085 dWorldImpulseToForce(_id, 00086 stepsize, 00087 ix, iy, iz, 00088 force); 00089 return LVecBase3f(force[0], force[1], force[2]); 00090 } 00091 00092 INLINE LVecBase3f OdeWorld:: 00093 impulse_to_force(dReal stepsize, \ 00094 const LVecBase3f &impulse){ 00095 dVector3 force; 00096 dWorldImpulseToForce(_id, 00097 stepsize, 00098 impulse[0], impulse[1], impulse[2], 00099 force); 00100 return LVecBase3f(force[0], force[1], force[2]); 00101 } 00102 00103 INLINE void OdeWorld:: 00104 quick_step(dReal stepsize) { 00105 dWorldQuickStep(_id, stepsize); 00106 } 00107 00108 INLINE void OdeWorld:: 00109 set_quick_step_num_iterations(int num) { 00110 dWorldSetQuickStepNumIterations(_id, num); 00111 } 00112 00113 INLINE int OdeWorld:: 00114 get_quick_step_num_iterations() const { 00115 return dWorldGetQuickStepNumIterations(_id); 00116 } 00117 00118 INLINE void OdeWorld:: 00119 set_quick_step_w(dReal over_relaxation) { 00120 dWorldSetQuickStepW(_id, over_relaxation); 00121 } 00122 00123 INLINE dReal OdeWorld:: 00124 get_quick_step_w() const { 00125 return dWorldGetQuickStepW(_id); 00126 } 00127 00128 INLINE void OdeWorld:: 00129 set_contact_max_correcting_vel(dReal vel) { 00130 dWorldSetContactMaxCorrectingVel(_id, vel); 00131 } 00132 00133 INLINE dReal OdeWorld:: 00134 get_contact_max_correcting_vel() const { 00135 return dWorldGetContactMaxCorrectingVel(_id); 00136 } 00137 00138 INLINE void OdeWorld:: 00139 set_contact_surface_layer(dReal depth) { 00140 dWorldSetContactSurfaceLayer(_id, depth); 00141 } 00142 00143 INLINE dReal OdeWorld:: 00144 get_contact_surface_layer() const { 00145 return dWorldGetContactSurfaceLayer(_id); 00146 } 00147 00148 INLINE void OdeWorld:: 00149 step_fast1(dReal stepsize, int maxiterations) { 00150 dWorldStepFast1(_id, stepsize, maxiterations); 00151 } 00152 00153 INLINE void OdeWorld:: 00154 set_auto_enable_depth_sf1(int auto_enable_depth) { 00155 dWorldSetAutoEnableDepthSF1(_id, auto_enable_depth); 00156 } 00157 00158 INLINE int OdeWorld:: 00159 get_auto_enable_depth_sf1() const { 00160 return dWorldGetAutoEnableDepthSF1(_id); 00161 } 00162 00163 INLINE dReal OdeWorld:: 00164 get_auto_disable_linear_threshold() const { 00165 return dWorldGetAutoDisableLinearThreshold(_id); 00166 } 00167 00168 INLINE void OdeWorld:: 00169 set_auto_disable_linear_threshold(dReal linear_threshold) { 00170 dWorldSetAutoDisableLinearThreshold(_id, linear_threshold); 00171 } 00172 00173 INLINE dReal OdeWorld:: 00174 get_auto_disable_angular_threshold() const { 00175 return dWorldGetAutoDisableAngularThreshold(_id); 00176 } 00177 00178 INLINE void OdeWorld:: 00179 set_auto_disable_angular_threshold(dReal angular_threshold) { 00180 dWorldSetAutoDisableAngularThreshold(_id, angular_threshold); 00181 } 00182 00183 INLINE int OdeWorld:: 00184 get_auto_disable_steps() const { 00185 return dWorldGetAutoDisableSteps(_id); 00186 } 00187 00188 INLINE void OdeWorld:: 00189 set_auto_disable_steps(int steps) { 00190 dWorldSetAutoDisableSteps(_id, steps); 00191 } 00192 00193 INLINE dReal OdeWorld:: 00194 get_auto_disable_time() const { 00195 return dWorldGetAutoDisableTime(_id); 00196 } 00197 00198 INLINE void OdeWorld:: 00199 set_auto_disable_time(dReal time) { 00200 dWorldSetAutoDisableTime(_id, time); 00201 } 00202 00203 INLINE int OdeWorld:: 00204 get_auto_disable_flag() const { 00205 return dWorldGetAutoDisableFlag(_id); 00206 } 00207 00208 INLINE void OdeWorld:: 00209 set_auto_disable_flag(int do_auto_disable) { 00210 dWorldSetAutoDisableFlag(_id, do_auto_disable); 00211 } 00212 00213 INLINE int OdeWorld:: 00214 compare_to(const OdeWorld &other) const { 00215 if (_id != other._id) { 00216 return _id < other._id ? -1 : 1; 00217 } 00218 return 0; 00219 }