ترميز 3D شبكة في ملف Google Draco

استرداد شبكة 3D وترميز في ملف Google Draco

يمكن استخدام طريقة encode التي تعرضها فئة DracoFormat لترميز شبكة ثلاثية الأبعاد في ملف Google Draco. يتطلب الأمر وجود كائنات Mesh و DracoSaveOptions كمعلمات. باستخدام خيارات الحفظ Draco ، يمكن للمطورين أيضًا تحديد الموضع ، إحداثيات النسيج ، واللون والبتات العادية بالإضافة إلى مستوى الضغط قبل تشفير شبكة.

Pروغرامينغ ple وافرة

يسترد هذا المثال البرمجي شبكة كروية ، ثم يرمز في الملف Google Draco بعد تحديد مستوى الضغط.

from aspose.threed import FileFormat
from aspose.threed.entities import Sphere
from aspose.threed.formats import DracoCompressionLevel, DracoSaveOptions

#  For complete examples and data files, please go to https:# github.com/aspose-3d/Aspose.3D-for-.NET
#  Create a sphere
sphere = Sphere()
options = DracoSaveOptions()
options.compression_level = DracoCompressionLevel.OPTIMAL
#  Encode the sphere to Google Draco raw data using optimal compression level.
b = FileFormat.DRACO.encode(sphere.to_mesh(), options)
#  Save the raw bytes to file
with open("out"  + "SphereMeshtoDRC_Out.drc", "wb") as f:
    f.write(b)