private void CollectAllGeometriesAndMaterials(HxScene.SceneNode root) { // Collect all geometries and materials foreach (var node in root.Traverse()) { if (GetMaterialFromNode(node, out var material) && !materialCollection.ContainsKey(material)) { materialCollection.Add(material, materialCollection.Count); } if (GetGeometryFromNode(node, out var geometry) && !geometryCollection.ContainsKey(geometry)) { geometryCollection.Add(geometry, geometryCollection.Count); } } foreach (var node in root.Traverse()) { if (node is HxScene.GeometryNode geo) { var info = OnCreateMeshInfo(geo); if (info == null) { logger.LogWarning("Create Mesh info failed. Node Name: {}", geo.Name); continue; } if (!meshInfos.ContainsKey(info.MaterialMeshKey)) { meshInfos.Add(info.MaterialMeshKey, info); } } } if (configuration.EnableParallelProcessing) { Parallel.ForEach(meshInfos, (info) => { info.Value.AssimpMesh = OnCreateAssimpMesh(info.Value); }); } else { foreach (var info in meshInfos) { info.Value.AssimpMesh = OnCreateAssimpMesh(info.Value); } } }
private void SyncNamesWithElement3DAndSceneNode(HxScene.SceneNode node) { foreach (var n in node.Traverse()) { if (n.WrapperSource is Element3D ele) { if (string.IsNullOrEmpty(ele.Name)) { continue; } else if (string.IsNullOrEmpty(node.Name)) { node.Name = ele.Name; } } } }