18 #include "directbase.h"
20 #include "clockObject.h"
21 #include "circBuffer.h"
25 static const int max_position_reports = 10;
26 static const int max_timestamp_delays = 10;
57 INLINE
bool set_pos(
const LVecBase3 &pos);
58 INLINE
bool set_pos(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
59 INLINE
bool set_x(PN_stdfloat x);
60 INLINE
bool set_y(PN_stdfloat y);
61 INLINE
bool set_z(PN_stdfloat z);
63 INLINE
bool set_hpr(
const LVecBase3 &hpr);
64 INLINE
bool set_hpr(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r);
65 INLINE
bool set_h(PN_stdfloat h);
66 INLINE
bool set_p(PN_stdfloat p);
67 INLINE
bool set_r(PN_stdfloat r);
70 INLINE
bool set_pos_hpr(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r);
72 INLINE
const LPoint3 &get_sample_pos()
const;
73 INLINE
const LVecBase3 &get_sample_hpr()
const;
75 INLINE
void set_phony_timestamp(
double timestamp = 0.0,
bool period_adjust =
false);
77 INLINE
void set_timestamp(
double timestamp);
79 INLINE
bool has_most_recent_timestamp()
const;
80 INLINE
double get_most_recent_timestamp()
const;
83 void clear_positions(
bool reset_velocity);
85 INLINE
bool compute_smooth_position();
86 bool compute_smooth_position(
double timestamp);
87 bool get_latest_position();
89 INLINE
const LPoint3 &get_smooth_pos()
const;
90 INLINE
const LVecBase3 &get_smooth_hpr()
const;
92 INLINE
void apply_smooth_pos(
NodePath &node)
const;
93 INLINE
void apply_smooth_pos_hpr(
NodePath &pos_node,
NodePath &hpr_node)
const;
94 INLINE
void apply_smooth_hpr(
NodePath &node)
const;
96 INLINE
void compute_and_apply_smooth_pos(
NodePath &node);
97 INLINE
void compute_and_apply_smooth_pos_hpr(
NodePath &pos_node,
NodePath &hpr_node);
98 INLINE
void compute_and_apply_smooth_hpr(
NodePath &hpr_node);
100 INLINE PN_stdfloat get_smooth_forward_velocity()
const;
101 INLINE PN_stdfloat get_smooth_lateral_velocity()
const;
102 INLINE PN_stdfloat get_smooth_rotational_velocity()
const;
103 INLINE
const LVecBase3 &get_forward_axis()
const;
113 enum PredictionMode {
121 INLINE
void set_smooth_mode(SmoothMode mode);
122 INLINE SmoothMode get_smooth_mode();
124 INLINE
void set_prediction_mode(PredictionMode mode);
125 INLINE PredictionMode get_prediction_mode();
127 INLINE
void set_delay(
double delay);
128 INLINE
double get_delay();
130 INLINE
void set_accept_clock_skew(
bool flag);
131 INLINE
bool get_accept_clock_skew();
133 INLINE
void set_max_position_age(
double age);
134 INLINE
double get_max_position_age();
136 INLINE
void set_expected_broadcast_period(
double period);
137 INLINE
double get_expected_broadcast_period();
139 INLINE
void set_reset_velocity_age(
double age);
140 INLINE
double get_reset_velocity_age();
142 INLINE
void set_directional_velocity(
bool flag);
143 INLINE
bool get_directional_velocity();
145 INLINE
void set_default_to_standing_still(
bool flag);
146 INLINE
bool get_default_to_standing_still();
148 void output(ostream &out)
const;
149 void write(ostream &out)
const;
154 void linear_interpolate(
int point_before,
int point_after,
double timestamp);
155 void compute_velocity(
const LVector3 &pos_delta,
159 void record_timestamp_delay(
double timestamp);
160 INLINE
double get_avg_timestamp_delay()
const;
178 double _smooth_timestamp;
179 bool _smooth_position_known;
180 bool _smooth_position_changed;
181 bool _computed_forward_axis;
183 double _smooth_forward_velocity;
184 double _smooth_lateral_velocity;
185 double _smooth_rotational_velocity;
187 bool _has_most_recent_timestamp;
188 double _most_recent_timestamp;
193 int _last_point_before;
194 int _last_point_after;
203 int _net_timestamp_delay;
204 double _last_heard_from;
206 SmoothMode _smooth_mode;
207 PredictionMode _prediction_mode;
209 bool _accept_clock_skew;
210 double _max_position_age;
211 double _expected_broadcast_period;
212 double _reset_velocity_age;
213 bool _directional_velocity;
214 bool _default_to_standing_still;
217 #include "smoothMover.I"
This is the base class for all three-component vectors and points.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
This class handles smoothing of sampled motion points over time, e.g.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...