MVVM frame work done, under unit test

This commit is contained in:
Nitload
2024-07-25 04:41:24 +08:00
parent 924fe6eef7
commit da75200347
101 changed files with 8435 additions and 847 deletions
@@ -0,0 +1,82 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="BufferObjectBase.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Graphics.OpenGL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Graphics
{
/// <summary>
/// Interface of all kinds OpenGL buffer objects
/// </summary>
public abstract class BufferObjectBase : IDisposable
{
protected RenderStream binding;
protected GlHandle[] _bufferHandle;
/// <summary>
/// Get the only handle to one of the Object instance
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public GlHandle this[int index] => _bufferHandle[index];
/// <summary>
/// Bind a buffer instance to OpenGL
/// </summary>
/// <param name="index">Index of handle of the object in this instance to be bind</param>
public abstract void Bind(int index);
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
/// <inheritdoc/>
public override string ToString()
{
return $"This is a {GetType().FullName}, containing {_bufferHandle.Length} buffer handles: {_bufferHandle.ToString()}.";
}
protected abstract void Dispose(bool disposing);
~BufferObjectBase()
{
Dispose(disposing: false);
}
}
}
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Graphics.GL;
using StgSharp.Graphics.OpenGL;
using System;
using System.Runtime.InteropServices;
@@ -31,7 +31,7 @@
using System;
using System.Drawing;
namespace StgSharp.Graphics.GL
namespace StgSharp.Graphics.OpenGL
{
//rename types in style of GLconst
@@ -4850,7 +4850,7 @@ namespace StgSharp.Graphics.GL
public static class glAttachment
{
private static int colorRange =
glFunc.GetMaskInteger((uint)GLconst.MAX_COLOR_ATTACHMENTS);
GlFunction.CurrentGL.GetMaskInteger((uint)GLconst.MAX_COLOR_ATTACHMENTS);
public static uint Color(int i)
{
+27 -14
View File
@@ -30,9 +30,11 @@
//-----------------------------------------------------------------------
namespace StgSharp.Graphics.GL
using System.Runtime.CompilerServices;
namespace StgSharp.Graphics.OpenGL
{
public enum ImageChannelLayout
public enum PixelChannelLayout
{
UByte = GLconst.UNSIGNED_BYTE,
Byte = GLconst.BYTE,
@@ -41,20 +43,31 @@ namespace StgSharp.Graphics.GL
UInt = GLconst.UNSIGNED_INT,
Int = GLconst.INT,
Float = GLconst.FLOAT,
UByte332 = 0x8032, // GL_UNSIGNED_BYTE_3_3_2
UByte233Rev = 0x8362, // GL_UNSIGNED_BYTE_2_3_3_REV
UShort565 = 0x8363, // GL_UNSIGNED_SHORT_5_6_5
UShort565Rev = 0x8364, // GL_UNSIGNED_SHORT_5_6_5_REV
UShort4444 = 0x8033, // GL_UNSIGNED_SHORT_4_4_4_4
UShort4444Rev = 0x8034, // GL_UNSIGNED_SHORT_4_4_4_4_REV
UShort5551 = 0x8035, // GL_UNSIGNED_SHORT_5_5_5_1
UShort1555Rev = 0x8366, // GL_UNSIGNED_SHORT_1_5_5_5_REV
UInt8888 = 0x8035, // GL_UNSIGNED_INT_8_8_8_8
UInt8888Rev = 0x8367, // GL_UNSIGNED_INT_8_8_8_8_REV
UInt1010102 = 0x8036, // GL_UNSIGNED_INT_10_10_10_2
UInt2101010Rev = 0x8368 // GL_UNSIGNED_INT_2_10_10_10_REV
UByte332 = GLconst.UNSIGNED_BYTE_3_3_2,
UByte233Rev = GLconst.UNSIGNED_BYTE_2_3_3_REV,
UShort565 = GLconst.UNSIGNED_SHORT_5_6_5,
UShort565Rev = GLconst.UNSIGNED_SHORT_5_6_5_REV,
UShort4444 = GLconst.UNSIGNED_SHORT_4_4_4_4,
UShort4444Rev = GLconst.UNSIGNED_SHORT_4_4_4_4_REV,
UShort5551 = GLconst.UNSIGNED_SHORT_5_5_5_1,
UShort1555Rev = GLconst.UNSIGNED_SHORT_1_5_5_5_REV,
UInt8888 = GLconst.UNSIGNED_INT_8_8_8_8,
UInt8888Rev = GLconst.UNSIGNED_INT_8_8_8_8_REV,
UInt1010102 = GLconst.UNSIGNED_INT_10_10_10_2,
UInt2101010Rev = GLconst.UNSIGNED_INT_2_10_10_10_REV
}
public enum FrameBufferStatus
{
Complete = GLconst.FRAMEBUFFER_COMPLETE, // GL_FRAMEBUFFER_COMPLETE
IncompleteAttachment = GLconst.FRAMEBUFFER_INCOMPLETE_ATTACHMENT, // GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
IncompleteMissingAttachment = GLconst.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT, // GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
IncompleteDrawBuffer = GLconst.FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER, // GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER
IncompleteReadBuffer = GLconst.FRAMEBUFFER_INCOMPLETE_READ_BUFFER, // GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER
Unsupported = GLconst.FRAMEBUFFER_UNSUPPORTED, // GL_FRAMEBUFFER_UNSUPPORTED
IncompleteMultisample = GLconst.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE, // GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE
IncompleteLayerTargets = GLconst.FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS // GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS
}
internal enum VkStructureType : uint
{