Ejemplo n.º 1
0
 void LateUpdate()
 {
     if (Container)
     {
         CurrentNode = Container.Tree.Update(this, CurrentNode, transform.position);
     }
 }
Ejemplo n.º 2
0
 void Update()
 {
     if (Container)
     {
         // Debug the octree
         //Verify();
         CurrentNode = Container.Tree.Update(this, CurrentNode, transform.position);
     }
 }
Ejemplo n.º 3
0
 public OctreeNode(SparseOctree <T> tree, OctreeNode parent, Bounds b)
 {
     NodeBounds = b;
     Tree       = tree;
     Parent     = parent;
     if (parent == null)
     {
         Depth = 0;
     }
     else
     {
         Depth = parent.Depth + 1;
     }
 }
Ejemplo n.º 4
0
    bool RecursiveVerify(HashSet <SparseOctree <OctreeElementComponent> .OctreeNode> set, SparseOctree <OctreeElementComponent> .OctreeNode node)
    {
        if (set.Contains(node) != node.Contained.Contains(this))
        {
            Debug.LogError("ERROR: Octree contained mismatch!  Failed with node @ " + node.NodeBounds);
            return(false);
        }

        if (node.Divisions != null)
        {
            for (int z = 0; z < 2; ++z)
            {
                for (int y = 0; y < 2; ++y)
                {
                    for (int x = 0; x < 2; ++x)
                    {
                        if (!RecursiveVerify(set, node.Divisions[x, y, z]))
                        {
                            return(false);
                        }
                    }
                }
            }
        }

        return(true);
    }
Ejemplo n.º 5
0
 void Awake()
 {
     Tree = new SparseOctree <OctreeElementComponent>(OctreeBounds, Depth);
 }