daily update on 20240104 by nitload youmu, double threading not work

This commit is contained in:
Nitload
2024-01-04 08:58:12 +08:00
parent 14eaab455f
commit 2767c91293
138 changed files with 9692 additions and 11011 deletions
+28 -24
View File
@@ -5,55 +5,59 @@ using System.Text;
namespace StgSharp.Graphics
{
public unsafe struct VertexArray : IDisposable, IBufferObject
public partial class Form
{
internal uint[] _bufferID;
private IglFunc GL;
/// <summary>
/// Create a set of <see cref="VertexArray"/>.
/// </summary>
/// <param name="count">Amount of VAO to be crated.</param>
/// <returns></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected VertexArray CreateVertexArray(uint count)
{
return new VertexArray(count, gl);
}
}
internal VertexArray(int n)
public unsafe class VertexArray : IBufferObject
{
internal VertexArray(uint n, IglFunc gl)
{
_bufferID = new uint[n];
//GL = glFunc;
GL = gl;
fixed (uint* id = _bufferID)
{
GL.GenVertexArrays(n, id);
}
}
public uint this[int n]
{
get
{
return _bufferID[n];
}
}
public void Bind(int index)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public sealed override void Bind(int index)
{
GL.BindVertexArray(_bufferID[index]);
}
public void Dispose()
{
fixed (uint* id = _bufferID)
{
GL.DeleteVertexArrays(_bufferID.Length, id);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindNull()
{
GL.BindVertexArray(0);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetVertexAttribute(uint index, int vertexLength, Type dataType, bool isNomalized, int stride, int pointer)
public void SetVertexAttribute(uint index, int vertexLength, Type dataType, bool isNomalized, uint stride, int pointer)
{
GL.SetVertexAttribute(
index, vertexLength, dataType,
isNomalized,
stride, pointer);
}
protected sealed override void Dispose(bool disposing)
{
if (disposing)
{
GL.DeleteVertexArrays((uint)_bufferID.Length, _bufferID);
}
}
}
}