Daily update on 20231211 by nitload youmu

This commit is contained in:
Nitload
2023-12-12 03:17:16 +08:00
parent ab85c1a9fe
commit f97fb137ba
100 changed files with 2699 additions and 3191 deletions
+36 -43
View File
@@ -5,62 +5,55 @@ using System.Text;
namespace StgSharp.Graphics
{
public partial class Form
public unsafe struct VertexArray : IDisposable, IBufferObject
{
protected VertexArray CreateVertexArray(int n)
internal uint[] _bufferID;
private IglFunc GL;
internal VertexArray(int n, IglFunc glFunc)
{
return new VertexArray(n, GL);
_bufferID = new uint[n];
GL = glFunc;
fixed (uint* id = _bufferID)
{
GL.GenVertexArrays(n, id);
}
}
protected unsafe struct VertexArray : IDisposable
public uint this[int n]
{
internal uint[] _bufferID;
private IglFunc GL;
internal VertexArray(int n, IglFunc glFunc)
get
{
_bufferID = new uint[n];
GL = glFunc;
fixed (uint* id = _bufferID)
{
GL.GenVertexArrays(n, id);
}
return _bufferID[n];
}
}
public uint this[int n]
{
get
{
return _bufferID[n];
}
}
public void Bind(int index)
{
GL.BindVertexArray(_bufferID[index]);
}
public void Bind(int index)
public void Dispose()
{
fixed (uint* id = _bufferID)
{
GL.BindVertexArray(_bufferID[index]);
GL.DeleteVertexArrays(_bufferID.Length, id);
}
}
public void Dispose()
{
fixed (uint* id = _bufferID)
{
GL.DeleteVertexArrays(_bufferID.Length, id);
}
}
public void BindNull()
{
GL.BindVertexArray(0);
}
public void BindNull()
{
GL.BindVertexArray(0);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetVertexAttribute(uint index, int vertexLength, Type dataType, bool isNomalized, int stride, int pointer)
{
GL.SetVertexAttribute(
index, vertexLength, dataType,
isNomalized,
stride, pointer);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetVertexAttribute(uint index, int vertexLength, Type dataType, bool isNomalized, int stride, int pointer)
{
GL.SetVertexAttribute(
index, vertexLength, dataType,
isNomalized,
stride, pointer);
}
}
}