Interface IGhostSerializer<TComponent, TSnapshot>
Interface implemented by all the component/buffer serialiser. For internal use only.
Namespace: Unity.NetCode
Assembly: Unity.NetCode.dll
Syntax
[RequireImplementors]
[Obsolete("The IGhostSerializer<TComponent, TSnapshot> has been deprecated. Please use the IGhostComponentSerializer instead")]
public interface IGhostSerializer<TComponent, TSnapshot> where TComponent : unmanaged where TSnapshot : unmanaged
Type Parameters
Name | Description |
---|---|
TComponent | The component type that this interface serialize. |
TSnapshot | The snapshot struct type that will contains the component data. |
Methods
CalculateChangeMaskGenerated(in TSnapshot, in TSnapshot, IntPtr, int)
Compute the change mask for the snapshot in respect to the given baseline
Declaration
void CalculateChangeMaskGenerated(in TSnapshot snapshot, in TSnapshot baseline, IntPtr changeMaskData, int startOffset)
Parameters
Type | Name | Description |
---|---|---|
TSnapshot | snapshot | Snapshot reference |
TSnapshot | baseline | Snapshot baseline |
Int |
changeMaskData | Change mask data |
int | startOffset | Start offset |
CopyFromSnapshotGenerated(in GhostDeserializerState, ref TComponent, float, float, in TSnapshot, in TSnapshot)
Copy/Convert the data form the snapshot to the component. Support interpolation and extrapolation.
Declaration
void CopyFromSnapshotGenerated(in GhostDeserializerState serializerState, ref TComponent component, float interpolationFactor, float snapshotInterpolationFactorRaw, in TSnapshot snapshotBefore, in TSnapshot snapshotAfter)
Parameters
Type | Name | Description |
---|---|---|
Ghost |
serializerState | Serializer state |
TComponent | component | Component |
float | interpolationFactor | Interpolation factor |
float | snapshotInterpolationFactorRaw | Snapshot interpolation factor |
TSnapshot | snapshotBefore | Snapshot before |
TSnapshot | snapshotAfter | Snapshot after |
CopyToSnapshotGenerated(in GhostSerializerState, ref TSnapshot, in TComponent)
Copy/Convert the component data to the snapshot.
Declaration
void CopyToSnapshotGenerated(in GhostSerializerState serializerState, ref TSnapshot snapshot, in TComponent component)
Parameters
Type | Name | Description |
---|---|---|
Ghost |
serializerState | Serializer state |
TSnapshot | snapshot | Snapshot reference |
TComponent | component | Component |
DeserializeGenerated(ref DataStreamReader, in StreamCompressionModel, IntPtr, int, ref TSnapshot, in TSnapshot)
Read the data from the reader
stream into the snapshot data.
Declaration
void DeserializeGenerated(ref DataStreamReader reader, in StreamCompressionModel compressionModel, IntPtr changeMask, int startOffset, ref TSnapshot snapshot, in TSnapshot baseline)
Parameters
Type | Name | Description |
---|---|---|
Data |
reader | Data stream reader |
Stream |
compressionModel | Compression model |
Int |
changeMask | Change mask |
int | startOffset | Starting offset |
TSnapshot | snapshot | Snapshot reference |
TSnapshot | baseline | Snapshot baseline |
PredictDeltaGenerated(ref TSnapshot, in TSnapshot, in TSnapshot, ref GhostDeltaPredictor)
Calculate the predicted baseline.
Declaration
void PredictDeltaGenerated(ref TSnapshot snapshot, in TSnapshot baseline1, in TSnapshot baseline2, ref GhostDeltaPredictor predictor)
Parameters
Type | Name | Description |
---|---|---|
TSnapshot | snapshot | Snapshot reference |
TSnapshot | baseline1 | Snapshot baseline |
TSnapshot | baseline2 | Snapshot baseline |
Ghost |
predictor | Delta predictor |
ReportPredictionErrorsGenerated(in TComponent, in TComponent, IntPtr, int)
Calculate the prediction error for this component.
Declaration
void ReportPredictionErrorsGenerated(in TComponent component, in TComponent backup, IntPtr errorsList, int errorsCount)
Parameters
Type | Name | Description |
---|---|---|
TComponent | component | Component |
TComponent | backup | Backup buffer |
Int |
errorsList | Data for errors |
int | errorsCount | Error count |
RestoreFromBackupGenerated(ref TComponent, in TComponent)
Restore the component data from the prediction backup buffer. Only serialised fields are restored.
Declaration
void RestoreFromBackupGenerated(ref TComponent component, in TComponent backup)
Parameters
Type | Name | Description |
---|---|---|
TComponent | component | Component |
TComponent | backup | Backup buffer |
SerializeCombinedGenerated(in TSnapshot, in TSnapshot, IntPtr, int, ref DataStreamWriter, in StreamCompressionModel)
Serialise the snapshot dato to the writer
based on the calculated changemask.
Declaration
void SerializeCombinedGenerated(in TSnapshot snapshot, in TSnapshot baseline, IntPtr changeMaskData, int startOffset, ref DataStreamWriter writer, in StreamCompressionModel compressionModel)
Parameters
Type | Name | Description |
---|---|---|
TSnapshot | snapshot | Snapshot reference |
TSnapshot | baseline | Snapshot baseline |
Int |
changeMaskData | Change mask data |
int | startOffset | Start offset |
Data |
writer | Datastream writer |
Stream |
compressionModel | Compression model |
SerializeGenerated(in TSnapshot, in TSnapshot, IntPtr, int, ref DataStreamWriter, in StreamCompressionModel)
Serialise the snapshot dato to the writer
based on the calculated changemask.
Declaration
void SerializeGenerated(in TSnapshot snapshot, in TSnapshot baseline, IntPtr changeMaskData, int startOffset, ref DataStreamWriter writer, in StreamCompressionModel compressionModel)
Parameters
Type | Name | Description |
---|---|---|
TSnapshot | snapshot | Snapshot reference |
TSnapshot | baseline | Snapshot baseline |
Int |
changeMaskData | Change mask data |
int | startOffset | Start offset |
Data |
writer | Datastream writer |
Stream |
compressionModel | Compression model |