![]() |
||||||||
|
|
||||||||


| T | Type of position vector. Supported are zU32, zS32 and zFloat. | |
| SIZE | Size of position, velocity and accel vectors. |
Peeking is not supported for this replicator.
See ex07_movement (in the samples directory) for example usage.
Public Member Functions | |
| zU32 * | getLastUpdateTime (ZCom_ConnID _cid) |
| Get pointer to time of last update to given connection. | |
| ZCom_Node * | getNode () const |
| Get the node in which this replicator is registered. | |
| void | sendData (eZCom_SendMode _mode, ZCom_BitStream *_stream, zU32 _reference_id=0) |
| Sends an event to peer replicators. | |
| void | sendDataDirect (eZCom_SendMode _mode, ZCom_ConnID _dest, ZCom_BitStream *_stream, zU32 _reference_id=0) |
| Same as sendData(), but with single destination. | |
| void | setNode (ZCom_Node *_node) |
| Set the node in which this replicator is registered. | |
| ZCOM_TAPI void | setTimeScale (zFloat _scale) |
| Set timescale of movement. | |
| ZCOM_TAPI void | setUpdateListener (ZCom_MoveUpdateListener< TYPE > *_listener) |
| Set the mandatory update listener. | |
| ZCOM_TAPI | ZCom_Replicate_Movement (zU8 _rbits, zU8 _flags, zU8 _rules, zU8 _intercept_id=0, zS16 _mindelay=-1, zS16 _maxdelay=-1) |
| constructor, builds the replicator setup automatically | |
| ZCOM_TAPI | ZCom_Replicate_Movement (ZCom_RSetupMovement< TYPE > *_setup) |
| constructor, taking a ZCom_ReplicatorSetup pointer | |
Data fetching. | |
Use these to get the current state. | |
| ZCOM_TAPI void | getAcceleration (zFloat *_data) |
| Get the current acceleration used for extrapolation. | |
| ZCOM_TAPI void | getExtrapolatedPosition (zS32 _attime, TYPE *_data) |
| Get extrapolated position for given time. | |
| ZCOM_TAPI void | getExtrapolatedVelocity (zS32 _attime, zFloat *_data) |
| Get the current velocity used for extrapolation. | |
| ZCOM_TAPI void | getLastReceivedPosition (T *_data) |
| Get last received position. | |
| ZCOM_TAPI void | getLastReceivedVelocity (zFloat *_data) |
| Get last received velocity. | |
Owner data updates and input API. | |
Feed owner with input data and retrieve past input data to apply corrections from auth. | |
| ZCOM_TAPI ZCom_BitStream * | getNextInputHistoryEntry (zU32 *_deltatime, void **_iter) |
| Get the next inputstream that has to be reapplied after the correction. | |
| ZCOM_TAPI void | updateInput (T *_pos, ZCom_BitStream *_inputstream) |
| Feed input data to owner. | |
Debugging | |
| ZCOM_TAPI void | getSplineControlPoint (zU32 _idx, TYPE *_data) |
| Get a control point from the spline. | |
| ZCOM_TAPI void | getSplinePoint (zFloat t, TYPE *_data) |
| Get a point on the interpolation spline. | |
Proxy data overrides. | |
Temporarily and locally override values on proxy. | |
| ZCOM_TAPI void | overrideState (TYPE *_newpos, zFloat *_newvel, zFloat *_newaccel, zS32 _time=0) |
| Override position, velocity and acceleration. | |
Authority data updates | |
Update data on authority. | |
| ZCOM_TAPI void | updateState (TYPE *_newpos, zFloat *_newvel, zFloat *_newaccel, bool _teleport) |
| Update position, velocity and acceleration. | |
Protected Attributes | |
| zU8 | m_flags |
| Additional replicator flags. ZCom_Replicator() c'tor will set this to 0. (ZCOM_REPLICATOR_*). | |
| ZCom_ReplicatorSetup * | m_setup |
| pointing to an instance of the setup class - all replication parameters are stored here | |
|
||||||||||
|
constructor, taking a ZCom_ReplicatorSetup pointer
|
|
||||||||||||||||||||||||||||||||
|
constructor, builds the replicator setup automatically
|
|
||||||||||
|
Set timescale of movement.
Set the scale to your_physics_rate/1000. For a 50hz update frequency, scale should be 0.05. If your update frequency is fixed at a constant rate, you can leave this value at 1, and call ZCom_Control::processReplicators(1) instead of the actually passed simulation time. |
|
||||||||||
|
Set the mandatory update listener.
|
|
||||||||||||||||
|
Feed input data to owner.
Calling this method results in the ZCom_MoveUpdateListener::inputUpdated() callback to be called on the authority. In case of correction, ZCom_MoveUpdateListener::correctionReceived() will be called later on the owner.
|
|
||||||||||||||||
|
Get the next inputstream that has to be reapplied after the correction.
|
|
||||||||||||||||||||||||
|
Update position, velocity and acceleration.
|
|
||||||||||||||||||||||||
|
Override position, velocity and acceleration.
|
|
||||||||||||||||
|
Get extrapolated position for given time.
|
|
||||||||||||||||
|
Get the current velocity used for extrapolation.
|
|
||||||||||
|
Get the current acceleration used for extrapolation.
|
|
||||||||||
|
Get last received position.
|
|
||||||||||
|
Get last received velocity.
|
|
||||||||||||||||
|
Get a point on the interpolation spline.
|
|
||||||||||||||||
|
Get a control point from the spline.
|
|
|
Get the node in which this replicator is registered.
|
|
|
Get pointer to time of last update to given connection.
If the result is non-NULL, writing to this pointer is encouraged, as advanced replicators have to manage timing on their own.
zU32* lastupdate = getLastUpdateTime(id_of_connection_which_is_currently_processed); if (lastupdate) { if (ZoidCom::getTime() - *lastupdate < m_setup->getMinDelay()) // don't send data if last update to this happened too recent return; else // store the current time because an update gets sent now *lastupdate = ZoidCom::getTime(); } |
|
||||||||||||||||
|
Sends an event to peer replicators.
In order to handle the event, overload ZCom_ReplicatorAdvanced::onDataReceived(). Replicator events are sent reliable unordered or unreliable.
|
|
||||||||||||||||||||
|
Same as sendData(), but with single destination.
Replicator events are sent reliable unordered or unreliable.
|
|
|
Set the node in which this replicator is registered.
|
|
|
Overloaded memory operator ensuring that always Zoidcom's new gets called.
|
|
|
Overloaded memory operator ensuring that always Zoidcom's delete gets called.
|
|
|
Get stream currently processed for peeking the data.
This will only return a valid result when called from inside the above mentioned interceptor callback. |
|
|
Store pointer to allocated peekbuffer, so it can be deleted again.
When you call peekDataStore() more than once with a pointer != NULL, clearPeekData() will get called automatically. Thread Local Storage means, there is one variable for each thread of the program. Replicators could as well declare a member variable used for that purpose instead, but that would waste a lot of memory when peeking interceptors are not used. |
|
|
Retrieve the peekbuffer pointer currently stored.
|
|
|
Additional replicator flags. ZCom_Replicator() c'tor will set this to 0. (ZCOM_REPLICATOR_*).
|
|
|
pointing to an instance of the setup class - all replication parameters are stored here
|
1.4.6-NO