daily update on 20240305 by nitload youmu
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
|
||||
public unsafe class VertexArray : BufferObjectBase
|
||||
{
|
||||
internal VertexArray(int n, IglFunc gl)
|
||||
@@ -15,7 +14,7 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public sealed override void Bind(int index)
|
||||
public override sealed void Bind(int index)
|
||||
{
|
||||
GL.BindVertexArray(_bufferHandle[index]);
|
||||
}
|
||||
@@ -23,7 +22,7 @@ namespace StgSharp.Graphics
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void BindNull()
|
||||
{
|
||||
GL.BindVertexArray(glHandle.Alloc(0));
|
||||
GL.BindVertexArray(glHandle.Zero);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -35,12 +34,13 @@ namespace StgSharp.Graphics
|
||||
stride, pointer);
|
||||
}
|
||||
|
||||
protected sealed override void Dispose(bool disposing)
|
||||
protected override sealed void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
GL.DeleteVertexArrays(_bufferHandle);
|
||||
_bufferHandle.Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Security;
|
||||
@@ -9,7 +10,6 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
|
||||
public unsafe class VertexBuffer : BufferObjectBase
|
||||
{
|
||||
internal VertexBuffer(int n, IglFunc glFunc)
|
||||
@@ -18,7 +18,7 @@ namespace StgSharp.Graphics
|
||||
_bufferHandle = GL.GenBuffers(n);
|
||||
}
|
||||
|
||||
public sealed override void Bind(int index)
|
||||
public override sealed void Bind(int index)
|
||||
{
|
||||
GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
|
||||
}
|
||||
@@ -32,9 +32,9 @@ 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 : IMat
|
||||
{
|
||||
Console.WriteLine("Setting vbo data.");
|
||||
GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
|
||||
GL.SetBufferData(BufferType.ARRAY_BUFFER, bufferData, usage);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -51,7 +51,7 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Unbind()
|
||||
@@ -65,13 +65,13 @@ namespace StgSharp.Graphics
|
||||
GL = gl;
|
||||
}
|
||||
|
||||
protected sealed override void Dispose(bool disposing)
|
||||
protected override sealed void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
GL.DeleteBuffers(_bufferHandle);
|
||||
_bufferHandle.Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user