daily update on 20240328 by nitload youmu, building thread blueprint
This commit is contained in:
@@ -37,13 +37,13 @@ using System.Threading.Tasks;
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface of all kinds OpenGL buffer onjects
|
||||
/// Interface of all kinds OpenGL buffer objects
|
||||
/// </summary>
|
||||
public abstract class BufferObjectBase : IDisposable
|
||||
{
|
||||
|
||||
protected glHandleSet _bufferHandle;
|
||||
protected Form binding;
|
||||
protected IglFunc binding;
|
||||
|
||||
/// <summary>
|
||||
/// Get the only handle to one of the Object instance
|
||||
|
||||
@@ -48,27 +48,27 @@ namespace StgSharp.Graphics
|
||||
|
||||
internal ElementBuffer(int n, Form binding)
|
||||
{
|
||||
this.binding = binding;
|
||||
_bufferHandle = binding.GL.GenBuffers(n);
|
||||
this.binding = binding.GL;
|
||||
_bufferHandle = this.binding.GenBuffers(n);
|
||||
}
|
||||
|
||||
public override sealed void Bind(int index)
|
||||
{
|
||||
binding.GL.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferHandle[index]);
|
||||
binding.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferHandle[index]);
|
||||
}
|
||||
|
||||
public void SetValue<T>(int index, T[] bufferArray, BufferUsage usage)
|
||||
where T : struct, IConvertible
|
||||
{
|
||||
binding.GL.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferHandle[index]);
|
||||
binding.GL.SetBufferData(BufferType.ELEMENT_ARRAY_BUFFER, bufferArray, usage);
|
||||
binding.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferHandle[index]);
|
||||
binding.SetBufferData(BufferType.ELEMENT_ARRAY_BUFFER, bufferArray, usage);
|
||||
}
|
||||
|
||||
protected override sealed void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
binding.GL.DeleteBuffers(_bufferHandle);
|
||||
binding.DeleteBuffers(_bufferHandle);
|
||||
_bufferHandle.Release();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,26 +40,26 @@ namespace StgSharp.Graphics
|
||||
|
||||
internal VertexArray(int n, Form binding)
|
||||
{
|
||||
this.binding = binding;
|
||||
_bufferHandle = binding.GL.GenVertexArrays(n);
|
||||
this.binding = binding.GL;
|
||||
_bufferHandle = this.binding.GenVertexArrays(n);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public override sealed void Bind(int index)
|
||||
{
|
||||
binding.GL.BindVertexArray(_bufferHandle[index]);
|
||||
binding.BindVertexArray(_bufferHandle[index]);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void BindNull()
|
||||
{
|
||||
binding.GL.BindVertexArray(glHandle.Zero);
|
||||
binding.BindVertexArray(glHandle.Zero);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void SetVertexAttribute(uint index, int vertexLength, TypeCode dataType, bool isNomalized, uint stride, int pointer)
|
||||
{
|
||||
binding.GL.SetVertexAttribute(
|
||||
binding.SetVertexAttribute(
|
||||
index, vertexLength, dataType,
|
||||
isNomalized,
|
||||
stride, pointer);
|
||||
@@ -69,7 +69,7 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
binding.GL.DeleteVertexArrays(_bufferHandle);
|
||||
binding.DeleteVertexArrays(_bufferHandle);
|
||||
_bufferHandle.Release();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,13 +45,13 @@ namespace StgSharp.Graphics
|
||||
|
||||
internal VertexBuffer(int n, Form binding)
|
||||
{
|
||||
this.binding = binding;
|
||||
_bufferHandle = binding.GL.GenBuffers(n);
|
||||
this.binding = binding.GL;
|
||||
_bufferHandle = this.binding.GenBuffers(n);
|
||||
}
|
||||
|
||||
public override sealed void Bind(int index)
|
||||
{
|
||||
binding.GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
|
||||
binding.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -63,8 +63,8 @@ namespace StgSharp.Graphics
|
||||
/// <param name="usage">How OpenGL use these data, defined by <see cref="BufferUsage"/></param>
|
||||
public void SetValue<T>(int index, T bufferData, BufferUsage usage) where T : struct, IMat
|
||||
{
|
||||
binding.GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
|
||||
binding.GL.SetBufferData(BufferType.ARRAY_BUFFER, bufferData, usage);
|
||||
binding.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
|
||||
binding.SetBufferData(BufferType.ARRAY_BUFFER, bufferData, usage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -76,8 +76,8 @@ namespace StgSharp.Graphics
|
||||
/// <param name="usage">How OpenGL use these data, defined by <see cref="BufferUsage"/></param>
|
||||
public void SetValueArray<T>(int index, T[] bufferArray, BufferUsage usage) where T : struct, IConvertible
|
||||
{
|
||||
binding.GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
|
||||
binding.GL.SetBufferData(BufferType.ARRAY_BUFFER, bufferArray, usage);
|
||||
binding.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
|
||||
binding.SetBufferData(BufferType.ARRAY_BUFFER, bufferArray, usage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -86,16 +86,14 @@ namespace StgSharp.Graphics
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Unbind()
|
||||
{
|
||||
binding.GL.BindBuffer(BufferType.ARRAY_BUFFER, glHandle.Zero);
|
||||
binding.BindBuffer(BufferType.ARRAY_BUFFER, glHandle.Zero);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected override sealed void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
binding.GL.DeleteBuffers(_bufferHandle);
|
||||
binding.DeleteBuffers(_bufferHandle);
|
||||
_bufferHandle.Release();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user