Пример #1
0
        public static unsafe CSGTree Create(Int32 userID, CSGTreeNode *childrenArray, int childrenArrayLength)
        {
            var treeNodeID = CompactHierarchyManager.CreateTree(userID);

            Debug.Assert(CompactHierarchyManager.IsValidNodeID(treeNodeID));
            if (childrenArray != null && childrenArrayLength > 0)
            {
                if (!CompactHierarchyManager.SetChildNodes(treeNodeID, childrenArray, childrenArrayLength))
                {
                    CompactHierarchyManager.DestroyNode(treeNodeID);
                    return(CSGTree.Invalid);
                }
            }
            CompactHierarchyManager.SetDirty(treeNodeID);
            return(CSGTree.Find(treeNodeID));
        }
Пример #2
0
        public static unsafe CSGTreeBranch CreateUnsafe(Int32 userID = 0, CSGOperationType operation = CSGOperationType.Additive, CSGTreeNode *childrenArray = null, int childrenArrayLength = 0)
        {
            var branchNodeID = CompactHierarchyManager.CreateBranch(operation, userID);

            Debug.Assert(CompactHierarchyManager.IsValidNodeID(branchNodeID));
            if (childrenArray != null && childrenArrayLength > 0)
            {
                if (!CompactHierarchyManager.SetChildNodes(branchNodeID, childrenArray, childrenArrayLength))
                {
                    CompactHierarchyManager.DestroyNode(branchNodeID);
                    return(CSGTreeBranch.Invalid);
                }
            }
            CompactHierarchyManager.SetDirty(branchNodeID);
            return(CSGTreeBranch.Find(branchNodeID));
        }