Holidays 12.10. -> 25.10.2020
~ Moved code around in files. SM.Base: + PostProcessing-system + OnInitialization() for Scenes. + Shader-Extensions + Added option to not react while unfocused to the window. + Added Screenshots to the window. + Connected the log system to the SM.OGL-action system. ~ Replaced IShader with abstract MaterialShader. ~ When a log compression folder doesn't exist, it will create one. SM.OGL: + Added support for UniformArrays + Added ShaderPreProcessing + Added Shader Extensions. + Added Debug actions. + SM.OGL settings ~ Framebuffer Size is automaticly changed, when the window and scale is set. SM2D: + Added easy shader drawing.
This commit is contained in:
parent
2c00dbd31a
commit
03b3942732
102 changed files with 2683 additions and 1398 deletions
|
|
@ -1,15 +1,31 @@
|
|||
using System;
|
||||
#region usings
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
using Buffer = OpenTK.Graphics.OpenGL4.Buffer;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace SM.OGL.Mesh
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains information for meshes
|
||||
/// Contains information for meshes
|
||||
/// </summary>
|
||||
public abstract class GenericMesh : GLObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Generates the AttribDataIndex
|
||||
/// </summary>
|
||||
protected GenericMesh()
|
||||
{
|
||||
AttribDataIndex = new Dictionary<int, VBO>
|
||||
{
|
||||
{0, Vertex},
|
||||
{1, UVs},
|
||||
{2, Normals}
|
||||
};
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override bool AutoCompile { get; } = true;
|
||||
|
||||
|
|
@ -17,61 +33,50 @@ namespace SM.OGL.Mesh
|
|||
public override ObjectLabelIdentifier TypeIdentifier { get; } = ObjectLabelIdentifier.VertexArray;
|
||||
|
||||
/// <summary>
|
||||
/// The primitive type, that determinants how the mesh is drawn.
|
||||
/// <para>Default: Triangles</para>
|
||||
/// The primitive type, that determinants how the mesh is drawn.
|
||||
/// <para>Default: Triangles</para>
|
||||
/// </summary>
|
||||
public virtual PrimitiveType PrimitiveType { get; } = PrimitiveType.Triangles;
|
||||
|
||||
/// <summary>
|
||||
/// Contains the vertices for the mesh.
|
||||
/// Contains the vertices for the mesh.
|
||||
/// </summary>
|
||||
public virtual VBO Vertex { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Contains the texture coords for the mesh.
|
||||
/// Contains the texture coords for the mesh.
|
||||
/// </summary>
|
||||
public virtual VBO UVs { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Contains the normals for the mesh.
|
||||
/// Contains the normals for the mesh.
|
||||
/// </summary>
|
||||
public virtual VBO Normals { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents the bounding box.
|
||||
/// Represents the bounding box.
|
||||
/// </summary>
|
||||
public virtual BoundingBox BoundingBox { get; } = new BoundingBox();
|
||||
|
||||
/// <summary>
|
||||
/// Connects the different buffer objects with ids.
|
||||
/// Connects the different buffer objects with ids.
|
||||
/// </summary>
|
||||
public Dictionary<int, VBO> AttribDataIndex { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Stores indices for a more performance friendly method to draw objects.
|
||||
/// Stores indices for a more performance friendly method to draw objects.
|
||||
/// </summary>
|
||||
public virtual int[] Indices { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Generates the AttribDataIndex
|
||||
/// </summary>
|
||||
protected GenericMesh()
|
||||
{
|
||||
AttribDataIndex = new Dictionary<int, VBO>()
|
||||
{
|
||||
{0, Vertex},
|
||||
{1, UVs},
|
||||
{2, Normals},
|
||||
};
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Compile()
|
||||
{
|
||||
_id = GL.GenVertexArray();
|
||||
GL.BindVertexArray(_id);
|
||||
|
||||
|
||||
if (AttribDataIndex == null) throw new Exception("[Critical] The model requires a attribute data index.");
|
||||
|
||||
foreach (KeyValuePair<int, VBO> kvp in AttribDataIndex) kvp.Value?.BindBuffer(kvp.Key);
|
||||
foreach (var kvp in AttribDataIndex) kvp.Value?.BindBuffer(kvp.Key);
|
||||
|
||||
GL.BindVertexArray(0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue