Exemple #1
0
        public void UpdateNodeOctant(OctreeZoneData zoneData)
        {
            AxisAlignedBox box = zoneData.OctreeWorldAABB;

            if (box.IsNull)
            {
                return;
            }

            // Skip if octree has been destroyed (shutdown conditions)
            if (null == this.rootOctree)
            {
                return;
            }

            PCZSceneNode node = zoneData.mAssociatedNode;

            if (null == zoneData.Octant)
            {
                //if outside the octree, force into the root node.
                if (!zoneData._isIn(this.rootOctree.Box))
                {
                    this.rootOctree.AddNode(node);
                }
                else
                {
                    AddNodeToOctree(node, this.rootOctree, 0);
                }
                return;
            }

            if (!zoneData._isIn(zoneData.Octant.Box))
            {
                //if outside the octree, force into the root node.
                if (!zoneData._isIn(this.rootOctree.Box))
                {
                    // skip if it's already in the root node.
                    if (((OctreeZoneData)node.GetZoneData(this)).Octant == this.rootOctree)
                    {
                        return;
                    }

                    RemoveNodeFromOctree(node);
                    this.rootOctree.AddNode(node);
                }
                else
                {
                    AddNodeToOctree(node, this.rootOctree, 0);
                }
            }
        }
Exemple #2
0
		public void UpdateNodeOctant( OctreeZoneData zoneData )
		{
			AxisAlignedBox box = zoneData.OctreeWorldAABB;

			if ( box.IsNull )
				return;

			// Skip if octree has been destroyed (shutdown conditions)
			if ( null == rootOctree )
				return;

			PCZSceneNode node = zoneData.mAssociatedNode;
			if ( null == zoneData.Octant )
			{
				//if outside the octree, force into the root node.
				if ( !zoneData._isIn( rootOctree.Box ) )
					rootOctree.AddNode( node );
				else
					AddNodeToOctree( node, rootOctree, 0 );
				return;
			}

			if ( !zoneData._isIn( zoneData.Octant.Box ) )
			{

				//if outside the octree, force into the root node.
				if ( !zoneData._isIn( rootOctree.Box ) )
				{
					// skip if it's already in the root node.
					if ( ( (OctreeZoneData)node.GetZoneData( this ) ).Octant == rootOctree )
						return;

					RemoveNodeFromOctree( node );
					rootOctree.AddNode( node );
				}
				else
					AddNodeToOctree( node, rootOctree, 0 );
			}
		}