示例#1
0
        public override CSGNode ToCSGNode(CSGNode parent, HashSet <CSGNode> animateNodes, bool ignoreAnimate)
        {
            var branch = new CSGNode(this.ID, Operator);

            branch.Parent           = parent;
            branch.LocalTranslation = this.Translation;
            if (parent != null)
            {
                branch.Translation = Vector3.Add(parent.Translation, branch.LocalTranslation);
            }
            else
            {
                branch.Translation = branch.LocalTranslation;
            }

            branch.Left  = Left.ToCSGNode(branch, animateNodes, Animate || ignoreAnimate);
            branch.Right = Right.ToCSGNode(branch, animateNodes, Animate || ignoreAnimate);

            if (Animate && !ignoreAnimate)
            {
                animateNodes.Add(branch);
            }

            return(branch);
        }
示例#2
0
        public CSGTree ToCSGTree(out HashSet <CSGNode> animatedNodes)
        {
            animatedNodes = new HashSet <CSGNode>();
            var tree = new CSGTree();

            tree.RootNode = RootNode.ToCSGNode(null, animatedNodes, false);
            return(tree);
        }