daily update on 20240828 by nitload youmu, autotexture added
This commit is contained in:
@@ -40,10 +40,10 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics.OpenGL
|
||||
{
|
||||
public unsafe class VertexBuffer : GlBufferObjectBase
|
||||
public sealed unsafe class VertexBuffer : GlBufferObjectBase
|
||||
{
|
||||
|
||||
internal VertexBuffer(int n, glRenderStream binding):base(binding)
|
||||
internal VertexBuffer(int n, glRenderStream binding) : base(binding)
|
||||
{
|
||||
_bufferHandle = GL.GenBuffers(n);
|
||||
}
|
||||
@@ -54,13 +54,22 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set data to current vertex buffer object
|
||||
///
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Unbind()
|
||||
{
|
||||
GL.BindBuffer(BufferType.ArrayBuffer, GlHandle.Zero);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set _data to current vertex buffer object
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of bufferData</typeparam>
|
||||
/// <param name="index">Index to find certain VBO in this instance</param>
|
||||
/// <param name="bufferData">Data to write in</param>
|
||||
/// <param name="usage">How OpenGL use these data, defined by <see cref="BufferUsage"/></param>
|
||||
public void WriteMatrixData<T>(int index, T bufferData, BufferUsage usage)
|
||||
/// <param name="usage">How OpenGL use these _data, defined by <see cref="BufferUsage"/></param>
|
||||
public void WriteMatrixData<T>(int index, T bufferData, BufferUsage usage)
|
||||
where T : struct, IMat
|
||||
{
|
||||
GL.BindBuffer(BufferType.ArrayBuffer, _bufferHandle[index]);
|
||||
@@ -68,12 +77,12 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set data to current vertex buffer object
|
||||
/// Set _data to current vertex buffer object
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of bufferData</typeparam>
|
||||
/// <param name="index">Index to find certain VBO in this instance</param>
|
||||
/// <param name="bufferArray">Data to write in</param>
|
||||
/// <param name="usage">How OpenGL use these data, defined by <see cref="BufferUsage"/></param>
|
||||
/// <param name="usage">How OpenGL use these _data, defined by <see cref="BufferUsage"/></param>
|
||||
public void WriteScalerData<T>(int index, T[] bufferArray, BufferUsage usage)
|
||||
where T : struct,
|
||||
#if NET8_0_OR_GREATER
|
||||
@@ -87,12 +96,12 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set data to current vertex buffer object
|
||||
/// Set _data to current vertex buffer object
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of bufferData</typeparam>
|
||||
/// <param name="index">Index to find certain VBO in this instance</param>
|
||||
/// <param name="scalerSpan">A <see cref="Span{T}"/> of data to write in</param>
|
||||
/// <param name="usage">How OpenGL use these data, defined by <see cref="BufferUsage"/></param>
|
||||
/// <param name="scalerSpan">A <see cref="Span{T}"/> of _data to write in</param>
|
||||
/// <param name="usage">How OpenGL use these _data, defined by <see cref="BufferUsage"/></param>
|
||||
public void WriteScalerData<T>(int index, ReadOnlySpan<T> scalerSpan, BufferUsage usage)
|
||||
where T : struct,
|
||||
#if NET8_0_OR_GREATER
|
||||
@@ -106,12 +115,12 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set data to current vertex buffer object
|
||||
/// Set _data to current vertex buffer object
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of bufferData</typeparam>
|
||||
/// <param name="index">Index to find certain VBO in this instance</param>
|
||||
/// <param name="vectorSpan">A <see cref="Span{T}"/> of data to write in</param>
|
||||
/// <param name="usage">How OpenGL use these data, defined by <see cref="BufferUsage"/></param>
|
||||
/// <param name="vectorSpan">A <see cref="Span{T}"/> of _data to write in</param>
|
||||
/// <param name="usage">How OpenGL use these _data, defined by <see cref="BufferUsage"/></param>
|
||||
public void WriteVectorData<T>(int index, ReadOnlySpan<T> vectorSpan, BufferUsage usage) where T : struct, IVector
|
||||
{
|
||||
GL.BindBuffer(BufferType.ArrayBuffer, _bufferHandle[index]);
|
||||
@@ -119,27 +128,18 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set data to current vertex buffer object
|
||||
/// Set _data to current vertex buffer object
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of bufferData</typeparam>
|
||||
/// <param name="index">Index to find certain VBO in this instance</param>
|
||||
/// <param name="vectorArray">A array of data to write in</param>
|
||||
/// <param name="usage">How OpenGL use these data, defined by <see cref="BufferUsage"/></param>
|
||||
/// <param name="vectorArray">A array of _data to write in</param>
|
||||
/// <param name="usage">How OpenGL use these _data, defined by <see cref="BufferUsage"/></param>
|
||||
public void WriteVectorData<T>(int index, T[] vectorArray, BufferUsage usage) where T : struct, IVector
|
||||
{
|
||||
GL.BindBuffer(BufferType.ArrayBuffer, _bufferHandle[index]);
|
||||
GL.SetBufferVectorData(BufferType.ArrayBuffer, vectorArray, usage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Unbind()
|
||||
{
|
||||
GL.BindBuffer(BufferType.ArrayBuffer, GlHandle.Zero);
|
||||
}
|
||||
|
||||
protected override sealed void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
|
||||
Reference in New Issue
Block a user