diff --git a/direct/src/deadrec/smoothMover.I b/direct/src/deadrec/smoothMover.I index f5e2a11016..1185c0dbff 100644 --- a/direct/src/deadrec/smoothMover.I +++ b/direct/src/deadrec/smoothMover.I @@ -306,6 +306,7 @@ INLINE void SmoothMover:: set_phony_timestamp() { double now = ClockObject::get_global_clock()->get_frame_time(); _sample._timestamp = now; + _has_most_recent_timestamp = true; _most_recent_timestamp = now; } @@ -324,33 +325,31 @@ set_timestamp(double timestamp) { } */ _sample._timestamp = timestamp; + _has_most_recent_timestamp = true; _most_recent_timestamp = timestamp; record_timestamp_delay(timestamp); } +//////////////////////////////////////////////////////////////////// +// Function: SmoothMover::has_most_recent_timestamp +// Access: Published +// Description: Returns true if we have most recently recorded timestamp +//////////////////////////////////////////////////////////////////// +INLINE bool SmoothMover:: +has_most_recent_timestamp() const { + return _has_most_recent_timestamp; +} + //////////////////////////////////////////////////////////////////// // Function: SmoothMover::get_most_recent_timestamp // Access: Published // Description: Returns most recently recorded timestamp //////////////////////////////////////////////////////////////////// INLINE double SmoothMover:: -get_most_recent_timestamp() { +get_most_recent_timestamp() const { return _most_recent_timestamp; } -//////////////////////////////////////////////////////////////////// -// Function: SmoothMover::set_most_recent_timestamp -// Access: Published -// Description: Specifies the time that the current position report -// applies. This should be called after a call to -// mark_position(). -//////////////////////////////////////////////////////////////////// -INLINE void SmoothMover:: -set_most_recent_timestamp(double timestamp) { - _points.back()._timestamp = timestamp; - _most_recent_timestamp = timestamp; -} - //////////////////////////////////////////////////////////////////// // Function: SmoothMover::compute_smooth_position // Access: Published diff --git a/direct/src/deadrec/smoothMover.cxx b/direct/src/deadrec/smoothMover.cxx index e3196b052e..b7b22f6fb1 100644 --- a/direct/src/deadrec/smoothMover.cxx +++ b/direct/src/deadrec/smoothMover.cxx @@ -46,6 +46,8 @@ SmoothMover() { _smooth_lateral_velocity = 0.0; _smooth_rotational_velocity = 0.0; + _has_most_recent_timestamp = false; + _last_point_before = -1; _last_point_after = -1; @@ -207,6 +209,7 @@ clear_positions(bool reset_velocity) { _last_point_before = -1; _last_point_after = -1; _smooth_position_known = false; + _has_most_recent_timestamp = false; if (reset_velocity) { _smooth_forward_velocity = 0.0; diff --git a/direct/src/deadrec/smoothMover.h b/direct/src/deadrec/smoothMover.h index ff2ec0d465..b81bc8adfc 100644 --- a/direct/src/deadrec/smoothMover.h +++ b/direct/src/deadrec/smoothMover.h @@ -87,8 +87,8 @@ PUBLISHED: INLINE void set_phony_timestamp(); INLINE void set_timestamp(double timestamp); - INLINE double get_most_recent_timestamp(); - void set_most_recent_timestamp(double timestamp); + INLINE bool has_most_recent_timestamp() const; + INLINE double get_most_recent_timestamp() const; void mark_position(); void clear_positions(bool reset_velocity); @@ -201,6 +201,7 @@ private: double _smooth_lateral_velocity; double _smooth_rotational_velocity; + bool _has_most_recent_timestamp; double _most_recent_timestamp; // typedef CircBuffer Points;