More Summaries

This commit is contained in:
Nineto Nine 2021-09-26 21:33:58 +02:00
parent 9b52d401e7
commit 2c0517ca48
4 changed files with 43 additions and 0 deletions

View file

@ -28,6 +28,10 @@ namespace SM.OGL.Framebuffer
/// </summary>
public Framebuffer ConnectedFramebuffer { get; private set; }
/// <summary>
/// Can contains the size this attachment want to be.
/// <para>If set, it will ignore the size from the framebuffer.</para>
/// </summary>
public Vector2? AttachmentSize = null;
/// <summary>
@ -56,6 +60,7 @@ namespace SM.OGL.Framebuffer
/// Creates a attachment with a specific id.
/// </summary>
/// <param name="attachmentId"></param>
/// <param name="size"></param>
public ColorAttachment(int attachmentId, Vector2? size = null) : this(attachmentId, PixelInformation.RGBA_LDR, size)
{ }
@ -64,6 +69,7 @@ namespace SM.OGL.Framebuffer
/// </summary>
/// <param name="attachmentID"></param>
/// <param name="pixelInformation"></param>
/// <param name="size"></param>
/// <param name="multisamples"></param>
public ColorAttachment(int attachmentID, PixelInformation pixelInformation, Vector2? size = null, int multisamples = 0)
{

View file

@ -50,8 +50,14 @@ namespace SM.OGL.Framebuffer
/// </summary>
public Vector2 Size { get; private set; }
/// <summary>
/// Says what value the dafault for the "applyViewport"-value in <see cref="Framebuffer.Activate(bool?)"/>.
/// </summary>
public bool DefaultApplyViewport { get; set; } = true;
/// <summary>
/// Stores the first color attachment added.
/// </summary>
public ColorAttachment FirstColorAttachment { get; private set; }
/// <summary>
@ -171,6 +177,12 @@ namespace SM.OGL.Framebuffer
/// Appends a color attachment.
/// </summary>
public void Append(string key, int pos) => Append(key, new ColorAttachment(pos, null));
/// <summary>
/// Appends a color attachment.
/// </summary>
/// <param name="key"></param>
/// <param name="size"></param>
/// <param name="pos"></param>
public void Append(string key, Vector2 size, int pos) => Append(key, new ColorAttachment(pos, size));
/// <summary>
/// Appends a color attachment.
@ -203,6 +215,7 @@ namespace SM.OGL.Framebuffer
/// Activates the framebuffer for the specific target framebuffer and without clearing.
/// </summary>
/// <param name="target"></param>
/// <param name="applyViewport"></param>
public void Activate(FramebufferTarget target, bool? applyViewport = null)
{
Activate(target, ClearBufferMask.None, applyViewport);
@ -212,6 +225,7 @@ namespace SM.OGL.Framebuffer
/// Activates the framebuffer while clearing the specified buffer.
/// </summary>
/// <param name="clearMask"></param>
/// <param name="applyViewport"></param>
public void Activate(ClearBufferMask clearMask, bool? applyViewport = null)
{
Activate(FramebufferTarget.Framebuffer, clearMask, applyViewport);
@ -222,6 +236,7 @@ namespace SM.OGL.Framebuffer
/// </summary>
/// <param name="target"></param>
/// <param name="clear"></param>
/// <param name="applyViewport"></param>
public void Activate(FramebufferTarget target, ClearBufferMask clear, bool? applyViewport = null)
{
switch (target)

View file

@ -81,5 +81,16 @@ namespace SM.OGL.Framebuffer
return false;
}
/// <inheritdoc/>
public override int GetHashCode()
{
int hashCode = -1803239493;
hashCode = hashCode * -1521134295 + Storage.GetHashCode();
hashCode = hashCode * -1521134295 + FramebufferAttachment.GetHashCode();
hashCode = hashCode * -1521134295 + Multisample.GetHashCode();
hashCode = hashCode * -1521134295 + ID.GetHashCode();
return hashCode;
}
}
}

View file

@ -53,7 +53,14 @@ namespace SM.OGL.Texture
/// </summary>
public virtual int Height { get; protected set; }
/// <summary>
/// Returns the size of the texture.
/// </summary>
public Vector2 Size => new Vector2(Width, Height);
/// <summary>
/// Returns the texel size of the texture.
/// <para>Returns: 1 / Size</para>
/// </summary>
public Vector2 TexelSize => new Vector2(1f / Width, 1f / Height);
/// <inheritdoc />
@ -63,6 +70,10 @@ namespace SM.OGL.Texture
base.Dispose();
}
/// <summary>
/// Generates a basic texture, that applies all settings from the <see cref="TextureBase"/>-class.
/// </summary>
/// <param name="size"></param>
protected void GenerateBaseTexture(Vector2 size)
{
Width = (int)size.X;