Working with Watermark
Contents
[
Hide
]
Using the Aspose.3D for .NET API, developers can easily add blind watermarks to 3D files while saving in any supported output file format.
Create a 3D Scene
First you need to create a 3d scene from a 3d file.The following code snippet shows how to use this functionality:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-3d/Aspose.3D-for-.NET | |
string file = "template.3ds"; | |
Scene scene = Scene.FromFile(file); |
Encode Watermark
Aspose.3D for .NET adds watermark text information and watermark password to 3d files through the EncodeWatermark
method. The following code snippet shows how to use this functionality:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-3d/Aspose.3D-for-.NET | |
var numMeshes = 0; | |
scene.RootNode.Accept((Node node) => | |
{ | |
var mesh = node.GetEntity<Mesh>(); | |
if (mesh != null) | |
{ | |
numMeshes++; | |
mesh = Watermark.EncodeWatermark(mesh, "HelloWorld", "1234"); | |
if (mesh != null) | |
{ | |
node.Entity = mesh; | |
} | |
} | |
return true; | |
}); |
Save Document
You can save to any 3d file format you want.The following code snippet shows how to use this functionality:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-3d/Aspose.3D-for-.NET | |
string output = "output.fbx"; | |
scene.Save(output, FileFormat.FBX7400ASCII); |