/// <summary>
		/// Overridden.  Creats a scene graph with a <see cref="PCacheCamera">PCacheCamera</see>
		/// as the main camera.
		/// </summary>
		protected override PCamera CreateBasicScenegraph() {
			PRoot r = new PRoot();
			PLayer l = new PLayer();
			PCamera c = new PCacheCamera();

			r.AddChild(c); 
			r.AddChild(l); 
			c.AddLayer(l);
		
			return c;
		}
Beispiel #2
0
        /// <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);
        }
Beispiel #3
0
		/// <summary>
		/// Creates a basic PiccoloDirect3D 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 P3Camera CreateBasicScenegraph() {
			PRoot r = new PRoot();
			PLayer l = new PLayer();
			P3Camera c = new P3Camera();
		
			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();
		}
		/// <summary>
		/// Installs the scroll director and adds the appropriate handlers.
		/// </summary>
		/// <param name="scrollableControl">
		/// The scrollable control on which this director directs.
		/// </param>
		/// <param name="view">The PCanvas that the scrollable control scrolls.</param>
		public virtual void Install(PScrollableControl scrollableControl, PCanvas view) {
			this.scrollableControl = scrollableControl;
			this.view = view;

			if (view != null) {
				this.camera = view.Camera;
				this.root = view.Root;
			}

			if (camera != null) {
				camera.ViewTransformChanged += new PPropertyEventHandler(camera_ViewTransformChanged);
				camera.BoundsChanged += new PPropertyEventHandler(camera_BoundsChanged);
				camera.FullBoundsChanged += new PPropertyEventHandler(camera_FullBoundsChanged);
			}
			if (root != null) {
				root.BoundsChanged += new PPropertyEventHandler(root_BoundsChanged);
				root.FullBoundsChanged += new PPropertyEventHandler(root_FullBoundsChanged);
			}

			if (scrollableControl != null) {
				scrollableControl.UpdateScrollbars();
			}
		}
		/// <summary>
		/// Uninstalls the scroll director from the scrollable control.
		/// </summary>
		public virtual void UnInstall() {
			scrollableControl = null;
			view = null;

			if (camera != null) {
				camera.ViewTransformChanged -= new PPropertyEventHandler(camera_ViewTransformChanged);
				camera.BoundsChanged -= new PPropertyEventHandler(camera_BoundsChanged);
				camera.FullBoundsChanged -= new PPropertyEventHandler(camera_FullBoundsChanged);
			}
			if (root != null) {
				root.BoundsChanged -= new PPropertyEventHandler(root_BoundsChanged);
				root.FullBoundsChanged -= new PPropertyEventHandler(root_FullBoundsChanged);
			}

			camera = null;
			root = null;
		}