Esempio n. 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);
                }
            }
        }
Esempio n. 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 );
			}
		}
Esempio n. 3
0
        /** create zone specific data for a node
         */

        public override void CreateNodeZoneData(PCZSceneNode node)
        {
            var ozd = new OctreeZoneData(node, this);

            node.SetZoneData(this, ozd);
        }
Esempio n. 4
0
		/** create zone specific data for a node
		*/
		public override void CreateNodeZoneData( PCZSceneNode node )
		{
			OctreeZoneData ozd = new OctreeZoneData( node, this );
			node.SetZoneData( this, ozd );
		}