updated mesh to also pass normals to shader
Some checks failed
Gitea Actions Demo / Scan the project (push) Failing after 6s
Some checks failed
Gitea Actions Demo / Scan the project (push) Failing after 6s
This commit is contained in:
parent
3c598d57f3
commit
cf6fb35eb2
|
@ -1,9 +1,4 @@
|
||||||
using Silk.NET.OpenGL;
|
using Silk.NET.OpenGL;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Nebulix.Rendering
|
namespace Nebulix.Rendering
|
||||||
{
|
{
|
||||||
|
@ -41,10 +36,13 @@ namespace Nebulix.Rendering
|
||||||
|
|
||||||
gl.BindVertexArray(vao);
|
gl.BindVertexArray(vao);
|
||||||
|
|
||||||
// TODO: verticesData needs to also contain "normals" not just vertices (and uv coords if I decide to add some)
|
// TODO: meshData needs to also contain uv coords if I decide to add some
|
||||||
ReadOnlySpan<float> verticesData = new(vertices);
|
List<float> meshData = new(vertices.Length + normals.Length);
|
||||||
|
meshData.AddRange(vertices);
|
||||||
|
meshData.AddRange(normals);
|
||||||
|
ReadOnlySpan<float> data = new(meshData.ToArray());
|
||||||
gl.BindBuffer(BufferTargetARB.ArrayBuffer, vbo);
|
gl.BindBuffer(BufferTargetARB.ArrayBuffer, vbo);
|
||||||
gl.BufferData(BufferTargetARB.ArrayBuffer, (nuint)(verticesData.Length * sizeof(float)), verticesData, BufferUsageARB.StaticDraw);
|
gl.BufferData(BufferTargetARB.ArrayBuffer, (nuint)(data.Length * sizeof(float)), data, BufferUsageARB.StaticDraw);
|
||||||
|
|
||||||
ReadOnlySpan<float> indicesData = new(indices);
|
ReadOnlySpan<float> indicesData = new(indices);
|
||||||
gl.BindBuffer(BufferTargetARB.ElementArrayBuffer, ebo);
|
gl.BindBuffer(BufferTargetARB.ElementArrayBuffer, ebo);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user