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(); }
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(); }
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(); }
/// <summary> /// Gets the animation from the input texture and stores it in a texture array to be retreived by GetCurrentTexture() /// </summary> /// <param name="x">X coordinate of where the animation should start</param> /// <param name="y">Y coordinate of where the animation should start</param> /// <param name="width">Width of the sprite</param> /// <param name="height">Height of the sprite</param> /// <param name="collumnAmount">Amount of collumns the animation has</param> /// <param name="rowAmount">Amount of rows the animation has</param> public void GetTextures(int x, int y, int width, int height, int collumnAmount, int rowAmount) { Texture2D[] returnArray = new Texture2D[collumnAmount * rowAmount]; Texture2D part = new Texture2D(InputTexture.GraphicsDevice, width, height); Rectangle sourceRect = Rectangle.Empty; Color[] data = new Color[width * height]; for (int i = 0; i < rowAmount; i++) { for (int j = 0; j < collumnAmount; j++) { part = new Texture2D(InputTexture.GraphicsDevice, width, height); sourceRect = new Rectangle(j * width + x, i * height + y, width, height); InputTexture.GetData(0, sourceRect, data, 0, data.Length); part.SetData(data); part.Tag = i + j; returnArray[i + j] = part; } } TextureArray = returnArray; if (collumnAmount * rowAmount < _imageCounter) { _imageCounter = 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(); }
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(); }
///<summary> /// Set an input local texture. An empty string clears the input. ///</summary> ///<param name="id">Input to set. Must be in 0..Config.MaxTextureLayers-1</param> ///<param name="name">Which texture to bind to this input. An empty string clears the input.</param> /// <param name="mrtIndex"></param> ///<remarks> /// Note applies when CompositorPassType is RenderQuad ///</remarks> public void SetInput( int id, string name, int mrtIndex ) { inputs[ id ] = new InputTexture( name, mrtIndex ); }