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:
Michel Fedde 2020-10-24 15:10:36 +02:00
parent 2c00dbd31a
commit 03b3942732
102 changed files with 2683 additions and 1398 deletions

View file

@ -1,146 +1,145 @@
using System;
using System.Configuration.Assemblies;
#region usings
using System.Diagnostics;
using OpenTK;
#endregion
namespace SM.Base.Types
{
/// <summary>
/// Represents a base vector-class
/// Represents a base vector-class
/// </summary>
public abstract class CVector
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private float _x = default;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private float _y = default;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private float _z = default;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private float _w = default;
/// <summary>
/// The X-component.
/// </summary>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
protected float _X
{
get => _x;
set => _x = value;
}
/// <summary>
/// The Y-component
/// </summary>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
protected float _Y
{
get => _y;
set => _y = value;
}
/// <summary>
/// The Z-component.
/// </summary>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
protected float _Z
{
get => _z;
set => _z = value;
}
/// <summary>
/// The W-component.
/// </summary>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
protected float _W
{
get => _w;
set => _w = value;
}
/// <summary>
/// Creates a vector by setting every component to the same value.
/// Creates a vector by setting every component to the same value.
/// </summary>
protected CVector(float uniform) : this(uniform, uniform, uniform, uniform)
{ }
{
}
/// <summary>
/// Creates a vector by setting values for each component.
/// Creates a vector by setting values for each component.
/// </summary>
protected CVector(float x, float y, float z, float w)
{
_x = x;
_y = y;
_z = z;
_w = w;
_X = x;
_Y = y;
_Z = z;
_W = w;
}
/// <summary>
/// The X-component.
/// </summary>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
protected float _X { get; set; }
/// <summary>
/// The Y-component
/// </summary>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
protected float _Y { get; set; }
/// <summary>
/// The Z-component.
/// </summary>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
protected float _Z { get; set; }
/// <summary>
/// The W-component.
/// </summary>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
protected float _W { get; set; }
/// <summary>
/// Transforms a <see cref="CVector" /> to a <see cref="OpenTK.Vector2" />
/// </summary>
public static implicit operator Vector2(CVector v) => new Vector2(v._X, v._Y);
/// <summary>
/// Transforms a <see cref="CVector" /> to a <see cref="OpenTK.Vector3" />
/// </summary>
public static implicit operator Vector3(CVector v) => new Vector3(v._X, v._Y, v._Z);
/// <summary>
/// Transforms a <see cref="CVector" /> to a <see cref="OpenTK.Vector4" />
/// </summary>
public static implicit operator Vector4(CVector v) => new Vector4(v._X, v._Y, v._Z, v._W);
#region Set
/// <summary>
/// Sets the X and Y-component.
/// Sets the X and Y-component.
/// </summary>
protected void Set(float x, float y)
{
_X = x;
_Y = y;
}
/// <summary>
/// Sets the X and Y-component from a <see cref="OpenTK.Vector2"/>
/// Sets the X and Y-component from a <see cref="OpenTK.Vector2" />
/// </summary>
protected void Set(OpenTK.Vector2 vector)
protected void Set(Vector2 vector)
{
Set(vector.X, vector.Y);
}
/// <summary>
/// Sets the X, Y and Z-component.
/// Sets the X, Y and Z-component.
/// </summary>
protected void Set(float x, float y, float z)
{
Set(x,y);
Set(x, y);
_Z = z;
}
/// <summary>
/// Sets the X, Y and Z-component from a <see cref="OpenTK.Vector3"/>.
/// Sets the X, Y and Z-component from a <see cref="OpenTK.Vector3" />.
/// </summary>
/// <param name="vector"></param>
protected void Set(OpenTK.Vector3 vector)
protected void Set(Vector3 vector)
{
Set(vector.X, vector.Y, vector.Z);
}
/// <summary>
/// Sets the X, Y, Z and W-component.
/// Sets the X, Y, Z and W-component.
/// </summary>
protected void Set(float x, float y, float z, float w)
{
Set(x,y,z);
Set(x, y, z);
_W = w;
}
/// <summary>
/// Sets the X, Y, Z and W-component from a <see cref="OpenTK.Vector4"/>.
/// Sets the X, Y, Z and W-component from a <see cref="OpenTK.Vector4" />.
/// </summary>
protected void Set(OpenTK.Vector4 vector)
protected void Set(Vector4 vector)
{
Set(vector.X, vector.Y, vector.Z, vector.W);
}
#endregion
#region Add
/// <summary>
/// Adds a <see cref="OpenTK.Vector2"/> to the X and Y-component.
/// Adds a <see cref="OpenTK.Vector2" /> to the X and Y-component.
/// </summary>
protected void Add(OpenTK.Vector2 vector)
protected void Add(Vector2 vector)
{
_X += vector.X;
_Y += vector.Y;
}
/// <summary>
/// Adds a <see cref="OpenTK.Vector3"/> to the X, Y and Z-component.
/// Adds a <see cref="OpenTK.Vector3" /> to the X, Y and Z-component.
/// </summary>
protected void Add(OpenTK.Vector3 vector)
protected void Add(Vector3 vector)
{
_X += vector.X;
_Y += vector.Y;
@ -148,9 +147,9 @@ namespace SM.Base.Types
}
/// <summary>
/// Adds a <see cref="OpenTK.Vector4"/> to the X, Y, Z and W-component.
/// Adds a <see cref="OpenTK.Vector4" /> to the X, Y, Z and W-component.
/// </summary>
protected void Add(OpenTK.Vector4 vector)
protected void Add(Vector4 vector)
{
_X += vector.X;
_Y += vector.Y;
@ -159,18 +158,5 @@ namespace SM.Base.Types
}
#endregion
/// <summary>
/// Transforms a <see cref="CVector"/> to a <see cref="OpenTK.Vector2"/>
/// </summary>
public static implicit operator OpenTK.Vector2(CVector v) => new OpenTK.Vector2(v._x, v._y);
/// <summary>
/// Transforms a <see cref="CVector"/> to a <see cref="OpenTK.Vector3"/>
/// </summary>
public static implicit operator OpenTK.Vector3(CVector v) => new OpenTK.Vector3(v._x, v._y, v._z);
/// <summary>
/// Transforms a <see cref="CVector"/> to a <see cref="OpenTK.Vector4"/>
/// </summary>
public static implicit operator OpenTK.Vector4(CVector v) => new OpenTK.Vector4(v._x, v._y, v._z, v._w);
}
}

