Exemplo n.º 1
0
        protected override void OnSceneChanged(SceneChangedEventArgs eventArgs)
        {
            base.OnSceneChanged(eventArgs);

            var sceneNode = eventArgs.SceneNode;

            if (eventArgs.Changes == SceneChanges.NodeAdded)
            {
                // Recursively add scene nodes to collision domain.
                Register(sceneNode);
            }
            else if (eventArgs.Changes == SceneChanges.NodeRemoved)
            {
                // Recursively remove scene nodes to collision domain.
                Unregister(sceneNode);
            }
            else if (eventArgs.Changes == SceneChanges.IsEnabledChanged)
            {
                // Recursively enable/disable collision objects.
                HandleIsEnabledChanged(sceneNode);
            }
            else if (eventArgs.Changes == SceneChanges.ShapeChanged)
            {
                // Shape changes are usually handled by the collision domain, except for
                // EmptyShapes: EmptyShapes should not be registered in the collision domain.
                HandleShapeChange(sceneNode);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Called when the subtree of a LOD changed.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="eventArgs">
        /// The <see cref="SceneChangedEventArgs"/> instance containing the event data.
        /// </param>
        private void OnLodSceneChanged(object sender, SceneChangedEventArgs eventArgs)
        {
            if (_ignoreChanges)
            {
                return;
            }

            switch (eventArgs.Changes)
            {
            case SceneChanges.NodeAdded:
                SetProxy(eventArgs.SceneNode, _owner);
                _owner.UpdateBoundingShape();
                break;

            case SceneChanges.NodeRemoved:
                SetProxy(eventArgs.SceneNode, null);
                _owner.UpdateBoundingShape();
                break;

            case SceneChanges.PoseChanged:
            case SceneChanges.ShapeChanged:
                _owner.UpdateBoundingShape();
                break;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Calls <see cref="OnSceneChanged(SceneChangedEventArgs)"/>.
        /// </summary>
        /// <param name="sceneNode">The scene node that was added/removed/modified.</param>
        /// <param name="changes">The changes.</param>
        private void OnSceneChanged(SceneNode sceneNode, SceneChanges changes)
        {
            var args = SceneChangedEventArgs.Create(sceneNode, changes);

            OnSceneChanged(args);
            args.Recycle();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Raises the <see cref="SceneChanged"/> event.
        /// </summary>
        /// <param name="eventArgs">
        /// <see cref="SceneChangedEventArgs"/> object that provides the arguments for the event.
        /// </param>
        /// <remarks>
        /// <para>
        /// This method is called when a change in the local subtree occurred. For example, when a scene
        /// node was added/removed, or a scene node's pose or shape changed.
        /// </para>
        /// <para>
        /// <strong>Notes to Inheritors:</strong> When overriding
        /// <see cref="OnSceneChanged(SceneChangedEventArgs)"/> in a derived class, be sure to call the
        /// base class's <see cref="OnSceneChanged(SceneChangedEventArgs)"/> method so that registered
        /// delegates receive the event.
        /// </para>
        /// </remarks>
        protected virtual void OnSceneChanged(SceneChangedEventArgs eventArgs)
        {
            var handler = SceneChanged;

            if (handler != null)
            {
                handler(this, eventArgs);
            }

            if (_parent != null)
            {
                _parent.OnSceneChanged(eventArgs);
            }
        }
Exemplo n.º 5
0
 private static void OnSceneChangedValidation(object sender, SceneChangedEventArgs eventArgs)
 {
     if (eventArgs.Changes == SceneChanges.NodeAdded)
     {
         ValidateShape(eventArgs.SceneNode);
         ValidatePose(eventArgs.SceneNode);
     }
     else if (eventArgs.Changes == SceneChanges.ShapeChanged)
     {
         ValidateShape(eventArgs.SceneNode);
     }
     else if (eventArgs.Changes == SceneChanges.PoseChanged)
     {
         ValidatePose(eventArgs.SceneNode);
     }
 }