mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 00:32:57 -04:00
optimize smooth task a bit
This commit is contained in:
parent
f23d52b385
commit
5ba29949be
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user