05.01.2021

+ Bloom effect
+ PixelInformation
+ Many Summaries
+ Add-methods for CVectors
+ Exposure-Field in GenericCamera for HDR.

~ ColorAttachments now can have PixelInformation
~ Transformed MeshAttributes to a own class
~ Fixed the non-applying of transformations at texts
~ Added more information to the context
~ Improved Pipeline-Process.
~ Changed how Uniform takes arrays

- Light system
This commit is contained in:
Michel Fedde 2021-01-06 17:04:15 +01:00
parent 9b917ac181
commit 4c18127c88
52 changed files with 697 additions and 373 deletions

View file

@ -8,31 +8,64 @@ using SM.OGL.Texture;
namespace SM.OGL.Framebuffer
{
/// <summary>
/// Represents a Framebuffer-Color Attachment.
/// <para>Can be use like a texture.</para>
/// </summary>
public class ColorAttachment : TextureBase
{
public ColorAttachment(int attachmentId)
/// <summary>
/// Creates a attachment with a specific id.
/// </summary>
/// <param name="attachmentId"></param>
public ColorAttachment(int attachmentId) : this(attachmentId, PixelInformation.RGBA_LDR)
{ }
public ColorAttachment(int attachmentID, PixelInformation pixelInformation)
{
AttachmentID = attachmentId;
AttachmentID = attachmentID;
PixelInformation = pixelInformation;
}
/// <summary>
/// The ID the attachment was given.
/// </summary>
public int AttachmentID { get; }
/// <summary>
/// Returns the <see cref="OpenTK.Graphics.OpenGL4.FramebufferAttachment"/> of this ColorAttachment.
/// </summary>
public FramebufferAttachment FramebufferAttachment => FramebufferAttachment.ColorAttachment0 + AttachmentID;
/// <summary>
/// Returns the <see cref="OpenTK.Graphics.OpenGL4.DrawBufferMode"/> of this ColorAttachment.
/// </summary>
public DrawBufferMode DrawBufferMode => DrawBufferMode.ColorAttachment0 + AttachmentID;
/// <summary>
/// Returns the <see cref="OpenTK.Graphics.OpenGL4.ReadBufferMode"/> of this ColorAttachment.
/// </summary>
public ReadBufferMode ReadBufferMode => ReadBufferMode.ColorAttachment0 + AttachmentID;
/// <summary>
/// Returns the <see cref="OpenTK.Graphics.OpenGL4.DrawBuffersEnum"/> of this ColorAttachment.
/// </summary>
public DrawBuffersEnum DrawBuffersEnum => DrawBuffersEnum.ColorAttachment0 + AttachmentID;
/// <summary>
/// Generates the attachment.
/// </summary>
/// <param name="f"></param>
public void Generate(Framebuffer f)
{
_id = GL.GenTexture();
GL.BindTexture(TextureTarget.Texture2D, _id);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba8,
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInformation.InternalFormat,
(int) f.Size.X, (int) f.Size.Y,
0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
0, PixelInformation.Format, PixelInformation.DataType, IntPtr.Zero);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter,
(int) TextureMinFilter.Linear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter,
(int) TextureMinFilter.Linear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS,
(int) TextureParameterName.ClampToEdge);