3D dosyasında tüm ağlar için normal veri oluştur
Contents
[
Hide
]
Aspose.3D for .NET kullanarak, geliştiriciler herhangi bir 3D modelinde (normal veri olmadan) tüm ağlar için normal veri oluşturabilirler.
3DS dosyasında tüm ağlar için normal veri oluştur
PolygonModifier
sınıfı tarafından maruz kalan GenerateNormal
yöntemi, 3DS dosyasındaki tüm ağlar için normal veri oluşturmak için kullanılabilir. Eğer VertexElementSmoothingGroup
elemanı örgüde tanımlanmışsa, oluşturulan normal veriler VertexElementSmoothingGroup
tarafından düzeltilecektir.
Programming ample ample
Bu kod örneği 3DS dosyasını yükler, tüm düğümleri ziyaret eder ve tüm ağlar için normal veri oluşturur.
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 | |
// Load a 3ds file, 3ds file doesn't have normal data, but it has smoothing group | |
Scene s = new Scene(RunExamples.GetDataFilePath("camera.3ds")); | |
// Visit all nodes and create normal data for all meshes | |
s.RootNode.Accept(delegate(Node n) | |
{ | |
Mesh mesh = n.GetEntity<Mesh>(); | |
if (mesh != null) | |
{ | |
VertexElementNormal normals = PolygonModifier.GenerateNormal(mesh); | |
mesh.VertexElements.Add(normals); | |
} | |
return true; | |
}); |