Updated Sphere generation
Some checks failed
Gitea Actions Demo / Scan the project (push) Failing after 7s
Some checks failed
Gitea Actions Demo / Scan the project (push) Failing after 7s
This commit is contained in:
@ -5,19 +5,29 @@ namespace Nebulix.Rendering
|
||||
public sealed class Mesh
|
||||
{
|
||||
public float[] Vertices { get => vertices; set { vertices = value; regenerate = true; } }
|
||||
public float[] Indices { get => indices; set { indices = value; regenerate = true; } }
|
||||
public float[] Normals { get => normals; }
|
||||
public nuint[] Indices { get => indices; set { indices = value; regenerate = true; } }
|
||||
|
||||
private uint vao = 0, vbo = 0, ebo = 0;
|
||||
private bool regenerate = true;
|
||||
|
||||
private float[] vertices = [];
|
||||
private float[] indices = [];
|
||||
private nuint[] indices = [];
|
||||
private float[] normals = [];
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
vertices = [];
|
||||
indices = [];
|
||||
}
|
||||
|
||||
// getting called by "Engine" which currently is in other assembly, meaning I probably need to make this public
|
||||
internal void Use(GL gl)
|
||||
public void CalculateNormals()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
// getting called by "Engine" which currently is in another assembly, meaning I probably need to make this public
|
||||
// needs to be change for the real engine
|
||||
public void Use(GL gl)
|
||||
{
|
||||
if (regenerate) Generate(gl);
|
||||
|
||||
@ -44,7 +54,7 @@ namespace Nebulix.Rendering
|
||||
gl.BindBuffer(BufferTargetARB.ArrayBuffer, vbo);
|
||||
gl.BufferData(BufferTargetARB.ArrayBuffer, (nuint)(data.Length * sizeof(float)), data, BufferUsageARB.StaticDraw);
|
||||
|
||||
ReadOnlySpan<float> indicesData = new(indices);
|
||||
ReadOnlySpan<nuint> indicesData = new(indices);
|
||||
gl.BindBuffer(BufferTargetARB.ElementArrayBuffer, ebo);
|
||||
gl.BufferData(BufferTargetARB.ElementArrayBuffer, (nuint)(indicesData.Length * sizeof(uint)), indicesData, BufferUsageARB.StaticDraw);
|
||||
|
||||
|
Reference in New Issue
Block a user