private static void GenerateNodeHierarchy(Node node, ref GeoModel model) { GeoNode root = new GeoNode(); root.Name = node.Name; root.Transform = HelperMatrix.ConvertAssimpToOpenTKMatrix(node.Transform); root.Parent = null; model.Root = root; model.NodesWithoutHierarchy.Add(root); foreach (Node child in node.Children) { root.Children.Add(MapNodeToNode(child, ref model, ref root)); } }
private static GeoNode MapNodeToNode(Node n, ref GeoModel model, ref GeoNode callingNode) { GeoNode gNode = new GeoNode(); gNode.Parent = callingNode; gNode.Transform = HelperMatrix.ConvertAssimpToOpenTKMatrix(n.Transform); gNode.Name = n.Name; model.NodesWithoutHierarchy.Add(gNode); foreach (Node child in n.Children) { gNode.Children.Add(MapNodeToNode(child, ref model, ref gNode)); } return(gNode); }
public static GeoNode FindChild(GeoNode nodeStart, string name) { if (nodeStart.Name == name) { return(nodeStart); } else { foreach (GeoNode child in nodeStart.Children) { if (child.Name == name) { return(child); } GeoNode v = FindChild(child, name); if (v != null && v.Name == name) { return(v); } } } return(null); }