reckfellENGINE

VoxelBlockSerializer

Low-level utility to save and load the data within a VoxelBuffer. This can be useful to send data over the network, or to store it in a file.

On this page
class VoxelBlockSerializerReckfellSharpInherits RefCounted

Low-level utility to save and load the data within a VoxelBuffer. This can be useful to send data over the network, or to store it in a file.

To store into a file allocating a PackedByteArray:

To read it back:

To store into a file by re-using a StreamPeerBuffer:

To read it back:

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

VoxelBlockSerializerConstructor
# VoxelBlockSerializer
C#
public VoxelBlockSerializer();

Methods5

DeserializeFromByteArray2 overloads
# DeserializeFromByteArray · 1/2
C#
public static void DeserializeFromByteArray(byte[] bytes, VoxelBuffer voxelBuffer, bool decompress);

Reads the data of a VoxelBuffer from a byte[].

Parameters
NameTypeDefault
bytesbyte[]—
voxelBufferVoxelBuffer—
decompressbool—
# DeserializeFromByteArray · 2/2
C#
public static void DeserializeFromByteArray(ReadOnlySpan<byte> bytes, VoxelBuffer voxelBuffer, bool decompress);

Reads the data of a VoxelBuffer from a byte[].

Parameters
NameTypeDefault
bytesReadOnlySpan<byte>—
voxelBufferVoxelBuffer—
decompressbool—
DeserializeFromStreamPeervoid
# DeserializeFromStreamPeer
C#
public static void DeserializeFromStreamPeer(StreamPeer peer, VoxelBuffer voxelBuffer, long size, bool decompress);

Reads the data of a VoxelBuffer from a StreamPeer. You must provide the number of bytes to read.

Parameters
NameTypeDefault
peerStreamPeer—
voxelBufferVoxelBuffer—
sizelong—
decompressbool—
SerializeToByteArraybyte[]
# SerializeToByteArray
C#
public static byte[] SerializeToByteArray(VoxelBuffer voxelBuffer, VoxelBlockSerializer.Compression compress);

Stores the data of a VoxelBuffer into a byte[].

Parameters
NameTypeDefault
voxelBufferVoxelBuffer—
compressVoxelBlockSerializer.Compression—
Returns byte[]
SerializeToStreamPeerint
# SerializeToStreamPeer
C#
public static int SerializeToStreamPeer(StreamPeer peer, VoxelBuffer voxelBuffer, VoxelBlockSerializer.Compression compress);

Stores the data of a VoxelBuffer into a StreamPeer. Returns the number of written bytes.

Parameters
NameTypeDefault
peerStreamPeer—
voxelBufferVoxelBuffer—
compressVoxelBlockSerializer.Compression—
Returns int

VoxelBlockSerializer.Compression

ValueDescription
Lz4 = 1

Use the LZ4 default compression algorithm. Fast, but lower compression ratio.

None = 0

Don't compress the data.

Zstd = 2

Use the Zstandard default compression algorithm. Good compression ratio but slower.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.