internal static CSGTreeNode DuplicateInternal(CSGTreeNode node) { switch (node.Type) { case CSGNodeType.Brush: { var srcTreeBrush = (CSGTreeBrush)node; return(CSGTreeBrush.Create(srcTreeBrush.UserID, srcTreeBrush.LocalTransformation, srcTreeBrush.BrushMesh, srcTreeBrush.Operation, srcTreeBrush.Flags)); } case CSGNodeType.Tree: { var srcTree = (CSGTree)node; return(CSGTree.Create(srcTree.UserID, DuplicateChildNodesInternal(srcTree))); } case CSGNodeType.Branch: { var srcTreeBranch = (CSGTreeBranch)node; return(CSGTreeBranch.Create(srcTreeBranch.UserID, srcTreeBranch.Operation, DuplicateChildNodesInternal(srcTreeBranch))); } default: throw new NotImplementedException(); } }
internal static CSGTreeNode[] DuplicateChildNodesInternal(CSGTreeBranch branch) { var childCount = branch.Count; if (childCount == 0) { return(new CSGTreeNode[0]); } var duplicateNodes = new CSGTreeNode[childCount]; for (int i = 0; i < childCount; i++) { duplicateNodes[i] = DuplicateInternal(branch[i]); } return(duplicateNodes); }
public CSGTreeBranch CreateBranch(Int32 userID = 0, CSGOperationType operation = CSGOperationType.Additive) { return(CSGTreeBranch.Create(userID, operation)); }