diff --git a/SMCode/SM.Base/SM.Base.csproj b/SMCode/SM.Base/SM.Base.csproj index b2c5c4c..f813f4e 100644 --- a/SMCode/SM.Base/SM.Base.csproj +++ b/SMCode/SM.Base/SM.Base.csproj @@ -75,10 +75,9 @@ - + - diff --git a/SMCode/SM.Base/Types/CVector.cs b/SMCode/SM.Base/Types/CVector.cs deleted file mode 100644 index ceaa22d..0000000 --- a/SMCode/SM.Base/Types/CVector.cs +++ /dev/null @@ -1,162 +0,0 @@ -#region usings - -using System.Diagnostics; -using OpenTK; - -#endregion - -namespace SM.Base.Types -{ - /// - /// Represents a base vector-class - /// - public abstract class CVector - { - /// - /// Creates a vector by setting every component to the same value. - /// - protected CVector(float uniform) : this(uniform, uniform, uniform, uniform) - { - } - - /// - /// Creates a vector by setting values for each component. - /// - protected CVector(float x, float y, float z, float w) - { - _X = x; - _Y = y; - _Z = z; - _W = w; - } - - /// - /// The X-component. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected float _X { get; set; } - - /// - /// The Y-component - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected float _Y { get; set; } - - /// - /// The Z-component. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected float _Z { get; set; } - - /// - /// The W-component. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected float _W { get; set; } - - /// - /// Transforms a to a - /// - public static implicit operator Vector2(CVector v) => new Vector2(v._X, v._Y); - - /// - /// Transforms a to a - /// - public static implicit operator Vector3(CVector v) => new Vector3(v._X, v._Y, v._Z); - - /// - /// Transforms a to a - /// - public static implicit operator Vector4(CVector v) => new Vector4(v._X, v._Y, v._Z, v._W); - - #region Set - - /// - /// Sets the X and Y-component. - /// - protected void Set(float x, float y) - { - _X = x; - _Y = y; - } - - /// - /// Sets the X and Y-component from a - /// - protected void Set(Vector2 vector) - { - Set(vector.X, vector.Y); - } - - /// - /// Sets the X, Y and Z-component. - /// - protected void Set(float x, float y, float z) - { - Set(x, y); - _Z = z; - } - - /// - /// Sets the X, Y and Z-component from a . - /// - /// - protected void Set(Vector3 vector) - { - Set(vector.X, vector.Y, vector.Z); - } - - /// - /// Sets the X, Y, Z and W-component. - /// - protected void Set(float x, float y, float z, float w) - { - Set(x, y, z); - _W = w; - } - - /// - /// Sets the X, Y, Z and W-component from a . - /// - protected void Set(Vector4 vector) - { - Set(vector.X, vector.Y, vector.Z, vector.W); - } - - #endregion - - #region Add - - /// - /// Adds a to the X and Y-component. - /// - protected void Add(Vector2 vector) - { - _X += vector.X; - _Y += vector.Y; - } - - /// - /// Adds a to the X, Y and Z-component. - /// - protected void Add(Vector3 vector) - { - _X += vector.X; - _Y += vector.Y; - _Z += vector.Z; - } - - /// - /// Adds a to the X, Y, Z and W-component. - /// - protected void Add(Vector4 vector) - { - _X += vector.X; - _Y += vector.Y; - _Z += vector.Z; - _W += vector.W; - } - - #endregion - } -} \ No newline at end of file diff --git a/SMCode/SM.Base/Types/CVector1.cs b/SMCode/SM.Base/Types/CVector1.cs new file mode 100644 index 0000000..3161449 --- /dev/null +++ b/SMCode/SM.Base/Types/CVector1.cs @@ -0,0 +1,20 @@ +namespace SM.Base.Types +{ + public class CVector1 + { + public float X { get; set; } + + public CVector1(float x) + { + X = x; + } + + public virtual void Set(float x) + { + X = x; + } + + public static implicit operator float(CVector1 vector1) => vector1.X; + public static implicit operator CVector1(float f) => new CVector1(f); + } +} \ No newline at end of file diff --git a/SMCode/SM.Base/Types/CVector2.cs b/SMCode/SM.Base/Types/CVector2.cs index a9128b2..593ee83 100644 --- a/SMCode/SM.Base/Types/CVector2.cs +++ b/SMCode/SM.Base/Types/CVector2.cs @@ -1,81 +1,39 @@ -#region usings - -using OpenTK; - -#endregion +using OpenTK; namespace SM.Base.Types { - /// - /// Represents a vector of two floats. - /// - public class CVector2 : CVector + public class CVector2 : CVector1 { - /// - public CVector2() : this(0) - { - } + public float Y { get; set; } - /// public CVector2(float uniform) : base(uniform) { + Y = uniform; } - /// - public CVector2(float x, float y) : base(x, y, default, default) + public CVector2(float x, float y) : base(x) { + Y = y; } - /// - protected CVector2(float x, float y, float z, float w) : base(x, y, z, w) + public virtual void Set(float uniform) { + base.Set(uniform); + Y = uniform; } - /// - /// X-component - /// - public float X + public void Set(Vector2 vector) { - get => _X; - set => _X = value; + Set(vector.X, vector.Y); } - /// - /// Y-component - /// - public float Y + public void Set(float x, float y) { - get => _Y; - set => _Y = value; + base.Set(x); + Y = y; } - /// - /// Sets the X and Y-component. - /// - public new void Set(float x, float y) - { - base.Set(x, y); - } - - /// - /// Sets the X and Y-component from a - /// - public new void Set(Vector2 vector) - { - base.Set(vector); - } - - /// - /// Adds a to the X and Y-component. - /// - public new void Add(Vector2 vector) - { - base.Add(vector); - } - - /// - /// Converts a to - /// - public static implicit operator CVector2(Vector2 v) => new CVector2(v.X,v.Y); + public static implicit operator Vector2(CVector2 vector2) => new Vector2(vector2.X, vector2.Y); + 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 6fb9a53..b7cd82f 100644 --- a/SMCode/SM.Base/Types/CVector3.cs +++ b/SMCode/SM.Base/Types/CVector3.cs @@ -1,62 +1,39 @@ -#region usings - -using OpenTK; - -#endregion +using OpenTK; namespace SM.Base.Types { - /// - /// Represents a Vector of three floats. - /// public class CVector3 : CVector2 { - /// + public float Z { get; set; } + public CVector3(float uniform) : base(uniform) { + Z = uniform; } - /// - public CVector3(float x, float y, float z) : base(x, y, z, default) + public CVector3(float x, float y, float z) : base(x, y) { + Z = z; } - /// - protected CVector3(float x, float y, float z, float w) : base(x, y, z, w) + public override void Set(float uniform) { + base.Set(uniform); + Z = uniform; } - /// - /// Z-component - /// - public float Z + public void Set(float x, float y, float z) { - get => _Z; - set => _Z = value; + base.Set(x,y); + Z = z; } - /// - /// Sets the X, Y and Z-component. - /// - public new void Set(float x, float y, float z) + public void Set(Vector3 vector) { - base.Set(x, y, z); + Set(vector.X, vector.Y, vector.Z); } - /// - /// Sets the X, Y and Z-component from a . - /// - public new void Set(Vector3 vector) - { - base.Set(vector); - } - - /// - /// Adds a to the X, Y and Z-component. - /// - public new void Add(Vector3 vector) - { - base.Add(vector); - } + public static implicit operator Vector3(CVector3 vector) => new Vector3(vector.X, vector.Y, vector.Z); + 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/Types/CVector4.cs b/SMCode/SM.Base/Types/CVector4.cs deleted file mode 100644 index 0aafe3e..0000000 --- a/SMCode/SM.Base/Types/CVector4.cs +++ /dev/null @@ -1,57 +0,0 @@ -#region usings - -using OpenTK; - -#endregion - -namespace SM.Base.Types -{ - /// - /// Represents a vector of four floats. - /// - public class CVector4 : CVector3 - { - /// - public CVector4(float uniform) : base(uniform) - { - } - - /// - public CVector4(float x, float y, float z, float w) : base(x, y, z, w) - { - } - - /// - /// W-component - /// - public float W - { - get => _W; - set => _W = value; - } - - /// - /// Sets the X, Y, Z and W-component. - /// - public new void Set(float x, float y, float z, float w) - { - base.Set(x, y, z, w); - } - - /// - /// Sets the X, Y, Z and W-component from a . - /// - public new void Set(Vector4 vector) - { - base.Set(vector); - } - - /// - /// Adds a to the X, Y, Z and W-component. - /// - public new void Add(Vector4 vector) - { - base.Add(vector); - } - } -} \ No newline at end of file diff --git a/SM_TEST/Program.cs b/SM_TEST/Program.cs index dcfea4c..8ea6954 100644 --- a/SM_TEST/Program.cs +++ b/SM_TEST/Program.cs @@ -67,10 +67,10 @@ namespace SM_TEST text.Transform.Position.Set(0, 500); scene.HUD.Add(text); - PointLight light = new PointLight(); - scene.LightInformations.Lights.Add(light); + /*PointLight light = new PointLight(); + scene.LightInformations.Lights.Add(light);*/ - scene.LightInformations.Ambient = Color4.Black; + scene.LightInformations.Ambient = Color4.White; //particles.Trigger(); }