diff --git a/direct/src/deadrec/smoothMover.I b/direct/src/deadrec/smoothMover.I index 6ca89f8114..253bdbcc76 100644 --- a/direct/src/deadrec/smoothMover.I +++ b/direct/src/deadrec/smoothMover.I @@ -302,6 +302,48 @@ get_smooth_hpr() const { return _smooth_hpr; } +//////////////////////////////////////////////////////////////////// +// Function: SmoothMover::apply_smooth_pos +// Access: Published +// Description: Applies the smoothed position to the indicated +// NodePath. This is equivalent to calling +// node.set_pos(smooth_mover->get_smooth_pos()). It +// exists as an optimization only, to avoid the overhead +// of passing the return value through Python. +//////////////////////////////////////////////////////////////////// +INLINE void SmoothMover:: +apply_smooth_pos(NodePath &node) const { + node.set_pos(get_smooth_pos()); +} + +//////////////////////////////////////////////////////////////////// +// Function: SmoothMover::apply_smooth_hpr +// Access: Published +// Description: Applies the smoothed orientation to the indicated +// NodePath. This is equivalent to calling +// node.set_hpr(smooth_mover->get_smooth_hpr()). It +// exists as an optimization only, to avoid the overhead +// of passing the return value through Python. +//////////////////////////////////////////////////////////////////// +INLINE void SmoothMover:: +apply_smooth_hpr(NodePath &node) const { + node.set_hpr(get_smooth_hpr()); +} + +//////////////////////////////////////////////////////////////////// +// Function: SmoothMover::apply_smooth_mat +// Access: Published +// Description: Applies the smoothed transform to the indicated +// NodePath. This is equivalent to calling +// node.set_mat(smooth_mover->get_smooth_mat()). It +// exists as an optimization only, to avoid the overhead +// of passing the return value through Python. +//////////////////////////////////////////////////////////////////// +INLINE void SmoothMover:: +apply_smooth_mat(NodePath &node) { + node.set_mat(get_smooth_mat()); +} + //////////////////////////////////////////////////////////////////// // Function: SmoothMover::get_smooth_mat // Access: Published diff --git a/direct/src/deadrec/smoothMover.h b/direct/src/deadrec/smoothMover.h index f5377d8009..408fc34a76 100644 --- a/direct/src/deadrec/smoothMover.h +++ b/direct/src/deadrec/smoothMover.h @@ -23,10 +23,12 @@ #include "luse.h" #include "clockObject.h" #include "circBuffer.h" +#include "nodePath.h" static const int max_position_reports = 10; static const int max_timestamp_delays = 10; + //////////////////////////////////////////////////////////////////// // Class : SmoothMover // Description : This class handles smoothing of sampled motion points @@ -92,6 +94,10 @@ PUBLISHED: INLINE const LVecBase3f &get_smooth_hpr() const; INLINE const LMatrix4f &get_smooth_mat(); + INLINE void apply_smooth_pos(NodePath &node) const; + INLINE void apply_smooth_hpr(NodePath &node) const; + INLINE void apply_smooth_mat(NodePath &node); + INLINE float get_smooth_forward_velocity() const; INLINE float get_smooth_rotational_velocity() const; diff --git a/direct/src/distributed/DistributedSmoothNode.py b/direct/src/distributed/DistributedSmoothNode.py index 0fe4e200c3..225eeb74e4 100644 --- a/direct/src/distributed/DistributedSmoothNode.py +++ b/direct/src/distributed/DistributedSmoothNode.py @@ -104,7 +104,7 @@ class DistributedSmoothNode(DistributedNode.DistributedNode, to specialize the behavior. """ if self.smoother.computeSmoothPosition(): - self.setMat(self.smoother.getSmoothMat()) + self.smoother.applySmoothMat(self) def doSmoothTask(self, task): self.smoothPosition() @@ -153,7 +153,7 @@ class DistributedSmoothNode(DistributedNode.DistributedNode, """ if (not self.isLocal()) and \ self.smoother.getLatestPosition(): - self.setMat(self.smoother.getSmoothMat()) + self.smoother.applySmoothMat(self) self.smoother.clearPositions(1) def reloadPosition(self):