Esempio n. 1
0
        public override void Run()
        {
            if (nop)
            {
                return;
            }

            GL.SetClearColor(Color.FromArgb(BackgroundColor));
            GL.Clear(OpenTK.Graphics.OpenGL.ClearBufferMask.ColorBufferBit);

            GuiRenderer.Begin(OutputSize.Width, OutputSize.Height);
            GuiRenderer.SetBlendState(GL.BlendNoneCopy);

            if (FilterOption != eFilterOption.None)
            {
                InputTexture.SetFilterLinear();
            }
            else
            {
                InputTexture.SetFilterNearest();
            }

            if (FilterOption == eFilterOption.Bicubic)
            {
            }


            GuiRenderer.Draw(InputTexture, LL.vx, LL.vy, LL.vw, LL.vh);

            GuiRenderer.End();
        }
Esempio n. 2
0
        public override void Run()
        {
            if (nop)
            {
                return;
            }

            //TODO: this could be more efficient (draw only in gap)
            GL.SetClearColor(Color.Black);
            GL.Clear(OpenTK.Graphics.OpenGL.ClearBufferMask.ColorBufferBit);

            FilterProgram.GuiRenderer.Begin(outputSize);
            GuiRenderer.SetBlendState(GL.BlendNoneCopy);

            //TODO: may depend on input, or other factors, not sure yet
            //watch out though... if we filter linear, then screens will bleed into each other.
            //so we will have to break them into render targets first.
            InputTexture.SetFilterNearest();

            //draw screens
            bool renderTop    = false;
            bool renderBottom = false;
            var  settings     = nds.GetSettings();

            if (settings.ScreenLayout == MelonDS.ScreenLayoutKind.Bottom)
            {
                renderBottom = true;
            }
            if (settings.ScreenLayout == MelonDS.ScreenLayoutKind.Top)
            {
                renderTop = true;
            }
            if (settings.ScreenLayout == MelonDS.ScreenLayoutKind.Vertical)
            {
                renderTop = renderBottom = true;
            }
            if (settings.ScreenLayout == MelonDS.ScreenLayoutKind.Horizontal)
            {
                renderTop = renderBottom = true;
            }

            if (renderTop)
            {
                GuiRenderer.Modelview.Push();
                GuiRenderer.Modelview.PreMultiplyMatrix(matTop);
                GuiRenderer.DrawSubrect(InputTexture, 0, 0, 256, 192, 0.0f, 0.0f, 1.0f, 0.5f);
                GuiRenderer.Modelview.Pop();
            }

            if (renderBottom)
            {
                GuiRenderer.Modelview.Push();
                GuiRenderer.Modelview.PreMultiplyMatrix(matBot);
                GuiRenderer.DrawSubrect(InputTexture, 0, 0, 256, 192, 0.0f, 0.5f, 1.0f, 1.0f);
                GuiRenderer.Modelview.Pop();
            }

            GuiRenderer.End();
        }
Esempio n. 3
0
        FilterProgram BuildDefaultChain(Size chain_insize, Size chain_outsize, bool includeOSD)
        {
            //select user special FX shader chain
            Dictionary <string, object> selectedChainProperties = new Dictionary <string, object>();

            BizHawk.Client.EmuHawk.Filters.RetroShaderChain selectedChain = null;

            if (Global.Config.TargetDisplayFilter == 3 && ShaderChain_user != null && ShaderChain_user.Available)
            {
                selectedChain = ShaderChain_user;
            }

            BizHawk.Client.EmuHawk.Filters.FinalPresentation fPresent = new BizHawk.Client.EmuHawk.Filters.FinalPresentation(chain_outsize);
            BizHawk.Client.EmuHawk.Filters.SourceImage       fInput   = new BizHawk.Client.EmuHawk.Filters.SourceImage(chain_insize);
            BizHawk.Client.EmuHawk.Filters.OSD fOSD = new BizHawk.Client.EmuHawk.Filters.OSD();
            fOSD.RenderCallback = () =>
            {
                if (!includeOSD)
                {
                    return;
                }
                var size = fOSD.FindInput().SurfaceFormat.Size;
                Renderer.Begin(size.Width, size.Height);
                Renderer.SetBlendState(GL.BlendNormal);
                Renderer.End();
            };

            var chain = new FilterProgram();

            //add the first filter, encompassing output from the emulator core
            chain.AddFilter(fInput, "input");

            //choose final filter
            BizHawk.Client.EmuHawk.Filters.FinalPresentation.eFilterOption finalFilter = BizHawk.Client.EmuHawk.Filters.FinalPresentation.eFilterOption.None;
            if (Global.Config.DispFinalFilter == 1)
            {
                finalFilter = BizHawk.Client.EmuHawk.Filters.FinalPresentation.eFilterOption.Bilinear;
            }
            if (Global.Config.DispFinalFilter == 2)
            {
                finalFilter = BizHawk.Client.EmuHawk.Filters.FinalPresentation.eFilterOption.Bicubic;
            }

            finalFilter = BizHawk.Client.EmuHawk.Filters.FinalPresentation.eFilterOption.None;

            fPresent.FilterOption = finalFilter;

            //add final presentation
            chain.AddFilter(fPresent, "presentation");

            return(chain);
        }
