Reworked the VBO
This commit is contained in:
parent
3bc90dd83b
commit
ee732240f7
11 changed files with 174 additions and 253 deletions
|
|
@ -163,7 +163,7 @@ namespace SM.Base
|
|||
private static void GLDebugAction(DebugSource source, DebugType type, DebugSeverity severity, string msg)
|
||||
{
|
||||
if (type.HasFlag(DebugType.DebugTypeError)) throw new Exception("[GLError] " + msg);
|
||||
Write(type != DebugType.DontCare ? type.ToString().Substring(9) : "DontCare", ConsoleColor.Gray, msg);
|
||||
Write("GL"+ (type != DebugType.DontCare ? type.ToString().Substring(9) : "DontCare"), ConsoleColor.Gray, msg);
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#region usings
|
||||
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
using SM.OGL.Mesh;
|
||||
|
||||
|
|
@ -21,19 +23,19 @@ namespace SM.Base.Objects
|
|||
/// </param>
|
||||
public InstancedMesh(PrimitiveType type, string[] enabledAttibute) : base(type)
|
||||
{
|
||||
Attributes["vertex"] = Vertex = new VBO();
|
||||
Attributes["vertex"] = Vertex = new VBO<Vector3>();
|
||||
|
||||
foreach (string attribute in enabledAttibute)
|
||||
switch (attribute)
|
||||
{
|
||||
case "uv":
|
||||
Attributes["uv"] = UVs = new VBO(pointerSize: 2);
|
||||
Attributes["uv"] = UVs = new VBO<Vector2>();
|
||||
break;
|
||||
case "normals":
|
||||
Attributes["normal"] = Normals = new VBO();
|
||||
Attributes["normal"] = Normals = new VBO<Vector3>();
|
||||
break;
|
||||
case "color":
|
||||
Attributes["color"] = Color = new VBO(pointerSize: 4);
|
||||
Attributes["color"] = Color = new VBO<Color4>();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#region usings
|
||||
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
using SM.OGL.Mesh;
|
||||
|
||||
|
|
@ -22,7 +23,7 @@ namespace SM.Base.Objects
|
|||
/// <summary>
|
||||
/// Contains vertex colors
|
||||
/// </summary>
|
||||
public virtual VBO Color { get; protected set; }
|
||||
public virtual VBO<Color4> Color { get; protected set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public float LineWidth { get; set; } = 1;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#region usings
|
||||
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
using SM.OGL.Mesh;
|
||||
|
|
@ -27,18 +28,18 @@ namespace SM.Base.Objects.Static
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override VBO Vertex { get; protected set; } = new VBO
|
||||
public override VBO<Vector3> Vertex { get; protected set; } = new VBO<Vector3>
|
||||
{
|
||||
{0, 0, 0},
|
||||
{.5f, 0, 0},
|
||||
{0, 0, 0},
|
||||
{0, .5f, 0},
|
||||
{0, 0, -.5f},
|
||||
{0, 0, .5f}
|
||||
new Vector3(0, 0, 0),
|
||||
new Vector3(.5f, 0, 0),
|
||||
new Vector3(0, 0, 0),
|
||||
new Vector3(0, .5f, 0),
|
||||
new Vector3(0, 0, -.5f),
|
||||
new Vector3(0, 0, .5f)
|
||||
};
|
||||
|
||||
/// <inheritdoc />
|
||||
public override VBO Color { get; protected set; } = new VBO(pointerSize: 4)
|
||||
public override VBO<Color4> Color { get; protected set; } = new VBO<Color4>
|
||||
{
|
||||
Color4.White,
|
||||
Color4.Red,
|
||||
|
|
|
|||
|
|
@ -25,21 +25,21 @@ namespace SM.Base.Objects.Static
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override VBO Vertex { get; protected set; } = new VBO
|
||||
public override VBO<Vector3> Vertex { get; protected set; } = new VBO<Vector3>
|
||||
{
|
||||
{-.5f, -.5f, 0},
|
||||
{-.5f, .5f, 0},
|
||||
{.5f, .5f, 0},
|
||||
{.5f, -.5f, 0}
|
||||
new Vector3(-.5f, -.5f, 0),
|
||||
new Vector3(-.5f, .5f, 0),
|
||||
new Vector3(.5f, .5f, 0),
|
||||
new Vector3(.5f, -.5f, 0),
|
||||
};
|
||||
|
||||
/// <inheritdoc />
|
||||
public override VBO UVs { get; protected set; } = new VBO(pointerSize: 2)
|
||||
public override VBO<Vector2> UVs { get; protected set; } = new VBO<Vector2>
|
||||
{
|
||||
{0, 1},
|
||||
{0, 0},
|
||||
{1, 0},
|
||||
{1, 1}
|
||||
new Vector2(0, 1),
|
||||
new Vector2(0, 0),
|
||||
new Vector2(1, 0),
|
||||
new Vector2(1, 1),
|
||||
};
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue