Root view port that should never take part in rendering.
Inheritance: ViewPort
Ejemplo n.º 1
0
        /// <summary>
        /// Manages a scene to be rendered and updated.
        /// </summary>
        /// <param name="camera">Camera of the scene</param>
        /// <param name="canvas">Canvas that this scene binds to.</param>
        /// <param name="objects">Objects to be rendered</param>
        public Scene(ICamera camera, ICanvas canvas, params SceneObject[] objects)
        {
            if (camera == null || canvas == null)
            {
                throw new ArgumentNullException();
            }

            this.Canvas = canvas;
            {
                this.rootUI = new SceneRootUI();
            }
            {
                var rootObject = new SceneRootObject(this);
                rootObject.Children.AddRange(objects);
                this.rootObject = rootObject;
            }
            {
                var rootViewPort = new SceneRootViewPort(
                    AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Top, new Padding(0, 0, 0, 0), canvas.Size);
                rootViewPort.Children.Add(new ViewPort(camera,
                                                       AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom,
                                                       new Padding(0, 0, 0, 0), canvas.Size));
                this.rootViewPort = rootViewPort;
            }
            //var cursor = UICursor.CreateDefault();
            //cursor.Enabled = false;
            //this.rootCursor.Children.Add(cursor);
            //this.Cursor = cursor;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Manages a scene to be rendered and updated.
        /// </summary>
        /// <param name="camera">Camera of the scene</param>
        /// <param name="canvas">Canvas that this scene binds to.</param>
        /// <param name="objects">Objects to be rendered</param>
        public Scene(ICamera camera, ICanvas canvas, params SceneObject[] objects)
        {
            if (camera == null || canvas == null) { throw new ArgumentNullException(); }

            this.Canvas = canvas;
            {
                this.rootUI = new SceneRootUI();
            }
            {
                var rootObject = new SceneRootObject(this);
                rootObject.Children.AddRange(objects);
                this.rootObject = rootObject;
            }
            {
                var rootViewPort = new SceneRootViewPort(
                     AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Top, new Padding(0, 0, 0, 0), canvas.Size);
                rootViewPort.Children.Add(new ViewPort(camera,
                    AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom,
                    new Padding(0, 0, 0, 0), canvas.Size));
                this.rootViewPort = rootViewPort;
            }
            //var cursor = UICursor.CreateDefault();
            //cursor.Enabled = false;
            //this.rootCursor.Children.Add(cursor);
            //this.Cursor = cursor;
        }