Beispiel #1
0
 /// <summary>
 /// 'node' becomes a child of 'insertLocation' or the Root of the
 /// SceneGraph if 'insertLocation' is null
 /// </summary>
 /// <param name="node"></param>
 /// <param name="insertLocation"></param>
 public void Insert(SceneNode node, SceneNode insertLocation)
 {
     if (insertLocation == null)
     {
         Root = node;
     }
     else
     {
         insertLocation.AddChild(node);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Explicitly change this SceneNodes parent... this is broken
        /// out into a seperate method rather than allowing direct setting
        /// of the Parent property because changes of Parent should be
        /// exceptional and have, at the very least, spatial consequences for
        /// the entire subtree rooted at this SceneNode
        /// </summary>
        /// <param name="newParent"></param>
        internal virtual void ChangeParent(SceneNode newParent)
        {
            if (newParent == null)
            {
                throw new ArgumentNullException();
            }

            if (parent != null)
            {
                parent.RemoveChild(this);
            }

            newParent.AddChild(this);

            parent = newParent;
        }
Beispiel #3
0
 /// <summary>
 /// 'node' becomes a child of 'insertLocation' or the Root of the 
 /// SceneGraph if 'insertLocation' is null
 /// </summary>
 /// <param name="node"></param>
 /// <param name="insertLocation"></param>
 public void Insert(SceneNode node, SceneNode insertLocation)
 {
     if (insertLocation == null)
     {
         Root = node;
     }
     else
     {
         insertLocation.AddChild(node);
     }
 }
Beispiel #4
0
        /// <summary>
        /// Explicitly change this SceneNodes parent... this is broken
        /// out into a seperate method rather than allowing direct setting
        /// of the Parent property because changes of Parent should be 
        /// exceptional and have, at the very least, spatial consequences for 
        /// the entire subtree rooted at this SceneNode
        /// </summary>
        /// <param name="newParent"></param>
        internal virtual void ChangeParent(SceneNode newParent)
        {
            if (newParent == null)
                throw new ArgumentNullException();

            if (parent != null)
                parent.RemoveChild(this);

            newParent.AddChild(this);

            parent = newParent;
        }