~ Changed Pipelines

(Default2DPipeline: Has Lights, Post-ProcessingEffects, etc.)
(Basic2DPipeline: Simple Color and Texture stuff, thats it)
This commit is contained in:
Michel Fedde 2020-12-19 18:31:44 +01:00
parent 1ed03fec3f
commit 5d4b360b05
23 changed files with 243 additions and 59 deletions

View file

@ -42,15 +42,14 @@ namespace SM.Base.Drawing
CleanUp();
GL.UseProgram(0);
context.ShaderArguments.Clear();
}
/// <summary>
/// Draws the context.
/// </summary>
/// <param name="context"></param>
protected virtual void DrawProcess(DrawContext context)
{
}
protected abstract void DrawProcess(DrawContext context);
}
}

View file

@ -12,7 +12,7 @@ namespace SM.Base.Objects
/// <summary>
/// While initializing, it will add the <see cref="Color" /> to the data index.
/// </summary>
protected Mesh()
public Mesh()
{
Attributes.Add(3, "color", Color);
}

View file

@ -24,7 +24,7 @@ namespace SM.Base.PostProcess
Init();
}
public virtual void Draw(Framebuffer main)
public virtual void Draw(Framebuffer main, Framebuffer target)
{
}

View file

@ -53,12 +53,11 @@ namespace SM.Base.PostProcess
Uniforms["MVP"].SetMatrix4(PostProcessEffect.Mvp);
Uniforms["ModelMatrix"].SetMatrix4(PostProcessEffect.Model);
Uniforms["renderedTexture"].SetTexture(color, 0);
Uniforms["renderedTexture"].SetTexture(color);
GL.DrawArrays(PrimitiveType.Quads, 0, 4);
GL.BindTexture(TextureTarget.Texture2D, 0);
GL.BindVertexArray(0);
CleanUp();
GL.UseProgram(0);
}
@ -74,14 +73,13 @@ namespace SM.Base.PostProcess
Uniforms["MVP"].SetMatrix4(PostProcessEffect.Mvp);
Uniforms["ModelMatrix"].SetMatrix4(PostProcessEffect.Model);
Uniforms["renderedTexture"].SetTexture(color, 0);
Uniforms["renderedTexture"].SetTexture(color);
setUniformAction(Uniforms);
GL.DrawArrays(PrimitiveType.Quads, 0, 4);
GL.BindTexture(TextureTarget.Texture2D, 0);
GL.BindVertexArray(0);
CleanUp();
GL.UseProgram(0);
}
}

View file

@ -1,6 +1,7 @@
#region usings
using System.Collections.Generic;
using System.Dynamic;
using OpenTK;
using SM.Base.Drawing;
using SM.Base.Scene;
@ -71,6 +72,11 @@ namespace SM.Base.Contexts
/// </summary>
public object LastPassthough;
/// <summary>
/// Arguments for shaders
/// </summary>
public IDictionary<string, object> ShaderArguments;
/// <summary>
/// Returns the appropriate shader.
/// <para>

View file

@ -268,6 +268,7 @@ namespace SM.Base
new Instance
{ModelMatrix = Matrix4.Identity, TexturePosition = Vector2.Zero, TextureScale = Vector2.One}
},
ShaderArguments = new Dictionary<string, object>(),
Mesh = Plate.Object,
ForceViewport = ForceViewportCamera,
WorldScale = _worldScale,

View file

@ -88,9 +88,9 @@ namespace SM.Base
{
}
protected Framebuffer CreateWindowFramebuffer()
public static Framebuffer CreateWindowFramebuffer()
{
Framebuffer framebuffer = new Framebuffer(window: _window);
Framebuffer framebuffer = new Framebuffer(window: SMRenderer.CurrentWindow);
framebuffer.Append("color", 0);
framebuffer.Compile();
return framebuffer;