public static MeshData[] ProcMesh(FbxManager manager, FbxNode node, FbxMesh mesh, ImportOptions importOptions, Matrix4 additionalTransform) { var transform = additionalTransform * FbxMath.EvaluateGlobalTransform(node).ToMatrix4(); transform = transform * FbxMath.GetGeometryOffset(node).ToMatrix4(); var converter = new FbxGeometryConverter(manager); bool success = false; try { mesh = FbxMesh.Cast(converter.Triangulate(mesh, false)); //ToDo :? Может true? Чтобы не создавать второй mesh в Attribute success = true; } catch (Exception ex) { FbxImportLog.LogError(node, "Inside Triangulate error: " + ex); } if (!success || mesh == null) { return(null); } MeshData data = ReadTriangles(mesh, node); var ret = ReadMaterialsAndSplitByMaterials(data); foreach (var m in ret) { ReadMeshElements(m, importOptions, ref transform); } return(ret); }
public static bool GetNodeMesh(FbxNode pNode, out FbxMesh pMesh) { pMesh = null; for (int i = 0; i < pNode.GetNodeAttributeCount(); i++) { if (pNode.GetNodeAttributeByIndex(i).GetAttributeType() == FbxNodeAttribute.EType.eMesh) { pMesh = FbxMesh.Cast(pNode.GetNodeAttributeByIndex(i)); return(true); } } return(false); }