Aspose.3D for Java 21.8发行说明

改进和变更

钥匙摘要类别
THREEDNET-922添加盲水印支持新功能
THREEDNET-920保存到GLB文件与外部draco编码器丢失了许多信息。错误修复
THREEDNET-918并行化场景中的重要锁定争用。使用fbx文件打开改进
THREEDNET-924顶点演绎在TriMesh中并不总是起作用错误修复
THREEDNET-923不透明度不在FBX进口商中处理错误修复
THREEDNET-912FBX到GLTF2转换问题错误修复

API更改

添加了com.aspose.threed.Watermark

从21.8,您可以将盲水印应用于网格,并且即使在将水印导出为不同格式后,该水印也可以存在。

    /**
    * Utility to encode/decode blind watermark  to/from a mesh.
    */
    public class Watermark
    {
        /**
        * Encode a text into mesh' blind watermark.
        * @param input Mesh to encode a blind watermark
        * @param text Text to encode to the mesh
        * @param password Password to protect the watermark, it's optional
        */
        public static Mesh encodeWatermark(Mesh input, String text, String password)
            throws IOException

        /**
        * Decode the watermark from a mesh
        * @param input The mesh to extract watermark
        * @param password The password to decrypt the watermark
        * @throws SecurityException The mesh is protected by password, and provided password is incorrect.
        */
        public static String decodeWatermark(Mesh input, String password)

    }

使用水印生成网格并将其保存到PLY文件的示例代码:

    //prepare a mesh for testing
    var mesh = new Torus().toMesh();
    //encode the watermark to the mesh with password protected
    mesh = Watermark.encodeWatermark(mesh, "Powered by Aspose.3D", "password");
    //save it to a file
    var scene = new Scene(mesh);
    scene.save("watermark-mesh.ply", FileFormat.PLY);

从网格中读取水印的示例代码:

    //load a mesh instance from a ply file
    var scene = new Scene("watermark-mesh.ply");
    var mesh = (Mesh)scene.getRootNode().getChild(0).getEntity();
    //read the watermark
    var watermark = Watermark.decodeWatermark(mesh, "password");
    System.out.println(watermark);