View file

@ -1,20 +1,47 @@
namespace SM.Base.Types
#region usings
using OpenTK;
#endregion
namespace SM.Base.Types
{
/// <summary>
/// Represents a vector of two floats.
/// Represents a vector of two floats.
/// </summary>
public class CVector2 : CVector
{
/// <inheritdoc />
public CVector2() : this(0)
{
}
/// <inheritdoc />
public CVector2(float uniform) : base(uniform)
{
}
/// <inheritdoc />
public CVector2(float x, float y) : base(x, y, default, default)
{
}
/// <inheritdoc />
protected CVector2(float x, float y, float z, float w) : base(x, y, z, w)
{
}
/// <summary>
/// X-component
/// X-component
/// </summary>
public float X
{
get => _X;
set => _X = value;
}
/// <summary>
/// Y-component
/// Y-component
/// </summary>
public float Y
{
@ -22,35 +49,30 @@
set => _Y = value;
}
/// <inheritdoc />
public CVector2() : this(0)
{}
/// <inheritdoc />
public CVector2(float uniform) : base(uniform)
/// <summary>
/// Sets the X and Y-component.
/// </summary>
public new void Set(float x, float y)
{
base.Set(x, y);
}
/// <inheritdoc />
public CVector2(float x, float y) : base(x,y, default, default) {}
/// <inheritdoc />
protected CVector2(float x, float y, float z, float w) : base(x, y, z, w) {}
/// <summary>
/// Sets the X and Y-component from a <see cref="OpenTK.Vector2" />
/// </summary>
public new void Set(Vector2 vector)
{
base.Set(vector);
}
/// <summary>
/// Sets the X and Y-component.
/// Adds a <see cref="OpenTK.Vector2" /> to the X and Y-component.
/// </summary>
public new void Set(float x, float y) => base.Set(x, y);
public new void Add(Vector2 vector)
{
base.Add(vector);
}
/// <summary>
/// Sets the X and Y-component from a <see cref="OpenTK.Vector2"/>
/// </summary>
public new void Set(OpenTK.Vector2 vector) => base.Set(vector);
/// <summary>
/// Adds a <see cref="OpenTK.Vector2"/> to the X and Y-component.
/// </summary>
public new void Add(OpenTK.Vector2 vector) => base.Add(vector);
public static implicit operator CVector2(Vector2 v) => new CVector2(v.X,v.Y);
}
}

View file

@ -1,16 +1,33 @@
using System.Drawing.Design;
using System.Runtime.InteropServices;
#region usings
using OpenTK;
#endregion
namespace SM.Base.Types
{
/// <summary>
/// Represents a Vector of three floats.
/// Represents a Vector of three floats.
/// </summary>
public class CVector3 : CVector2
{
/// <inheritdoc />
public CVector3(float uniform) : base(uniform)
{
}
/// <inheritdoc />
public CVector3(float x, float y, float z) : base(x, y, z, default)
{
}
/// <inheritdoc />
protected CVector3(float x, float y, float z, float w) : base(x, y, z, w)
{
}
/// <summary>
/// Z-component
/// Z-component
/// </summary>
public float Z
{
@ -18,29 +35,28 @@ namespace SM.Base.Types
set => _Z = value;
}
/// <inheritdoc />
public CVector3(float uniform) : base(uniform)
{ }
/// <inheritdoc />
public CVector3(float x, float y, float z) : base(x, y, z, default)
{ }
/// <inheritdoc />
protected CVector3(float x, float y, float z, float w) : base(x, y, z, w) { }
/// <summary>
/// Sets the X, Y and Z-component.
/// Sets the X, Y and Z-component.
/// </summary>
public new void Set(float x, float y, float z) => base.Set(x, y, z);
/// <summary>
/// Sets the X, Y and Z-component from a <see cref="OpenTK.Vector3"/>.
/// </summary>
public new void Set(Vector3 vector) => base.Set(vector);
public new void Set(float x, float y, float z)
{
base.Set(x, y, z);
}
/// <summary>
/// Adds a <see cref="OpenTK.Vector3"/> to the X, Y and Z-component.
/// Sets the X, Y and Z-component from a <see cref="OpenTK.Vector3" />.
/// </summary>
public new void Add(Vector3 vector) => base.Add(vector);
public new void Set(Vector3 vector)
{
base.Set(vector);
}
/// <summary>
/// Adds a <see cref="OpenTK.Vector3" /> to the X, Y and Z-component.
/// </summary>
public new void Add(Vector3 vector)
{
base.Add(vector);
}
}
}

View file

@ -1,21 +1,16 @@
using OpenTK;
#region usings
using OpenTK;
#endregion
namespace SM.Base.Types
{
/// <summary>
/// Represents a vector of four floats.
/// Represents a vector of four floats.
/// </summary>
public class CVector4 : CVector3
{
/// <summary>
/// W-component
/// </summary>
public float W
{
get => _W;
set => _W = value;
}
/// <inheritdoc />
public CVector4(float uniform) : base(uniform)
{
@ -27,16 +22,36 @@ namespace SM.Base.Types
}
/// <summary>
/// Sets the X, Y, Z and W-component.
/// W-component
/// </summary>
public new void Set(float x, float y, float z, float w) => base.Set(x, y, z, w);
public float W
{
get => _W;
set => _W = value;
}
/// <summary>
/// Sets the X, Y, Z and W-component from a <see cref="OpenTK.Vector4"/>.
/// Sets the X, Y, Z and W-component.
/// </summary>
public new void Set(Vector4 vector) => base.Set(vector);
public new void Set(float x, float y, float z, float w)
{
base.Set(x, y, z, w);
}
/// <summary>
/// Adds a <see cref="OpenTK.Vector4"/> to the X, Y, Z and W-component.
/// Sets the X, Y, Z and W-component from a <see cref="OpenTK.Vector4" />.
/// </summary>
public new void Add(Vector4 vector) => base.Add(vector);
public new void Set(Vector4 vector)
{
base.Set(vector);
}
/// <summary>
/// Adds a <see cref="OpenTK.Vector4" /> to the X, Y, Z and W-component.
/// </summary>
public new void Add(Vector4 vector)
{
base.Add(vector);
}
}
}