Exemplo n.º 1
0
        public override void Run()
        {
            var shader = RSC.Shaders[RSI];

            shader.Bind();

            //apply all parameters to this shader.. even if it was meant for other shaders. kind of lame.
            if (Parameters != null)
            {
                foreach (var kvp in Parameters)
                {
                    if (kvp.Value is float)
                    {
                        shader.Pipeline[kvp.Key].Set((float)kvp.Value);
                    }
                }
            }

            var input = InputTexture;

            if (SP.InputFilterLinear)
            {
                InputTexture.SetFilterLinear();
            }
            else
            {
                InputTexture.SetFilterNearest();
            }
            RSC.Shaders[RSI].Run(input, input.Size, OutputSize, InputTexture.IsUpsideDown);

            //maintain invariant.. i think.
            InputTexture.SetFilterNearest();
        }
Exemplo n.º 2
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();
        }
Exemplo n.º 3
0
        public override void Run()
        {
            var shader = _rsc.Shaders[_rsi];

            shader.Bind();

            // apply all parameters to this shader.. even if it was meant for other shaders. kind of lame.
            if (Parameters != null)
            {
                foreach (var(k, v) in Parameters)
                {
                    if (v is float value)
                    {
                        shader.Pipeline[k].Set(value);
                    }
                }
            }

            var input = InputTexture;

            if (_sp.InputFilterLinear)
            {
                InputTexture.SetFilterLinear();
            }
            else
            {
                InputTexture.SetFilterNearest();
            }

            _rsc.Shaders[_rsi].Run(input, input.Size, _outputSize, InputTexture.IsUpsideDown);

            // maintain invariant.. i think.
            InputTexture.SetFilterNearest();
        }
Exemplo n.º 4
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();
        }
Exemplo 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();
        }