Example #1
0
        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();
            }
        }
Example #2
0
        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);
        }
Example #3
0
 public CSGTreeBranch CreateBranch(Int32 userID = 0, CSGOperationType operation = CSGOperationType.Additive)
 {
     return(CSGTreeBranch.Create(userID, operation));
 }