diff --git a/SMCode/SM.Base/Drawing/GenericTransformation.cs b/SMCode/SM.Base/Drawing/GenericTransformation.cs
index 949c4e7..0912b47 100644
--- a/SMCode/SM.Base/Drawing/GenericTransformation.cs
+++ b/SMCode/SM.Base/Drawing/GenericTransformation.cs
@@ -11,6 +11,9 @@ namespace SM.Base.Drawing
///
public abstract class GenericTransformation
{
+ ///
+ /// If true, ignores the transformation and sends , when requested.
+ ///
public bool Ignore = false;
///
diff --git a/SMCode/SM.Base/Drawing/Particles/ParticleDrawingBasis.cs b/SMCode/SM.Base/Drawing/Particles/ParticleDrawingBasis.cs
index 281e5e7..e04789c 100644
--- a/SMCode/SM.Base/Drawing/Particles/ParticleDrawingBasis.cs
+++ b/SMCode/SM.Base/Drawing/Particles/ParticleDrawingBasis.cs
@@ -54,6 +54,10 @@ namespace SM.Base.Drawing.Particles
///
public abstract Func MovementCalculation { get; set; }
+ ///
+ /// Sets up the timer.
+ ///
+ /// Duration how long the particles should live
protected ParticleDrawingBasis(TimeSpan duration)
{
timer = new Timer(duration);
diff --git a/SMCode/SM.Base/Objects/Mesh.cs b/SMCode/SM.Base/Objects/Mesh.cs
index dad91e2..79c18d0 100644
--- a/SMCode/SM.Base/Objects/Mesh.cs
+++ b/SMCode/SM.Base/Objects/Mesh.cs
@@ -1,5 +1,6 @@
#region usings
+using OpenTK.Graphics.OpenGL4;
using SM.OGL.Mesh;
#endregion
@@ -12,14 +13,15 @@ namespace SM.Base.Objects
///
/// While initializing, it will add the to the data index.
///
- public Mesh()
+ public Mesh(PrimitiveType type)
{
+ PrimitiveType = type;
Attributes.Add(3, "color", Color);
}
///
/// Contains vertex colors
///
- public virtual VBO Color { get; }
+ public virtual VBO Color { get; protected set; }
}
}
\ No newline at end of file
diff --git a/SMCode/SM.Base/Objects/Static/AxisHelper.cs b/SMCode/SM.Base/Objects/Static/AxisHelper.cs
index be22208..02b902f 100644
--- a/SMCode/SM.Base/Objects/Static/AxisHelper.cs
+++ b/SMCode/SM.Base/Objects/Static/AxisHelper.cs
@@ -4,13 +4,24 @@ using SM.OGL.Mesh;
namespace SM.Base.Objects.Static
{
+ ///
+ /// An AxisHelper-Model
+ /// White: -X, -Y, -Z
+ /// Red: +X
+ /// Green: +Y
+ /// Blue: +Z
+ ///
public class AxisHelper : Mesh
{
+ ///
+ /// Object
+ ///
public static AxisHelper Object = new AxisHelper();
- private AxisHelper() {}
+ private AxisHelper() : base(PrimitiveType.Lines) {}
- public override VBO Vertex { get; } = new VBO()
+ ///
+ public override VBO Vertex { get; protected set; } = new VBO()
{
{0, 0, 0},
{.5f, 0, 0},
@@ -20,7 +31,8 @@ namespace SM.Base.Objects.Static
{0, 0, .5f},
};
- public override VBO Color { get; } = new VBO(pointerSize:4)
+ ///
+ public override VBO Color { get; protected set; } = new VBO(pointerSize:4)
{
{Color4.White},
{Color4.Red},
@@ -29,7 +41,5 @@ namespace SM.Base.Objects.Static
{Color4.White},
{Color4.DarkBlue},
};
-
- public override PrimitiveType PrimitiveType { get; } = PrimitiveType.Lines;
}
}
\ No newline at end of file
diff --git a/SMCode/SM.Base/Objects/Static/Plate.cs b/SMCode/SM.Base/Objects/Static/Plate.cs
index 4c105b5..222866d 100644
--- a/SMCode/SM.Base/Objects/Static/Plate.cs
+++ b/SMCode/SM.Base/Objects/Static/Plate.cs
@@ -25,7 +25,7 @@ namespace SM.Base.Objects.Static
}
///
- public override VBO Vertex { get; } = new VBO
+ public override VBO Vertex { get; protected set; } = new VBO
{
{-.5f, -.5f, 0},
{-.5f, .5f, 0},
@@ -34,7 +34,7 @@ namespace SM.Base.Objects.Static
};
///
- public override VBO UVs { get; } = new VBO(pointerSize: 2)
+ public override VBO UVs { get; protected set; } = new VBO(pointerSize: 2)
{
{0, 1},
{0, 0},
@@ -43,7 +43,7 @@ namespace SM.Base.Objects.Static
};
///
- public override PrimitiveType PrimitiveType { get; } = PrimitiveType.Quads;
+ public override PrimitiveType PrimitiveType { get; protected set; } = PrimitiveType.Quads;
///
public override BoundingBox BoundingBox { get; } =
diff --git a/SMCode/SM.Base/PostProcess/PostProcessEffect.cs b/SMCode/SM.Base/PostProcess/PostProcessEffect.cs
index 9e0836a..48f5ff1 100644
--- a/SMCode/SM.Base/PostProcess/PostProcessEffect.cs
+++ b/SMCode/SM.Base/PostProcess/PostProcessEffect.cs
@@ -10,25 +10,39 @@ using SM.OGL.Shaders;
namespace SM.Base.PostProcess
{
+ ///
+ /// Basis for a post process effect
+ ///
public abstract class PostProcessEffect
{
internal static Matrix4 Mvp;
internal static Matrix4 Model;
- public virtual ICollection RequiredFramebuffers { get; }
+ ///
+ /// Method, to initialize the shader.
+ ///
public virtual void Init() {}
+
+ ///
+ /// Method, to initialize the shader.
+ ///
public virtual void Init(Framebuffer main)
{
Init();
}
- public virtual void Draw(Framebuffer main, Framebuffer target)
- {
-
- }
+ ///
+ /// Method to draw the actual effect.
+ ///
+ /// The framebuffer, that was used.
+ /// The framebuffer, the system should draw to.
+ public abstract void Draw(Framebuffer main, Framebuffer target);
+ ///
+ /// Event, when the scene changed.
+ ///
public virtual void SceneChanged(GenericScene scene)
{
diff --git a/SMCode/SM.Base/Textures/Texture.cs b/SMCode/SM.Base/Textures/Texture.cs
index f8eea33..5833d87 100644
--- a/SMCode/SM.Base/Textures/Texture.cs
+++ b/SMCode/SM.Base/Textures/Texture.cs
@@ -41,6 +41,9 @@ namespace SM.Base.Textures
get => _height ?? Map.Height;
protected set => _height = value;
}
+ ///
+ /// Aspect ratio of Width and Height of the texture
+ ///
public float Aspect { get; private set; }
///
diff --git a/SMCode/SM.Base/Time/Interval.cs b/SMCode/SM.Base/Time/Interval.cs
index 5f089a7..663aa90 100644
--- a/SMCode/SM.Base/Time/Interval.cs
+++ b/SMCode/SM.Base/Time/Interval.cs
@@ -12,8 +12,6 @@ namespace SM.Base.Time
///
public class Interval : Timer
{
- private bool _stop;
-
///
public Interval(float seconds) : base(seconds)
{
diff --git a/SMCode/SM.Base/Time/Stopwatch.cs b/SMCode/SM.Base/Time/Stopwatch.cs
index 36d361c..7212f85 100644
--- a/SMCode/SM.Base/Time/Stopwatch.cs
+++ b/SMCode/SM.Base/Time/Stopwatch.cs
@@ -16,8 +16,15 @@ namespace SM.Base.Time
private static List _activeStopwatches = new List();
private bool _paused = false;
+ ///
+ /// If true, the stopwatch was started.
+ /// This doesn't changed when paused.
+ ///
public bool Active { get; private set; } = false;
+ ///
+ /// Gets/Sets if the stopwatch is paused.
+ ///
public bool Paused
{
get => _paused;
@@ -30,6 +37,9 @@ namespace SM.Base.Time
}
}
+ ///
+ /// If true, the stopwatch is active and not paused... (who would have guessed...)
+ ///
public bool Running => Active && !Paused;
///
diff --git a/SMCode/SM.Base/Types/CVector1.cs b/SMCode/SM.Base/Types/CVector1.cs
index 3161449..26041c3 100644
--- a/SMCode/SM.Base/Types/CVector1.cs
+++ b/SMCode/SM.Base/Types/CVector1.cs
@@ -1,20 +1,90 @@
-namespace SM.Base.Types
+using System;
+using OpenTK;
+
+namespace SM.Base.Types
{
+ ///
+ /// A One-dimensional Vector (also known as ), in a class.
+ ///
public class CVector1
{
+ ///
+ /// X - Component
+ ///
public float X { get; set; }
+ ///
+ /// The length/magnitute of the vector.
+ ///
+ public float Length => GetLength();
+ ///
+ /// Gets the square of the vector length (magnitude).
+ ///
+ ///
+ /// This property avoids the costly square root operation required by the Length property. This makes it more suitable
+ /// for comparisons.
+ ///
+ public float LengthSquared => GetLength(true);
+
+ ///
+ /// Creates a class vector
+ ///
+ /// X-Component
public CVector1(float x)
{
X = x;
}
+ ///
+ /// Sets the X-Component.
+ ///
+ /// X-Component
public virtual void Set(float x)
{
X = x;
}
+ ///
+ /// Get the length of the vector.
+ ///
+ /// If true, it will return the squared product.
+ ///
+ public float GetLength(bool squared = false)
+ {
+ float length = GetLengthProcess();
+ if (squared) return length;
+ return (float) Math.Sqrt(length);
+ }
+
+
+ ///
+ /// Normalizes the vector.
+ ///
+ public void Normalize()
+ {
+ float length = GetLength();
+ NormalizationProcess(length);
+ }
+
+
+ ///
+ /// Conversion into
+ ///
public static implicit operator float(CVector1 vector1) => vector1.X;
+ ///
+ /// Conversion from to One-dimensional Vector.
+ ///
+ ///
+ ///
public static implicit operator CVector1(float f) => new CVector1(f);
+
+ private protected virtual float GetLengthProcess()
+ {
+ return X * X;
+ }
+ private protected virtual void NormalizationProcess(float length)
+ {
+ X *= length;
+ }
}
}
\ No newline at end of file
diff --git a/SMCode/SM.Base/Types/CVector2.cs b/SMCode/SM.Base/Types/CVector2.cs
index 593ee83..1af021f 100644
--- a/SMCode/SM.Base/Types/CVector2.cs
+++ b/SMCode/SM.Base/Types/CVector2.cs
@@ -2,38 +2,81 @@
namespace SM.Base.Types
{
+ ///
+ /// A two-dimensional vector.
+ ///
public class CVector2 : CVector1
{
+ ///
+ /// Y-component
+ ///
public float Y { get; set; }
+ ///
+ /// Creates a vector, where each component is the same value.
+ ///
+ /// The Value
public CVector2(float uniform) : base(uniform)
{
Y = uniform;
}
+ ///
+ /// Creates a vector
+ ///
public CVector2(float x, float y) : base(x)
{
Y = y;
}
- public virtual void Set(float uniform)
+ private protected override float GetLengthProcess()
+ {
+ return base.GetLengthProcess() + Y * Y;
+ }
+
+ private protected override void NormalizationProcess(float length)
+ {
+ base.NormalizationProcess(length);
+ Y *= length;
+ }
+
+ ///
+ /// Sets each component to the same value
+ ///
+ ///
+ public override void Set(float uniform)
{
base.Set(uniform);
Y = uniform;
}
+ ///
+ /// Sets each component to the counter-part.
+ ///
+ ///
public void Set(Vector2 vector)
{
Set(vector.X, vector.Y);
}
+ ///
+ /// Sets the a own value to each component.
+ ///
+ ///
+ ///
public void Set(float x, float y)
{
base.Set(x);
Y = y;
}
+ ///
+ /// Converts to
+ ///
public static implicit operator Vector2(CVector2 vector2) => new Vector2(vector2.X, vector2.Y);
+ ///
+ /// Converts from to .
+ ///
public static implicit operator CVector2(Vector2 vector2) => new CVector2(vector2.X, vector2.Y);
}
}
\ No newline at end of file
diff --git a/SMCode/SM.Base/Types/CVector3.cs b/SMCode/SM.Base/Types/CVector3.cs
index b7cd82f..f04b015 100644
--- a/SMCode/SM.Base/Types/CVector3.cs
+++ b/SMCode/SM.Base/Types/CVector3.cs
@@ -2,38 +2,74 @@
namespace SM.Base.Types
{
+ ///
+ /// A three-dimensional vector.
+ ///
public class CVector3 : CVector2
{
+ ///
+ /// Z-component
+ ///
public float Z { get; set; }
+ ///
+ /// Creates a vector, where each component is the same value.
+ ///
+ /// The Value
public CVector3(float uniform) : base(uniform)
{
Z = uniform;
}
-
+ ///
+ /// Creates a vector
+ ///
public CVector3(float x, float y, float z) : base(x, y)
{
Z = z;
}
+ private protected override float GetLengthProcess()
+ {
+ return base.GetLengthProcess() + Z * Z;
+ }
+
+ private protected override void NormalizationProcess(float length)
+ {
+ base.NormalizationProcess(length);
+ Z *= length;
+ }
+
+ ///
public override void Set(float uniform)
{
base.Set(uniform);
Z = uniform;
}
+ ///
+ /// Sets the a own value to each component.
+ ///
public void Set(float x, float y, float z)
{
base.Set(x,y);
Z = z;
}
-
+ ///
+ /// Sets each component to the counter-part.
+ ///
+ ///
public void Set(Vector3 vector)
{
Set(vector.X, vector.Y, vector.Z);
}
+ ///
+ /// Converts to
+ ///
public static implicit operator Vector3(CVector3 vector) => new Vector3(vector.X, vector.Y, vector.Z);
+ ///
+ /// Converts from to .
+ ///
public static implicit operator CVector3(Vector3 vector) => new CVector3(vector.X, vector.Y, vector.Z);
}
}
\ No newline at end of file
diff --git a/SMCode/SM.Base/Utility/Randomize.cs b/SMCode/SM.Base/Utility/Randomize.cs
index 5597cc2..e0f2c81 100644
--- a/SMCode/SM.Base/Utility/Randomize.cs
+++ b/SMCode/SM.Base/Utility/Randomize.cs
@@ -84,6 +84,9 @@ namespace SM.Utility
return (float) Randomizer.NextDouble() * (max - min) + min;
}
+ ///
+ /// Gets a random item from the provided list.
+ ///
public static TSource GetRandomItem(this IList list)
{
return list[GetInt(0, list.Count - 1)];
diff --git a/SMCode/SM.Base/Window/GenericWindow.cs b/SMCode/SM.Base/Window/GenericWindow.cs
index e1f0294..ae5e984 100644
--- a/SMCode/SM.Base/Window/GenericWindow.cs
+++ b/SMCode/SM.Base/Window/GenericWindow.cs
@@ -182,6 +182,9 @@ namespace SM.Base
if (!CursorVisible) CursorVisible = true;
}
+ ///
+ /// Create a bitmap from the framebuffer.
+ ///
public Bitmap TakeScreenshot(Framebuffer framebuffer, ReadBufferMode readBuffer, int x, int y, int width, int height)
{
GL.GetInteger(GetPName.FramebufferBinding, out int prevFBId);
diff --git a/SMCode/SM.Base/Window/RenderPipeline.cs b/SMCode/SM.Base/Window/RenderPipeline.cs
index df43851..b492540 100644
--- a/SMCode/SM.Base/Window/RenderPipeline.cs
+++ b/SMCode/SM.Base/Window/RenderPipeline.cs
@@ -16,8 +16,14 @@ namespace SM.Base
///
public abstract class RenderPipeline
{
+ ///
+ /// If true, this pipeline was already once activated.
+ ///
public bool IsInitialized { get; private set; } = false;
+ ///
+ /// The window the pipeline is connected to.
+ ///
protected GenericWindow _window { get; private set; }
///
@@ -76,6 +82,10 @@ namespace SM.Base
}
+ ///
+ /// Occurs, when the pipeline was connected to a window the first time.
+ ///
+ ///
protected internal virtual void Initialization(GenericWindow window)
{
@@ -88,6 +98,10 @@ namespace SM.Base
{
}
+ ///
+ /// Creates a framebuffer, that has specific (often) required settings already applied.
+ ///
+ ///
public static Framebuffer CreateWindowFramebuffer()
{
Framebuffer framebuffer = new Framebuffer(window: SMRenderer.CurrentWindow);
@@ -112,6 +126,10 @@ namespace SM.Base
context.ActivePipeline = this;
}
+ ///
+ /// Event, that triggers, when the scene in the current window changes.
+ ///
+ ///
protected internal virtual void SceneChanged(TScene scene)
{
diff --git a/SMCode/SM.OGL/Mesh/GenericMesh.cs b/SMCode/SM.OGL/Mesh/GenericMesh.cs
index 888f58c..fcb3e41 100644
--- a/SMCode/SM.OGL/Mesh/GenericMesh.cs
+++ b/SMCode/SM.OGL/Mesh/GenericMesh.cs
@@ -37,22 +37,22 @@ namespace SM.OGL.Mesh
/// The primitive type, that determinants how the mesh is drawn.
/// Default: Triangles
///
- public virtual PrimitiveType PrimitiveType { get; } = PrimitiveType.Triangles;
+ public virtual PrimitiveType PrimitiveType { get; protected set; } = PrimitiveType.Triangles;
///
/// Contains the vertices for the mesh.
///
- public virtual VBO Vertex { get; }
+ public virtual VBO Vertex { get; protected set; }
///
/// Contains the texture coords for the mesh.
///
- public virtual VBO UVs { get; }
+ public virtual VBO UVs { get; protected set; }
///
/// Contains the normals for the mesh.
///
- public virtual VBO Normals { get; }
+ public virtual VBO Normals { get; protected set; }
///
/// Represents the bounding box.
diff --git a/SMCode/SM2D/Light/LightPostEffect.cs b/SMCode/SM2D/Light/LightPostEffect.cs
index da3f205..f052211 100644
--- a/SMCode/SM2D/Light/LightPostEffect.cs
+++ b/SMCode/SM2D/Light/LightPostEffect.cs
@@ -22,8 +22,6 @@ namespace SM2D.Light
public override void Draw(Framebuffer main, Framebuffer target)
{
- base.Draw(main, target);
-
_shader.Draw(main.ColorAttachments["color"], collection =>
{
collection["FragSize"].SetUniform2((SMRenderer.CurrentWindow as GLWindow2D).WorldScale);
diff --git a/SMCode/SM2D/Object/Polygon.cs b/SMCode/SM2D/Object/Polygon.cs
index afdcf45..01d73ce 100644
--- a/SMCode/SM2D/Object/Polygon.cs
+++ b/SMCode/SM2D/Object/Polygon.cs
@@ -14,7 +14,7 @@ namespace SM2D.Object
{
public class Polygon : Mesh
{
- public Polygon(ICollection vertices)
+ public Polygon(ICollection vertices) : base(PrimitiveType.TriangleFan)
{
foreach (var vertex in vertices)
{
@@ -25,7 +25,7 @@ namespace SM2D.Object
foreach (var vertex in vertices) AddUV(vertex);
}
- public Polygon(ICollection vertices)
+ public Polygon(ICollection vertices) : base(PrimitiveType.TriangleFan)
{
foreach (var polygonVertex in vertices)
{
@@ -36,11 +36,11 @@ namespace SM2D.Object
foreach (var vertex in vertices) AddUV(vertex.Vertex);
}
- public override VBO Vertex { get; } = new VBO();
- public override VBO UVs { get; } = new VBO(pointerSize: 2);
- public override VBO Color { get; } = new VBO(pointerSize: 4);
+ public override VBO Vertex { get; protected set; } = new VBO();
+ public override VBO UVs { get; protected set; } = new VBO(pointerSize: 2);
+ public override VBO Color { get; protected set; } = new VBO(pointerSize: 4);
- public override PrimitiveType PrimitiveType { get; } = PrimitiveType.TriangleFan;
+ public override PrimitiveType PrimitiveType { get; protected set; } = PrimitiveType.TriangleFan;
private void AddVertex(Vector2 vertex)
{