+ comments to the SM.Base

+ Length, Normalize methods for CVectors
This commit is contained in:
Michel Fedde 2020-12-19 20:49:16 +01:00
parent 5d4b360b05
commit 9b917ac181
18 changed files with 248 additions and 33 deletions

View file

@ -1,5 +1,6 @@
#region usings
using OpenTK.Graphics.OpenGL4;
using SM.OGL.Mesh;
#endregion
@ -12,14 +13,15 @@ namespace SM.Base.Objects
/// <summary>
/// While initializing, it will add the <see cref="Color" /> to the data index.
/// </summary>
public Mesh()
public Mesh(PrimitiveType type)
{
PrimitiveType = type;
Attributes.Add(3, "color", Color);
}
/// <summary>
/// Contains vertex colors
/// </summary>
public virtual VBO Color { get; }
public virtual VBO Color { get; protected set; }
}
}

View file

@ -4,13 +4,24 @@ using SM.OGL.Mesh;
namespace SM.Base.Objects.Static
{
/// <summary>
/// An AxisHelper-Model
/// <para>White: -X, -Y, -Z</para>
/// <para>Red: +X </para>
/// <para>Green: +Y </para>
/// <para>Blue: +Z </para>
/// </summary>
public class AxisHelper : Mesh
{
/// <summary>
/// Object
/// </summary>
public static AxisHelper Object = new AxisHelper();
private AxisHelper() {}
private AxisHelper() : base(PrimitiveType.Lines) {}
public override VBO Vertex { get; } = new VBO()
/// <inheritdoc />
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)
/// <inheritdoc />
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;
}
}

View file

@ -25,7 +25,7 @@ namespace SM.Base.Objects.Static
}
/// <inheritdoc />
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
};
/// <inheritdoc />
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
};
/// <inheritdoc />
public override PrimitiveType PrimitiveType { get; } = PrimitiveType.Quads;
public override PrimitiveType PrimitiveType { get; protected set; } = PrimitiveType.Quads;
/// <inheritdoc />
public override BoundingBox BoundingBox { get; } =