Beispiel #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;
            }
        }
Beispiel #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--;
        }