daily update on 20240305 by nitload youmu

This commit is contained in:
YoumuLiu
2024-03-05 10:17:02 +08:00
parent 1f2fca4c8f
commit 6a0cccae79
156 changed files with 23040 additions and 1385 deletions
+7 -7
View File
@@ -1,4 +1,5 @@
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
@@ -7,11 +8,9 @@ using System.Text;
namespace StgSharp.Graphics
{
/// <summary>
/// A collecion of handle to Element Buffer Object in OpenGL.
/// Each <see langword="int"/> value indexed from instance of this class this
/// Each <see langword="uint"/> value indexed from instance of this class this
/// is the only handle to one Element Buffer Object.
/// </summary>
public unsafe class ElementBuffer : BufferObjectBase
@@ -22,8 +21,7 @@ namespace StgSharp.Graphics
_bufferHandle = GL.GenBuffers(n);
}
public override void Bind(int index)
public override sealed void Bind(int index)
{
GL.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferHandle[index]);
}
@@ -31,16 +29,18 @@ namespace StgSharp.Graphics
public void SetValue<T>(int index, T[] bufferArray, BufferUsage usage)
where T : struct, IConvertible
{
Console.WriteLine("Setting ebo data.");
GL.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferHandle[index]);
GL.SetBufferData(BufferType.ELEMENT_ARRAY_BUFFER, bufferArray, usage);
}
protected sealed override void Dispose(bool disposing)
protected override sealed void Dispose(bool disposing)
{
if (disposing)
{
GL.DeleteBuffers(_bufferHandle);
_bufferHandle.Release();
}
}
}
}
}