Exemplo n.º 1
0
        /// <summary>
        /// Render the decoration scene
        /// </summary>
        void RenderDecorationScene()
        {
            GlDecorationControl.MakeCurrent();
            Display.ClearBuffers();

            if (Batch != null && Maze != null)
            {
                Batch.Begin();

                Batch.DrawTile(Maze.WallTileset, 0, Point.Empty);

                TileDrawing td = DisplayCoordinates.GetWalls(ViewFieldPosition.L)[0];
                Batch.DrawTile(Maze.WallTileset, td.ID, td.Location);


                // Draw the decoration
                if (Maze.Decoration != null)
                {
                    Maze.Decoration.Draw(Batch, (int)DecorationIdBox.Value, ViewFieldPosition.L);
                }

                Batch.End();
            }


            GlDecorationControl.SwapBuffers();
        }
Exemplo n.º 2
0
        public void DrawTick()
        {
            Monitor.Enter(this._captureLock);
            if (this._activeSettings == null)
            {
                return;
            }
            bool notRetro = Lighting.NotRetro;

            if (this._renderQueue.Count > 0)
            {
                CaptureCamera.CaptureChunk captureChunk = this._renderQueue.Dequeue();
                this._graphics.SetRenderTarget((RenderTarget2D)null);
                this._graphics.Clear(Microsoft.Xna.Framework.Color.Transparent);
                TileDrawing tilesRenderer = Main.instance.TilesRenderer;
                Microsoft.Xna.Framework.Rectangle area = captureChunk.Area;
                int left = area.Left;
                area = captureChunk.Area;
                int right = area.Right;
                area = captureChunk.Area;
                int top = area.Top;
                area = captureChunk.Area;
                int bottom = area.Bottom;
                tilesRenderer.PrepareForAreaDrawing(left, right, top, bottom);
                Main.instance.TilePaintSystem.PrepareAllRequests();
                this._graphics.SetRenderTarget(this._frameBuffer);
                this._graphics.Clear(Microsoft.Xna.Framework.Color.Transparent);
                if (notRetro)
                {
                    Microsoft.Xna.Framework.Color clearColor = this._activeSettings.CaptureBackground ? Microsoft.Xna.Framework.Color.Black : Microsoft.Xna.Framework.Color.Transparent;
                    Filters.Scene.BeginCapture(this._filterFrameBuffer1, clearColor);
                    Main.instance.DrawCapture(captureChunk.Area, this._activeSettings);
                    Filters.Scene.EndCapture(this._frameBuffer, this._filterFrameBuffer1, this._filterFrameBuffer2, clearColor);
                }
                else
                {
                    Main.instance.DrawCapture(captureChunk.Area, this._activeSettings);
                }
                if (this._activeSettings.UseScaling)
                {
                    this._graphics.SetRenderTarget(this._scaledFrameBuffer);
                    this._graphics.Clear(Microsoft.Xna.Framework.Color.Transparent);
                    this._spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, this._downscaleSampleState, DepthStencilState.Default, RasterizerState.CullNone);
                    this._spriteBatch.Draw((Texture2D)this._frameBuffer, new Microsoft.Xna.Framework.Rectangle(0, 0, this._scaledFrameBuffer.Width, this._scaledFrameBuffer.Height), Microsoft.Xna.Framework.Color.White);
                    this._spriteBatch.End();
                    this._graphics.SetRenderTarget((RenderTarget2D)null);
                    this._scaledFrameBuffer.GetData <byte>(this._scaledFrameData, 0, this._scaledFrameBuffer.Width * this._scaledFrameBuffer.Height * 4);
                    this.DrawBytesToBuffer(this._scaledFrameData, this._outputData, this._scaledFrameBuffer.Width, this._outputImageSize.Width, captureChunk.ScaledArea);
                }
                else
                {
                    this._graphics.SetRenderTarget((RenderTarget2D)null);
                    this.SaveImage((Texture2D)this._frameBuffer, captureChunk.ScaledArea.Width, captureChunk.ScaledArea.Height, ImageFormat.Png, this._activeSettings.OutputName, captureChunk.Area.X.ToString() + "-" + (object)captureChunk.Area.Y + ".png");
                }
                this._tilesProcessed += (float)(captureChunk.Area.Width * captureChunk.Area.Height);
            }
            if (this._renderQueue.Count == 0)
            {
                this.FinishCapture();
            }
            Monitor.Exit(this._captureLock);
        }