产生紫外线
Contents
[
Hide
]
产生紫外线
Aspose.3D for Java 提供 PolygonModifier
类,该类公开GenerateUV方法,您可以使用该方法手动生成UV并将其与网格关联。以下代码段显示了生成和关联它的完整功能:
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-Java | |
// The path to the documents directory. | |
String MyDir = RunExamples.getDataDir(); | |
Scene scene = new Scene(); | |
//since all primitive entities in Aspose.3D will have builtin UV generation | |
//here we manually remove it to assume we have a mesh without UV data | |
Mesh mesh = (new Box()).toMesh(); | |
mesh.getVertexElements().remove(mesh.getElement(VertexElementType.UV)); | |
//then we can manually generate UV for it | |
VertexElement uv = PolygonModifier.generateUV(mesh); | |
//generated UV data is not associated with the mesh, we should manually do this | |
mesh.addElement(uv); | |
//put it to the scene | |
Node node = scene.getRootNode().createChildNode(mesh); | |
//then save it | |
scene.save(MyDir + "test.obj", FileFormat.WAVEFRONTOBJ); |