Added missing summeries #1

This commit is contained in:
Michel Fedde 2021-03-17 17:09:59 +01:00
parent 03d99ea28e
commit 8665b5b709
104 changed files with 1165 additions and 821 deletions

View file

@ -38,6 +38,9 @@ namespace SM.OGL.Framebuffer
/// </summary>
public DrawBuffersEnum DrawBuffersEnum => DrawBuffersEnum.ColorAttachment0 + AttachmentID;
/// <summary>
/// Returns true, if multisamples are above 0.
/// </summary>
public bool IsMultisampled => _multisamples > 0;
/// <summary>

View file

@ -14,7 +14,7 @@ namespace SM.OGL.Framebuffer
/// </summary>
public class Framebuffer : GLObject
{
protected override bool AutoCompile { get; } = true;
protected override bool AutoCompile { get; set; } = true;
/// <summary>
/// Represents the screen buffer.
@ -22,11 +22,9 @@ namespace SM.OGL.Framebuffer
public static readonly Framebuffer Screen = new Framebuffer
{
_id = 0,
_canBeCompiled = false
CanCompile = false,
};
private bool _canBeCompiled = true;
private IFramebufferWindow _window;
private float _windowScale;
@ -77,8 +75,6 @@ namespace SM.OGL.Framebuffer
/// <inheritdoc />
public override void Compile()
{
if (!_canBeCompiled) return;
if (_window != null) Size = new Vector2(_window.Width * _windowScale, _window.Height * _windowScale);
base.Compile();
@ -181,7 +177,7 @@ namespace SM.OGL.Framebuffer
{
Framebuffer buffer = new Framebuffer()
{
_canBeCompiled = false,
CanCompile = false,
ReportAsNotCompiled = true
};
switch (target)

View file

@ -1,5 +1,8 @@
namespace SM.OGL.Framebuffer
{
/// <summary>
/// A interface, so the framebuffer system can react to changes of windows.
/// </summary>
public interface IFramebufferWindow
{
int Width { get; }

View file

@ -2,15 +2,33 @@
namespace SM.OGL.Framebuffer
{
/// <summary>
/// Describes a renderbuffer attachment.
/// </summary>
public struct RenderbufferAttachment
{
/// <summary>
/// Preset for the depthbuffer attachment.
/// </summary>
public static readonly RenderbufferAttachment Depth = new RenderbufferAttachment(RenderbufferStorage.Depth24Stencil8, FramebufferAttachment.DepthStencilAttachment);
/// <summary>
/// Storage describes the internal format for the renderbuffer.
/// </summary>
public RenderbufferStorage Storage;
/// <summary>
/// FramebufferAttachment describes the attachment for the framebuffer.
/// </summary>
public FramebufferAttachment FramebufferAttachment;
/// <summary>
/// This contains the amount of multisampling for the attachment.
/// </summary>
public int Multisample;
/// <summary>
/// Constructor
/// </summary>
public RenderbufferAttachment(RenderbufferStorage storage, FramebufferAttachment framebufferAttachment, int multisample = 0)
{
Storage = storage;
@ -18,18 +36,23 @@ namespace SM.OGL.Framebuffer
Multisample = multisample;
}
/// <summary>
/// This generates the renderbuffer for the framebuffer to add.
/// </summary>
/// <param name="f">The framebuffer</param>
/// <returns>The ID of the renderbuffer.</returns>
public int Generate(Framebuffer f)
{
int rbo = GL.GenRenderbuffer();
int rb = GL.GenRenderbuffer();
GL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, rbo);
GL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, rb);
if (Multisample != 0)
GL.RenderbufferStorageMultisample(RenderbufferTarget.Renderbuffer, Multisample, Storage, (int)f.Size.X, (int)f.Size.Y);
else
GL.RenderbufferStorage(RenderbufferTarget.Renderbuffer, Storage, (int)f.Size.X, (int)f.Size.Y);
GL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, 0);
return rbo;
return rb;
}
}
}