Example #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);
            }
        }
Example #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;
            }
        }
Example #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();
        }
Example #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);
            }
        }
Example #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);
     }
 }
Example #6
0
    /// <summary>
    /// Called when the referenced node (or a node in its subtree) changed.
    /// </summary>
    /// <param name="sender">The sender.</param>
    /// <param name="eventArgs">
    /// The <see cref="SceneChangedEventArgs"/> instance containing the event data.
    /// </param>
    private void OnNodeSceneChanged(object sender, SceneChangedEventArgs eventArgs)
    {
      if (_ignoreChanges)
        return;

      switch (eventArgs.Changes)
      {
        case SceneChanges.NodeAdded:
          SetProxy(eventArgs.SceneNode, this);
          UpdateBoundingShape();
          break;
        case SceneChanges.NodeRemoved:
          SetProxy(eventArgs.SceneNode, null);
          UpdateBoundingShape();
          break;
        case SceneChanges.PoseChanged:
        case SceneChanges.ShapeChanged:
          UpdateBoundingShape();
          break;
      }
    }
Example #7
0
 private void OnDirectionalLightNodeChanged(object sender, SceneChangedEventArgs eventArgs)
 {
   _godRayFilter.Enabled = _directionalLightNode.IsEnabled;
   _godRayFilter.LightDirection = _directionalLightNode.PoseWorld.ToWorldDirection(Vector3F.Forward);
 }
Example #8
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);
    }