daily update on 20240213 by nitload youmu. 逐步弃用GLFW,正在使用wgl重写glfw底层,相关实现转移到C#实现,SSC彻底变成线性代数计算器。

This commit is contained in:
Nitload
2024-02-13 23:42:22 +08:00
parent 8391569482
commit a2241a5a58
307 changed files with 16701 additions and 10296 deletions
@@ -9,7 +9,7 @@ namespace StgSharp.Graphics
/// <summary>
/// Interface of all kinds OpenGL buffer onjects
/// </summary>
public abstract class IBufferObject : IDisposable
public abstract class BufferObjectBase : IDisposable
{
protected glHandleSet _bufferHandle;
protected IglFunc GL;
@@ -30,9 +30,15 @@ namespace StgSharp.Graphics
/// <param name="index">Index of handle of the object in this instance to be bind</param>
public abstract void Bind(int index);
/// <inheritdoc/>
public override string ToString()
{
return $"This is a {GetType().FullName}, containing {_bufferHandle.length} buffer handles: {_bufferHandle.ToString()}.";
}
protected abstract void Dispose(bool disposing);
~IBufferObject()
~BufferObjectBase()
{
Dispose(disposing: false);
}
+1 -5
View File
@@ -14,7 +14,7 @@ namespace StgSharp.Graphics
/// Each <see langword="int"/> value indexed from instance of this class this
/// is the only handle to one Element Buffer Object.
/// </summary>
public unsafe class ElementBuffer : IBufferObject
public unsafe class ElementBuffer : BufferObjectBase
{
internal ElementBuffer(int n, IglFunc gl)
{
@@ -22,10 +22,6 @@ namespace StgSharp.Graphics
_bufferHandle = GL.GenBuffers(n);
}
public glHandle this[int n]
{
get { return _bufferHandle[n]; }
}
public override void Bind(int index)
{
+1 -1
View File
@@ -6,7 +6,7 @@ using System.Text;
namespace StgSharp.Graphics
{
public unsafe class VertexArray : IBufferObject
public unsafe class VertexArray : BufferObjectBase
{
internal VertexArray(int n, IglFunc gl)
{
+3 -1
View File
@@ -10,7 +10,7 @@ using System.Text;
namespace StgSharp.Graphics
{
public unsafe class VertexBuffer : IBufferObject
public unsafe class VertexBuffer : BufferObjectBase
{
internal VertexBuffer(int n, IglFunc glFunc)
{
@@ -58,6 +58,8 @@ namespace StgSharp.Graphics
{
GL.BindBuffer(BufferType.ARRAY_BUFFER, glHandle.Zero);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal void ChangeEnvironment(IglFunc gl)
{
GL = gl;
@@ -41,12 +41,12 @@ namespace StgSharp.Graphics
/// <param name="loader"> </param>
public unsafe void LoadTexture(int index, string name, ImageLoader loader)
{
sourceList[index] = new Image();
fixed (Image.ImageInfo* textureInfo = &sourceList[index].info)
{
InternalIO.InternalLoadImage(name, textureInfo, loader);
}
Image.ImageInfo info = default;
InternalIO.InternalLoadImage(name, &info, loader);
Console.WriteLine(info);
sourceList[index] = new Image(info);
InternalIO.InternalUnloadImage(&info);
Console.WriteLine(sourceList[index]);
if (sourceList[index].info.pixelPtr != IntPtr.Zero)
{
uint channel;