DracoFormat.Encode

Encode(Entity, Stream, DracoSaveOptions)

Encode the entity to specified stream

public void Encode(Entity entity, Stream stream, DracoSaveOptions options = null)
ParameterTypeDescription
entityEntityThe entity to be encoded
streamStreamThe stream that encoded data will be written to
optionsDracoSaveOptionsExtra options for encoding the point cloud

Examples

The following code shows how to encode and decode a Mesh to/from byte array:

Mesh mesh = (new Sphere()).ToMesh();
//encode mesh into Draco format
byte[] draco = FileFormat.Draco.Encode(mesh);
//decode mesh from Draco format
Mesh decodedMesh = (Mesh)FileFormat.Draco.Decode(draco);

See Also


Encode(Entity, string, DracoSaveOptions)

Encode the entity to specified file

public void Encode(Entity entity, string fileName, DracoSaveOptions options = null)
ParameterTypeDescription
entityEntityThe entity to be encoded
fileNameStringThe file name to be written
optionsDracoSaveOptionsExtra options for encoding the point cloud

Examples

The following code shows how to encode and decode a Mesh to/from byte array:

Mesh mesh = (new Sphere()).ToMesh();
//encode mesh into Draco format
byte[] draco = FileFormat.Draco.Encode(mesh);
//decode mesh from Draco format
Mesh decodedMesh = (Mesh)FileFormat.Draco.Decode(draco);

See Also


Encode(Entity, DracoSaveOptions)

Encode the entity to Draco raw data

public byte[] Encode(Entity entity, DracoSaveOptions options = null)
ParameterTypeDescription
entityEntityThe entity to be encoded
optionsDracoSaveOptionsExtra options for encoding the point cloud

Return Value

The encoded draco data represented in bytes

Examples

The following code shows how to encode and decode a Mesh to/from byte array:

Mesh mesh = (new Sphere()).ToMesh();
//encode mesh into Draco format
byte[] draco = FileFormat.Draco.Encode(mesh);
//decode mesh from Draco format
Mesh decodedMesh = (Mesh)FileFormat.Draco.Decode(draco);

See Also