This commit is contained in:
Michel Fedde 2021-03-24 17:30:04 +01:00
commit 3bc90dd83b
14 changed files with 190 additions and 49 deletions

View file

@ -75,29 +75,57 @@ namespace SM.Base.Window
/// </summary>
public virtual void Resize()
{
if (Framebuffers == null) return;
foreach (var framebuffer in Framebuffers)
framebuffer.Dispose();
Recompile();
}
Thread.Sleep(50);
/// <summary>
/// Compiles the framebuffers.
/// </summary>
public void Compile()
{
foreach (var framebuffer in Framebuffers)
framebuffer.Compile();
}
/// <summary>
/// Recompiles the pipeline.
/// </summary>
public void Recompile()
{
if (Framebuffers == null) return;
Dispose();
Thread.Sleep(100);
Compile();
}
/// <summary>
/// Disposes unmanaged resources like Framebuffers.
/// </summary>
public void Dispose()
{
foreach (var framebuffer in Framebuffers)
framebuffer.Dispose();
}
/// <summary>
/// This creates a finished setup for a framebuffer.
/// </summary>
/// <param name="multisamples"></param>
/// <returns></returns>
public Framebuffer CreateWindowFramebuffer(int multisamples = 0)
public Framebuffer CreateWindowFramebuffer(int multisamples = 0, PixelInformation? pixelInformation = null, bool depth = true)
{
Framebuffer framebuffer = new Framebuffer(ConnectedWindow);
framebuffer.Append("color", new ColorAttachment(0, PixelInformation.RGBA_LDR, multisamples));
RenderbufferAttachment depthAttach = RenderbufferAttachment.Depth;
depthAttach.Multisample = multisamples;
framebuffer.AppendRenderbuffer(depthAttach);
framebuffer.Append("color", new ColorAttachment(0, pixelInformation.GetValueOrDefault(PixelInformation.RGBA_LDR), multisamples));
if (depth)
{
RenderbufferAttachment depthAttach = RenderbufferAttachment.Depth;
depthAttach.Multisample = multisamples;
framebuffer.AppendRenderbuffer(depthAttach);
}
return framebuffer;
}

View file

@ -13,6 +13,7 @@ using SM.Base.Shaders.Extensions;
using SM.Base.Time;
using SM.Base.Utility;
using SM.OGL;
using SM.OGL.Framebuffer;
using Keyboard = SM.Base.Controls.Keyboard;
using Mouse = SM.Base.Controls.Mouse;
@ -26,6 +27,7 @@ namespace SM.Base.Window
{
GLSystem.INIT_SYSTEM();
GLSettings.ShaderPreProcessing = true;
Framebuffer.ScreenWindow = window;
var args = Environment.GetCommandLineArgs();
if (args.Contains("--advDebugging"))