From a80d9f95ba9e8bc632a1bda56453c41d6ab829b2 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Sun, 11 Feb 2007 07:38:27 +0000 Subject: [PATCH] formatting and added LVecBase3f functionality --- panda/src/ode/odeWorld.I | 18 +++++++++++++++++- panda/src/ode/odeWorld.h | 41 +++++++++++++++++++++++----------------- 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/panda/src/ode/odeWorld.I b/panda/src/ode/odeWorld.I index 6a6e10ea78..7fdb384cbd 100755 --- a/panda/src/ode/odeWorld.I +++ b/panda/src/ode/odeWorld.I @@ -26,6 +26,11 @@ set_gravity(dReal x, dReal y, dReal z) { dWorldSetGravity(_id, x, y, z); } +INLINE void OdeWorld:: +set_gravity(const LVecBase3f &vec) { + dWorldSetGravity(_id, vec[0], vec[1], vec[2]); +} + INLINE LVecBase3f OdeWorld:: get_gravity() const { dVector3 gravity; @@ -61,7 +66,7 @@ step(dReal stepsize) { INLINE LVecBase3f OdeWorld:: impulse_to_force(dReal stepsize, \ - dReal ix, dReal iy, dReal iz){ + dReal ix, dReal iy, dReal iz){ dVector3 force; dWorldImpulseToForce(_id, stepsize, @@ -70,6 +75,17 @@ impulse_to_force(dReal stepsize, \ return LVecBase3f(force[0], force[1], force[2]); } +INLINE LVecBase3f OdeWorld:: +impulse_to_force(dReal stepsize, \ + const LVecBase3f &impulse){ + dVector3 force; + dWorldImpulseToForce(_id, + stepsize, + impulse[0], impulse[1], impulse[2], + force); + return LVecBase3f(force[0], force[1], force[2]); +} + INLINE void OdeWorld:: quick_step(dReal stepsize) { dWorldQuickStep(_id, stepsize); diff --git a/panda/src/ode/odeWorld.h b/panda/src/ode/odeWorld.h index 0ffe7a4e31..8e5472d9ec 100755 --- a/panda/src/ode/odeWorld.h +++ b/panda/src/ode/odeWorld.h @@ -39,36 +39,43 @@ PUBLISHED: void destroy(); INLINE void set_gravity(dReal x, dReal y, dReal z); - INLINE LVecBase3f get_gravity() const; + INLINE void set_gravity(const LVecBase3f &vec); INLINE void set_erp(dReal erp); - INLINE dReal get_erp() const; INLINE void set_cfm(dReal cfm); - INLINE dReal get_cfm() const; - INLINE void step(dReal stepsize); - INLINE LVecBase3f impulse_to_force(dReal stepsize, \ - dReal ix, dReal iy, dReal iz); - INLINE void quick_step(dReal stepsize); INLINE void set_quick_step_num_iterations(int num); - INLINE int get_quick_step_num_iterations() const; + INLINE void set_quick_step_w(dReal over_relaxation); - INLINE dReal get_quick_step_w() const; INLINE void set_contact_max_correcting_vel(dReal vel); - INLINE dReal get_contact_max_correcting_vel() const; INLINE void set_contact_surface_layer(dReal depth); - INLINE dReal get_contact_surface_layer() const; - INLINE void step_fast1(dReal stepsize, int maxiterations); INLINE void set_auto_enable_depth_sf1(int auto_enable_depth); + INLINE void set_auto_disable_linear_threshold(dReal linear_threshold); + INLINE void set_auto_disable_angular_threshold(dReal angular_threshold); + INLINE void set_auto_disable_steps(int steps); + INLINE void set_auto_disable_time(dReal time); + INLINE void set_auto_disable_flag(int do_auto_disable); + + INLINE LVecBase3f get_gravity() const; + INLINE dReal get_erp() const; + INLINE dReal get_cfm() const; + INLINE int get_quick_step_num_iterations() const; + INLINE dReal get_quick_step_w() const; + INLINE dReal get_contact_max_correcting_vel() const; + INLINE dReal get_contact_surface_layer() const; INLINE int get_auto_enable_depth_sf1() const; INLINE dReal get_auto_disable_linear_threshold() const; - INLINE void set_auto_disable_linear_threshold(dReal linear_threshold); INLINE dReal get_auto_disable_angular_threshold() const; - INLINE void set_auto_disable_angular_threshold(dReal angular_threshold); INLINE int get_auto_disable_steps() const; - INLINE void set_auto_disable_steps(int steps); INLINE dReal get_auto_disable_time() const; - INLINE void set_auto_disable_time(dReal time); INLINE int get_auto_disable_flag() const; - INLINE void set_auto_disable_flag(int do_auto_disable); + + INLINE LVecBase3f impulse_to_force(dReal stepsize, \ + dReal ix, dReal iy, dReal iz); + INLINE LVecBase3f impulse_to_force(dReal stepsize, \ + const LVecBase3f &impulse); + + INLINE void step(dReal stepsize); + INLINE void quick_step(dReal stepsize); + INLINE void step_fast1(dReal stepsize, int maxiterations); INLINE int compare_to(const OdeWorld &other) const; public: