/// <summary> /// Remove all the children nodes as well from the octree. /// </summary> public void RemoveNodeAndchildren() { OctreeSceneManager man = (OctreeSceneManager)this.creator; man.RemoveOctreeNode(this); foreach (OctreeNode child in children) { RemoveChild(child); child.RemoveNodeAndchildren(); } }
public void TestChildSceneNodeDestruction() { SceneManager sceneManager = new OctreeSceneManager( "Manager under test" ); SceneNode node = sceneManager.CreateSceneNode( "testNode" ); SceneNode childNode = node.CreateChildSceneNode( "childNode" ); Assert.IsTrue( ManagerContainsNode( sceneManager, childNode ), "A child node was created but not added to the scene graph." ); node.RemoveAndDestroyChild( childNode ); Assert.IsFalse( ManagerContainsNode( sceneManager, childNode ), "A child node was destroryed but not removed from the scene graph." ); }
public void TestChildSceneNodeRemoval() { SceneManager sceneManager = new OctreeSceneManager( "Manager under test" ); SceneNode node = sceneManager.CreateSceneNode( "testNode" ); SceneNode childNode = node.CreateChildSceneNode( "childNode" ); Assert.IsTrue( ManagerContainsNode( sceneManager, childNode ), "A child node was created but not added to the scene graph." ); node.RemoveChild( childNode.Name ); Assert.IsTrue( ManagerContainsNode( sceneManager, childNode ), "A child node was removed from its parent but also incorrectly removed from the scene graph." ); }
/// <summary> /// Same as SceneNode, only it doesn't care about children... /// </summary> protected override void UpdateBounds() { //update bounds from attached objects foreach (MovableObject obj in objectList.Values) { localAABB.Merge(obj.BoundingBox); worldAABB = obj.GetWorldBoundingBox(true); } if (!worldAABB.IsNull) { OctreeSceneManager oManager = (OctreeSceneManager)this.creator; oManager.UpdateOctreeNode(this); } }