Class BufferSerializationHelper<TComponentType, TSnapshot, TSerializer>
Helper class used by code-gen to setup the serialisation function pointers.
Inherited Members
Namespace: Unity.NetCode
Assembly: Unity.NetCode.dll
Syntax
public static class BufferSerializationHelper<TComponentType, TSnapshot, TSerializer> where TComponentType : unmanaged where TSnapshot : unmanaged where TSerializer : unmanaged, IGhostSerializer
Type Parameters
Name | Description |
---|---|
TComponentType | The unmanaged buffer the helper serialise |
TSnapshot | The snaphost data struct that contains the IBuffer |
TSerializer | A concrete type that implement the IGhost |
Methods
CopyBuffersFromSnapshot(IntPtr, IntPtr, int, int, IntPtr, int, int, TSerializer)
Copy the dynamic buffers content from the snapshot, using the serializer
strategy.
Declaration
public static void CopyBuffersFromSnapshot(IntPtr stateData, IntPtr snapshotData, int snapshotOffset, int snapshotStride, IntPtr componentData, int componentStride, int count, TSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
Int |
stateData | a pointer to the Ghost |
Int |
snapshotData | the snapshot buffer |
int | snapshotOffset | the current offset in the snapshot buffer |
int | snapshotStride | the stride to apply to snapshot pointer for each individual entity |
Int |
componentData | a pointer to the chunk component data |
int | componentStride | the stride to apply to component pointer for each individual entity |
int | count | the number of entities |
TSerializer | serializer | the IGhostSerialized instance used to serialize the buffer content |
CopyBuffersToSnapshot(IntPtr, IntPtr, int, int, IntPtr, int, int, TSerializer)
Copy the dynamic buffers content to the snapshot, using the serializer
strategy.
Declaration
public static void CopyBuffersToSnapshot(IntPtr stateData, IntPtr snapshotData, int snapshotOffset, int snapshotStride, IntPtr componentData, int componentStride, int count, TSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
Int |
stateData | a pointer to the Ghost |
Int |
snapshotData | the snapshot buffer |
int | snapshotOffset | the current offset in the snapshot buffer |
int | snapshotStride | the stride to apply to snapshot pointer for each individual entity |
Int |
componentData | a pointer to the chunk component data |
int | componentStride | the stride to apply to component pointer for each individual entity |
int | count | the number of entities |
TSerializer | serializer | the IGhostSerialized instance used to serialize the buffer content |
PostSerializeBuffers(IntPtr, int, int, int, int, int, IntPtr, ref DataStreamWriter, StreamCompressionModel, IntPtr, IntPtr, IntPtr, int, TSerializer)
Copy the pre-serialized dynamic buffer data to data stream writer
using the serializer
strategy.
Declaration
public static void PostSerializeBuffers(IntPtr snapshotData, int snapshotOffset, int snapshotStride, int maskOffsetInBits, int changeMaskBits, int count, IntPtr baselines, ref DataStreamWriter writer, StreamCompressionModel compressionModel, IntPtr entityStartBit, IntPtr snapshotDynamicDataPtr, IntPtr dynamicSizePerEntity, int dynamicSnapshotMaxOffset, TSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
Int |
snapshotData | the snapshot buffer |
int | snapshotOffset | the current offset in the snapshot buffer |
int | snapshotStride | the stride to apply to each individual entity |
int | maskOffsetInBits | the offset in the changemask bit array |
int | changeMaskBits | the changemask bit array |
int | count | the number of entities |
Int |
baselines | the baselines for each entity |
Data |
writer | the output data stream |
Stream |
compressionModel | the compression model used to compressed the stream |
Int |
entityStartBit | an array of start/end offset in the data stream, that denote for each individual component where their compressed data is stored in the data stream. |
Int |
snapshotDynamicDataPtr | storage for the buffer snapshot |
Int |
dynamicSizePerEntity | the total buffer size (in bytes) written into the snapshot buffer for each entity. |
int | dynamicSnapshotMaxOffset | the dynamic snapshot buffer capacity |
TSerializer | serializer | the IGhostSerialized instance used to serialize the buffer content |
SerializeBuffers(IntPtr, IntPtr, int, int, int, int, IntPtr, IntPtr, int, IntPtr, ref DataStreamWriter, StreamCompressionModel, IntPtr, IntPtr, ref int, IntPtr, int, TSerializer)
Serialize the dynamic buffer content to the writer
stream using the serializer
strategy.
Declaration
public static void SerializeBuffers(IntPtr stateData, IntPtr snapshotData, int snapshotOffset, int snapshotStride, int maskOffsetInBits, int changeMaskBits, IntPtr componentData, IntPtr componentDataLen, int count, IntPtr baselines, ref DataStreamWriter writer, StreamCompressionModel compressionModel, IntPtr entityStartBit, IntPtr snapshotDynamicDataPtr, ref int dynamicSnapshotDataOffset, IntPtr dynamicSizePerEntity, int dynamicSnapshotMaxOffset, TSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
Int |
stateData | a pointer to the Ghost |
Int |
snapshotData | the snapshot buffer |
int | snapshotOffset | the current offset in the snapshot buffer |
int | snapshotStride | the stride to apply to each individual entity |
int | maskOffsetInBits | the offset in the changemask bit array |
int | changeMaskBits | the changemask bit array |
Int |
componentData | a pointer to the chunk component data |
Int |
componentDataLen | the len of each individual buffer |
int | count | the number of entities |
Int |
baselines | the baselines for each entity |
Data |
writer | the output data stream |
Stream |
compressionModel | the compression model used to compressed the stream |
Int |
entityStartBit | an array of start/end offset in the data stream, that denote for each individual component where their compressed data is stored in the data stream. |
Int |
snapshotDynamicDataPtr | storage for the buffer snapshot |
int | dynamicSnapshotDataOffset | the current offset in the dynamic snapshot buffer |
Int |
dynamicSizePerEntity | the total buffer size (in bytes) written into the snapshot buffer for each entity. |
int | dynamicSnapshotMaxOffset | the dynamic snapshot buffer capacity |
TSerializer | serializer | the IGhostSerialized instance used to serialize the buffer content |