Exemplo n.º 1
0
        /// <summary>
        /// Renders the Scene.
        /// </summary>
        /// <param name="target">
        /// The <see cref="RenderTarget"/> which will be used for all rendering output.
        /// "null" means rendering directly to the output buffer of the game window / screen.
        /// </param>
        /// <param name="viewportRect">The viewport to which will be rendered.</param>
        /// <param name="imageSize">Target size of the rendered image before adjusting it to fit the specified viewport.</param>
        public void Render(ContentRef <RenderTarget> target, Rect viewportRect, Vector2 imageSize)
        {
            if (!this.active)
            {
                throw new InvalidOperationException("Cannot render a scene that is not active. Call Activate first.");
            }
            if (this.isRendering)
            {
                throw new InvalidOperationException("Can't render a Scene while it is already being rendered.");
            }
            this.isRendering = true;
            try
            {
                // Retrieve the rendering setup that will be used for rendering the scene
                RenderSetup setup =
                    DualityApp.AppData.RenderingSetup.Res ??
                    RenderSetup.Default.Res;

                // Render the scene
                setup.RenderScene(this, target, viewportRect, imageSize);
            }
            finally
            {
                this.isRendering = false;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Renders the Scene
        /// </summary>
        /// <param name="target">
        /// The <see cref="RenderTarget"/> which will be used for all rendering output.
        /// "null" means rendering directly to the output buffer of the game window / screen.
        /// </param>
        /// <param name="viewportRect">The viewport to which will be rendered.</param>
        /// <param name="imageSize">Target size of the rendered image before adjusting it to fit the specified viewport.</param>
        internal void Render(ContentRef <RenderTarget> target, Rect viewportRect, Vector2 imageSize)
        {
            if (!this.IsCurrent)
            {
                throw new InvalidOperationException("Can't render non-current Scene!");
            }
            switchLock++;

            // Retrieve the rendering setup that will be used for rendering the scene
            RenderSetup setup =
                //DualityApp.AppData.RenderingSetup.Res ??
                RenderSetup.Default.Res;

            // Render the scene
            setup.RenderScene(this, target, viewportRect, imageSize);

            switchLock--;
        }
Exemplo n.º 3
0
        internal static void InitDefaultContent()
        {
            RenderSetup defaultSetup = new RenderSetup();

            defaultSetup.Steps.Add(new RenderStep
            {
                Id = "World",
                DefaultClearColor = true
            });
            defaultSetup.Steps.Add(new RenderStep
            {
                Id             = "ScreenOverlay",
                MatrixMode     = RenderMatrix.ScreenSpace,
                ClearFlags     = ClearFlag.None,
                VisibilityMask = VisibilityFlag.AllGroups | VisibilityFlag.ScreenOverlay
            });

            InitDefaultContent <RenderSetup>(new Dictionary <string, RenderSetup>
            {
                { "Default", defaultSetup },
            });
        }
Exemplo n.º 4
0
        internal static void InitDefaultContent()
        {
            RenderSetup defaultSetup = new RenderSetup();

            defaultSetup.Steps.Add(new RenderStep
            {
                Id = "World",
                DefaultClearColor = true,
                DefaultProjection = true
            });
            defaultSetup.Steps.Add(new RenderStep
            {
                Id             = "ScreenOverlay",
                Projection     = ProjectionMode.Screen,
                ClearFlags     = ClearFlag.None,
                VisibilityMask = VisibilityFlag.AllGroups | VisibilityFlag.ScreenOverlay
            });

            DefaultContent.InitType(new Dictionary <string, RenderSetup> {
                { "Default", defaultSetup },
            });
        }