/// <summary>
        /// Animate the camera's view matrix from its current value when the activity starts
        /// to the new destination matrix value.
        /// </summary>
        /// <param name="destination">The final matrix value.</param>
        /// <param name="duration">The amount of time that the animation should take.</param>
        /// <returns>
        /// The newly scheduled activity, if the duration is greater than 0; else null.
        /// </returns>
        public virtual PTransformActivity AnimateViewToMatrix(PMatrix destination, long duration)
        {
            if (duration == 0)
            {
                ViewMatrix = destination;
                return(null);
            }

            PTransformActivity ta = new PTransformActivity(duration, PUtil.DEFAULT_ACTIVITY_STEP_RATE, new PCameraTransformTarget(this), destination);

            PRoot r = Root;

            if (r != null)
            {
                r.AddActivity(ta);
            }

            return(ta);
        }
Example #2
0
        /// <summary>
        /// Creates a basic scene graph.
        /// </summary>
        /// <returns>The main camera node in the new scene graph.</returns>
        /// <remarks>
        /// The scene graph will consist of  root node with two children, a layer and a
        /// camera.  Additionally, The camera will be set to view the layer.  Typically,
        /// you will want to add new nodes to the layer.
        /// </remarks>
        public static PCamera CreateBasicScenegraph()
        {
            PRoot r = new PRoot();
            PLayer l = new PLayer();
            PCamera c = new PCamera();

            r.AddChild(c);
            r.AddChild(l);
            c.AddLayer(l);

            return c;
        }
 /// <summary>
 /// Constructs a new PActivityScheduler.
 /// </summary>
 /// <param name="rootNode">The root node to associate with this activity scheduler.</param>
 public PActivityScheduler(PRoot rootNode)
 {
     root = rootNode;
     activities = new PActivityList();
     processingActivities = new PActivityList();
 }