Ejemplo n.º 1
0
 /// <summary>
 /// Add a <see cref="SceneGraphObject"/> as child of this instance.
 /// </summary>
 /// <param name="sceneGraphObject">
 /// The <see cref="SceneGraphObject"/> to be included in the children list of this instance.
 /// </param>
 public override void AddChild(SceneGraphObject sceneGraphObject)
 {
     // Base implementation
     base.AddChild(sceneGraphObject);
     // Set default view
     if ((_CurrentView == null) && (sceneGraphObject is SceneGraphCameraObject))
     {
         _CurrentView = (SceneGraphCameraObject)sceneGraphObject;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Add a <see cref="SceneGraphObject"/> as child of this instance.
        /// </summary>
        /// <param name="sceneGraphObject">
        /// The <see cref="SceneGraphObject"/> to be included in the children list of this instance.
        /// </param>
        public virtual void AddChild(SceneGraphObject sceneGraphObject)
        {
            if (sceneGraphObject == null)
            {
                throw new ArgumentNullException("sceneGraphObject");
            }
            if (sceneGraphObject._ParentObject != null)
            {
                throw new ArgumentException("already in graph");
            }

            // Set the parent to this instance
            sceneGraphObject._ParentObject = this;
            // Include object in children list
            _Children.Add(sceneGraphObject);
            LinkResource(sceneGraphObject);
        }