Преглед на файлове

formatting and added LVecBase3f functionality

Josh Wilson преди 19 години
родител
ревизия
a80d9f95ba
променени са 2 файла, в които са добавени 41 реда и са изтрити 18 реда
  1. 17 1
      panda/src/ode/odeWorld.I
  2. 24 17
      panda/src/ode/odeWorld.h

+ 17 - 1
panda/src/ode/odeWorld.I

@@ -26,6 +26,11 @@ set_gravity(dReal x, dReal y, dReal z) {
   dWorldSetGravity(_id, x, y, 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::
 INLINE LVecBase3f OdeWorld::
 get_gravity() const {
 get_gravity() const {
   dVector3 gravity;
   dVector3 gravity;
@@ -61,7 +66,7 @@ step(dReal stepsize) {
 
 
 INLINE LVecBase3f OdeWorld::
 INLINE LVecBase3f OdeWorld::
 impulse_to_force(dReal stepsize, \
 impulse_to_force(dReal stepsize, \
-               dReal ix, dReal iy, dReal iz){
+                 dReal ix, dReal iy, dReal iz){
   dVector3 force;
   dVector3 force;
   dWorldImpulseToForce(_id,
   dWorldImpulseToForce(_id,
                        stepsize,
                        stepsize,
@@ -70,6 +75,17 @@ impulse_to_force(dReal stepsize, \
   return LVecBase3f(force[0], force[1], force[2]);
   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::
 INLINE void OdeWorld::
 quick_step(dReal stepsize) {
 quick_step(dReal stepsize) {
   dWorldQuickStep(_id, stepsize);
   dWorldQuickStep(_id, stepsize);

+ 24 - 17
panda/src/ode/odeWorld.h

@@ -39,36 +39,43 @@ PUBLISHED:
   void destroy();
   void destroy();
 
 
   INLINE void set_gravity(dReal x, dReal y, dReal z);
   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 void set_erp(dReal erp);
-  INLINE dReal get_erp() const;
   INLINE void set_cfm(dReal cfm);
   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 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 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 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 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_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 int get_auto_enable_depth_sf1() const;
   INLINE dReal get_auto_disable_linear_threshold() 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 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 int get_auto_disable_steps() const;
-  INLINE void set_auto_disable_steps(int steps);
   INLINE dReal get_auto_disable_time() const;
   INLINE dReal get_auto_disable_time() const;
-  INLINE void set_auto_disable_time(dReal time);
   INLINE int get_auto_disable_flag() const;
   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;
   INLINE int compare_to(const OdeWorld &other) const;
 public: 
 public: