Esempio n. 1
0
        public ROctree Add(ref RRenderNode o, BoundingBox transformebbox)
        {
            float   radius = (transformebbox.Max - transformebbox.Min).Length() / 2;
            Vector3 center = (transformebbox.Max + transformebbox.Min) / 2;

            if (this.bounds.Contains(transformebbox) == ContainmentType.Contains)
            {
                return(this.Add(ref o, transformebbox, center, radius));
            }
            return(null);
        }
Esempio n. 2
0
        public ROctree Add(ref RRenderNode o, Vector3 center, float radius)
        {
            Vector3     min    = center - new Vector3(radius);
            Vector3     max    = center + new Vector3(radius);
            BoundingBox bounds = new BoundingBox(min, max);

            if (this.bounds.Contains(bounds) == ContainmentType.Contains)
            {
                return(this.Add(ref o, bounds, center, radius));
            }
            return(null);
        }
Esempio n. 3
0
        private ROctree Add(ref RRenderNode o, BoundingBox bounds, Vector3 center, float radius)
        {
            if (this.children != null)
            {
                // Find which child the object is closest to based on where the
                // object's center is located in relation to the octree's center.
                int index = (center.X <= this.center.X ? 0 : 1) +
                            (center.Y >= this.center.Y ? 0 : 4) +
                            (center.Z <= this.center.Z ? 0 : 2);

                // Add the object to the child if it is fully contained within
                // it.
                if (this.children[index].bounds.Contains(bounds) == ContainmentType.Contains)
                {
                    return(this.children[index].Add(ref o, bounds, center, radius));
                }
            }
            this.objects.Add(o);
            return(this);
        }
Esempio n. 4
0
 public void Remove(ref RRenderNode obj)
 {
     objects.Remove(obj);
 }