编码 Google Draco 文件中的 3D 网格

检索 3D 网格并在 Google Draco 文件中编码

DracoFormat 类公开的 Encode 方法可用于对 Google Draco 文件中的3d网格进行编码。它采用 MeshDracoSaveOptions 对象作为参数。使用 Draco 保存选项,开发人员还可以在编码网格之前指定位置,纹理坐标,颜色和正常位以及压缩级别。

编程示例

此代码示例检索 SphereMesh,然后在指定压缩级别后在 Google Draco 文件中进行编码。

// For complete examples and data files, please go to https://github.com/aspose-3d/Aspose.3D-for-.NET
// Create a sphere
var sphere = new Sphere();
// Encode the sphere to Google Draco raw data using optimal compression level.
var b = FileFormat.Draco.Encode(sphere.ToMesh(),
new DracoSaveOptions() { CompressionLevel = DracoCompressionLevel.Optimal });
// Save the raw bytes to file
File.WriteAllBytes(RunExamples.GetOutputFilePath("SphereMeshtoDRC_Out.drc"), b);