Esempio n. 4
0
        public void Draw(GameTime gameTime)
        {
            var deltaSeconds = gameTime.GetElapsedSeconds();

            _renderer.Begin();

            if (Screen != null)
            {
                DrawChildren(Screen.Controls, deltaSeconds);

                var cursor = Screen.Skin?.Cursor;

                if (cursor != null)
                {
                    _renderer.DrawRegion(cursor.TextureRegion, CursorPosition, cursor.Color);
                }
            }

            _renderer.End();
        }
Esempio n. 5
0
        public override void Run()
        {
            if (nop)
            {
                return;
            }

            GL.SetClearColor(Color.FromArgb(BackgroundColor));
            GL.Clear(OpenTK.Graphics.OpenGL.ClearBufferMask.ColorBufferBit);

            GuiRenderer.Begin(OutputSize.Width, OutputSize.Height);
            GuiRenderer.SetBlendState(GL.BlendNoneCopy);

            if (FilterOption != eFilterOption.None)
            {
                InputTexture.SetFilterLinear();
            }
            else
            {
                InputTexture.SetFilterNearest();
            }

            if (FilterOption == eFilterOption.Bicubic)
            {
                //this was handled earlier by another filter
            }

            GuiRenderer.Modelview.Translate(LL.vx, LL.vy);
            if (Flip)
            {
                GuiRenderer.Modelview.Scale(1, -1);
                GuiRenderer.Modelview.Translate(0, -LL.vh);
            }
            GuiRenderer.Draw(InputTexture, 0, 0, LL.vw, LL.vh);

            GuiRenderer.End();
        }
Esempio n. 6
0
        public void Draw(GameTime gameTime)
        {
            var deltaSeconds = gameTime.GetElapsedSeconds();

            _renderer.Begin();

            foreach (var screen in Screens)
            {
                if (screen.IsVisible)
                {
                    DrawChildren(screen.Controls, deltaSeconds);
                    DrawWindows(screen.Windows, deltaSeconds);
                }
            }

            var cursor = ActiveScreen.Skin?.Cursor;

            if (cursor != null)
            {
                _renderer.DrawRegion(cursor.TextureRegion, CursorPosition, cursor.Color);
            }

            _renderer.End();
        }
Esempio n. 7
0
        FilterProgram BuildDefaultChain(Size chain_insize, Size chain_outsize, bool includeOSD)
        {
            //select user special FX shader chain
            Dictionary <string, object> selectedChainProperties = new Dictionary <string, object>();

            EmuHawk.Filters.RetroShaderChain selectedChain = null;
            if (Global.Config.TargetDisplayFilter == 3 && ShaderChain_user != null && ShaderChain_user.Available)
            {
                selectedChain = ShaderChain_user;
            }

            EmuHawk.Filters.FinalPresentation fPresent = new EmuHawk.Filters.FinalPresentation(chain_outsize);
            EmuHawk.Filters.SourceImage       fInput   = new EmuHawk.Filters.SourceImage(chain_insize);
            EmuHawk.Filters.OSD fOSD = new EmuHawk.Filters.OSD();
            fOSD.RenderCallback = () =>
            {
                if (!includeOSD)
                {
                    return;
                }
                var size = fOSD.FindInput().SurfaceFormat.Size;
                Renderer.Begin(size.Width, size.Height);
                Renderer.SetBlendState(GL.BlendNormal);
                Renderer.End();
            };

            var chain = new FilterProgram();

            //add the first filter, encompassing output from the emulator core
            chain.AddFilter(fInput, "input");

            //if a non-zero padding is required, add a filter to allow for that
            //note, we have two sources of padding right now.. one can come from the videoprovider and one from the user.
            //we're combining these now and just using black, for sake of being lean, despite the discussion below:
            //keep in mind, the videoprovider design in principle might call for another color.
            //we havent really been using this very hard, but users will probably want black there (they could fill it to another color if needed tho)
            var padding = CalculateCompleteContentPadding(true, true);

            if (padding.Vertical != 0 || padding.Horizontal != 0)
            {
                //TODO - add another filter just for this, its cumbersome to use final presentation... I think. but maybe theres enough similarities to justify it.
                Size size = chain_insize;
                size.Width  += padding.Horizontal;
                size.Height += padding.Vertical;
                EmuHawk.Filters.FinalPresentation fPadding = new EmuHawk.Filters.FinalPresentation(size);
                chain.AddFilter(fPadding, "padding");
                fPadding.GuiRenderer    = Renderer;
                fPadding.GL             = GL;
                fPadding.Config_PadOnly = true;
                fPadding.Padding        = padding;
            }

            if (Global.Config.DispPrescale != 1)
            {
                EmuHawk.Filters.PrescaleFilter fPrescale = new EmuHawk.Filters.PrescaleFilter()
                {
                    Scale = Global.Config.DispPrescale
                };
                chain.AddFilter(fPrescale, "user_prescale");
            }

            //AutoPrescale makes no sense for a None final filter
            if (Global.Config.DispAutoPrescale && Global.Config.DispFinalFilter != (int)EmuHawk.Filters.FinalPresentation.eFilterOption.None)
            {
                var apf = new EmuHawk.Filters.AutoPrescaleFilter();
                chain.AddFilter(apf, "auto_prescale");
            }

            //choose final filter
            EmuHawk.Filters.FinalPresentation.eFilterOption finalFilter = EmuHawk.Filters.FinalPresentation.eFilterOption.None;
            fPresent.FilterOption = finalFilter;

            //add final presentation
            chain.AddFilter(fPresent, "presentation");

            return(chain);
        }