daily update on 20250122 by nitload youmu, architect rearrange

This commit is contained in:
Nitload
2025-01-22 11:34:49 +08:00
parent 6cfaa42ff3
commit 190d67a034
192 changed files with 25177 additions and 3156 deletions
+17 -16
View File
@@ -30,6 +30,7 @@
//-----------------------------------------------------------------------
using StgSharp.Graphics;
using StgSharp.Graphics.OpenGL;
using StgSharp.Internal.OpenGL;
using System;
@@ -173,22 +174,22 @@ namespace StgSharp
#pragma warning restore CA1027
{
Joystick_1 = GLconst.GLFW_JOYSTICK_1,
Joystick_2 = GLconst.GLFW_JOYSTICK_2,
Joystick_3 = GLconst.GLFW_JOYSTICK_3,
Joystick_4 = GLconst.GLFW_JOYSTICK_4,
Joystick_5 = GLconst.GLFW_JOYSTICK_5,
Joystick_6 = GLconst.GLFW_JOYSTICK_6,
Joystick_7 = GLconst.GLFW_JOYSTICK_7,
Joystick_8 = GLconst.GLFW_JOYSTICK_8,
Joystick_9 = GLconst.GLFW_JOYSTICK_9,
Joystick_10 = GLconst.GLFW_JOYSTICK_10,
Joystick_11 = GLconst.GLFW_JOYSTICK_11,
Joystick_12 = GLconst.GLFW_JOYSTICK_12,
Joystick_13 = GLconst.GLFW_JOYSTICK_13,
Joystick_14 = GLconst.GLFW_JOYSTICK_14,
Joystick_15 = GLconst.GLFW_JOYSTICK_15,
Joystick_16 = GLconst.GLFW_JOYSTICK_16,
Joystick_1 = glConst.GLFW_JOYSTICK_1,
Joystick_2 = glConst.GLFW_JOYSTICK_2,
Joystick_3 = glConst.GLFW_JOYSTICK_3,
Joystick_4 = glConst.GLFW_JOYSTICK_4,
Joystick_5 = glConst.GLFW_JOYSTICK_5,
Joystick_6 = glConst.GLFW_JOYSTICK_6,
Joystick_7 = glConst.GLFW_JOYSTICK_7,
Joystick_8 = glConst.GLFW_JOYSTICK_8,
Joystick_9 = glConst.GLFW_JOYSTICK_9,
Joystick_10 = glConst.GLFW_JOYSTICK_10,
Joystick_11 = glConst.GLFW_JOYSTICK_11,
Joystick_12 = glConst.GLFW_JOYSTICK_12,
Joystick_13 = glConst.GLFW_JOYSTICK_13,
Joystick_14 = glConst.GLFW_JOYSTICK_14,
Joystick_15 = glConst.GLFW_JOYSTICK_15,
Joystick_16 = glConst.GLFW_JOYSTICK_16,
First = Joystick_1,
Last = Joystick_16
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data;
using StgSharp.Internal;
using System;
using System.Collections.Generic;
+1 -1
View File
@@ -33,7 +33,7 @@ using StgSharp;
using System;
using System.Runtime.CompilerServices;
namespace StgSharp.Data
namespace StgSharp.Internal
{
public class DataLabel
{
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.Intrinsic;
using StgSharp.Internal.Intrinsic;
using System;
using System.IO;
@@ -39,7 +39,7 @@ using System.Transactions;
using System.Xml;
using System.Xml.Serialization;
namespace StgSharp.Data
namespace StgSharp.Internal
{
public class RandomGenerator
{
+2 -2
View File
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.FileIO;
using StgSharp.Internal.FileIO;
using System;
using System.Collections.Generic;
@@ -36,7 +36,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Data
namespace StgSharp.Internal
{
/// <summary>
/// An independent storage area, used as the only folder type in root folder. Contains several
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.Intrinsic;
using StgSharp.Internal.Intrinsic;
using System;
using System.Collections;
@@ -38,7 +38,7 @@ using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
namespace StgSharp.Data
namespace StgSharp.Internal
{
[StructLayout( LayoutKind.Explicit, Size = 16 )]
public struct SSDSegmentHead
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.Intrinsic;
using StgSharp.Internal.Intrinsic;
using StgSharp.Math;
using System;
@@ -39,7 +39,7 @@ using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Data
namespace StgSharp.Internal
{
[StructLayout( LayoutKind.Explicit, Size = StgSharp.ssdSegmentLength * 16 )]
public unsafe struct SSDSegment : IComparable<int>, IComparable<SSDSegment>
+2 -2
View File
@@ -28,14 +28,14 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.FileIO;
using StgSharp.Internal.FileIO;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace StgSharp.Data
namespace StgSharp.Internal
{
public partial class SSD
{
@@ -28,14 +28,14 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.FileIO;
using StgSharp.Internal.FileIO;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Data
namespace StgSharp.Internal
{
public class SSDFolder : ISSDSerializable
{
+1 -1
View File
@@ -43,7 +43,7 @@ using System.Security.Cryptography;
using System.Text;
using System.Xml.Serialization;
namespace StgSharp.Data.FileIO
namespace StgSharp.Internal.FileIO
{
public class SSDraw
{
@@ -32,7 +32,7 @@ using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Data
namespace StgSharp.Internal
{
/// <summary>
/// A class contains a sets of methods to serialize several types
@@ -34,7 +34,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Data
namespace StgSharp.Internal
{
public interface ISSDSerializable
{
@@ -33,7 +33,8 @@
// using StgSharp.Graphics;
// using StgSharp.Math;
using StgSharp.Data.Intrinsic;
using StgSharp.Internal;
using StgSharp.Internal.Intrinsic;
using System;
using System.Collections.Generic;
@@ -168,8 +169,8 @@ namespace StgSharp
/// <summary>
/// Write a log message to log file, and mark the _level of this message.
/// </summary>
/// <param name="message"> A string contains information of how current evironment runs. </param>
/// <param name="logType"> The severity of current message. </param>
/// <param _name="message"> A string contains information of how current evironment runs. </param>
/// <param _name="logType"> The severity of current message. </param>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static void WriteLog( string message, LogType logType )
{
@@ -82,7 +82,7 @@ namespace StgSharp.Geometries
/// <summary>
/// Calculate movement to center
/// </summary>
/// <param name="tick"> CurrentBlueprint time tick </param>
/// <param _name="tick"> CurrentBlueprint time tick </param>
/// <returns></returns>
public virtual Vec3 MovCenter( uint tick )
{
@@ -3,7 +3,12 @@
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
global using StgSharp.Internal;
global using StgSharp.Internal.Intrinsic;
global using StgSharp.Internal.OpenGL;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
[assembly: SuppressMessage("Design", "CA1008:枚举应具有零值", Justification = "<挂起>", Scope = "type", Target = "~T:StgSharp.Graphics.OpenGL.ShaderStatus")]
[assembly: SuppressMessage("Naming", "CA1715:标识符应具有正确的前缀", Justification = "<挂起>", Scope = "member", Target = "~M:StgSharp.Graphics.OpenGL.ShaderProgram.GetUniform``2(System.String)~StgSharp.Graphics.OpenGL.Uniform{``0,``1}")]
@@ -15,3 +20,4 @@ using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Performance", "CA1864:首选 \"IDictionary.TryAdd(TKey, TValue)\" 方法", Justification = "<挂起>", Scope = "member", Target = "~P:StgSharp.MVVM.View.ViewBase.ViewRender`1.Item(System.String)")]
[assembly: SuppressMessage("Design", "CA1033:接口方法应可由子类型调用", Justification = "<挂起>", Scope = "member", Target = "~P:StgSharp.Collections.IBidirectionalDictionary`2.System#Collections#Generic#IDictionary<TFirst,TSecond>#Keys")]
[assembly: SuppressMessage("Design", "CA1033:接口方法应可由子类型调用", Justification = "<挂起>", Scope = "member", Target = "~P:StgSharp.Collections.IBidirectionalDictionary`2.System#Collections#Generic#IDictionary<TFirst,TSecond>#Values")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.ApplicationDirectory)]
@@ -50,14 +50,14 @@ namespace StgSharp.Graphics
/// <summary>
/// Get the only handle to one of the Object instance
/// </summary>
/// <param name="index"></param>
/// <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>
/// <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()
+4 -122
View File
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data;
using StgSharp.Internal;
using StgSharp.Graphics.OpenGL;
using StgSharp.Math;
@@ -41,6 +41,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using StgSharp.Internal.OpenGL;
namespace StgSharp.Graphics
{
@@ -106,7 +107,7 @@ namespace StgSharp.Graphics
internal set => _rawInfo.Width = value;
}
public int PixelSize => GlHelper.GetPixelSize(
public int PixelSize => ImageInfo.GetPixelSize(
_rawInfo.pixelLayout, _rawInfo.Channel );
public PixelChannelLayout PixelLayout
@@ -173,7 +174,7 @@ namespace StgSharp.Graphics
public unsafe byte[] GetBytes()
{
if( _data.Length == 0 ) {
int size = Width * Height * GlHelper.GetPixelSize(
int size = Width * Height * ImageInfo.GetPixelSize(
PixelLayout, Channel );
_data = new Span<byte>( ( byte* )_rawInfo.StreamPtr,
size ).ToArray();
@@ -207,76 +208,6 @@ namespace StgSharp.Graphics
}
[StructLayout( LayoutKind.Sequential )]
internal struct ImageInfo
{
private ImageChannel channel;
private int height;
private int width;
private IntPtr pixelPtr;
internal PixelChannelLayout pixelLayout;
public ImageChannel Channel
{
get => channel;
set { channel = value; }
}
public int ChannelCount
{
get => GlHelper.GetChannelCount( channel );
}
public int Height
{
get => height;
set => height = value;
}
public int StreamSize
{
get => width * height * GlHelper.GetPixelSize(
pixelLayout, channel );
}
public int Width
{
get => width;
set => width = value;
}
public IntPtr StreamPtr
{
get => pixelPtr;
internal set => pixelPtr = value;
}
public override int GetHashCode()
{
int hash = 17;
hash = hash * 17 + width;
hash = hash * 17 + height;
hash = hash * 17 + ( int )channel;
return hash;
}
public override string ToString()
{
return $"{channel}\t{width}\t{height}\t{(ulong)StreamPtr}";
}
}
public enum ImageChannel : uint
{
SingleColor = GLconst.RED,
DoubleColor = GLconst.RG,
TripleColor = GLconst.RGB,
WithAlphaChannel = GLconst.RGBA,
}
}
namespace StgSharp.Graphics.OpenGL
@@ -284,54 +215,5 @@ namespace StgSharp.Graphics.OpenGL
public static partial class GlHelper
{
internal static int GetChannelCount( ImageChannel channel )
{
return channel switch
{
ImageChannel.SingleColor => 1,
ImageChannel.DoubleColor => 2,
ImageChannel.TripleColor => 3,
ImageChannel.WithAlphaChannel => 4,
_ => throw new InvalidCastException(
"Unknown color channel decoding setting." )
};
}
internal static int GetPixelSize(
PixelChannelLayout layout,
ImageChannel cahnnel )
{
return layout switch
{
PixelChannelLayout.UByte => sizeof( byte ) * GetChannelCount(
cahnnel ),
PixelChannelLayout.Byte => sizeof( byte ) * GetChannelCount(
cahnnel ),
PixelChannelLayout.UShort => sizeof( short ) * GetChannelCount(
cahnnel ),
PixelChannelLayout.Short => sizeof( short ) * GetChannelCount(
cahnnel ),
PixelChannelLayout.UInt => sizeof( int ) * GetChannelCount(
cahnnel ),
PixelChannelLayout.Int => sizeof( int ) * GetChannelCount(
cahnnel ),
PixelChannelLayout.Float => sizeof( float ) * GetChannelCount(
cahnnel ),
PixelChannelLayout.UByte332 => sizeof( byte ),
PixelChannelLayout.UByte233Rev => sizeof( byte ),
PixelChannelLayout.UShort565 => sizeof( short ),
PixelChannelLayout.UShort565Rev => sizeof( short ),
PixelChannelLayout.UShort4444 => sizeof( short ),
PixelChannelLayout.UShort4444Rev => sizeof( short ),
PixelChannelLayout.UShort5551 => sizeof( short ),
PixelChannelLayout.UShort1555Rev => sizeof( short ),
PixelChannelLayout.UInt8888 => sizeof( int ),
PixelChannelLayout.UInt8888Rev => sizeof( int ),
PixelChannelLayout.UInt1010102 => sizeof( int ),
PixelChannelLayout.UInt2101010Rev => sizeof( int ),
_ => throw new ArgumentException( "Unknown layout type" ),
};
}
}
}
@@ -30,6 +30,7 @@
//-----------------------------------------------------------------------
using StgSharp.Graphics;
using StgSharp.Graphics.OpenGL;
using StgSharp.Internal.OpenGL;
using StgSharp.Math;
using System;
@@ -47,9 +47,9 @@ namespace StgSharp.Graphics.OpenGL
#pragma warning restore CA1008
{
Read = GLconst.READ_FRAMEBUFFER,
All = GLconst.FRAMEBUFFER,
Draw = GLconst.DRAW_FRAMEBUFFER,
Read = glConst.READ_FRAMEBUFFER,
All = glConst.FRAMEBUFFER,
Draw = glConst.DRAW_FRAMEBUFFER,
}
@@ -63,10 +63,10 @@ namespace StgSharp.Graphics.OpenGL
}
/// <summary>
/// Bind the frame buffer object with name frame buffer to the frame buffer target specified
/// Bind the frame buffer object with _name frame buffer to the frame buffer target specified
/// by target. <see langword="FrameBufferTarget.All" /> will be set as default target.
/// </summary>
/// <param name="index"> Index of object to be binded in handle set </param>
/// <param _name="index"> Index of object to be binded in handle set </param>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public override unsafe void Bind( int index )
{
@@ -74,11 +74,11 @@ namespace StgSharp.Graphics.OpenGL
}
/// <summary>
/// Bind the frame buffer object with name frame buffer to the frame buffer target specified
/// Bind the frame buffer object with _name frame buffer to the frame buffer target specified
/// by target. Target of this frame buffer should be set manually.
/// </summary>
/// <param name="target"> The frame buffer target of the binding operation. </param>
/// <param name="index"> Index of object to be binded in handle set </param>
/// <param _name="target"> The frame buffer target of the binding operation. </param>
/// <param _name="index"> Index of object to be binded in handle set </param>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe void Bind( FrameBufferTarget target, int index )
{
@@ -28,7 +28,8 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.Intrinsic;
using StgSharp.Internal.Intrinsic;
using StgSharp.Internal.OpenGL;
using StgSharp.Math;
using System;
@@ -85,14 +86,14 @@ namespace StgSharp.Graphics.OpenGL
public void Bind2D( int index )
{
currentEditingTextureIndex = index;
_gl.BindTexture( GLconst.TEXTURE_2D, _textureHandle[ index ] );
_gl.BindTexture( glConst.TEXTURE_2D, _textureHandle[ index ] );
}
/// <summary>
/// Load an <see cref="Image" /> to certain texture.
/// </summary>
/// <param name="index"> </param>
/// <param name="i"> </param>
/// <param _name="index"> </param>
/// <param _name="i"> </param>
public unsafe void LoadTexture( int index, Image i )
{
byte[] handle = i.PixelBuffer;
@@ -117,10 +118,10 @@ namespace StgSharp.Graphics.OpenGL
}
#endif
_gl.TextureParameter(
GLconst.TEXTURE_2D, GLconst.TEXTURE_MIN_FILTER,
glConst.TEXTURE_2D, glConst.TEXTURE_MIN_FILTER,
( int )onMinify );
_gl.TextureParameter(
GLconst.TEXTURE_2D, GLconst.TEXTURE_MAG_FILTER,
glConst.TEXTURE_2D, glConst.TEXTURE_MAG_FILTER,
( int )onMagnify );
}
@@ -137,10 +138,10 @@ namespace StgSharp.Graphics.OpenGL
}
#endif
_gl.TextureParameter(
GLconst.TEXTURE_2D, GLconst.TEXTURE_WRAP_S,
glConst.TEXTURE_2D, glConst.TEXTURE_WRAP_S,
( int )onHorizontial );
_gl.TextureParameter(
GLconst.TEXTURE_2D, GLconst.TEXTURE_WRAP_T, ( int )onVertical );
glConst.TEXTURE_2D, glConst.TEXTURE_WRAP_T, ( int )onVertical );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
@@ -252,12 +253,12 @@ namespace StgSharp.Graphics.OpenGL
#pragma warning restore CA1008
{
Nearest = GLconst.NEAREST,
Linear = GLconst.LINEAR,
NearestLinearMipmap = GLconst.NEAREST_MIPMAP_LINEAR,
LinearLinearMipmap = GLconst.LINEAR_MIPMAP_LINEAR,
NearestNearestMipmap = GLconst.NEAREST_MIPMAP_NEAREST,
LinearNearestMipmap = GLconst.LINEAR_MIPMAP_NEAREST,
Nearest = glConst.NEAREST,
Linear = glConst.LINEAR,
NearestLinearMipmap = glConst.NEAREST_MIPMAP_LINEAR,
LinearLinearMipmap = glConst.LINEAR_MIPMAP_LINEAR,
NearestNearestMipmap = glConst.NEAREST_MIPMAP_NEAREST,
LinearNearestMipmap = glConst.LINEAR_MIPMAP_NEAREST,
}
@@ -266,22 +267,22 @@ namespace StgSharp.Graphics.OpenGL
#pragma warning restore CA1008
{
Unit0 = GLconst.TEXTURE0,
Unit1 = GLconst.TEXTURE1,
Unit2 = GLconst.TEXTURE2,
Unit3 = GLconst.TEXTURE3,
Unit4 = GLconst.TEXTURE4,
Unit5 = GLconst.TEXTURE5,
Unit6 = GLconst.TEXTURE6,
Unit7 = GLconst.TEXTURE7,
Unit8 = GLconst.TEXTURE8,
Unit9 = GLconst.TEXTURE9,
Unit10 = GLconst.TEXTURE10,
Unit11 = GLconst.TEXTURE11,
Unit12 = GLconst.TEXTURE12,
Unit13 = GLconst.TEXTURE13,
Unit14 = GLconst.TEXTURE14,
Unit15 = GLconst.TEXTURE15,
Unit0 = glConst.TEXTURE0,
Unit1 = glConst.TEXTURE1,
Unit2 = glConst.TEXTURE2,
Unit3 = glConst.TEXTURE3,
Unit4 = glConst.TEXTURE4,
Unit5 = glConst.TEXTURE5,
Unit6 = glConst.TEXTURE6,
Unit7 = glConst.TEXTURE7,
Unit8 = glConst.TEXTURE8,
Unit9 = glConst.TEXTURE9,
Unit10 = glConst.TEXTURE10,
Unit11 = glConst.TEXTURE11,
Unit12 = glConst.TEXTURE12,
Unit13 = glConst.TEXTURE13,
Unit14 = glConst.TEXTURE14,
Unit15 = glConst.TEXTURE15,
}
@@ -290,10 +291,10 @@ namespace StgSharp.Graphics.OpenGL
#pragma warning restore CA1008
{
Repeat = GLconst.REPEAT,
MirroredRepeat = GLconst.MIRRORED_REPEAT,
ClampToEdge = GLconst.CLAMP_TO_EDGE,
ClampToBorder = GLconst.CLAMP_TO_BORDER,
Repeat = glConst.REPEAT,
MirroredRepeat = glConst.MIRRORED_REPEAT,
ClampToEdge = glConst.CLAMP_TO_EDGE,
ClampToBorder = glConst.CLAMP_TO_BORDER,
}
}
@@ -66,10 +66,10 @@ namespace StgSharp.Graphics.OpenGL
/// <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>
/// <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,
@@ -83,10 +83,10 @@ namespace StgSharp.Graphics.OpenGL
/// <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="bufferArray"> Data to write in </param>
/// <param name="usage"> How OpenGL use these _data, defined by <see cref="BufferUsage" /></param>
/// <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>
public void WriteScalerData<T>(
int index,
T[] bufferArray,
@@ -105,10 +105,10 @@ namespace StgSharp.Graphics.OpenGL
/// <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="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>
/// <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>
public void WriteScalerData<T>(
int index,
ReadOnlySpan<T> scalerSpan,
@@ -127,10 +127,10 @@ namespace StgSharp.Graphics.OpenGL
/// <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="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>
/// <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>
public void WriteVectorData<T>(
int index,
ReadOnlySpan<T> vectorSpan,
@@ -144,10 +144,10 @@ namespace StgSharp.Graphics.OpenGL
/// <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="vectorArray"> A array of _data to write in </param>
/// <param name="usage"> How OpenGL use these _data, defined by <see cref="BufferUsage" /></param>
/// <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>
public void WriteVectorData<T>(
int index,
T[] vectorArray,
@@ -29,7 +29,7 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp;
using StgSharp.Data;
using StgSharp.Internal;
using System;
using System.Collections.Generic;
@@ -86,8 +86,8 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Attach one shader code to a shader program.
/// </summary>
/// <param name="target"> Shader program to attach </param>
/// <param name="index"> Index of shader code in current shader code set. </param>
/// <param _name="target"> Shader program to attach </param>
/// <param _name="index"> Index of shader code in current shader code set. </param>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void AttachTo( int index, ShaderProgram target )
{
@@ -160,7 +160,7 @@ namespace StgSharp.Graphics.OpenGL
public enum ShaderStatus : int
{
CompileStatus = GLconst.COMPILE_STATUS,
CompileStatus = glConst.COMPILE_STATUS,
}
@@ -182,7 +182,7 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Get a uniform form current shader, the value type of the uniform should be provided.
/// </summary>
/// <param name="name"> ContextName of the Uniform in shader code </param>
/// <param _name="name"> ContextName of the Uniform in shader code </param>
/// <returns></returns>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe Uniform<T> GetUniform<T>( string name ) where T: struct
@@ -193,7 +193,7 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Get a uniform form current shader, the value type of the uniform should be provided.
/// </summary>
/// <param name="name"> ContextName of the Uniform in shader code </param>
/// <param _name="name"> ContextName of the Uniform in shader code </param>
/// <returns></returns>
public unsafe Uniform<T, U> GetUniform<T, U>( string name )
where T: struct
@@ -206,7 +206,7 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Get a uniform form current shader, the value type of the uniform should be provided.
/// </summary>
/// <param name="name"> ContextName of the Uniform in shader code </param>
/// <param _name="name"> ContextName of the Uniform in shader code </param>
/// <returns></returns>
public unsafe Uniform<T, U, V> GetUniform<T, U, V>( string name )
where T: struct
@@ -220,7 +220,7 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Get a uniform form current shader, the value type of the uniform should be provided.
/// </summary>
/// <param name="name"> ContextName of the Uniform in shader code </param>
/// <param _name="name"> ContextName of the Uniform in shader code </param>
/// <returns></returns>
public unsafe Uniform<T, U, V, W> GetUniform<T, U, V, W>( string name )
where T: struct
@@ -33,6 +33,7 @@ using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -129,7 +130,7 @@ namespace StgSharp.Graphics.OpenGL
{
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetUniformValue( Uniform<Matrix44> uniform, Matrix44 mat )
public void SetUniformValue( [NotNull] Uniform<Matrix44> uniform, Matrix44 mat )
{
Matrix44 temp = mat;
Context.glUniformMatrix4fv(
@@ -138,35 +139,35 @@ namespace StgSharp.Graphics.OpenGL
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetUniformValue(
Uniform<float, float, float, float> uniform,
[NotNull]Uniform<float, float, float, float> uniform,
Vec4 vec )
{
Vec4 temp = vec;
Context.glUniform1fv( uniform.id.SignedValue, 4, &temp );
Context.glUniform1fv( uniform.id.SignedValue, 4, &temp.reg );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetUniformValue( Uniform<Vec4> uniform, Vec4 vec )
public void SetUniformValue( [NotNull]Uniform<Vec4> uniform, Vec4 vec )
{
Vec4 temp = vec;
Context.glUniform1fv( uniform.id.SignedValue, 4, &temp );
Context.glUniform1fv( uniform.id.SignedValue, 4, &temp.reg );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetUniformValue( Uniform<float> uniform, float v0 )
public void SetUniformValue( [NotNull]Uniform<float> uniform, float v0 )
{
Context.glUniform1f( uniform.id.SignedValue, v0 );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetUniformValue( Uniform<int> uniform, int i0 )
public void SetUniformValue( [NotNull]Uniform<int> uniform, int i0 )
{
Context.glUniform1i( uniform.id.SignedValue, i0 );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetUniformValue(
Uniform<float, float> uniform,
[NotNull] Uniform<float, float> uniform,
float v0,
float v1 )
{
@@ -175,7 +176,7 @@ namespace StgSharp.Graphics.OpenGL
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetUniformValue(
Uniform<float, float, float> uniform,
[NotNull] Uniform<float, float, float> uniform,
float v0,
float v1,
float v2 )
@@ -185,7 +186,7 @@ namespace StgSharp.Graphics.OpenGL
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetUniformValue(
Uniform<float, float, float, float> uniform,
[NotNull] Uniform<float, float, float, float> uniform,
float v0,
float v1,
float v2,
@@ -59,9 +59,9 @@ namespace StgSharp.Graphics.OpenGL
//--------------------------------------------------------------------------------
/// <summary>
/// Get the function pointer of given OpenGL api name
/// Get the function pointer of given OpenGL api _name
/// </summary>
/// <param name="name"> ContextName of the OpenGL api </param>
/// <param _name="name"> ContextName of the OpenGL api </param>
/// <returns> The funtion pointer of the api in stream of <see cref="IntPtr" /></returns>
public static IntPtr LoadGLfunc( string name )
{
@@ -77,7 +77,7 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Load all supported OpenGL APIs and bind them to given <see cref="ViewPort" />.
/// </summary>
/// <param name="contextHandle"> The handle to current OpenGL viewPortDisplay </param>
/// <param _name="contextHandle"> The handle to current OpenGL viewPortDisplay </param>
public static unsafe void LoadOpenGLApiTo( IntPtr contextHandle )
{
OpenglContext* context = ( OpenglContext* )contextHandle;
@@ -151,7 +151,7 @@ namespace StgSharp.Graphics.OpenGL
}
int extensionCount;
context->glGetIntegerv( GLconst.NUM_EXTENSIONS, &extensionCount );
context->glGetIntegerv( glConst.NUM_EXTENSIONS, &extensionCount );
if( extensionCount == 0 ) {
InternalIO.InternalWriteLog(
"No supported OpenGL extensions are found.", LogType.Info );
@@ -161,7 +161,7 @@ namespace StgSharp.Graphics.OpenGL
List<string> extensions = new List<string>();
for( uint i = 0; i < extensionCount; i++ ) {
byte* strPtr = context->glGetStringi( GLconst.EXTENSIONS, i );
byte* strPtr = context->glGetStringi( glConst.EXTENSIONS, i );
extensions.Add( Marshal.PtrToStringAnsi( ( IntPtr )strPtr ) );
}
@@ -3219,7 +3219,7 @@ namespace StgSharp.Graphics.OpenGL
"glStencilOpSeparate" );
contextPtr->glUniform1f = ( delegate*<int, float, void> )load(
"glUniform1f" );
contextPtr->glUniform1fv = ( delegate*<int, uint, Vec4*, void> )load(
contextPtr->glUniform1fv = ( delegate*<int, uint, M128*, void> )load(
"glUniform1fv" );
contextPtr->glUniform1i = ( delegate*<int, int, void> )load(
"glUniform1i" );
@@ -54,7 +54,7 @@ namespace StgSharp.Graphics.OpenGL
internal void ReturnAvailableUnit( IEnumerable<TextureUnit> source )
{
int v = GLconst.TEXTURE0 + TextureUnitCount;
int v = glConst.TEXTURE0 + TextureUnitCount;
foreach( TextureUnit unit in source ) {
if( ( int )unit > v ) {
throw new InvalidOperationException(
@@ -83,7 +83,7 @@ namespace StgSharp.Graphics.OpenGL
ConcurrentQueue<TextureUnit> result = new ConcurrentQueue<TextureUnit>(
);
for( int index = 0; index < TextureUnitCount; index++ ) {
result.Enqueue( ( TextureUnit )( GLconst.TEXTURE0 + index ) );
result.Enqueue( ( TextureUnit )( glConst.TEXTURE0 + index ) );
}
return result;
}
@@ -29,7 +29,8 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Graphics;
using StgSharp.Internal;
using StgSharp.Internal.OpenGL;
using StgSharp.Math;
using System;
@@ -42,25 +43,6 @@ using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace StgSharp
{
internal static unsafe partial class InternalIO
{
[DllImport(
SSC_libName,
EntryPoint = "glCheckShaderStat",
CallingConvention = CallingConvention.Cdecl )]
#pragma warning disable CA5392
internal static extern int glCheckShaderStatus(
ref OpenglContext context,
uint shaderHandle,
int key,
ref IntPtr logPtr );
#pragma warning restore CA5392
}
}
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
@@ -77,13 +59,13 @@ namespace StgSharp.Graphics.OpenGL
private OpenGLFunction()
{
textureUnitCountGetter = new Lazy<int>(
() => GetMaskInteger( GLconst.MAX_TEXTURE_IMAGE_UNITS ) );
() => GetMaskInteger( glConst.MAX_TEXTURE_IMAGE_UNITS ) );
unusedTextureImageUintInitilizing = new Lazy<ConcurrentQueue<TextureUnit>>(
InitializeUnusedTextureImageUint );
_attachmentColorRange = new Lazy<int>(
() => {
return GetMaskInteger(
( uint )GLconst.MAX_COLOR_ATTACHMENTS );
( uint )glConst.MAX_COLOR_ATTACHMENTS );
} );
}
@@ -123,7 +105,7 @@ namespace StgSharp.Graphics.OpenGL
public void Assert( bool shouldReportWhenNormal )
{
uint code = Context.glGetError();
if( code != GLconst.NO_ERROR ) {
if( code != glConst.NO_ERROR ) {
throw new GlExecutionException( code );
}
if( shouldReportWhenNormal ) {
@@ -147,8 +129,8 @@ namespace StgSharp.Graphics.OpenGL
/// Bind a frame buffer to a frame buffer target Same function as <see
/// href="https://docs._gl/gl3/glBindFramebuffer">glBindFramebuffer</see>.
/// </summary>
/// <param name="target"> The frame buffer target of the binding operation. </param>
/// <param name="handle"> The handle of the frame buffer object to bind. </param>
/// <param _name="target"> The frame buffer target of the binding operation. </param>
/// <param _name="handle"> The handle of the frame buffer object to bind. </param>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void BindFrameBuffer( FrameBufferTarget target, GlHandle handle )
{
@@ -158,7 +140,7 @@ namespace StgSharp.Graphics.OpenGL
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void BindRenderBuffer( GlHandle handle )
{
Context.glBindRenderbuffer( GLconst.RENDERBUFFER, handle.Value );
Context.glBindRenderbuffer( glConst.RENDERBUFFER, handle.Value );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
@@ -223,7 +205,7 @@ namespace StgSharp.Graphics.OpenGL
GlHandle rboHandle )
{
Context.glFramebufferRenderbuffer(
GLconst.FRAMEBUFFER, ( uint )attachment, GLconst.RENDERBUFFER,
glConst.FRAMEBUFFER, ( uint )attachment, glConst.RENDERBUFFER,
rboHandle.Value );
}
@@ -297,7 +279,7 @@ namespace StgSharp.Graphics.OpenGL
/// href="https://docs.gl/gl3/glDeleteRenderbuffers">glDeleteRenderbuffers</see>. The only
/// deifference is that this mehtod can only delete one renderbuffer at the same time.
/// </summary>
/// <param name="bufferHandle"> Handle to buffer to delete. </param>
/// <param _name="bufferHandle"> Handle to buffer to delete. </param>
public unsafe void DeleteRenderBuffer( GlHandle bufferHandle )
{
Context.glDeleteRenderbuffers( 1, &bufferHandle.Value );
@@ -324,9 +306,9 @@ namespace StgSharp.Graphics.OpenGL
uint a;
a = type switch
{
TypeCode.UInt32 => GLconst.UNSIGNED_INT,
TypeCode.UInt16 => GLconst.UNSIGNED_SHORT,
TypeCode.Byte => GLconst.UNSIGNED_BYTE,
TypeCode.UInt32 => glConst.UNSIGNED_INT,
TypeCode.UInt16 => glConst.UNSIGNED_SHORT,
TypeCode.Byte => glConst.UNSIGNED_BYTE,
_ => throw new ArgumentException(
$"{$"{$"Parameter error in parameter {nameof(type)} method DrawElements. "}"}{$"{$"Only {typeof(uint).Name},{typeof(ushort).Name},{typeof(byte).Name} types are supported."}"}" )
};
@@ -344,15 +326,15 @@ namespace StgSharp.Graphics.OpenGL
uint a;
switch( type ) {
case TypeCode.UInt32:
a = GLconst.UNSIGNED_INT;
a = glConst.UNSIGNED_INT;
break;
case TypeCode.UInt16:
a = GLconst.UNSIGNED_SHORT;
a = glConst.UNSIGNED_SHORT;
break;
case TypeCode.Byte:
a = GLconst.UNSIGNED_BYTE;
a = glConst.UNSIGNED_BYTE;
break;
default:
@@ -508,7 +490,7 @@ namespace StgSharp.Graphics.OpenGL
fixed( byte* ptr = code ) {
int ret = Context.glGetUniformLocation( program.Value, ptr );
#if DEBUG
if( ( ret == GLconst.INVALID_OPERATION ) || ( ret == GLconst.INVALID_VALUE ) ) {
if( ( ret == glConst.INVALID_OPERATION ) || ( ret == glConst.INVALID_VALUE ) ) {
throw new InvalidOperationException();
}
if( ret == -1 ) {
@@ -707,7 +689,7 @@ namespace StgSharp.Graphics.OpenGL
(int width, int height) size )
{
Context.glRenderbufferStorage(
GLconst.RENDERBUFFER, ( uint )internalFormat, size.width,
glConst.RENDERBUFFER, ( uint )internalFormat, size.width,
size.height );
}
@@ -717,7 +699,7 @@ namespace StgSharp.Graphics.OpenGL
(uint width, uint height) size )
{
Context.glRenderbufferStorage(
GLconst.RENDERBUFFER, ( uint )internalFormat, ( int )size.width,
glConst.RENDERBUFFER, ( uint )internalFormat, ( int )size.width,
( int )size.height );
}
@@ -50,7 +50,7 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Create a set of <see cref="ElementBuffer" />.
/// </summary>
/// <param name="count"> Amount of EBO to be created. </param>
/// <param _name="count"> Amount of EBO to be created. </param>
/// <returns></returns>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
protected ElementBuffer CreateElementBuffer( int count )
@@ -73,7 +73,7 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Create a sets of <see cref="TextureGL" />
/// </summary>
/// <param name="count"> Amount of textures to be created. </param>
/// <param _name="count"> Amount of textures to be created. </param>
/// <returns></returns>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
protected TextureGL CreateTexture( int count )
@@ -84,7 +84,7 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Create a set of <see cref="VertexArray" />.
/// </summary>
/// <param name="count"> Amount of VAO to be created. </param>
/// <param _name="count"> Amount of VAO to be created. </param>
/// <returns></returns>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
protected VertexArray CreateVertexArray( int count )
@@ -95,7 +95,7 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Create a set of <see cref="VertexBuffer" />.
/// </summary>
/// <param name="count"> Amount of Object to be created. </param>
/// <param _name="count"> Amount of Object to be created. </param>
/// <returns></returns>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
protected VertexBuffer CreateVertexBuffer( int count )
@@ -131,10 +131,10 @@ namespace StgSharp.Graphics
/// <summary>
/// Set the size limit of current form
/// </summary>
/// <param name="minWidth"> Minimum width of current form </param>
/// <param name="minHeight"> Minimum height of current form </param>
/// <param name="maxWidth"> Maximum width of current form </param>
/// <param name="maxHeight"> Maximum height of current form </param>
/// <param _name="minWidth"> Minimum width of current form </param>
/// <param _name="minHeight"> Minimum height of current form </param>
/// <param _name="maxWidth"> Maximum width of current form </param>
/// <param _name="maxHeight"> Maximum height of current form </param>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public abstract void SetSizeLimit(
int minWidth,
@@ -185,8 +185,8 @@ namespace StgSharp.Graphics
/// shader rendering, each shader requires a uniform, so do not ignore return value of this
/// method.
/// </summary>
/// <param name="source"> Shader using this camera </param>
/// <param name="name"> ContextName of projection camera named in shader </param>
/// <param _name="source"> Shader using this camera </param>
/// <param _name="name"> ContextName of projection camera named in shader </param>
/// <returns>
/// <see cref="Uniform{T}" />(TView is <see cref="Matrix44" />) representing projection
/// matrix in shader program.
@@ -29,7 +29,7 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.BluePrint;
using StgSharp.Blueprint;
using System;
using System.Collections.Generic;
@@ -32,6 +32,7 @@ using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Text;
@@ -69,7 +70,7 @@ namespace StgSharp.Graphics
_tex = provider.ProvideImage();
}
public void UpdateFromImage( Image i )
public void UpdateFromImage( [NotNull]Image i )
{
if( i == _tex ) {
return;
@@ -44,466 +44,4 @@ using System.Text;
namespace StgSharp
{
internal partial class InternalIO
{
#region api call
[DllImport( SSC_libName, EntryPoint = "glfwInit" )] internal static extern unsafe int glfwInit(
);
[DllImport( SSC_libName, EntryPoint = "glfwTerminate" )] internal static extern unsafe void glfwTerminate(
);
[DllImport( SSC_libName, EntryPoint = "glfwInitHint" )] internal static extern unsafe void glfwInitHint(
int hint,
int value );
[DllImport( SSC_libName, EntryPoint = "glfwGetVersion" )] internal static extern unsafe void glfwGetVersion(
int* major,
int* minor,
int* rev );
[DllImport( SSC_libName, EntryPoint = "glfwGetVersionString" )] internal static extern unsafe byte* glfwGetVersionString(
);
[DllImport( SSC_libName, EntryPoint = "glfwGetError" )] internal static extern unsafe int glfwGetError(
byte** description );
[DllImport( SSC_libName, EntryPoint = "glfwSetErrorCallback" )] internal static extern unsafe GLFWerrorfun glfwSetErrorCallback(
GLFWerrorfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwGetMonitors" )] internal static extern unsafe IntPtr* glfwGetMonitors(
int* count );
[DllImport( SSC_libName, EntryPoint = "glfwGetPrimaryMonitor" )] internal static extern unsafe IntPtr glfwGetPrimaryMonitor(
);
[DllImport( SSC_libName, EntryPoint = "glfwGetMonitorPos" )] internal static extern unsafe void glfwGetMonitorPos(
IntPtr monitor,
int* xpos,
int* ypos );
[DllImport( SSC_libName, EntryPoint = "glfwGetMonitorWorkarea" )] internal static extern unsafe void glfwGetMonitorWorkarea(
IntPtr monitor,
int* xpos,
int* ypos,
int* width,
int* height );
[DllImport( SSC_libName, EntryPoint = "glfwGetMonitorPhysicalSize" )] internal static extern unsafe void glfwGetMonitorPhysicalSize(
IntPtr monitor,
int* widthMM,
int* heightMM );
[DllImport( SSC_libName, EntryPoint = "glfwGetMonitorContentScale" )] internal static extern unsafe void glfwGetMonitorContentScale(
IntPtr monitor,
float* xscale,
float* yscale );
[DllImport( SSC_libName, EntryPoint = "glfwGetMonitorName" )] internal static extern unsafe byte* glfwGetMonitorName(
IntPtr monitor );
[DllImport( SSC_libName, EntryPoint = "glfwSetMonitorUserPointer" )] internal static extern unsafe void glfwSetMonitorUserPointer(
IntPtr monitor,
void* pointer );
[DllImport( SSC_libName, EntryPoint = "glfwGetMonitorUserPointer" )] internal static extern unsafe void* glfwGetMonitorUserPointer(
IntPtr monitor );
[DllImport( SSC_libName, EntryPoint = "glfwSetMonitorCallback" )] internal static extern unsafe GLFWmonitorfun glfwSetMonitorCallback(
GLFWmonitorfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwGetVideoModes" )] internal static extern unsafe glfwVideomode* glfwGetVideoModes(
IntPtr monitor,
int* count );
[DllImport( SSC_libName, EntryPoint = "glfwGetVideoMode" )] internal static extern unsafe glfwVideomode* glfwGetVideoMode(
IntPtr monitor );
[DllImport( SSC_libName, EntryPoint = "glfwSetGamma" )] internal static extern unsafe void glfwSetGamma(
IntPtr monitor,
float gamma );
[DllImport( SSC_libName, EntryPoint = "glfwGetGammaRamp" )] internal static extern unsafe glfwGammaramp* glfwGetGammaRamp(
IntPtr monitor );
[DllImport( SSC_libName, EntryPoint = "glfwSetGammaRamp" )] internal static extern unsafe void glfwSetGammaRamp(
IntPtr monitor,
glfwGammaramp* ramp );
[DllImport( SSC_libName, EntryPoint = "glfwDefaultWindowHints" )] internal static extern unsafe void glfwDefaultWindowHints(
);
[DllImport( SSC_libName, EntryPoint = "glfwWindowHint" )] internal static extern unsafe void glfwWindowHint(
int hint,
int value );
[DllImport( SSC_libName, EntryPoint = "glfwWindowHintString" )] internal static extern unsafe void glfwWindowHintString(
int hint,
byte* value );
[DllImport( SSC_libName, EntryPoint = "glfwCreateWindow" )] internal static extern unsafe IntPtr glfwCreateWindow(
int width,
int height,
byte[] title,
IntPtr monitor,
IntPtr share );
[DllImport( SSC_libName, EntryPoint = "glfwDestroyWindow" )] internal static extern unsafe void glfwDestroyWindow(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwWindowShouldClose" )] internal static extern unsafe int glfwWindowShouldClose(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowShouldClose" )] internal static extern unsafe void glfwSetWindowShouldClose(
IntPtr window,
int value );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowTitle" )] internal static extern unsafe void glfwSetWindowTitle(
IntPtr window,
byte* title );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowIcon" )] internal static extern unsafe void glfwSetWindowIcon(
IntPtr window,
int count,
GLFWimage* images );
[DllImport( SSC_libName, EntryPoint = "glfwGetWindowPos" )] internal static extern unsafe void glfwGetWindowPos(
IntPtr window,
int* xpos,
int* ypos );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowPos" )] internal static extern unsafe void glfwSetWindowPos(
IntPtr window,
int xpos,
int ypos );
[DllImport( SSC_libName, EntryPoint = "glfwGetWindowSize" )] internal static extern unsafe void glfwGetWindowSize(
IntPtr window,
int* width,
int* height );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowSizeLimits" )] internal static extern unsafe void glfwSetWindowSizeLimits(
IntPtr window,
int minwidth,
int minheight,
int maxwidth,
int maxheight );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowAspectRatio" )] internal static extern unsafe void glfwSetWindowAspectRatio(
IntPtr window,
int numer,
int denom );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowSize" )] internal static extern unsafe void glfwSetWindowSize(
IntPtr window,
int width,
int height );
[DllImport( SSC_libName, EntryPoint = "glfwGetFramebufferSize" )] internal static extern unsafe void glfwGetFramebufferSize(
IntPtr window,
int* width,
int* height );
[DllImport( SSC_libName, EntryPoint = "glfwGetWindowFrameSize" )] internal static extern unsafe void glfwGetWindowFrameSize(
IntPtr window,
int* left,
int* top,
int* right,
int* bottom );
[DllImport( SSC_libName, EntryPoint = "glfwGetWindowContentScale" )] internal static extern unsafe void glfwGetWindowContentScale(
IntPtr window,
float* xscale,
float* yscale );
[DllImport( SSC_libName, EntryPoint = "glfwGetWindowOpacity" )] internal static extern unsafe float glfwGetWindowOpacity(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowOpacity" )] internal static extern unsafe void glfwSetWindowOpacity(
IntPtr window,
float opacity );
[DllImport( SSC_libName, EntryPoint = "glfwIconifyWindow" )] internal static extern unsafe void glfwIconifyWindow(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwRestoreWindow" )] internal static extern unsafe void glfwRestoreWindow(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwMaximizeWindow" )] internal static extern unsafe void glfwMaximizeWindow(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwShowWindow" )] internal static extern unsafe void glfwShowWindow(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwHideWindow" )] internal static extern unsafe void glfwHideWindow(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwFocusWindow" )] internal static extern unsafe void glfwFocusWindow(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwRequestWindowAttention" )] internal static extern unsafe void glfwRequestWindowAttention(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwGetWindowMonitor" )] internal static extern unsafe IntPtr glfwGetWindowMonitor(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowMonitor" )] internal static extern unsafe void glfwSetWindowMonitor(
IntPtr window,
IntPtr monitor,
int xpos,
int ypos,
int width,
int height,
int refreshRate );
[DllImport( SSC_libName, EntryPoint = "glfwGetWindowAttrib" )] internal static extern unsafe int glfwGetWindowAttrib(
IntPtr window,
int attrib );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowAttrib" )] internal static extern unsafe void glfwSetWindowAttrib(
IntPtr window,
int attrib,
int value );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowUserPointer" )] internal static extern unsafe void glfwSetWindowUserPointer(
IntPtr window,
void* pointer );
[DllImport( SSC_libName, EntryPoint = "glfwGetWindowUserPointer" )] internal static extern unsafe void* glfwGetWindowUserPointer(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowPosCallback" )] internal static extern unsafe GLFWwindowposfun glfwSetWindowPosCallback(
IntPtr window,
IntPtr callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowSizeCallback" )] internal static extern unsafe GLFWwindowsizefun glfwSetWindowSizeCallback(
IntPtr window,
GLFWwindowsizefun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowCloseCallback" )] internal static extern unsafe GLFWwindowclosefun glfwSetWindowCloseCallback(
IntPtr window,
GLFWwindowclosefun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowRefreshCallback" )] internal static extern unsafe GLFWwindowrefreshfun glfwSetWindowRefreshCallback(
IntPtr window,
GLFWwindowrefreshfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowFocusCallback" )] internal static extern unsafe GLFWwindowfocusfun glfwSetWindowFocusCallback(
IntPtr window,
GLFWwindowfocusfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowIconifyCallback" )] internal static extern unsafe GLFWwindowiconifyfun glfwSetWindowIconifyCallback(
IntPtr window,
GLFWwindowiconifyfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowMaximizeCallback" )] internal static extern unsafe GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(
IntPtr window,
GLFWwindowmaximizefun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetFramebufferSizeCallback" )] internal static extern unsafe FrameBufferSizeHandler glfwSetFramebufferSizeCallback(
IntPtr window,
IntPtr callback );
[DllImport(
SSC_libName,
EntryPoint = "glfwSetWindowContentScaleCallback" )] internal static extern unsafe GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(
IntPtr window,
GLFWwindowcontentscalefun callback );
[DllImport( SSC_libName, EntryPoint = "glfwPollEvents" )] internal static extern unsafe void glfwPollEvents(
);
[DllImport( SSC_libName, EntryPoint = "glfwWaitEvents" )] internal static extern unsafe void glfwWaitEvents(
);
[DllImport( SSC_libName, EntryPoint = "glfwWaitEventsTimeout" )] internal static extern unsafe void glfwWaitEventsTimeout(
double timeout );
[DllImport( SSC_libName, EntryPoint = "glfwPostEmptyEvent" )] internal static extern unsafe void glfwPostEmptyEvent(
);
[DllImport( SSC_libName, EntryPoint = "glfwGetInputMode" )] internal static extern unsafe int glfwGetInputMode(
IntPtr window,
int mode );
[DllImport( SSC_libName, EntryPoint = "glfwSetInputMode" )] internal static extern unsafe void glfwSetInputMode(
IntPtr window,
int mode,
int value );
[DllImport( SSC_libName, EntryPoint = "glfwRawMouseMotionSupported" )] internal static extern unsafe int glfwRawMouseMotionSupported(
);
[DllImport( SSC_libName, EntryPoint = "glfwGetKeyName" )] internal static extern unsafe byte* glfwGetKeyName(
int key,
int scancode );
[DllImport( SSC_libName, EntryPoint = "glfwGetKeyScancode" )] internal static extern unsafe int glfwGetKeyScancode(
int key );
[DllImport( SSC_libName, EntryPoint = "glfwGetKey" )] internal static extern unsafe KeyStatus glfwGetKey(
IntPtr window,
int key );
[DllImport( SSC_libName, EntryPoint = "glfwGetMouseButton" )] internal static extern unsafe int glfwGetMouseButton(
IntPtr window,
int button );
[DllImport( SSC_libName, EntryPoint = "glfwGetCursorPos" )] internal static extern unsafe void glfwGetCursorPos(
IntPtr window,
double* xpos,
double* ypos );
[DllImport( SSC_libName, EntryPoint = "glfwSetCursorPos" )] internal static extern unsafe void glfwSetCursorPos(
IntPtr window,
double xpos,
double ypos );
[DllImport( SSC_libName, EntryPoint = "glfwCreateCursor" )] internal static extern unsafe GLFWcursor* glfwCreateCursor(
GLFWimage* image,
int xhot,
int yhot );
[DllImport( SSC_libName, EntryPoint = "glfwCreateStandardCursor" )] internal static extern unsafe GLFWcursor* glfwCreateStandardCursor(
int shape );
[DllImport( SSC_libName, EntryPoint = "glfwDestroyCursor" )] internal static extern unsafe void glfwDestroyCursor(
GLFWcursor* cursor );
[DllImport( SSC_libName, EntryPoint = "glfwSetCursor" )] internal static extern unsafe void glfwSetCursor(
IntPtr window,
GLFWcursor* cursor );
[DllImport( SSC_libName, EntryPoint = "glfwSetKeyCallback" )] internal static extern unsafe GLFWkeyfun glfwSetKeyCallback(
IntPtr window,
GLFWkeyfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetCharCallback" )] internal static extern unsafe GLFWcharfun glfwSetCharCallback(
IntPtr window,
GLFWcharfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetCharModsCallback" )] internal static extern unsafe GLFWcharmodsfun glfwSetCharModsCallback(
IntPtr window,
GLFWcharmodsfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetMouseButtonCallback" )] internal static extern unsafe GLFWmousebuttonfun glfwSetMouseButtonCallback(
IntPtr window,
GLFWmousebuttonfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetCursorPosCallback" )] internal static extern unsafe GLFWcursorposfun glfwSetCursorPosCallback(
IntPtr window,
GLFWcursorposfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetCursorEnterCallback" )] internal static extern unsafe GLFWcursorenterfun glfwSetCursorEnterCallback(
IntPtr window,
GLFWcursorenterfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetScrollCallback" )] internal static extern unsafe GLFWscrollfun glfwSetScrollCallback(
IntPtr window,
GLFWscrollfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetDropCallback" )] internal static extern unsafe GLFWdropfun glfwSetDropCallback(
IntPtr window,
GLFWdropfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwJoystickPresent" )] internal static extern unsafe int glfwJoystickPresent(
int jid );
[DllImport( SSC_libName, EntryPoint = "glfwGetJoystickAxes" )] internal static extern unsafe float* glfwGetJoystickAxes(
int jid,
int* count );
[DllImport( SSC_libName, EntryPoint = "glfwGetJoystickButtons" )] internal static extern unsafe byte* glfwGetJoystickButtons(
int jid,
int* count );
[DllImport( SSC_libName, EntryPoint = "glfwGetJoystickHats" )] internal static extern unsafe byte* glfwGetJoystickHats(
int jid,
int* count );
[DllImport( SSC_libName, EntryPoint = "glfwGetJoystickName" )] internal static extern unsafe byte* glfwGetJoystickName(
int jid );
[DllImport( SSC_libName, EntryPoint = "glfwGetJoystickGUID" )] internal static extern unsafe byte* glfwGetJoystickGUID(
int jid );
[DllImport( SSC_libName, EntryPoint = "glfwSetJoystickUserPointer" )] internal static extern unsafe void glfwSetJoystickUserPointer(
int jid,
void* pointer );
[DllImport( SSC_libName, EntryPoint = "glfwGetJoystickUserPointer" )] internal static extern unsafe void* glfwGetJoystickUserPointer(
int jid );
[DllImport( SSC_libName, EntryPoint = "glfwJoystickIsGamepad" )] internal static extern unsafe int glfwJoystickIsGamepad(
int jid );
[DllImport( SSC_libName, EntryPoint = "glfwSetJoystickCallback" )] internal static extern unsafe GLFWjoystickfun glfwSetJoystickCallback(
GLFWjoystickfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwUpdateGamepadMappings" )] internal static extern unsafe int glfwUpdateGamepadMappings(
byte* str );
[DllImport( SSC_libName, EntryPoint = "glfwGetGamepadName" )] internal static extern unsafe byte* glfwGetGamepadName(
int jid );
[DllImport( SSC_libName, EntryPoint = "glfwGetGamepadState" )] internal static extern unsafe int glfwGetGamepadState(
int jid,
GLFWgamepadstate* state );
[DllImport( SSC_libName, EntryPoint = "glfwSetClipboardString" )] internal static extern unsafe void glfwSetClipboardString(
IntPtr window,
byte* str );
[DllImport( SSC_libName, EntryPoint = "glfwGetClipboardString" )] internal static extern unsafe byte* glfwGetClipboardString(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwGetTime" )] internal static extern unsafe double glfwGetTime(
);
[DllImport( SSC_libName, EntryPoint = "glfwSetTime" )] internal static extern unsafe void glfwSetTime(
double time );
[DllImport( SSC_libName, EntryPoint = "glfwGetTimerValue" )] internal static extern unsafe ulong* glfwGetTimerValue(
);
[DllImport( SSC_libName, EntryPoint = "glfwGetTimerFrequency" )] internal static extern unsafe ulong* glfwGetTimerFrequency(
);
[DllImport( SSC_libName, EntryPoint = "glfwMakeContextCurrent" )] internal static extern unsafe void glfwMakeContextCurrent(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwGetCurrentContext" )] internal static extern unsafe IntPtr glfwGetCurrentContext(
);
[DllImport( SSC_libName, EntryPoint = "glfwSwapBuffers" )] internal static extern unsafe void glfwSwapBuffers(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwSwapInterval" )] internal static extern unsafe void glfwSwapInterval(
int interval );
[DllImport( SSC_libName, EntryPoint = "glfwExtensionSupported" )] internal static extern unsafe int glfwExtensionSupported(
byte* extension );
[DllImport(
SSC_libName,
EntryPoint = "glfwGetProcAddress",
CharSet = CharSet.Ansi )] internal static extern unsafe IntPtr glfwGetProcAddress(
string procname );
[DllImport( SSC_libName, EntryPoint = "glfwVulkanSupported" )] internal static extern unsafe int glfwVulkanSupported(
);
[DllImport(
SSC_libName,
EntryPoint = "glfwGetRequiredInstanceExtensions" )] internal static extern unsafe byte** glfwGetRequiredInstanceExtensions(
uint* count );
//[DllImport(InternalIO.SSC_libname, EntryPoint = "glfwGetInstanceProcAddress")] internal extern unsafe static GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, byte* procname);
//[DllImport(InternalIO.SSC_libname, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal extern unsafe static int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint* queuefamily);
//[DllImport(InternalIO.SSC_libname, EntryPoint = "glfwCreateWindowSurface")] internal extern unsafe static VkResult glfwCreateWindowSurface(VkInstance instance, glfwWindow* window, VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
#endregion api call
}
}
@@ -0,0 +1,108 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="gl.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;
using StgSharp.Internal.OpenGL;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Internal
{
internal partial class InternalIO
{
[DllImport(
SSC_libName,
EntryPoint = "glCheckShaderStat",
CallingConvention = CallingConvention.Cdecl )]
#pragma warning disable CA5392
internal static extern int glCheckShaderStatus(
ref OpenglContext context,
uint shaderHandle,
int key,
ref IntPtr logPtr );
#pragma warning restore CA5392
#region ssgc api define
[DllImport(
SSC_libName,
EntryPoint = "initGL",
CallingConvention = CallingConvention.Cdecl )]
internal static extern void InternalInitGL(
int majorVersion,
int minorVersion );
[DllImport(
SSC_libName,
EntryPoint = "loadGlfuncDefault",
CallingConvention = CallingConvention.Cdecl,
CharSet = CharSet.Ansi )]
internal static extern IntPtr InternalLoadGlfuncDefault( string name );
[DllImport(
SSC_libName,
EntryPoint = "linkShaderProgram",
CallingConvention = CallingConvention.Cdecl )]
internal static extern unsafe uint InternalLinkShaderProgram(
OpenglContext* context,
uint shaderProgram );
[DllImport(
SSC_libName,
EntryPoint = "readLog",
CallingConvention = CallingConvention.Cdecl )]
internal static extern unsafe IntPtr InternalReadSSCLog();
[DllImport(
SSC_libName,
EntryPoint = "loadImageData",
CallingConvention = CallingConvention.Cdecl,
CharSet = CharSet.Ansi )]
internal static extern unsafe void InternalLoadImage(
string fileName,
ImageInfo* output,
ImageLoader loader );
[DllImport(
SSC_libName,
EntryPoint = "unloadImageData",
CallingConvention = CallingConvention.Cdecl,
CharSet = CharSet.Ansi )]
internal static extern unsafe void InternalUnloadImage(
ImageInfo* output );
#endregion ssgc api define
}
}
@@ -0,0 +1,146 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="InternalIO.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.Internal;
using StgSharp.Internal.OpenGL;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace StgSharp.Internal
{
internal static unsafe partial class InternalIO
{
internal const string SS_errorLog =
"SS_errorlog.log";
internal const string SSC_libName =
"StgSharpC";
internal static Dictionary<TypeCode, uint> GLtype =
new Dictionary<TypeCode, uint>();
internal static readonly GCHandle ssc_logHandle =
GCHandle.Alloc( new byte[512], GCHandleType.Pinned );
internal static IntPtr SSClibPtr = IntPtr.Zero;
internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(
1, 1 );
static InternalIO()
{
GLtype.Add( TypeCode.Single, glConst.FLOAT );
GLtype.Add( TypeCode.Int32, glConst.INT );
GLtype.Add( TypeCode.UInt32, glConst.UNSIGNED_INT );
GLtype.Add( TypeCode.Int16, glConst.SHORT );
GLtype.Add( TypeCode.UInt16, glConst.UNSIGNED_SHORT );
GLtype.Add( TypeCode.SByte, glConst.BYTE );
GLtype.Add( TypeCode.Byte, glConst.UNSIGNED_BYTE );
}
internal static void InternalAppendLog( string log )
{
if( !File.Exists( SS_errorLog ) ) {
FileStream stream = File.Create( SS_errorLog );
stream.Close();
}
using( StreamWriter logStream = File.AppendText( SS_errorLog ) ) {
logStream.WriteLine( log );
}
}
[Obsolete( "Not completed", true )]
internal static IntPtr InternalLoadProc<T>( IntPtr lib, string name )
where T: Delegate
{
try {
IntPtr procPtr =
#if WINDOWS
IntPtr.Zero;
#elif LINUX
#else
IntPtr.Zero;
#endif
return procPtr;
}
catch( Exception ) {
throw;
}
}
internal static void InternalWriteLog( string logLine, LogType logType )
{
logSyncSemaphore.Wait();
if( !File.Exists( SS_errorLog ) ) {
FileStream stream = File.Create( SS_errorLog );
stream.Close();
}
using( StreamWriter logStream = File.AppendText( SS_errorLog ) ) {
logStream.WriteLine(
$"{logType}\t{DateTime.Now.ToString("o")}" );
logStream.WriteLine( logLine );
}
logSyncSemaphore.Release();
}
internal static void InternalWriteLog(
string beforeTime,
string logLine,
LogType logType )
{
logSyncSemaphore.Wait();
if( !File.Exists( InternalIO.SS_errorLog ) ) {
FileStream stream = File.Create( InternalIO.SS_errorLog );
stream.Close();
}
using( StreamWriter logStream = File.AppendText( SS_errorLog ) ) {
logStream.WriteLine( beforeTime );
logStream.WriteLine(
$"{logType}\t@\t{DateTime.Now.ToString("o")}" );
logStream.WriteLine( logLine );
}
logSyncSemaphore.Release( 1 );
}
}
}
@@ -0,0 +1,99 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="InternalResource.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 System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Internal
{
internal partial class InternalIO
{
#region ControllingItemRender
internal const string ControlItemRenderVertexShader = """
""";
#endregion
#region CollisionTexture
internal const string CollisionTextureVertexShader = """
#version 430 core
layout(location = 0) in vec2 localCollisionCoord;
layout(location = 1) in vec2 spaceCoord;
layout(location = 2) in float rotation;
layout(location = 3) in float scaling;
uniform vec2 target;
uniform mat2 projection;
void main()
{
mat2 scaling = mat2(
scaling,0,
0,scaling );
mat2 rotation = mat2(
cos(rotation),-sin(rotation),
sin(rotation),cos(rotation) );
vec2 realCoord = (rotation * scaling * localCollisionCoord) + spaceCoord - target;
realCoord = projection * realCoord;
float dist = distance(realCoord, vec2(0,0));
float angle = atan(realCoord.y, realCoord.x);
gl_Position = vec4(angle, realCoord.y, dist, 1);
}
""";
internal const string CollisionTextureFragmentShader = """
#version 430 core
out vec4 Color;
uniform float range;
void main()
{
float dist = gl_FragCoord.z;
if(dist > range)
{
discard;
}
dist /= range;
gl_FragDepth = min(dist, gl_FragDepth);
Color = vec4(dist,0,0,1);
}
""";
#endregion
}
}
@@ -0,0 +1,91 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ColumnSet2.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;
using StgSharp.Internal.Intrinsic;
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Internal.Intrinsic
{
[StructLayout( LayoutKind.Explicit, Size = 12 * sizeof( float ), Pack = 16 )]
internal struct ColumnSet2 : IEquatable<ColumnSet2>
{
[FieldOffset( 0 * sizeof( float ) )] internal float m00;
[FieldOffset( 4 * sizeof( float ) )] internal float m01;
[FieldOffset( 1 * sizeof( float ) )] internal float m10;
[FieldOffset( 5 * sizeof( float ) )] internal float m11;
[FieldOffset( 2 * sizeof( float ) )] internal float m20;
[FieldOffset( 6 * sizeof( float ) )] internal float m21;
[FieldOffset( 3 * sizeof( float ) )] internal float m30;
[FieldOffset( 7 * sizeof( float ) )] internal float m31;
[FieldOffset( 0 )] internal Vector4 colum0;
[FieldOffset( 4 * sizeof( float ) )] internal Vector4 colum1;
internal ColumnSet2( Vector4 c0, Vector4 c1 )
{
Unsafe.SkipInit( out this );
colum0 = c0;
colum1 = c1;
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public override bool Equals( object? obj )
{
return ( obj is ColumnSet2 mat ) && Equals( mat );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public bool Equals( ColumnSet2 other )
{
return colum0.Equals( other.colum0 ) && colum1.Equals(
other.colum1 );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static bool operator !=( ColumnSet2 left, ColumnSet2 right )
{
return !( left == right );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static bool operator ==( ColumnSet2 left, ColumnSet2 right )
{
return left.Equals( right );
}
}
}
@@ -0,0 +1,87 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ColumnSet3.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.Internal.Intrinsic;
using StgSharp.Math;
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace StgSharp.Internal.Intrinsic
{
[StructLayout( LayoutKind.Explicit, Size = 12 * sizeof( float ), Pack = 16 )]
internal struct ColumnSet3 : IEquatable<ColumnSet3>, IMat
{
[FieldOffset( 0 * sizeof( float ) )] internal float m00;
[FieldOffset( 4 * sizeof( float ) )] internal float m01;
[FieldOffset( 8 * sizeof( float ) )] internal float m02;
[FieldOffset( 1 * sizeof( float ) )] internal float m10;
[FieldOffset( 5 * sizeof( float ) )] internal float m11;
[FieldOffset( 9 * sizeof( float ) )] internal float m12;
[FieldOffset( 2 * sizeof( float ) )] internal float m20;
[FieldOffset( 6 * sizeof( float ) )] internal float m21;
[FieldOffset( 10 * sizeof( float ) )] internal float m22;
[FieldOffset( 3 * sizeof( float ) )] internal float m30;
[FieldOffset( 7 * sizeof( float ) )] internal float m31;
[FieldOffset( 11 * sizeof( float ) )] internal float m32;
[FieldOffset( 0 )] internal Vector4 colum0;
[FieldOffset( 4 * sizeof( float ) )] internal Vector4 colum1;
[FieldOffset( 8 * sizeof( float ) )] internal Vector4 colum2;
public override bool Equals( object? obj )
{
return ( obj is ColumnSet3 mat ) && Equals( mat );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public bool Equals( ColumnSet3 other )
{
return colum0.Equals( other.colum0 ) && colum1.Equals(
other.colum1 ) && colum2.Equals( other.colum2 );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static bool operator !=( ColumnSet3 left, ColumnSet3 right )
{
return !( left == right );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static bool operator ==( ColumnSet3 left, ColumnSet3 right )
{
return left.Equals( right );
}
}
}
@@ -0,0 +1,107 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ColumnSet4.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;
using StgSharp.Internal.Intrinsic;
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace StgSharp.Internal.Intrinsic
{
[StructLayout( LayoutKind.Explicit, Size = 16 * sizeof( float ) )]
internal struct ColumnSet4 : IEquatable<ColumnSet4>, IMat
{
[FieldOffset( 0 )] internal Vector4 colum0;
[FieldOffset( 16 )] internal Vector4 colum1;
[FieldOffset( 32 )] internal Vector4 colum2;
[FieldOffset( 48 )] internal Vector4 colum3;
[FieldOffset( 0 )] public float m00;
[FieldOffset( 16 )] public float m01;
[FieldOffset( 32 )] public float m02;
[FieldOffset( 48 )] public float m03;
[FieldOffset( 4 )] public float m10;
[FieldOffset( 20 )] public float m11;
[FieldOffset( 36 )] public float m12;
[FieldOffset( 52 )] public float m13;
[FieldOffset( 8 )] public float m20;
[FieldOffset( 24 )] public float m21;
[FieldOffset( 40 )] public float m22;
[FieldOffset( 56 )] public float m23;
[FieldOffset( 12 )] public float m30;
[FieldOffset( 28 )] public float m31;
[FieldOffset( 44 )] public float m32;
[FieldOffset( 60 )] public float m33;
[MethodImpl( MethodImplOptions.AggressiveInlining )]
internal ColumnSet4(
Vector4 colum0,
Vector4 colum1,
Vector4 colum2,
Vector4 colum3 )
{
Unsafe.SkipInit( out this );
this.colum0 = colum0;
this.colum1 = colum1;
this.colum2 = colum2;
this.colum3 = colum3;
}
public override bool Equals( object? obj )
{
return ( obj is ColumnSet4 mat ) && Equals( mat );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public bool Equals( ColumnSet4 other )
{
return colum0.Equals( other.colum0 ) && colum1.Equals(
other.colum1 ) && colum2.Equals( other.colum2 ) && colum3.Equals(
other.colum3 );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static bool operator !=( ColumnSet4 left, ColumnSet4 right )
{
return !( left == right );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static bool operator ==( ColumnSet4 left, ColumnSet4 right )
{
return left.Equals( right );
}
}
}
@@ -0,0 +1,61 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="IRegisterType.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 System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Internal.Intrinsic
{
public interface IRegisterType
{
public T Read<T>( int index )
where T: struct
#if NET8_0_OR_GREATER
, INumber
#else
, IConvertible
#endif
;
public void Write<T>( int index, T value )
where T: struct
#if NET8_0_OR_GREATER
, INumber
#else
, IConvertible
#endif
;
}
}
@@ -0,0 +1,69 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="IntrinsicContext.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;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Internal.Intrinsic
{
[StructLayout( LayoutKind.Sequential )]
internal unsafe struct IntrinsicContext
{
public delegate* unmanaged[Cdecl]<ColumnSet2*, ColumnSet2*, ColumnSet2*, void> add_mat_2;
public delegate* unmanaged[Cdecl]<ColumnSet3*, ColumnSet3*, ColumnSet3*, void> add_mat_3;
public delegate* unmanaged[Cdecl]<ColumnSet4*, ColumnSet4*, ColumnSet4*, void> add_mat_4;
public delegate* unmanaged[Cdecl]<ColumnSet3*, ColumnSet3*, float> det_mat_3;
public delegate* unmanaged[Cdecl]<ColumnSet4*, ColumnSet4*, float> det_mat_4;
public delegate* unmanaged[Cdecl]<ColumnSet3*, Vector4*, Vector4*, void> dot_31;
public delegate* unmanaged[Cdecl]<ColumnSet3*, Vector4*, Vector4*, void> dot_32;
public delegate* unmanaged[Cdecl]<ColumnSet4*, Vector4*, Vector4*, void> dot_41;
public delegate* unmanaged[Cdecl]<ColumnSet4*, Vector4*, Vector4*, void> dot_42;
public delegate* unmanaged[Cdecl]<ColumnSet4*, Vector4*, Vector4*, void> dot_43;
public delegate* unmanaged[Cdecl]<M128*, M128*, void> normalize_v3;
public delegate* unmanaged[Cdecl]<char*, int, int> string_quickHash;
public delegate* unmanaged[Cdecl]<ColumnSet2*, ColumnSet3*, void> transpose23;
public delegate* unmanaged[Cdecl]<ColumnSet2*, ColumnSet4*, void> transpose24;
public delegate* unmanaged[Cdecl]<ColumnSet3*, ColumnSet2*, void> transpose32;
public delegate* unmanaged[Cdecl]<ColumnSet3*, ColumnSet3*, void> transpose33;
public delegate* unmanaged[Cdecl]<ColumnSet3*, ColumnSet4*, void> transpose34;
public delegate* unmanaged[Cdecl]<ColumnSet4*, ColumnSet2*, void> transpose42;
public delegate* unmanaged[Cdecl]<ColumnSet4*, ColumnSet3*, void> transpose43;
public delegate* unmanaged[Cdecl]<ColumnSet4*, ColumnSet4*, void> transpose44;
}
}
@@ -0,0 +1,194 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="M128.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 System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
#if NET5_0_OR_GREATER
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
#endif
using System.Text;
namespace StgSharp.Internal.Intrinsic
{
[StructLayout( LayoutKind.Explicit, Pack = 16 )]
public unsafe struct M128 : IRegisterType
{
[FieldOffset( 0 )] internal Vector4 vec;
internal M128( Vector4 v )
{
vec = v;
}
public override bool Equals( [NotNullWhen( true )] object obj )
{
if( obj is not M128 other ) {
return false;
}
return this == other;
}
public override int GetHashCode()
{
return vec.GetHashCode();
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public T Read<T>( int index )
where T: struct
#if NET8_0_OR_GREATER
, INumber
#else
, IConvertible
#endif
{
fixed( Vector4* p = &vec ) {
#pragma warning disable CS8500
return *( ( T* )p + index );
#pragma warning restore CS8500
}
}
public override string ToString()
{
return string.Empty;
}
public string ToString( int sample )
{
string str = string.Empty;
for( int i = 15; i >= 0; i-- ) {
str += $"{Convert.ToString(Read<byte>(i), sample)} ";
}
return str;
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void Write<T>( int index, T value )
where T: struct
#if NET8_0_OR_GREATER
, INumber
#else
, IConvertible
#endif
{
fixed( Vector4* p = &vec ) {
#pragma warning disable CS8500
*( ( T* )p + index ) = value;
#pragma warning restore CS8500
}
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static bool operator !=( M128 left, M128 right )
{
return left.vec != right.vec;
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static bool operator ==( M128 left, M128 right )
{
return left.vec == right.vec;
}
#if NET5_0_OR_GREATER
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static explicit operator Vector128<byte>( M128 m )
{
return m.vec.AsVector128().As<float, byte>();
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static explicit operator Vector128<sbyte>( M128 m )
{
return m.vec.AsVector128().As<float, sbyte>();
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static explicit operator Vector128<short>( M128 m )
{
return m.vec.AsVector128().As<float, short>();
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static explicit operator Vector128<ushort>( M128 m )
{
return m.vec.AsVector128().As<float, ushort>();
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static explicit operator Vector128<int>( M128 m )
{
return m.vec.AsVector128().As<float, int>();
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static explicit operator Vector128<uint>( M128 m )
{
return m.vec.AsVector128().As<float, uint>();
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static explicit operator Vector128<long>( M128 m )
{
return m.vec.AsVector128().As<float, long>();
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static explicit operator Vector128<ulong>( M128 m )
{
return m.vec.AsVector128().As<float, ulong>();
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static explicit operator Vector128<float>( M128 m )
{
return m.vec.AsVector128().As<float, float>();
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static explicit operator Vector128<double>( M128 m )
{
return m.vec.AsVector128().As<float, double>();
}
#endif
}
}
@@ -0,0 +1,75 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="M256.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 System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Internal.Intrinsic
{
[StructLayout( LayoutKind.Sequential )]
public unsafe struct M256 : IRegisterType
{
private M128 v0;
private M128 v1;
public T Read<T>( int index )
where T: struct
#if NET8_0_OR_GREATER
, INumber
#else
, IConvertible
#endif
{
fixed( M128* mptr = &v0 ) {
return *( ( T* )mptr + index );
}
}
public void Write<T>( int index, T value )
where T: struct
#if NET8_0_OR_GREATER
, INumber
#else
, IConvertible
#endif
{
fixed( M128* mptr = &v0 ) {
*( ( T* )mptr + index ) = value;
}
}
}
}
@@ -0,0 +1,38 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="MatInterface.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 System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Internal.Intrinsic
{
public interface IMat { }
}
@@ -0,0 +1,77 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="intrinsicContextProvider.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.Internal.Intrinsic;
using System;
using System.Reflection;
using System.Runtime.InteropServices;
namespace StgSharp.Internal
{
internal static unsafe partial class InternalIO
{
private static readonly IntrinsicContext _intrinsicContext = new IntrinsicContext(
);
internal static IntrinsicContext Intrinsic
{
get => _intrinsicContext;
}
internal static void InitIntrinsicContext()
{
int statCode;
fixed( IntrinsicContext* cptr = &_intrinsicContext ) {
statCode = LoadIntrinsicFunction( cptr );
}
switch( statCode ) {
case 0:
//Dialogue.PostError(new PlatformNotSupportedException("No SIMD instructions supported on current hardware platform"));
Environment.Exit( -1 );
break;
default:
break;
}
}
[DllImport(
SSC_libName,
CallingConvention = CallingConvention.Cdecl,
EntryPoint = "load_intrinsic_function" )]
private static extern int LoadIntrinsicFunction(
IntrinsicContext* context );
}
}
@@ -0,0 +1,960 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="StructDefine.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.Internal.OpenGL;
using System;
using System.Runtime.InteropServices;
/**/
namespace StgSharp.Internal
{
//rename types in style of GLFW
using GLFWbool = Boolean;
//strucs defined in GLFW3.h
#region GLFW3 struct
[StructLayout( LayoutKind.Sequential )]
public unsafe struct GLFWcontext
{
private delegate*<byte*> extensionSupported;
private delegate*<delegate*<void>, void> getProcAddress;
/*
void (* makeCurrent) (glfwWindow*);
void (* swapBuffers) (glfwWindow*);
void (* swapInterval) (int);
int (* extensionSupported) (const byte*);
GLFWglproc(*getProcAddress)(const byte*);
void (* destroy) (glfwWindow*);
*/
private delegate*<glfwWindow*> makeCurrent;
private delegate*<glfwWindow*> swapBuffer;
private delegate*<int> swapInterval;
private GLFWbool forward, debug, noerror;
private int client;
private int major, minor, revision;
private int profile;
private int release;
private int robustness;
private int source;
private IntPtr destroy;
//PFNGLGETINTEGERVPROC GetIntegerv;
private IntPtr GetIntegerv;
//PFNGLGETSTRINGPROC GetString;
private IntPtr GetString;
//PFNGLGETSTRINGIPROC GetStringi;
private IntPtr GetStringi;
internal struct egl
{
private void* client;
/*
EGLConfig config;
EGLContext handle;
EGLSurface surface;
*/
private void* config;
private void* handle;
private void* surface;
}
internal struct osmesa
{
private void* buffer;
//OSMesaContext handle;
private void* handle;
private int height;
private int width;
}
// This is defined in platform.h
//GLFW_PLATFORM_CONTEXT_STATE
}
[StructLayout( LayoutKind.Sequential )]
public unsafe struct glfwVideomode
{
/*! The refresh rate, in Hz, of the video mode.
*/
private int refreshRate;
/*! The bit depth of the blue channel of the video mode.
*/
public int blueBits;
/*! The bit depth of the green channel of the video mode.
*/
public int greenBits;
/*! The height, in screen coordinates, of the video mode.
*/
public int height;
/*! The bit depth of the red channel of the video mode.
*/
public int redBits;
/*! The width, in screen coordinates, of the video mode.
*/
public int width;
}
[StructLayout( LayoutKind.Sequential )]
public unsafe struct glfwGammaramp
{
/*! An array of value describing the response of the blue channel.
*/
private ushort* blue;
/*! An array of value describing the response of the green channel.
*/
private ushort* green;
/*! An array of value describing the response of the red channel.
*/
private ushort* red;
/*! The number of elements in each array.
*/
private uint size;
}
[StructLayout( LayoutKind.Sequential )]
public unsafe struct GLFWimage
{
/*! The pixel _data of this image, arranged left-to-right, top-to-bottom.
*/
private byte* pixels;
/*! The height, in pixels, of this image.
*/
private int height;
/*! The width, in pixels, of this image.
*/
private int width;
}
[StructLayout( LayoutKind.Sequential )]
public unsafe struct GLFWgamepadstate
{
/*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS`
* or `GLFW_RELEASE`.
*/
public fixed byte buttons[ 15 ];
/*! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0
* to 1.0 inclusive.
*/
public fixed float axes[ 6 ];
}
[StructLayout( LayoutKind.Sequential )]
public unsafe struct GLFWallocator
{
private void* user;
//GLFWallocatefun allocate;
private IntPtr allocate;
//GLFWdeallocatefun deallocate;
private IntPtr deallocate;
//GLFWreallocatefun reallocate;
private IntPtr reallocate;
}
[StructLayout( LayoutKind.Sequential )]
public unsafe struct glfwMonitor
{
private glfwVideomode* modes;
private glfwWindow* window;
private fixed byte name[ 128 ];
private glfwGammaramp currentRamp;
private glfwGammaramp originalRamp;
private glfwVideomode currentMode;
private int modeCount;
private int width, height;
private IntPtr userPointer;
public glfwMonitor() { }
public unsafe string Name
{
get
{
fixed( byte* cptr = name ) {
return Marshal.PtrToStringAnsi( ( IntPtr )cptr );
}
}
}
}
[StructLayout( LayoutKind.Sequential )]
internal unsafe struct glfwWindow
{
private glfwWindow* next;
private void* userPointer;
private bool rawMouseMotion;
private Callbacks callbacks;
// Virtual cursor position when cursor is disabled
private double virtualCursorPosX, virtualCursorPosY;
private int autoIconify;
private int cursorMode;
private int decorated;
private int doublebuffer;
private int floating;
private int focusOnShow;
private int lockKeyMods;
private int maxwidth, maxheight;
private int minwidth, minheight;
private int mousePassthrough;
private int numer, denom;
// Window settings and state
private int resizable;
private int shouldClose;
private int stickyKeys;
private int stickyMouseButtons;
private IntPtr cursor; // _GLFWcursor* cursor;
// glfwVideomode videoMode; // 根据GLFWvidmode的定义转换
private IntPtr monitor; // _GLFWmonitor* monitor;
public fixed byte keys[ glConst.GLFW_KEY_LAST + 1 ];
public fixed byte mouseButtons[ glConst.GLFW_MOUSE_BUTTON_LAST + 1 ];
// _GLFWcontext viewPortDisplay; // 根据_GLFWcontext的定义转换
// Callbacks are represented as IntPtr since we don't need the actual function pointers in C#
internal struct Callbacks
{
internal IntPtr character;
internal IntPtr charmods;
internal IntPtr close;
internal IntPtr cursorEnter;
internal IntPtr cursorPos;
internal IntPtr drop;
internal IntPtr fbsize;
internal IntPtr focus;
internal IntPtr iconify;
internal IntPtr key;
internal IntPtr maximize;
internal IntPtr mouseButton;
internal IntPtr pos;
internal IntPtr refresh;
internal IntPtr scale;
internal IntPtr scroll;
internal IntPtr size;
}
// GLFW_PLATFORM_WINDOW_STATE platformWindowState;
}
[StructLayout( LayoutKind.Sequential )]
public struct GLFWwindowCallback { }
[StructLayout( LayoutKind.Sequential )]
public struct GLFWcursor
{
//GLFWcursor* next;
private IntPtr next;
// This is defined in platform.h
// not completed in tranformation
// GLFW_PLATFORM_CURSOR_STATE;
}
/*
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWerror
{
//GLFWerror* next;
IntPtr next;
int code;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)glConst.GLFW_MESSAGE_SIZE)]
byte[] description = new byte[glConst.GLFW_MESSAGE_SIZE];
public GLFWerror()
{
}
}
*/
[StructLayout( LayoutKind.Sequential )]
public unsafe struct GLFWinitconfig
{
private GLFWbool hatButtons;
private int angleType;
private int platformID;
//PFN_vkGetInstanceProcAddr vulkanLoader;
private IntPtr vulkanLoader;
}
[StructLayout( LayoutKind.Sequential )]
public unsafe struct GLFWwndconfig
{
private byte* title;
private GLFWbool autoIconify;
private GLFWbool centerCursor;
private GLFWbool decorated;
private GLFWbool floating;
private GLFWbool focused;
private GLFWbool focusOnShow;
private GLFWbool maximized;
private GLFWbool mousePassthrough;
private GLFWbool resizable;
private GLFWbool scaleToMonitor;
private GLFWbool visible;
private int height;
private int width;
private int xpos;
private int ypos;
internal Ns ns = new Ns();
internal Win32 win32 = new Win32();
internal Wl wl = new Wl();
internal X11 x11 = new X11();
public GLFWwndconfig() { }
internal struct Ns
{
private GLFWbool retina = false;
public fixed byte frameName[ 256 ];
public Ns() { }
}
internal struct X11
{
public fixed byte className[ 256 ];
public fixed byte instanceName[ 256 ];
public X11() { }
}
internal struct Win32
{
private GLFWbool keymenu;
}
internal struct Wl
{
public fixed byte appId[ 256 ];
public Wl() { }
}
}
[StructLayout( LayoutKind.Sequential )]
public unsafe struct GLFWctxconfig
{
private GLFWbool debug;
private GLFWbool forward;
private GLFWbool noerror;
private int client;
private int major;
private int minor;
private int profile;
private int release;
private int robustness;
private int source;
//glfwWindow* share;
private IntPtr share;
internal Nsgl nsgl = new Nsgl();
public GLFWctxconfig() { }
internal struct Nsgl
{
private GLFWbool offline;
}
}
[StructLayout( LayoutKind.Sequential )]
public unsafe struct GLFWfbconfig
{
private GLFWbool doublebuffer;
private GLFWbool sRGB;
private GLFWbool stereo;
private GLFWbool transparent;
private int accumAlphaBits;
private int accumBlueBits;
private int accumGreenBits;
private int accumRedBits;
private int alphaBits;
private int auxBuffers;
private int blueBits;
private int depthBits;
private int greenBits;
private int redBits;
private int samples;
private int stencilBits;
private uintptr_t handle;
}
[StructLayout( LayoutKind.Sequential )]
internal unsafe struct GLFWlibrary
{
[MarshalAs(
UnmanagedType.ByValArray,
SizeConst = glConst.GLFW_JOYSTICK_LAST + 1 )]
private GLFWjoystick[] joysticks = new GLFWjoystick[glConst.GLFW_JOYSTICK_LAST + 1];
private GLFWallocator allocator;
private GLFWbool initialized;
private GLFWbool joysticksInitialized;
private GLFWls contextSlot;
private GLFWls errorSlot;
private GLFWmutex errorLock;
private GLFWplatform platform;
private int mappingCount;
private int monitorCount;
//GLFWcursor* cursorListHead;
private IntPtr cursorListHead;
//GLFWerror* errorListHead;
private IntPtr errorListHead;
//GLFWmapping* mappings;
private IntPtr mappings;
//GLFWmonitor** monitors;
private IntPtr monitors;
//glfwWindow* windowListHead;
private IntPtr windowListHead;
internal Callbacks callbacks = new Callbacks();
internal Egl egl = new Egl();
internal Hints hints = new Hints();
internal Osmesa osmesa = new Osmesa();
public GLFWlibrary() { }
internal unsafe struct Hints
{
private GLFWctxconfig context;
private GLFWfbconfig framebuffer;
private GLFWinitconfig init;
private GLFWwndconfig window;
private int refreshRate;
}
internal unsafe struct timer
{
private ulong offset;
// This is defined in platform.h
//not transformed function defination
//GLFW_PLATFORM_LIBRARY_TIMER_STATE
}
internal unsafe struct Egl
{
internal void* display;
internal void* handle;
internal bool ANGLE_platform_angle;
internal bool ANGLE_platform_angle_d3d;
internal bool ANGLE_platform_angle_metal;
internal bool ANGLE_platform_angle_opengl;
internal bool ANGLE_platform_angle_vulkan;
internal bool EXT_client_extensions;
internal bool EXT_platform_base;
internal bool EXT_platform_wayland;
internal bool EXT_platform_x11;
internal bool EXT_present_opaque;
internal bool KHR_colorSpace;
internal bool KHR_context_flush_control;
internal bool KHR_create_context;
internal bool KHR_create_context_no_error;
internal bool KHR_get_all_proc_addresses;
internal bool prefix;
internal int major, minor;
internal int platform;
internal IntPtr BindAPI;
internal IntPtr CreateContext;
internal IntPtr CreatePlatformWindowSurfaceEXT;
internal IntPtr CreateWindowSurface;
internal IntPtr DestroyContext;
internal IntPtr DestroySurface;
internal IntPtr GetConfigAttrib;
internal IntPtr GetConfigs;
internal IntPtr GetDisplay;
internal IntPtr GetError;
internal IntPtr GetPlatformDisplayEXT;
internal IntPtr GetProcAddress;
internal IntPtr Initialize;
internal IntPtr MakeCurrent;
internal IntPtr QueryString;
internal IntPtr SwapBuffers;
internal IntPtr SwapInterval;
internal IntPtr Terminate;
}
internal unsafe struct Osmesa
{
private void* handle;
private IntPtr CreateContextAttribs;
private IntPtr CreateContextExt;
private IntPtr DestroyContext;
private IntPtr GetColorBuffer;
private IntPtr GetDepthBuffer;
private IntPtr GetProcAddress;
private IntPtr MakeCurrent;
}
internal unsafe struct vk
{
private void* handle;
private GLFWbool available;
private GLFWbool EXT_metal_surface;
private GLFWbool KHR_surface;
private GLFWbool KHR_wayland_surface;
private GLFWbool KHR_win32_surface;
private GLFWbool KHR_xcb_surface;
private GLFWbool KHR_xlib_surface;
private GLFWbool MVK_macos_surface;
private IntPtr GetInstanceProcAddr;
private fixed ulong extensions[ 2 ];
public vk() { }
}
internal unsafe struct Callbacks
{
private IntPtr joystick;
private IntPtr monitor;
}
}
[StructLayout( LayoutKind.Sequential )]
public unsafe struct GLFWmapelement
{
private byte index;
private byte type;
private sbyte axisOffset;
private sbyte axisScale;
}
[StructLayout( LayoutKind.Sequential )]
public unsafe struct GLFWmapping
{
[MarshalAs( UnmanagedType.ByValArray, SizeConst = 6 )]
private GLFWmapelement[] axes = new GLFWmapelement[6];
[MarshalAs( UnmanagedType.ByValArray, SizeConst = 15 )]
private GLFWmapelement[] buttons = new GLFWmapelement[15];
private fixed byte guid[ 33 ];
private fixed byte name[ 128 ];
public GLFWmapping() { }
}
[StructLayout( LayoutKind.Sequential )]
public unsafe struct GLFWjoystick
{
private float* axes;
private byte* buttons;
private byte* hats;
private void* userPointer;
private fixed byte guid[ 33 ];
private fixed byte name[ 128 ];
private GLFWbool allocated;
private GLFWbool connected;
private int axisCount;
private int buttonCount;
private int hatCount;
//GLFWmapping* mapping;
private IntPtr mapping;
// This is defined in platform.h
// not completed in transforming
// GLFW_PLATFORM_JOYSTICK_STATE;
public GLFWjoystick() { }
}
[StructLayout( LayoutKind.Sequential )]
public unsafe struct GLFWls
{
// This is defined in platform.h
//GLFW_PLATFORM_TLS_STATE
}
[StructLayout( LayoutKind.Sequential )]
public unsafe struct GLFWplatform
{
private int platformID;
// init
//GLFWbool(*init)(void);
private IntPtr init;
//void (* terminate) (void);
private IntPtr terminate;
internal IntPtr createCursor;
internal IntPtr createStandardCursor;
// window
internal IntPtr createWindow;
internal IntPtr destroyCursor;
internal IntPtr destroyWindow;
internal IntPtr focusWindow;
internal IntPtr framebufferTransparent;
// monitor
internal IntPtr freeMonitor;
internal IntPtr getClipboardString;
internal IntPtr getEGLNativeDisplay;
internal IntPtr getEGLNativeWindow;
// EGL
//EGLenum(*getEGLPlatform)(EGLint**);
//EGLNativeDisplayType(*getEGLNativeDisplay)(void);
//EGLNativeWindowType(*getEGLNativeWindow)(glfwWindow*);
internal IntPtr getEGLPlatform;
internal IntPtr getFramebufferSize;
internal IntPtr getGammaRamp;
internal IntPtr getKeyScancode;
internal IntPtr getMappingName;
internal IntPtr getMonitorContentScale;
internal IntPtr getMonitorPos;
internal IntPtr getMonitorWorkarea;
// vulkan
//void (* getRequiredInstanceExtensions) (byte**);
//GLFWbool(*getPhysicalDevicePresentationSupport)(VkInstance, VkPhysicalDevice, uint32_t);
//VkResult(*createWindowSurface)(VkInstance, glfwWindow*,const VkAllocationCallbacks*, VkSurfaceKHR*);
internal IntPtr getRequiredInstanceExtensions;
internal IntPtr getScancodeName;
internal IntPtr getVideoMode;
internal IntPtr getVideoModes;
internal IntPtr getWindowContentScale;
internal IntPtr getWindowFrameSize;
internal IntPtr getWindowOpacity;
internal IntPtr getWindowPos;
internal IntPtr getWindowSize;
internal IntPtr GLFWwindow;
internal IntPtr hideWindow;
internal IntPtr iconifyWindow;
internal IntPtr initJoysticks;
internal IntPtr maximizeWindow;
internal IntPtr pollEvents;
internal IntPtr pollJoystick;
internal IntPtr postEmptyEvent;
internal IntPtr rawMouseMotionSupported;
internal IntPtr requestWindowAttention;
internal IntPtr restoreWindow;
internal IntPtr setClipboardString;
internal IntPtr setCursor;
internal IntPtr setCursorMode;
#region input
/* void (* getCursorPos) (glfwWindow*, double*, double*);
void (* setCursorPos) (glfwWindow*, double, double);
void (* setCursorMode) (glfwWindow*, int);
void (* setRawMouseMotion) (glfwWindow*, GLFWbool);
GLFWbool(*rawMouseMotionSupported)(void);
GLFWbool(*createCursor)(GLFWcursor*,const GLFWimage*,int,int);
GLFWbool(*createStandardCursor)(GLFWcursor*, int);
void (* destroyCursor) (GLFWcursor*);
void (* setCursor) (glfwWindow*, GLFWcursor*);
const byte* (*getScancodeName)(int);
int (* getKeyScancode) (int);
void (* setClipboardString) (const byte*);
const byte* (*getClipboardString)(void);
GLFWbool(*initJoysticks)(void);
void (* terminateJoysticks) (void);
GLFWbool(*pollJoystick)(GLFWjoystick*, int);
const byte* (*getMappingName)(void);
void (* updateGamepadGUID) (byte*);
// monitor
void (* freeMonitor) (GLFWmonitor*);
void (* getMonitorPos) (GLFWmonitor*, int*, int*);
void (* getMonitorContentScale) (GLFWmonitor*, float*, float*);
void (* getMonitorWorkarea) (GLFWmonitor*, int*, int*, int*, int*);
glfwVideomode* (* getVideoModes) (GLFWmonitor*, int*);
void (* getVideoMode) (GLFWmonitor*, glfwVideomode*);
GLFWbool(*getGammaRamp)(GLFWmonitor*, glfwGammaramp*);
void (* setGammaRamp) (GLFWmonitor*,const glfwGammaramp*);
// window
GLFWbool(*createWindow)(glfwWindow*,const GLFWwndconfig*,const GLFWctxconfig*,const GLFWfbconfig*);
void (* destroyWindow) (glfwWindow*);
void (* setWindowTitle) (glfwWindow*,const byte*);
void (* setWindowIcon) (glfwWindow*, int,const GLFWimage*);
void (* getWindowPos) (glfwWindow*, int*, int*);
void (* setWindowPos) (glfwWindow*, int, int);
void (* getWindowSize) (glfwWindow*, int*, int*);
void (* setWindowSize) (glfwWindow*, int, int);
void (* setWindowSizeLimits) (glfwWindow*, int, int, int, int);
void (* setWindowAspectRatio) (glfwWindow*, int, int);
void (* getFramebufferSize) (glfwWindow*, int*, int*);
void (* getWindowFrameSize) (glfwWindow*, int*, int*, int*, int*);
void (* getWindowContentScale) (glfwWindow*, float*, float*);
void (* iconifyWindow) (glfwWindow*);
void (* restoreWindow) (glfwWindow*);
void (* maximizeWindow) (glfwWindow*);
void (* showWindow) (glfwWindow*);
void (* hideWindow) (glfwWindow*);
void (* requestWindowAttention) (glfwWindow*);
void (* focusWindow) (glfwWindow*);
void (* setWindowMonitor) (glfwWindow*, GLFWmonitor*, int, int, int, int, int);
GLFWbool(*windowFocused)(glfwWindow*);
GLFWbool(*windowIconified)(glfwWindow*);
GLFWbool(*windowVisible)(glfwWindow*);
GLFWbool(*windowMaximized)(glfwWindow*);
GLFWbool(*windowHovered)(glfwWindow*);
GLFWbool(*framebufferTransparent)(glfwWindow*);
float (* getWindowOpacity) (glfwWindow*);
void (* setWindowResizable) (glfwWindow*, GLFWbool);
void (* setWindowDecorated) (glfwWindow*, GLFWbool);
void (* setWindowFloating) (glfwWindow*, GLFWbool);
void (* setWindowOpacity) (glfwWindow*, float);
void (* setWindowMousePassthrough) (glfwWindow*, GLFWbool);
void (* pollEvents) (void);
void (* waitEvents) (void);
void (* waitEventsTimeout) (double);
void (* postEmptyEvent) (void);
*/
#endregion
internal IntPtr setCursorPos;
internal IntPtr setGammaRamp;
internal IntPtr setRawMouseMotion;
internal IntPtr setWindowAspectRatio;
internal IntPtr setWindowDecorated;
internal IntPtr setWindowFloating;
internal IntPtr setWindowIcon;
internal IntPtr setWindowMonitor;
internal IntPtr setWindowMousePassthrough;
internal IntPtr setWindowOpacity;
internal IntPtr setWindowPos;
internal IntPtr setWindowResizable;
internal IntPtr setWindowSize;
internal IntPtr setWindowSizeLimits;
internal IntPtr setWindowTitle;
internal IntPtr showWindow;
internal IntPtr terminateJoysticks;
internal IntPtr updateGamepadGUID;
internal IntPtr VkPhysicalDevice;
internal IntPtr waitEvents;
internal IntPtr waitEventsTimeout;
internal IntPtr windowFocused;
internal IntPtr windowHovered;
internal IntPtr windowIconified;
internal IntPtr windowMaximized;
internal IntPtr windowVisible;
}
[StructLayout( LayoutKind.Sequential )]
public unsafe struct GLFWmutex
{
// This is defined in platform.h
//GLFW_PLATFORM_MUTEX_STATE
}
//public unsafe struct VkAllocationCallbacks { }
[StructLayout( LayoutKind.Sequential )]
internal unsafe struct VkExtensionProperties
{
private fixed byte extensionName[ 256 ];
private uint specVersion;
public VkExtensionProperties() { }
}
/*
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct GLFWerror
{
IntPtr next;
int code;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024)]
byte[] description = new byte[1024];
public GLFWerror()
{
}
}
*/
[StructLayout( LayoutKind.Explicit, Size = 16 )]
public struct uintptr_t
{
[FieldOffset( 0 )]
private long part1;
[FieldOffset( 8 )]
private long part2;
}
#endregion GLFW3 struct
#region glad struct
[StructLayout( LayoutKind.Sequential )]
internal struct GLsync
{
public IntPtr Handle;
}
#endregion glad struct
}
/**/
@@ -0,0 +1,43 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="VisibaleRegulation.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 System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
[assembly: InternalsVisibleTo( "StgSharp" )]
[assembly: InternalsVisibleTo( "StgSharp.Model" )]
[assembly: InternalsVisibleTo( "StgSharp.Generator" )]
namespace StgSharp.Internal
{
internal class VisibaleRegulation { }
}
@@ -0,0 +1,49 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="GLfixed.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 System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Internal
{
[StructLayout( LayoutKind.Explicit, Size = 8 )]
public struct GLfixed
{
[FieldOffset( 0 )] public int All;
[FieldOffset( 0 )] public short Decimals;
[FieldOffset( 4 )] public short Inertger;
}
}
@@ -0,0 +1,92 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="glClampf.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 System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Internal
{
/// <summary>
/// OpenGL numeric type. An IEEE-754 floating-point value, clamped to the range [0,1].
/// </summary>
[StructLayout( LayoutKind.Sequential )]
public struct GLclampf
{
public float value;
public GLclampf( float a )
{
value = a;
}
public static explicit operator float( GLclampf v )
{
return v.value;
}
public static explicit operator GLclampf( float v )
{
return new GLclampf( v );
}
}
/// <summary>
/// OpenGL numeric type. An IEEE-754 double precision floating-point value, clamped to the range
/// [0,1].
/// </summary>
[StructLayout( LayoutKind.Sequential )]
public struct GLclampd
{
public double value;
public GLclampd( double a )
{
value = a;
}
public static explicit operator double( GLclampd v )
{
return v.value;
}
public static explicit operator GLclampd( double v )
{
return new GLclampd( v );
}
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,258 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="glEnum.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 System.Runtime.CompilerServices;
namespace StgSharp.Internal.OpenGL
{
public enum PixelChannelLayout
{
UByte = glConst.UNSIGNED_BYTE,
Byte = glConst.BYTE,
UShort = glConst.UNSIGNED_SHORT,
Short = glConst.SHORT,
UInt = glConst.UNSIGNED_INT,
Int = glConst.INT,
Float = glConst.FLOAT,
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
{
VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000,
VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000,
VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000,
VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000,
VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000,
VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT = 1000217000,
VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
}
public enum FrameBufferChannel
{
STENCIL_INDEX = glConst.STENCIL_INDEX,
DEPTH_COMPONENT = glConst.DEPTH_COMPONENT,
DEPTH_STENCIL = glConst.DEPTH_STENCIL,
RED = glConst.RED,
GREEN = glConst.GREEN,
BLUE = glConst.BLUE,
RGB = glConst.RGB,
BGR = glConst.BGR,
RGBA = glConst.RGBA,
BGRA = glConst.BGRA
}
public enum FrameBufferAttachment
{
Color = glConst.COLOR_ATTACHMENT0,
Depth = glConst.DEPTH_ATTACHMENT,
Stencil = glConst.STENCIL_ATTACHMENT,
DepthAndStencil = glConst.DEPTH_STENCIL_ATTACHMENT,
}
public enum Texture2DTarget
{
Texture2D = glConst.TEXTURE_2D,
ProxyTexture2D = glConst.PROXY_TEXTURE_2D,
Texture1DArray = glConst.TEXTURE_1D_ARRAY,
ProxyTexture1DArray = glConst.PROXY_TEXTURE_1D_ARRAY,
TextureRectangle = glConst.TEXTURE_RECTANGLE,
ProxyTextureRectangle = glConst.PROXY_TEXTURE_RECTANGLE,
TextureCubeMapPositiveX = glConst.TEXTURE_CUBE_MAP_POSITIVE_X,
TextureCubeMapNegativeX = glConst.TEXTURE_CUBE_MAP_NEGATIVE_X,
TextureCubeMapPositiveY = glConst.TEXTURE_CUBE_MAP_POSITIVE_Y,
TextureCubeMapNegativeY = glConst.TEXTURE_CUBE_MAP_NEGATIVE_Y,
TextureCubeMapPositiveZ = glConst.TEXTURE_CUBE_MAP_POSITIVE_Z,
TextureCubeMapNegativeZ = glConst.TEXTURE_CUBE_MAP_NEGATIVE_Z,
ProxyTextureCubeMap = glConst.PROXY_TEXTURE_CUBE_MAP
}
public enum RenderBufferInternalFormat : uint
{
RGBA8 = glConst.RGBA8,
Depth24_Stencil8 = glConst.DEPTH24_STENCIL8,
}
public enum GLOperation : uint
{
StencilTest = glConst.STENCIL_TEST,
}
internal enum VkResult
{
VK_SUCCESS = 0,
VK_NOT_READY = 1,
VK_TIMEOUT = 2,
VK_EVENT_SET = 3,
VK_EVENT_RESET = 4,
VK_INCOMPLETE = 5,
VK_ERROR_OUT_OF_HOST_MEMORY = -1,
VK_ERROR_OUT_OF_DEVICE_MEMORY = -2,
VK_ERROR_INITIALIZATION_FAILED = -3,
VK_ERROR_DEVICE_LOST = -4,
VK_ERROR_MEMORY_MAP_FAILED = -5,
VK_ERROR_LAYER_NOT_PRESENT = -6,
VK_ERROR_EXTENSION_NOT_PRESENT = -7,
VK_ERROR_FEATURE_NOT_PRESENT = -8,
VK_ERROR_INCOMPATIBLE_DRIVER = -9,
VK_ERROR_TOO_MANY_OBJECTS = -10,
VK_ERROR_FORMAT_NOT_SUPPORTED = -11,
VK_ERROR_SURFACE_LOST_KHR = -1000000000,
VK_SUBOPTIMAL_KHR = 1000001003,
VK_ERROR_OUT_OF_DATE_KHR = -1000001004,
VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001,
VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001,
VK_ERROR_VALIDATION_FAILED_EXT = -1000011001,
VK_RESULT_MAX_ENUM = 0x7FFFFFFF
}
#pragma warning disable CA1008
public enum ShaderType : int
#pragma warning restore CA1008
{
Fragment = glConst.FRAGMENT_SHADER,
Vertex = glConst.VERTEX_SHADER,
Compute = glConst.COMPUTE_SHADER,
Geometry = glConst.GEOMETRY_SHADER,
}
#pragma warning disable CA1008
public enum BufferType : int
#pragma warning restore CA1008
{
ArrayBuffer = glConst.ARRAY_BUFFER,
ElementArrayBuffer = glConst.ELEMENT_ARRAY_BUFFER,
AtomicCounterBuffer = glConst.ATOMIC_COUNTER_BUFFER,
COPY_READ_BUFFER = glConst.COPY_READ_BUFFER,
COPY_WRITE_BUFFER = glConst.COPY_WRITE_BUFFER,
DISPATCH_INDIRECT_BUFFER = glConst.DISPATCH_INDIRECT_BUFFER,
DRAW_INDIRECT_BUFFER = glConst.DRAW_INDIRECT_BUFFER,
PIXEL_PACK_BUFFER = glConst.PIXEL_PACK_BUFFER,
PIXEL_UNPACK_BUFFER = glConst.PIXEL_UNPACK_BUFFER,
QUERY_BUFFER = glConst.QUERY_BUFFER,
SHADER_STORAGE_BUFFER = glConst.SHADER_STORAGE_BUFFER,
TEXTURE_BUFFER = glConst.TEXTURE_BUFFER,
TRANSFORM_FEEDBACK_BUFFER = glConst.TRANSFORM_FEEDBACK_BUFFER,
UNIFORM_BUFFER = glConst.UNIFORM_BUFFER,
}
#pragma warning disable CA1008
public enum BufferUsage : int
#pragma warning restore CA1008
{
StreamDraw = 0x88E0,
StreamRead = 0x88E1,
StreamCopy = 0x88E2,
StaticDraw = 0x88E4,
StaticRead = 0x88E5,
StaticCopy = 0x88E6,
DynamicDraw = 0x88E8,
DynamicRead = 0x88E9,
DynamicCopy = 0x88EA
}
public enum MaskBufferBit
{
COLOR = glConst.COLOR_BUFFER_BIT,
DEPTH = glConst.DEPTH_BUFFER_BIT,
STENCIL = glConst.STENCIL_BUFFER_BIT,
}
public enum GeometryType : uint
{
POINTS = 0x0000,
LINES = 0x0001,
LINE_LOOP = 0x0002,
LINE_STRIP = 0x0003,
TRIANGLES = 0x0004,
TRIANGLE_STRIP = 0x0005,
TRIANGLE_FAN = 0x0006
}
public enum TextureFiltering
{
Nearest = 0x2600,
Linear = 0x2601
}
}
@@ -0,0 +1,62 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="glHalfNV.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 System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Internal.OpenGL
{
[StructLayout( LayoutKind.Explicit, Size = 16 )]
public struct GLhalfNV
{
[FieldOffset( 0 )] public short binary;
public GLhalfNV( short bin )
{
binary = bin;
}
public static explicit operator GLhalfNV( short x )
{
return new GLhalfNV( x );
}
public static explicit operator short( GLhalfNV x )
{
return x.binary;
}
}
}
@@ -0,0 +1,148 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="glType.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 System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Internal.OpenGL
{
public delegate IntPtr GLfuncLoader( string name );
internal delegate void GLVULKANPROCNV();
public unsafe struct GLhandleARB
{
private dynamic value;
public unsafe GLhandleARB( dynamic value )
{
if( !RuntimeInformation.IsOSPlatform( OSPlatform.OSX ) ) {
if( value.GetType().Name != "Uint32" ) {
goto errorlog;
}
this.value = value;
} else {
if( value.GetType().Name != "IntPtr" ) {
goto errorlog;
}
this.value = value;
}
errorlog:
{
InternalIO.InternalWriteLog(
$"{value.GetType().Name} does not match definination of GLhandlARB on OS {Environment.OSVersion.Platform} ",
LogType.Error );
}
}
public static implicit operator uint( GLhandleARB value )
{
return ( uint )value;
}
}
#region GLFW_dele
internal unsafe delegate void GLFWwindowsizefun(
glfwWindow* window,
int width,
int height );
internal unsafe delegate void GLFWwindowrefreshfun( glfwWindow* window );
internal unsafe delegate void GLFWwindowposfun(
glfwWindow* window,
int xpos,
int ypos );
internal unsafe delegate void GLFWwindowmaximizefun(
glfwWindow* window,
int maximized );
internal unsafe delegate void GLFWwindowiconifyfun(
glfwWindow* window,
int iconified );
internal unsafe delegate void GLFWwindowfocusfun(
glfwWindow* window,
int focused );
internal unsafe delegate void GLFWwindowcontentscalefun(
glfwWindow* window,
float xscale,
float yscale );
internal unsafe delegate void GLFWwindowclosefun( glfwWindow* window );
internal unsafe delegate void GLFWvkproc();
internal unsafe delegate void GLFWscrollfun(
glfwWindow* window,
double xoffset,
double yoffset );
internal unsafe delegate void GLFWmousebuttonfun(
glfwWindow* window,
int button,
int action,
int mods );
internal unsafe delegate void GLFWmonitorfun(
glfwMonitor* monitor,
int monitorevent );
internal unsafe delegate void GLFWkeyfun(
glfwWindow* window,
int key,
int scancode,
int action,
int mods );
internal unsafe delegate void GLFWjoystickfun( int jid, int keyevent );
public unsafe delegate void GLFWglproc();
internal unsafe delegate void GLFWerrorfun(
int error_code,
sbyte* description );
internal unsafe delegate void GLFWdropfun(
glfwWindow* window,
int path_count,
sbyte*[] paths );
internal unsafe delegate void GLFWcursorposfun(
glfwWindow* window,
double xpos,
double ypos );
internal unsafe delegate void GLFWcursorenterfun(
glfwWindow* window,
int entered );
internal unsafe delegate void GLFWcharmodsfun(
glfwWindow* window,
uint codepoint,
int mods );
internal unsafe delegate void GLFWcharfun(
glfwWindow* window,
uint codepoint );
#endregion
}
+636
View File
@@ -0,0 +1,636 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="glfw.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.Internal.OpenGL;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Internal
{
internal partial class InternalIO
{
/// <summary>
/// Function handler to load an opengl function by searching its _name.
/// </summary>
/// <param _name="name"> the _name of the Opengl function </param>
/// <returns> An Intptr value representing the pointer to the function </returns>
public delegate IntPtr glLoader( string name );
#region StgSharpDele
public unsafe delegate void FrameBufferSizeHandler(
IntPtr window,
int width,
int height );
public unsafe delegate void FramePositionHandler(
IntPtr window,
float width,
float height );
#endregion
#region glDEBUG
internal unsafe delegate void GLDEBUGPROC(
int source,
int type,
uint id,
int severity,
int length,
sbyte* message,
void* userParam );
internal unsafe delegate void GLDEBUGPROCARB(
int source,
int type,
uint id,
int severity,
int length,
sbyte* message,
void* userParam );
internal unsafe delegate void GLDEBUGPROCKHR(
int source,
int type,
uint id,
int severity,
int length,
sbyte* message,
void* userParam );
internal unsafe delegate void GLDEBUGPROCAMD(
uint id,
int category,
int severity,
int length,
sbyte* message,
void* userParam );
#endregion
#region api call
[DllImport( SSC_libName, EntryPoint = "glfwInit" )]
internal static extern unsafe int glfwInit();
[DllImport( SSC_libName, EntryPoint = "glfwTerminate" )]
internal static extern unsafe void glfwTerminate();
[DllImport( SSC_libName, EntryPoint = "glfwInitHint" )]
internal static extern unsafe void glfwInitHint( int hint, int value );
[DllImport( SSC_libName, EntryPoint = "glfwGetVersion" )]
internal static extern unsafe void glfwGetVersion(
int* major,
int* minor,
int* rev );
[DllImport( SSC_libName, EntryPoint = "glfwGetVersionString" )]
internal static extern unsafe byte* glfwGetVersionString();
[DllImport( SSC_libName, EntryPoint = "glfwGetError" )]
internal static extern unsafe int glfwGetError( byte** description );
[DllImport( SSC_libName, EntryPoint = "glfwSetErrorCallback" )]
internal static extern unsafe GLFWerrorfun glfwSetErrorCallback(
GLFWerrorfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwGetMonitors" )]
internal static extern unsafe IntPtr* glfwGetMonitors( int* count );
[DllImport( SSC_libName, EntryPoint = "glfwGetPrimaryMonitor" )]
internal static extern unsafe IntPtr glfwGetPrimaryMonitor();
[DllImport( SSC_libName, EntryPoint = "glfwGetMonitorPos" )]
internal static extern unsafe void glfwGetMonitorPos(
IntPtr monitor,
int* xpos,
int* ypos );
[DllImport( SSC_libName, EntryPoint = "glfwGetMonitorWorkarea" )]
internal static extern unsafe void glfwGetMonitorWorkarea(
IntPtr monitor,
int* xpos,
int* ypos,
int* width,
int* height );
[DllImport( SSC_libName, EntryPoint = "glfwGetMonitorPhysicalSize" )]
internal static extern unsafe void glfwGetMonitorPhysicalSize(
IntPtr monitor,
int* widthMM,
int* heightMM );
[DllImport( SSC_libName, EntryPoint = "glfwGetMonitorContentScale" )]
internal static extern unsafe void glfwGetMonitorContentScale(
IntPtr monitor,
float* xscale,
float* yscale );
[DllImport( SSC_libName, EntryPoint = "glfwGetMonitorName" )]
internal static extern unsafe byte* glfwGetMonitorName( IntPtr monitor );
[DllImport( SSC_libName, EntryPoint = "glfwSetMonitorUserPointer" )]
internal static extern unsafe void glfwSetMonitorUserPointer(
IntPtr monitor,
void* pointer );
[DllImport( SSC_libName, EntryPoint = "glfwGetMonitorUserPointer" )]
internal static extern unsafe void* glfwGetMonitorUserPointer(
IntPtr monitor );
[DllImport( SSC_libName, EntryPoint = "glfwSetMonitorCallback" )]
internal static extern unsafe GLFWmonitorfun glfwSetMonitorCallback(
GLFWmonitorfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwGetVideoModes" )]
internal static extern unsafe glfwVideomode* glfwGetVideoModes(
IntPtr monitor,
int* count );
[DllImport( SSC_libName, EntryPoint = "glfwGetVideoMode" )]
internal static extern unsafe glfwVideomode* glfwGetVideoMode(
IntPtr monitor );
[DllImport( SSC_libName, EntryPoint = "glfwSetGamma" )]
internal static extern unsafe void glfwSetGamma(
IntPtr monitor,
float gamma );
[DllImport( SSC_libName, EntryPoint = "glfwGetGammaRamp" )]
internal static extern unsafe glfwGammaramp* glfwGetGammaRamp(
IntPtr monitor );
[DllImport( SSC_libName, EntryPoint = "glfwSetGammaRamp" )]
internal static extern unsafe void glfwSetGammaRamp(
IntPtr monitor,
glfwGammaramp* ramp );
[DllImport( SSC_libName, EntryPoint = "glfwDefaultWindowHints" )]
internal static extern unsafe void glfwDefaultWindowHints();
[DllImport( SSC_libName, EntryPoint = "glfwWindowHint" )]
internal static extern unsafe void glfwWindowHint( int hint, int value );
[DllImport( SSC_libName, EntryPoint = "glfwWindowHintString" )]
internal static extern unsafe void glfwWindowHintString(
int hint,
byte* value );
[DllImport( SSC_libName, EntryPoint = "glfwCreateWindow" )]
internal static extern unsafe IntPtr glfwCreateWindow(
int width,
int height,
byte[] title,
IntPtr monitor,
IntPtr share );
[DllImport( SSC_libName, EntryPoint = "glfwDestroyWindow" )]
internal static extern unsafe void glfwDestroyWindow( IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwWindowShouldClose" )]
internal static extern unsafe int glfwWindowShouldClose( IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowShouldClose" )]
internal static extern unsafe void glfwSetWindowShouldClose(
IntPtr window,
int value );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowTitle" )]
internal static extern unsafe void glfwSetWindowTitle(
IntPtr window,
byte* title );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowIcon" )]
internal static extern unsafe void glfwSetWindowIcon(
IntPtr window,
int count,
GLFWimage* images );
[DllImport( SSC_libName, EntryPoint = "glfwGetWindowPos" )]
internal static extern unsafe void glfwGetWindowPos(
IntPtr window,
int* xpos,
int* ypos );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowPos" )]
internal static extern unsafe void glfwSetWindowPos(
IntPtr window,
int xpos,
int ypos );
[DllImport( SSC_libName, EntryPoint = "glfwGetWindowSize" )]
internal static extern unsafe void glfwGetWindowSize(
IntPtr window,
int* width,
int* height );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowSizeLimits" )]
internal static extern unsafe void glfwSetWindowSizeLimits(
IntPtr window,
int minwidth,
int minheight,
int maxwidth,
int maxheight );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowAspectRatio" )]
internal static extern unsafe void glfwSetWindowAspectRatio(
IntPtr window,
int numer,
int denom );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowSize" )]
internal static extern unsafe void glfwSetWindowSize(
IntPtr window,
int width,
int height );
[DllImport( SSC_libName, EntryPoint = "glfwGetFramebufferSize" )]
internal static extern unsafe void glfwGetFramebufferSize(
IntPtr window,
int* width,
int* height );
[DllImport( SSC_libName, EntryPoint = "glfwGetWindowFrameSize" )]
internal static extern unsafe void glfwGetWindowFrameSize(
IntPtr window,
int* left,
int* top,
int* right,
int* bottom );
[DllImport( SSC_libName, EntryPoint = "glfwGetWindowContentScale" )]
internal static extern unsafe void glfwGetWindowContentScale(
IntPtr window,
float* xscale,
float* yscale );
[DllImport( SSC_libName, EntryPoint = "glfwGetWindowOpacity" )]
internal static extern unsafe float glfwGetWindowOpacity(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowOpacity" )]
internal static extern unsafe void glfwSetWindowOpacity(
IntPtr window,
float opacity );
[DllImport( SSC_libName, EntryPoint = "glfwIconifyWindow" )]
internal static extern unsafe void glfwIconifyWindow( IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwRestoreWindow" )]
internal static extern unsafe void glfwRestoreWindow( IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwMaximizeWindow" )]
internal static extern unsafe void glfwMaximizeWindow( IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwShowWindow" )]
internal static extern unsafe void glfwShowWindow( IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwHideWindow" )]
internal static extern unsafe void glfwHideWindow( IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwFocusWindow" )]
internal static extern unsafe void glfwFocusWindow( IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwRequestWindowAttention" )]
internal static extern unsafe void glfwRequestWindowAttention(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwGetWindowMonitor" )]
internal static extern unsafe IntPtr glfwGetWindowMonitor(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowMonitor" )]
internal static extern unsafe void glfwSetWindowMonitor(
IntPtr window,
IntPtr monitor,
int xpos,
int ypos,
int width,
int height,
int refreshRate );
[DllImport( SSC_libName, EntryPoint = "glfwGetWindowAttrib" )]
internal static extern unsafe int glfwGetWindowAttrib(
IntPtr window,
int attrib );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowAttrib" )]
internal static extern unsafe void glfwSetWindowAttrib(
IntPtr window,
int attrib,
int value );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowUserPointer" )]
internal static extern unsafe void glfwSetWindowUserPointer(
IntPtr window,
void* pointer );
[DllImport( SSC_libName, EntryPoint = "glfwGetWindowUserPointer" )]
internal static extern unsafe void* glfwGetWindowUserPointer(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowPosCallback" )]
internal static extern unsafe GLFWwindowposfun glfwSetWindowPosCallback(
IntPtr window,
IntPtr callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowSizeCallback" )]
internal static extern unsafe GLFWwindowsizefun glfwSetWindowSizeCallback(
IntPtr window,
GLFWwindowsizefun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowCloseCallback" )]
internal static extern unsafe GLFWwindowclosefun glfwSetWindowCloseCallback(
IntPtr window,
GLFWwindowclosefun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowRefreshCallback" )]
internal static extern unsafe GLFWwindowrefreshfun glfwSetWindowRefreshCallback(
IntPtr window,
GLFWwindowrefreshfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowFocusCallback" )]
internal static extern unsafe GLFWwindowfocusfun glfwSetWindowFocusCallback(
IntPtr window,
GLFWwindowfocusfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowIconifyCallback" )]
internal static extern unsafe GLFWwindowiconifyfun glfwSetWindowIconifyCallback(
IntPtr window,
GLFWwindowiconifyfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetWindowMaximizeCallback" )]
internal static extern unsafe GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(
IntPtr window,
GLFWwindowmaximizefun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetFramebufferSizeCallback" )]
internal static extern unsafe FrameBufferSizeHandler glfwSetFramebufferSizeCallback(
IntPtr window,
IntPtr callback );
[DllImport(
SSC_libName,
EntryPoint = "glfwSetWindowContentScaleCallback" )]
internal static extern unsafe GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(
IntPtr window,
GLFWwindowcontentscalefun callback );
[DllImport( SSC_libName, EntryPoint = "glfwPollEvents" )]
internal static extern unsafe void glfwPollEvents();
[DllImport( SSC_libName, EntryPoint = "glfwWaitEvents" )]
internal static extern unsafe void glfwWaitEvents();
[DllImport( SSC_libName, EntryPoint = "glfwWaitEventsTimeout" )]
internal static extern unsafe void glfwWaitEventsTimeout(
double timeout );
[DllImport( SSC_libName, EntryPoint = "glfwPostEmptyEvent" )]
internal static extern unsafe void glfwPostEmptyEvent();
[DllImport( SSC_libName, EntryPoint = "glfwGetInputMode" )]
internal static extern unsafe int glfwGetInputMode(
IntPtr window,
int mode );
[DllImport( SSC_libName, EntryPoint = "glfwSetInputMode" )]
internal static extern unsafe void glfwSetInputMode(
IntPtr window,
int mode,
int value );
[DllImport( SSC_libName, EntryPoint = "glfwRawMouseMotionSupported" )]
internal static extern unsafe int glfwRawMouseMotionSupported();
[DllImport( SSC_libName, EntryPoint = "glfwGetKeyName" )]
internal static extern unsafe byte* glfwGetKeyName(
int key,
int scancode );
[DllImport( SSC_libName, EntryPoint = "glfwGetKeyScancode" )]
internal static extern unsafe int glfwGetKeyScancode( int key );
[DllImport( SSC_libName, EntryPoint = "glfwGetKey" )]
internal static extern unsafe KeyStatus glfwGetKey(
IntPtr window,
int key );
[DllImport( SSC_libName, EntryPoint = "glfwGetMouseButton" )]
internal static extern unsafe int glfwGetMouseButton(
IntPtr window,
int button );
[DllImport( SSC_libName, EntryPoint = "glfwGetCursorPos" )]
internal static extern unsafe void glfwGetCursorPos(
IntPtr window,
double* xpos,
double* ypos );
[DllImport( SSC_libName, EntryPoint = "glfwSetCursorPos" )]
internal static extern unsafe void glfwSetCursorPos(
IntPtr window,
double xpos,
double ypos );
[DllImport( SSC_libName, EntryPoint = "glfwCreateCursor" )]
internal static extern unsafe GLFWcursor* glfwCreateCursor(
GLFWimage* image,
int xhot,
int yhot );
[DllImport( SSC_libName, EntryPoint = "glfwCreateStandardCursor" )]
internal static extern unsafe GLFWcursor* glfwCreateStandardCursor(
int shape );
[DllImport( SSC_libName, EntryPoint = "glfwDestroyCursor" )]
internal static extern unsafe void glfwDestroyCursor(
GLFWcursor* cursor );
[DllImport( SSC_libName, EntryPoint = "glfwSetCursor" )]
internal static extern unsafe void glfwSetCursor(
IntPtr window,
GLFWcursor* cursor );
[DllImport( SSC_libName, EntryPoint = "glfwSetKeyCallback" )]
internal static extern unsafe GLFWkeyfun glfwSetKeyCallback(
IntPtr window,
GLFWkeyfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetCharCallback" )]
internal static extern unsafe GLFWcharfun glfwSetCharCallback(
IntPtr window,
GLFWcharfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetCharModsCallback" )]
internal static extern unsafe GLFWcharmodsfun glfwSetCharModsCallback(
IntPtr window,
GLFWcharmodsfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetMouseButtonCallback" )]
internal static extern unsafe GLFWmousebuttonfun glfwSetMouseButtonCallback(
IntPtr window,
GLFWmousebuttonfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetCursorPosCallback" )]
internal static extern unsafe GLFWcursorposfun glfwSetCursorPosCallback(
IntPtr window,
GLFWcursorposfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetCursorEnterCallback" )]
internal static extern unsafe GLFWcursorenterfun glfwSetCursorEnterCallback(
IntPtr window,
GLFWcursorenterfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetScrollCallback" )]
internal static extern unsafe GLFWscrollfun glfwSetScrollCallback(
IntPtr window,
GLFWscrollfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwSetDropCallback" )]
internal static extern unsafe GLFWdropfun glfwSetDropCallback(
IntPtr window,
GLFWdropfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwJoystickPresent" )]
internal static extern unsafe int glfwJoystickPresent( int jid );
[DllImport( SSC_libName, EntryPoint = "glfwGetJoystickAxes" )]
internal static extern unsafe float* glfwGetJoystickAxes(
int jid,
int* count );
[DllImport( SSC_libName, EntryPoint = "glfwGetJoystickButtons" )]
internal static extern unsafe byte* glfwGetJoystickButtons(
int jid,
int* count );
[DllImport( SSC_libName, EntryPoint = "glfwGetJoystickHats" )]
internal static extern unsafe byte* glfwGetJoystickHats(
int jid,
int* count );
[DllImport( SSC_libName, EntryPoint = "glfwGetJoystickName" )]
internal static extern unsafe byte* glfwGetJoystickName( int jid );
[DllImport( SSC_libName, EntryPoint = "glfwGetJoystickGUID" )]
internal static extern unsafe byte* glfwGetJoystickGUID( int jid );
[DllImport( SSC_libName, EntryPoint = "glfwSetJoystickUserPointer" )]
internal static extern unsafe void glfwSetJoystickUserPointer(
int jid,
void* pointer );
[DllImport( SSC_libName, EntryPoint = "glfwGetJoystickUserPointer" )]
internal static extern unsafe void* glfwGetJoystickUserPointer(
int jid );
[DllImport( SSC_libName, EntryPoint = "glfwJoystickIsGamepad" )]
internal static extern unsafe int glfwJoystickIsGamepad( int jid );
[DllImport( SSC_libName, EntryPoint = "glfwSetJoystickCallback" )]
internal static extern unsafe GLFWjoystickfun glfwSetJoystickCallback(
GLFWjoystickfun callback );
[DllImport( SSC_libName, EntryPoint = "glfwUpdateGamepadMappings" )]
internal static extern unsafe int glfwUpdateGamepadMappings( byte* str );
[DllImport( SSC_libName, EntryPoint = "glfwGetGamepadName" )]
internal static extern unsafe byte* glfwGetGamepadName( int jid );
[DllImport( SSC_libName, EntryPoint = "glfwGetGamepadState" )]
internal static extern unsafe int glfwGetGamepadState(
int jid,
GLFWgamepadstate* state );
[DllImport( SSC_libName, EntryPoint = "glfwSetClipboardString" )]
internal static extern unsafe void glfwSetClipboardString(
IntPtr window,
byte* str );
[DllImport( SSC_libName, EntryPoint = "glfwGetClipboardString" )]
internal static extern unsafe byte* glfwGetClipboardString(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwGetTime" )]
internal static extern unsafe double glfwGetTime();
[DllImport( SSC_libName, EntryPoint = "glfwSetTime" )]
internal static extern unsafe void glfwSetTime( double time );
[DllImport( SSC_libName, EntryPoint = "glfwGetTimerValue" )]
internal static extern unsafe ulong* glfwGetTimerValue();
[DllImport( SSC_libName, EntryPoint = "glfwGetTimerFrequency" )]
internal static extern unsafe ulong* glfwGetTimerFrequency();
[DllImport( SSC_libName, EntryPoint = "glfwMakeContextCurrent" )]
internal static extern unsafe void glfwMakeContextCurrent(
IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwGetCurrentContext" )]
internal static extern unsafe IntPtr glfwGetCurrentContext();
[DllImport( SSC_libName, EntryPoint = "glfwSwapBuffers" )]
internal static extern unsafe void glfwSwapBuffers( IntPtr window );
[DllImport( SSC_libName, EntryPoint = "glfwSwapInterval" )]
internal static extern unsafe void glfwSwapInterval( int interval );
[DllImport( SSC_libName, EntryPoint = "glfwExtensionSupported" )]
internal static extern unsafe int glfwExtensionSupported(
byte* extension );
[DllImport(
SSC_libName,
EntryPoint = "glfwGetProcAddress",
CharSet = CharSet.Ansi )]
internal static extern unsafe IntPtr glfwGetProcAddress(
string procname );
[DllImport( SSC_libName, EntryPoint = "glfwVulkanSupported" )]
internal static extern unsafe int glfwVulkanSupported();
[DllImport(
SSC_libName,
EntryPoint = "glfwGetRequiredInstanceExtensions" )]
internal static extern unsafe byte** glfwGetRequiredInstanceExtensions(
uint* count );
//[DllImport(InternalIO.SSC_libname, EntryPoint = "glfwGetInstanceProcAddress")] internal extern unsafe static GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, byte* procname);
//[DllImport(InternalIO.SSC_libname, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal extern unsafe static int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint* queuefamily);
//[DllImport(InternalIO.SSC_libname, EntryPoint = "glfwCreateWindowSurface")] internal extern unsafe static VkResult glfwCreateWindowSurface(VkInstance instance, glfwWindow* window, VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
#endregion api call
}
}
@@ -0,0 +1,184 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="publicType.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.Internal.OpenGL;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp
{
public enum LogType
{
Error,
Warning,
Info,
InfoError,
InfoWarning,
}
}
namespace StgSharp.Graphics
{
[UnmanagedFunctionPointer( CallingConvention.Cdecl, CharSet = CharSet.Ansi )]
public delegate IntPtr ImageLoader(
string name,
ref int width,
ref int height,
ref int definedChannel,
int desiredChannel );
[StructLayout(LayoutKind.Sequential)]
internal struct ImageInfo
{
private ImageChannel channel;
private int height;
private int width;
private IntPtr pixelPtr;
internal PixelChannelLayout pixelLayout;
public ImageChannel Channel
{
get => channel;
set { channel = value; }
}
public int ChannelCount
{
get => GetChannelCount(channel);
}
public int Height
{
get => height;
set => height = value;
}
public int StreamSize
{
get => width * height * GetPixelSize(
pixelLayout, channel);
}
public int Width
{
get => width;
set => width = value;
}
public IntPtr StreamPtr
{
get => pixelPtr;
internal set => pixelPtr = value;
}
public override int GetHashCode()
{
int hash = 17;
hash = hash * 17 + width;
hash = hash * 17 + height;
hash = hash * 17 + (int)channel;
return hash;
}
public override string ToString()
{
return $"{channel}\t{width}\t{height}\t{(ulong)StreamPtr}";
}
internal static int GetChannelCount(ImageChannel channel)
{
return channel switch
{
ImageChannel.SingleColor => 1,
ImageChannel.DoubleColor => 2,
ImageChannel.TripleColor => 3,
ImageChannel.WithAlphaChannel => 4,
_ => throw new InvalidCastException(
"Unknown color channel decoding setting.")
};
}
internal static int GetPixelSize(
PixelChannelLayout layout,
ImageChannel cahnnel)
{
return layout switch
{
PixelChannelLayout.UByte => sizeof(byte) * GetChannelCount(
cahnnel),
PixelChannelLayout.Byte => sizeof(byte) * GetChannelCount(
cahnnel),
PixelChannelLayout.UShort => sizeof(short) * GetChannelCount(
cahnnel),
PixelChannelLayout.Short => sizeof(short) * GetChannelCount(
cahnnel),
PixelChannelLayout.UInt => sizeof(int) * GetChannelCount(
cahnnel),
PixelChannelLayout.Int => sizeof(int) * GetChannelCount(
cahnnel),
PixelChannelLayout.Float => sizeof(float) * GetChannelCount(
cahnnel),
PixelChannelLayout.UByte332 => sizeof(byte),
PixelChannelLayout.UByte233Rev => sizeof(byte),
PixelChannelLayout.UShort565 => sizeof(short),
PixelChannelLayout.UShort565Rev => sizeof(short),
PixelChannelLayout.UShort4444 => sizeof(short),
PixelChannelLayout.UShort4444Rev => sizeof(short),
PixelChannelLayout.UShort5551 => sizeof(short),
PixelChannelLayout.UShort1555Rev => sizeof(short),
PixelChannelLayout.UInt8888 => sizeof(int),
PixelChannelLayout.UInt8888Rev => sizeof(int),
PixelChannelLayout.UInt1010102 => sizeof(int),
PixelChannelLayout.UInt2101010Rev => sizeof(int),
_ => throw new ArgumentException("Unknown layout type"),
};
}
}
public enum ImageChannel : uint
{
SingleColor = glConst.RED,
DoubleColor = glConst.RG,
TripleColor = glConst.RGB,
WithAlphaChannel = glConst.RGBA,
}
}
@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Blueprint.cs"
// file="BlueprintSchedueler.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
@@ -42,13 +42,13 @@ using System.Threading;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace StgSharp.BluePrint
namespace StgSharp.Blueprint
{
/// <summary>
/// A sets of complex logic designed for running in multi threads environment. Warning: do not
/// run a <see cref="Blueprint" /> instance in multi threads more than once.
/// run a <see cref="BlueprintSchedueler" /> instance in multi threads more than once.
/// </summary>
public partial class Blueprint : IConvertableToBlueprintNode
public partial class BlueprintSchedueler : IConvertableToBlueprintNode
{
private BeginningNode beginNode;
@@ -64,7 +64,7 @@ namespace StgSharp.BluePrint
internal int currentGlobalNodeIndex;
internal int currentNativeNodeIndex;
public Blueprint()
public BlueprintSchedueler()
{
allNode = new Dictionary<string, BlueprintNode>();
globalNodeList = new List<BlueprintNode>();
@@ -83,13 +83,22 @@ namespace StgSharp.BluePrint
get => runningStat.CurrentCount == 0;
}
/**/
internal Func<bool> ShouldClose
public ReadOnlySpan<string> InputInterfacesName
{
get => terminate;
set => terminate = value;
get { return beginNode.OutputInterfaces
.Select( p => p.Key )
.ToArray(); }
}
public ReadOnlySpan<string> OutputInterfacesName
{
get { return beginNode.OutputInterfaces
.Select( p => p.Key )
.ToArray(); }
}
/**/
internal SemaphoreSlim RunningStat
{
get => runningStat;
@@ -103,11 +112,17 @@ namespace StgSharp.BluePrint
allNode.Add( node.Name, node );
}
public void ExecuteMain(
in Dictionary<string, BlueprintPipeline> input,
in Dictionary<string, BlueprintPipeline> output )
in Dictionary<string, BlueprintPipeline> input,
in Dictionary<string, BlueprintPipeline> output )
{
BlueprintRunner.Run( this, () => true );
BlueprintRunner.Run( this );
}
public BlueprintNodeOperation Operation
{
get => ExecuteMain;
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
@@ -131,7 +146,7 @@ namespace StgSharp.BluePrint
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetInput(
params (string name, BlueprintPipelineArgs arg)[] parameters )
params (string name, BlueprintPipelineArgs arg)[] parameters )
{
beginNode.InputData = parameters;
}
@@ -164,18 +179,9 @@ namespace StgSharp.BluePrint
return false;
}
string[] IConvertableToBlueprintNode.InputInterfacesName
~BlueprintSchedueler()
{
get { return beginNode.OutputInterfaces
.Select( p => p.Key )
.ToArray(); }
}
string[] IConvertableToBlueprintNode.OutputInterfacesName
{
get { return beginNode.OutputInterfaces
.Select( p => p.Key )
.ToArray(); }
runningStat.Dispose();
}
}
@@ -33,6 +33,7 @@ using StgSharp.Entities;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
@@ -41,7 +42,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.BluePrint
namespace StgSharp.Blueprint
{
/// <summary>
///
@@ -55,22 +56,26 @@ namespace StgSharp.BluePrint
#pragma warning restore CA1036
{
private protected bool levelAvailable, nativeRequested;
private static BlueprintNode _emptyNode = new BlueprintNode(
string.Empty, null!, false );
private static Dictionary<string, BlueprintPipeline> _emptyLayer = new();
private protected bool _levelAvailable, _nativeRequested;
private protected Dictionary<string, BlueprintPipeline> _inputInterfaces;
private protected Dictionary<string, BlueprintPipeline> _outputInterfaces;
private protected int _level;
private IConvertableToBlueprintNode mainOperation;
private string name;
private IConvertableToBlueprintNode _mainOperation;
private string _name;
internal BlueprintNode(
string name,
IConvertableToBlueprintNode node,
bool isNative )
string name,
IConvertableToBlueprintNode node,
bool isNative )
{
this.levelAvailable = false;
this.name = name;
nativeRequested = isNative;
mainOperation = node;
_levelAvailable = false;
_name = name;
_nativeRequested = isNative;
_mainOperation = node;
_inputInterfaces = new Dictionary<string, BlueprintPipeline>();
_outputInterfaces = new Dictionary<string, BlueprintPipeline>();
foreach( string portName in node.InputInterfacesName ) {
@@ -84,10 +89,11 @@ namespace StgSharp.BluePrint
#pragma warning disable CS8618
internal BlueprintNode(
string name,
bool isNative,
string[] inputPorts,
string[] outputPorts )
BlueprintNodeOperation operation,
string name,
bool isNative,
string[] inputPorts,
string[] outputPorts )
#pragma warning restore CS8618
{
if( ( inputPorts == null ) || ( inputPorts.Length == 0 ) ) {
@@ -96,30 +102,54 @@ namespace StgSharp.BluePrint
if( ( outputPorts == null ) || ( outputPorts.Length == 0 ) ) {
throw new ArgumentNullException( nameof( outputPorts ) );
}
levelAvailable = false;
this.name = name;
IsNative = isNative;
_levelAvailable = false;
_name = name;
_nativeRequested = isNative;
operation = operation ?? DefaultOperation;
_mainOperation = new DefaultConvertableToBlueprintNode(
operation,
inputPorts,
outputPorts);
_inputInterfaces = new Dictionary<string, BlueprintPipeline>();
_outputInterfaces = new Dictionary<string, BlueprintPipeline>();
foreach( string portName in inputPorts ) {
_inputInterfaces.Add( portName, null! );
_inputInterfaces.Add(
portName,
SealedBlueprintPiipeline.SealOutput( this, name ) );
}
foreach( string portName in outputPorts ) {
_outputInterfaces.Add( portName, null! );
}
}
protected static void DefaultOperation(
in Dictionary<string, BlueprintPipeline> input,
in Dictionary<string, BlueprintPipeline> output)
{
BlueprintPipeline.SkipAll(output);
}
public static BlueprintNode Empty
{
get => _emptyNode;
}
public bool IsNative
{
get => nativeRequested;
internal set => nativeRequested = value;
get => _nativeRequested;
internal set => _nativeRequested = value;
}
public static Dictionary<string, BlueprintPipeline> EmptyPortLayer
{
get => _emptyLayer;
}
public int Level
{
get
{
if( levelAvailable ) {
if( _levelAvailable ) {
return _level;
}
_level = 0;
@@ -127,16 +157,17 @@ namespace StgSharp.BluePrint
if( item.Value == null ) {
continue;
}
if( _level <= item.Value.Level ) {
if( _level < item.Value.Level ) {
_level = item.Value.Level;
}
}
_level += 1;
_levelAvailable = true;
return _level;
}
}
public string Name => name;
public string Name => _name;
internal Dictionary<string, BlueprintPipeline> InputInterfaces => _inputInterfaces;
@@ -144,15 +175,39 @@ namespace StgSharp.BluePrint
internal IConvertableToBlueprintNode Value
{
get => mainOperation;
get => _mainOperation;
}
public void AddAfter(
BlueprintNode former,
string formerOutputPortName,
string thisInputPortName )
public void Append(
[NotNull] BlueprintNode next,
string thisOutputPortName,
string afterInputPortName )
{
this.levelAvailable = false;
this._levelAvailable = false;
BlueprintPipeline pipeline = new BlueprintPipeline( this, next );
if( next is EndingNode enode ) {
enode.SetCertainInputPort( afterInputPortName, pipeline );
} else {
next.SetCertainInputPort( afterInputPortName, pipeline );
}
SetCertainOutputPort( thisOutputPortName, pipeline );
}
public int CompareTo( BlueprintNode other )
{
if( null == other ) {
throw new ArgumentNullException( nameof( other ) );
}
return this.Level.CompareTo( other.Level );
}
public void Prepend(
[NotNull] BlueprintNode former,
string formerOutputPortName,
string thisInputPortName )
{
this._levelAvailable = false;
BlueprintPipeline pipeline = new BlueprintPipeline( former, this );
if( former is BeginningNode bnode ) {
bnode.SetCertainOutputPort( formerOutputPortName, pipeline );
@@ -162,35 +217,13 @@ namespace StgSharp.BluePrint
SetCertainInputPort( thisInputPortName, pipeline );
}
public void AddBefore(
BlueprintNode after,
string thisOutputPortName,
string afterInputPortName )
{
this.levelAvailable = false;
BlueprintPipeline pipeline = new BlueprintPipeline( this, after );
if( after is EndingNode enode ) {
enode.SetCertainInputPort( afterInputPortName, pipeline );
} else {
after.SetCertainInputPort( afterInputPortName, pipeline );
}
SetCertainOutputPort( thisOutputPortName, pipeline );
}
public int CompareTo( BlueprintNode other )
{
#pragma warning disable CA1062
return this.Level.CompareTo( other.Level );
#pragma warning restore CA1062
}
public virtual void Run()
{
try {
//Console.WriteLine(name);
//Console.WriteLine(_name);
BlueprintPipeline.WaitAll( _inputInterfaces );
if( mainOperation != null ) {
mainOperation.ExecuteMain(
if( _mainOperation != null ) {
_mainOperation.Operation(
in _inputInterfaces, in _outputInterfaces );
}
}
@@ -201,43 +234,43 @@ namespace StgSharp.BluePrint
#region port operation
public BlueprintPipeline GetCertainInputPort( string name )
public BlueprintPipeline GetInputPort( string name )
{
BlueprintPipeline ret;
if( !_inputInterfaces.TryGetValue( name, out ret ) ) {
throw new Exception(
throw new ArgumentOutOfRangeException(
$"Cannot find the interface named {name} in node {Name}." );
}
return ret;
}
public BlueprintPipeline GetCertainOutputPort( string name )
public BlueprintPipeline GetOutputPort( string name )
{
BlueprintPipeline ret;
if( !_outputInterfaces.TryGetValue( name, out ret ) ) {
throw new Exception(
throw new ArgumentOutOfRangeException(
$"Cannot find the interface named {name} in node {Name}." );
}
return ret;
}
public void SetCertainInputPort(
string name,
BlueprintPipeline pipeline )
string name,
BlueprintPipeline pipeline )
{
if( !_inputInterfaces.ContainsKey( name ) ) {
throw new Exception(
throw new ArgumentException(
$"Cannot find the interface named {name} in node {Name}." );
}
_inputInterfaces[ name ] = pipeline;
}
public void SetCertainOutputPort(
string name,
BlueprintPipeline pipeline )
string name,
BlueprintPipeline pipeline )
{
if( !_outputInterfaces.ContainsKey( name ) ) {
throw new Exception(
throw new ArgumentOutOfRangeException(
$"Cannot find the interface named {name} in node {Name}." );
}
_outputInterfaces[ name ] = pipeline;
@@ -250,8 +283,8 @@ namespace StgSharp.BluePrint
{
protected BlueprintNodeRunException(
SerializationInfo info,
StreamingContext context )
SerializationInfo info,
StreamingContext context )
: base( info, context ) { }
public BlueprintNodeRunException() { }
@@ -262,8 +295,8 @@ namespace StgSharp.BluePrint
public BlueprintNodeRunException( string message ) : base( message ) { }
public BlueprintNodeRunException(
string message,
Exception innerException )
string message,
Exception innerException )
: base( message, innerException ) { }
}
@@ -0,0 +1,58 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="BlueprintNodeCraeater.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 System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Blueprint
{
public partial class BlueprintSchedueler
{
public BlueprintNode CreateBlueprintNode(
string name,
BlueprintNodeOperation operation,
string[] inputPort,
string[] outputPort,
bool isNative )
{
BlueprintNode node = new BlueprintNode(
operation, name, isNative, inputPort, outputPort );
if( isNative ) {
nativeNodeList.Add( node );
} else {
globalNodeList.Add( node );
}
return node;
}
}
}
@@ -42,25 +42,36 @@ using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.BluePrint
namespace StgSharp.Blueprint
{
public static class BlueprintRunner
{
private static NodeRunner[] allAvailableTask = new NodeRunner[1];
private static CancellationTokenSource cts = new CancellationTokenSource(
);
private static ConcurrentStack<Blueprint> blueprintInWaiting = new ConcurrentStack<Blueprint>(
);
private static NodeRunner[] allAvailableTask = CreateBlueprintRunnerArray();
private static CancellationTokenSource cts = new CancellationTokenSource();
private static ConcurrentStack<BlueprintSchedueler> blueprintInWaiting
= new ConcurrentStack<BlueprintSchedueler>();
private static int _callingThread;
private static SemaphoreSlim bpLock = new SemaphoreSlim( 0, 1 );
private static NodeRunner[] CreateBlueprintRunnerArray()
{
int count = Environment.ProcessorCount;
return new NodeRunner[ count < 2 ? count : count - 2];
}
/// <summary>
/// Only the fallowing occasions of calling are valid:
/// 1. no bp is running or the only bp is quitting.
/// 2. calling from the main thread and the current running bp.
/// </summary>
internal static bool IsValidCalling
{
get
{
if( ( NodeRunner.CurrentBlueprint == null ) || //no bp running at all
( ( blueprintInWaiting.Count == 0 ) && ( NodeRunner.CurrentBlueprint.IsRunning == false ) ) ) // a bp is quiting
( ( blueprintInWaiting.IsEmpty ) && ( NodeRunner.CurrentBlueprint.IsRunning == false ) ) )
// a bp is quiting
{
//in case no bp is running
return true;
@@ -68,9 +79,7 @@ namespace StgSharp.BluePrint
int? id = Task.CurrentId;
if( id is null ) {
// in case calling from main thread and current running bp
//Console.WriteLine($"\t{_callingThread}");
//Console.WriteLine($"\t{Thread.CurrentThread.ManagedThreadId}");
return _callingThread == Thread.CurrentThread.ManagedThreadId;
return _callingThread == Environment.CurrentManagedThreadId;
}
foreach( NodeRunner item in allAvailableTask ) {
if( item.Id == id ) {
@@ -82,34 +91,27 @@ namespace StgSharp.BluePrint
}
}
public static void Run(
Blueprint blueprint,
Func<bool> terminateInstructor )
public static void Run(BlueprintSchedueler blueprint)
{
//Console.WriteLine();
if( blueprint == null ) {
return;
}
if( terminateInstructor == null ) {
throw new ArgumentNullException( nameof( terminateInstructor ) );
}
if( blueprint.IsRunning ) {
throw new InvalidOperationException(
"Attempt to run a blueprint instance twice." );
}
blueprint.ShouldClose = terminateInstructor;
if( IsValidCalling ) {
//Console.WriteLine("valid and run");
if( InterruptAndRunNewBp( blueprint ) ) {
do { } while (InterruptAndRunNewBp(
NodeRunner.CurrentBlueprint ));
while (InterruptAndRunNewBp(
NodeRunner.CurrentBlueprint )){ };
}
} else {
bpLock.Wait();
if( InterruptAndRunNewBp( blueprint ) ) {
do { } while (InterruptAndRunNewBp(
NodeRunner.CurrentBlueprint ));
while (InterruptAndRunNewBp(
NodeRunner.CurrentBlueprint)) { }
}
bpLock.Release();
@@ -139,13 +141,13 @@ namespace StgSharp.BluePrint
foreach( NodeRunner task in allAvailableTask ) {
task.Cts.Cancel();
}
foreach( Blueprint bp in blueprintInWaiting ) {
foreach( BlueprintSchedueler bp in blueprintInWaiting ) {
bp.Terminate();
}
blueprintInWaiting.Clear();
}
internal static bool InterruptAndRunNewBp( Blueprint newBp )
internal static bool InterruptAndRunNewBp( BlueprintSchedueler newBp )
{
Debug.Assert( newBp != null );
if( ( newBp != NodeRunner.CurrentBlueprint ) && ( NodeRunner.CurrentBlueprint != null ) ) {
@@ -156,12 +158,11 @@ namespace StgSharp.BluePrint
//load new bp to current bp
Interlocked.Exchange( ref NodeRunner.CurrentBlueprint!, newBp );
Interlocked.Exchange(
ref _callingThread, Thread.CurrentThread.ManagedThreadId );
ref _callingThread, Environment.CurrentManagedThreadId );
//run beginning node to init it first.
if( !NodeRunner.CurrentBlueprint.IsRunning ) {
( NodeRunner.CurrentBlueprint.BeginLayer as BeginningNode )!.Run(
);
( NodeRunner.CurrentBlueprint.BeginLayer as BeginningNode )!.Run();
}
//refresh all tasks
@@ -188,7 +189,7 @@ namespace StgSharp.BluePrint
internal class NodeRunner : CancellableTask
{
private static Blueprint _current;
private static BlueprintSchedueler _current;
internal NodeRunner()
: base()
@@ -196,7 +197,7 @@ namespace StgSharp.BluePrint
_startup = InternalRun;
}
internal static ref Blueprint CurrentBlueprint
internal static ref BlueprintSchedueler CurrentBlueprint
{
get => ref _current;
}
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.BluePrint;
using StgSharp.Blueprint;
using System;
using System.Collections.Generic;
@@ -36,14 +36,13 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.BluePrint
namespace StgSharp.Blueprint
{
public class CrossFrameOperation : IConvertableToBlueprintNode
{
private int currentCount;
private readonly int cycleCount;
private Action _mainExecution;
public CrossFrameOperation( Action startup, int cycleCount )
{
@@ -57,13 +56,17 @@ namespace StgSharp.BluePrint
public Action MainExecution
{
get;
private protected set;
get => _mainExecution;
private protected set => _mainExecution = value;
}
public static string InputInterfacesName => "TaskIn";
private static string[] _inputName = ["TaskIn"];
private static string[] _outputName = ["TaskOut"];
public static string OutputInterfacesName => "TaskOut";
public BlueprintNodeOperation Operation
{
get => ExecuteMain;
}
public void ExecuteMain(
in Dictionary<string, BlueprintPipeline> input,
@@ -80,9 +83,9 @@ namespace StgSharp.BluePrint
BlueprintPipeline.SkipAll( output );
}
string[] IConvertableToBlueprintNode.InputInterfacesName => [InputInterfacesName];
public ReadOnlySpan<string> InputInterfacesName => _inputName;
string[] IConvertableToBlueprintNode.OutputInterfacesName => [OutputInterfacesName];
public ReadOnlySpan<string> OutputInterfacesName => _outputName;
}
}
@@ -33,7 +33,7 @@ using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
namespace StgSharp.BluePrint
namespace StgSharp.Blueprint
{
public delegate void BlueprintNodeOperation(
in Dictionary<string, BlueprintPipeline> input,
@@ -41,24 +41,17 @@ namespace StgSharp.BluePrint
public interface IConvertableToBlueprintNode
{
#pragma warning disable CA1819
public string[] InputInterfacesName
public ReadOnlySpan<string> InputInterfacesName
{
get;
}
#pragma warning restore CA1819
#pragma warning disable CA1819
public string[] OutputInterfacesName
public ReadOnlySpan<string> OutputInterfacesName
{
get;
}
#pragma warning restore CA1819
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void ExecuteMain(
in Dictionary<string, BlueprintPipeline> input,
in Dictionary<string, BlueprintPipeline> output );
BlueprintNodeOperation Operation { get; }
}
@@ -79,16 +72,11 @@ namespace StgSharp.BluePrint
_execution = execution;
}
void IConvertableToBlueprintNode.ExecuteMain(
in Dictionary<string, BlueprintPipeline> input,
in Dictionary<string, BlueprintPipeline> output )
{
_execution( in input, in output );
}
public BlueprintNodeOperation Operation => _execution;
string[] IConvertableToBlueprintNode.InputInterfacesName => _input;
public ReadOnlySpan<string> InputInterfacesName => _input;
string[] IConvertableToBlueprintNode.OutputInterfacesName => _output;
public ReadOnlySpan<string> OutputInterfacesName => _output;
}
}
@@ -38,15 +38,15 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.BluePrint
namespace StgSharp.Blueprint
{
public class BlueprintPipeline
{
private BlueprintNode after;
private BlueprintNode former;
private BlueprintPipelineArgs args;
private SemaphoreSlim formerCompleteSemaphore;
private protected BlueprintNode after;
private protected BlueprintNode former;
private protected BlueprintPipelineArgs args;
private protected SemaphoreSlim formerCompleteSemaphore;
public BlueprintPipeline( BlueprintNode former, BlueprintNode after )
{
@@ -72,7 +72,7 @@ namespace StgSharp.BluePrint
Dictionary<string, BlueprintPipeline> ports )
{
if( ports == null ) {
throw new ArgumentNullException( nameof( ports ) );
return;
}
foreach( KeyValuePair<string, BlueprintPipeline> item in ports ) {
if( item.Value != null ) {
@@ -85,7 +85,7 @@ namespace StgSharp.BluePrint
Dictionary<string, BlueprintPipeline> ports )
{
if( ports == null ) {
throw new ArgumentNullException( nameof( ports ) );
return;
}
foreach( KeyValuePair<string, BlueprintPipeline> item in ports ) {
if( item.Value != null ) {
@@ -94,7 +94,7 @@ namespace StgSharp.BluePrint
}
}
public void WaitForStart()
public virtual void WaitForStart()
{
//Console.WriteLine($"Waiting \t{former.ContextName}\t->\t{after.ContextName}");
formerCompleteSemaphore.Wait();
@@ -126,12 +126,39 @@ namespace StgSharp.BluePrint
public abstract class BlueprintPipelineArgs
{
public object? Value
{
get;
set;
}
public object? ValueDefault
{
get;
}
}
public sealed class SealedBlueprintPiipeline:BlueprintPipeline
{
internal SealedBlueprintPiipeline(BlueprintNode former, BlueprintNode after):
base(former, after)
{
}
public static SealedBlueprintPiipeline SealOutput(BlueprintNode node, string portName)
{
return new SealedBlueprintPiipeline(node, BlueprintNode.Empty);
}
public static SealedBlueprintPiipeline SealInput(BlueprintNode node, string portName)
{
return new SealedBlueprintPiipeline(BlueprintNode.Empty, node);
}
public sealed override void WaitForStart()
{
}
}
}
@@ -35,7 +35,7 @@ using System.Reflection.Emit;
using System.Security.Cryptography.X509Certificates;
using System.Text;
namespace StgSharp.BluePrint
namespace StgSharp.Blueprint
{
public class RouteSwitch : BlueprintNode
{
@@ -43,7 +43,7 @@ namespace StgSharp.BluePrint
private protected Dictionary<string, (BlueprintPipeline pipeline, Func<bool> openingRule)> outputDictionary;
public RouteSwitch( string name, bool isNative, string inputPorts )
: base( name, isNative, [inputPorts], [string.Empty] )
: base(DefaultOperation, name, isNative, [inputPorts], [string.Empty] )
{
outputDictionary = new Dictionary<string, (BlueprintPipeline pipeline, Func<bool> openingRule)>(
);
@@ -53,7 +53,7 @@ namespace StgSharp.BluePrint
{
get
{
if( levelAvailable ) {
if( _levelAvailable ) {
return _level;
}
_level = 0;
@@ -37,15 +37,15 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.BluePrint
namespace StgSharp.Blueprint
{
internal sealed class BeginningNode : BlueprintNode
{
private Blueprint _bp;
private BlueprintSchedueler _bp;
public BeginningNode( Blueprint bp )
: base( name: "BeginningNode", true, ["default"], ["default"] )
public BeginningNode( BlueprintSchedueler bp )
: base(DefaultOperation, name: "BeginningNode", true, ["default"], ["default"] )
{
_bp = bp;
}
@@ -84,10 +84,10 @@ namespace StgSharp.BluePrint
internal sealed class EndingNode : BlueprintNode
{
private Blueprint _bp;
private BlueprintSchedueler _bp;
public EndingNode( Blueprint bp )
: base( name: "EndingNode", true, ["default"], ["default"] )
public EndingNode( BlueprintSchedueler bp )
: base(DefaultOperation, name: "EndingNode", true, ["default"], ["default"] )
{
_bp = bp;
}
@@ -0,0 +1,58 @@
using StgSharp;
using StgSharp.Graphics.OpenGL;
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Collections
{
public interface IPoolable
{
public int ID { get; }
}
public class CacheIndexPool<T> : IEnumerable<T> where T:IPoolable
{
private ConcurrentDictionary<int, T> _cache;
private Func<T> _defaultCreater;
public CacheIndexPool(Func<T> defaultCreater)
{
_cache = new ConcurrentDictionary<int, T>();
_defaultCreater = defaultCreater;
}
public T this[int index]
{
get
{
if (_cache.TryGetValue(index, out T value))
{
return value;
}
T newValue = _defaultCreater();
_cache.TryAdd(index, newValue);
return newValue;
}
}
public IEnumerator<T> GetEnumerator()
{
return _cache.Values.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
public T CreateObject()
{
T _new = _defaultCreater();
_cache.AddOrUpdate();
}
}
}
@@ -0,0 +1,162 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="CapacityFixedList.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 System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
namespace StgSharp.Collections
{
internal class CapacityFixedList<T> : IList<T>
{
private T[] values;
private int capacity, _index;
public CapacityFixedList( int size )
{
values = new T[size];
}
public T this[ int index ]
{
get => ( index < _index ) ?
values[ index ] : throw new ArgumentOutOfRangeException(
nameof( index ) );
set
{
if( index < _index ) {
values[ index ] = value;
} else {
throw new ArgumentOutOfRangeException( nameof( index ) );
}
}
}
public bool IsReadOnly => false;
public int Count => _index + 1;
public void Add( T item )
{
if( _index < capacity - 1 ) {
_index++;
this[ _index ] = item;
}
}
public void Clear()
{
values = new T[capacity];
_index = 0;
}
public bool Contains( T item )
{
for( int i = 0; i <= _index; i++ ) {
if( item.Equals( values[ i ] ) ) {
return true;
}
}
return false;
}
public void CopyTo( T[] array, int arrayIndex )
{
values.CopyTo( array, arrayIndex );
}
public IEnumerator<T> GetEnumerator()
{
for( int i = 0; i <= _index; i++ ) {
yield return values[ i ];
}
}
public int IndexOf( T item )
{
T v;
for( int i = 0; i <= _index; i++ ) {
if((v = values[i]) != null && v.Equals( item ) ){
return i;
}
}
return -1;
}
public bool Remove( T item )
{
T v;
for( int i = 0; i <= _index; i++ ) {
if((v = values[i]) != null && v.Equals( item ) ) {
values[ i ] = values[ _index ];
_index--;
return true;
}
}
return false;
}
public void RemoveAll( Predicate<T> predicate )
{
for( int i = _index; i > 0; i-- ) {
if( predicate( values[ i ] ) ) {
values[ i ] = values[ _index ];
_index--;
}
}
}
public void RemoveAt( int index )
{
if( index <= _index ) {
values[ index ] = values[ _index ];
_index--;
}
}
public void Resize( int newSize )
{
Array.Resize( ref values, newSize );
}
IEnumerator IEnumerable.GetEnumerator()
{
yield return GetEnumerator();
}
void IList<T>.Insert( int index, T item )
{
throw new NotSupportedException();
}
}//------------------------------------- End of Class ------------------------------------------
}
@@ -68,7 +68,7 @@ namespace StgSharp.Collections
/// Determines whether the <see cref="IBidirectionalDictionary{TFirst, TSecond}" /> contains
/// the specified key.
/// </summary>
/// <param name="key"> The value to locate in the <see cref="IBidirectionalDictionary{TFirst, TSecond}" />. </param>
/// <param _name="key"> The value to locate in the <see cref="IBidirectionalDictionary{TFirst, TSecond}" />. </param>
/// <returns>
/// true if the <see cref="IBidirectionalDictionary{TFirst, TSecond}" /> contains an element
/// with the specified key; otherwise, false.
@@ -79,7 +79,7 @@ namespace StgSharp.Collections
/// Determines whether the <see cref="IBidirectionalDictionary{TFirst, TSecond}" /> contains
/// the specified key.
/// </summary>
/// <param name="key"> The value to locate in the <see cref="IBidirectionalDictionary{TFirst, TSecond}" />. </param>
/// <param _name="key"> The value to locate in the <see cref="IBidirectionalDictionary{TFirst, TSecond}" />. </param>
/// <returns>
/// true if the <see cref="IBidirectionalDictionary{TFirst, TSecond}" /> contains an element
/// with the specified key; otherwise, false.
@@ -41,16 +41,17 @@ namespace StgSharp.Threading
public static partial class ThreadHelper
{
private static readonly int mainThreadId = Thread.CurrentThread.ManagedThreadId;
private static readonly int mainThreadId = Environment.CurrentManagedThreadId;
private static readonly ThreadLocal<bool> isNotMainThread = new ThreadLocal<bool>(
() => Thread.CurrentThread.ManagedThreadId != mainThreadId );
() => Environment.CurrentManagedThreadId != mainThreadId );
[Conditional( "DEBUG" )]
internal static void MainThreadAssert()
{
if( isNotMainThread.Value ) {
throw new InvalidOperationException(
$"Attempt to call sensitive operation which can be only called from main thread " + $"from thread {Thread.CurrentThread.ManagedThreadId}." );
$"Attempt to call sensitive operation which can be only called from main thread "
+ $"from thread {Environment.CurrentManagedThreadId}." );
}
}
@@ -61,8 +61,8 @@ namespace StgSharp.Timing
/// Create a new <see cref="TimeSpanProvider" /> and define the length of time span. Length
/// of a single time span is defined in microseconds.
/// </summary>
/// <param name="spanMicroSeconds"></param>
/// <param name="provider"></param>
/// <param _name="spanMicroSeconds"></param>
/// <param _name="provider"></param>
public TimeSpanProvider(
long spanMicroSeconds,
TimeSourceProviderBase provider )
@@ -83,8 +83,8 @@ namespace StgSharp.Timing
/// Create a new <see cref="TimeSpanProvider" /> and define the length of time span. Length
/// of a single time span is defined in seconds.
/// </summary>
/// <param name="spanSeconds"></param>
/// <param name="provider"></param>
/// <param _name="spanSeconds"></param>
/// <param _name="provider"></param>
public TimeSpanProvider(
double spanSeconds,
TimeSourceProviderBase provider )
@@ -106,9 +106,9 @@ namespace StgSharp.Timing
/// Create a new <see cref="TimeSpanProvider" /> and define the length of time span. Length
/// of a single time span is defined in microseconds.
/// </summary>
/// <param name="spanLength"></param>
/// <param name="maxSpan"></param>
/// <param name="provider"></param>
/// <param _name="spanLength"></param>
/// <param _name="maxSpan"></param>
/// <param _name="provider"></param>
public TimeSpanProvider(
long spanLength,
long maxSpan,
@@ -157,7 +157,7 @@ namespace StgSharp.MVVM.View
/// <summary>
/// Get the status of a certain key on the keyboard.
/// </summary>
/// <param name="key"></param>
/// <param _name="key"></param>
/// <returns><see cref="KeyStatus" /> representing if a key is pressed or released. </returns>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public KeyStatus GetKeyStatus( KeyboardKey key )
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data;
using StgSharp.Internal;
using StgSharp.Graphics;
using StgSharp.Math;
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.Intrinsic;
using StgSharp.Internal.Intrinsic;
using System;
using System.Collections.Generic;
using System.Data.Common;
@@ -47,6 +47,8 @@ using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using static StgSharp.Internal.InternalIO;
namespace StgSharp.MVVM.ViewModel
{
public abstract partial class ViewModelBase
@@ -205,10 +207,10 @@ namespace StgSharp.MVVM.ViewModel
/// <summary>
/// Set the size limit of current form
/// </summary>
/// <param name="minSize">
/// <param _name="minSize">
/// Minimum size of current form. In form of a <see cref="Vec2" /> of (width,height)
/// </param>
/// <param name="maxSize">
/// <param _name="maxSize">
/// Maximum size of current form. In form of a <see cref="Vec2" /> of (width,height)
/// </param>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
@@ -223,10 +225,10 @@ namespace StgSharp.MVVM.ViewModel
/// <summary>
/// Set the size limit of current form
/// </summary>
/// <param name="minWidth"> Minimum width of current form </param>
/// <param name="minHeight"> Minimum height of current form </param>
/// <param name="maxWidth"> Maximum width of current form </param>
/// <param name="maxHeight"> Maximum height of current form </param>
/// <param _name="minWidth"> Minimum width of current form </param>
/// <param _name="minHeight"> Minimum height of current form </param>
/// <param _name="maxWidth"> Maximum width of current form </param>
/// <param _name="maxHeight"> Maximum height of current form </param>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetSizeLimit(
int minWidth,
+1 -7
View File
@@ -28,17 +28,10 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Graphics;
using StgSharp.Math;
using StgSharp.Threading;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
@@ -123,6 +116,7 @@ namespace StgSharp.MVVM
set;
}
//[BlueprintNodeExecution]
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public static bool GetExistedViewPort(
IntPtr handle,
@@ -104,8 +104,8 @@ namespace StgSharp.Graphics
/// <summary>
/// Get all uniform related to this <see cref="Camera" />.
/// </summary>
/// <param name="source"> Shader program requires this camera. </param>
/// <param name="uniformName">
/// <param _name="source"> Shader program requires this camera. </param>
/// <param _name="uniformName">
/// ContextName of all related uniforms. If you fallow form from <see
/// cref="IglConvertable.DisplayGLtypeDefinition" />
/// </param>
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.Intrinsic;
using StgSharp.Internal.Intrinsic;
using System.Numerics;
using System.Runtime.CompilerServices;
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.Intrinsic;
using StgSharp.Internal.Intrinsic;
using System;
using System.Numerics;
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.Intrinsic;
using StgSharp.Internal.Intrinsic;
using System;
using System.Numerics;
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.Intrinsic;
using StgSharp.Internal.Intrinsic;
using System;
using System.Numerics;
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.Intrinsic;
using StgSharp.Internal.Intrinsic;
using System;
using System.Numerics;
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.Intrinsic;
using StgSharp.Internal.Intrinsic;
using System;
using System.Drawing;
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.Intrinsic;
using StgSharp.Internal.Intrinsic;
using System;
using System.Numerics;
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.Intrinsic;
using StgSharp.Internal.Intrinsic;
using System;
using System.Collections.Generic;
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.Intrinsic;
using StgSharp.Internal.Intrinsic;
using System;
using System.ComponentModel;
+1 -1
View File
@@ -29,7 +29,7 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.Intrinsic;
using StgSharp.Internal.Intrinsic;
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
+1 -1
View File
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.Intrinsic;
using StgSharp.Internal.Intrinsic;
using StgSharp.Math;
using System;
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data;
using StgSharp.Internal;
using StgSharp.Math;
using System;
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.Intrinsic;
using StgSharp.Internal.Intrinsic;
using StgSharp.Math;
using System;
@@ -39,22 +39,6 @@ using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp
{
internal static partial class InternalIO
{
[DllImport(
SSC_libName,
EntryPoint = "normalize",
CallingConvention = CallingConvention.Cdecl )]
internal static extern unsafe void Normalize(
M128* source,
M128* target );
}
}
namespace StgSharp.Math
{
public static partial class Linear
@@ -92,8 +76,8 @@ namespace StgSharp.Math
/// Orthogonalize two <see cref="Vec3" />s, let their length be 1 and perpendicular to each
/// other.
/// </summary>
/// <param name="source"></param>
/// <param name="target"></param>
/// <param _name="source"></param>
/// <param _name="target"></param>
public static unsafe void Orthogonalize(
ref Vec3 source,
ref Vec3 target )
+1 -1
View File
@@ -43,7 +43,7 @@ namespace StgSharp.Math
/// <summary>
/// Reurns the value of ArcSin(x)
/// </summary>
/// <param name="x"> The sine value of the angle </param>
/// <param _name="x"> The sine value of the angle </param>
/// <returns></returns>
/// <exception cref="ArgumentException"></exception>
public static float ASin( float x )
+1 -1
View File
@@ -38,7 +38,7 @@ namespace StgSharp.Math
/// <summary>
/// Get the value of E ^ x;
/// </summary>
/// <param name="x"></param>
/// <param _name="x"></param>
/// <returns></returns>
public static unsafe float Exp( float x )
{
+1 -1
View File
@@ -42,7 +42,7 @@ namespace StgSharp.Math
/// <summary>
///
/// </summary>
/// <param name="x"></param>
/// <param _name="x"></param>
/// <returns>
/// Returns the value of ln(x).
/// </returns>
+2 -2
View File
@@ -36,8 +36,8 @@ namespace StgSharp.Math
/// <summary>
/// calculate the value of x^y
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param _name="x"></param>
/// <param _name="y"></param>
/// <returns> Returns the value of x^y </returns>
public static unsafe float Pow( float x, float y )
{
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data;
using StgSharp.Internal;
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Graphics.OpenGL;
@@ -0,0 +1,116 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<LangVersion>Preview</LangVersion>
<ProduceReferenceAssembly>True</ProduceReferenceAssembly>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Platforms>AnyCPU;x64</Platforms>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<PackageLicenseExpression> MIT</PackageLicenseExpression>
<EnableNETAnalyzers>True</EnableNETAnalyzers>
<AnalysisLevel>preview-all</AnalysisLevel>
<OutputType>Library</OutputType>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;NoOps;RealDebug;Benchmark;Toollist</Configurations>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Optimize>True</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Optimize>True</Optimize>
<DebugType>embedded</DebugType>
<NoWarn>1701;1702;0649;1591;0169</NoWarn>
<Deterministic>False</Deterministic>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Benchmark|x64'">
<Optimize>True</Optimize>
<DebugType>embedded</DebugType>
<NoWarn>1701;1702;0649;1591;0169</NoWarn>
<Deterministic>False</Deterministic>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>embedded</DebugType>
<Optimize>True</Optimize>
<NoWarn>1701;1702;0649;1591;0169</NoWarn>
<Deterministic>False</Deterministic>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>none</DebugType>
<NoWarn>1701;1702;0649;1591;0169</NoWarn>
<Deterministic>False</Deterministic>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebugType>none</DebugType>
<NoWarn>1701;1702;0649;1591;0169</NoWarn>
<Deterministic>False</Deterministic>
</PropertyGroup>
<PropertyGroup>
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
</PropertyGroup>
<PropertyGroup Condition="'$(IsWindows)'=='true'">
<DefineConstants>WINDOWS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(IsOSX)'=='true'">
<DefineConstants>OSX</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(IsLinux)'=='true'">
<DefineConstants>LINUX</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.49-beta">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.0" />
</ItemGroup>
<ItemGroup>
<None Update="..\StgSharpGraphic">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Expression\" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
</Target>
<PropertyGroup>
<MySymbol>$(ColiisionTextureVertexShader)</MySymbol>
<MySymbol>$(ColiisionTextureFragmentShader)</MySymbol>
<SignAssembly>False</SignAssembly>
<ErrorReport>send</ErrorReport>
<PackageProjectUrl>https://github.com/Nitload-NSI/StgSharp</PackageProjectUrl>
<RepositoryUrl>https://github.com/Nitload-NSI/StgSharp.git</RepositoryUrl>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='NoOps|AnyCPU'">
<Deterministic>False</Deterministic>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='NoOps|x64'">
<Deterministic>False</Deterministic>
</PropertyGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="xcopy /E /I /Y $(SolutionDir)build $(OutDir)" />
</Target>
</Project>
@@ -0,0 +1,84 @@
{
"format": 1,
"restore": {
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp\\StgSharp.Commom.csproj": {}
},
"projects": {
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp\\StgSharp.Commom.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp\\StgSharp.Commom.csproj",
"projectName": "StgSharp.Commom",
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp\\StgSharp.Commom.csproj",
"packagesPath": "C:\\Users\\Youmu\\.nuget\\packages\\",
"outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\Youmu\\AppData\\Roaming\\NuGet\\NuGet.Config"
],
"originalTargetFrameworks": [
"netstandard2.1"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"D:\\Programmer\\NugetLocal": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netstandard2.1": {
"targetAlias": "netstandard2.1",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
}
},
"frameworks": {
"netstandard2.1": {
"targetAlias": "netstandard2.1",
"dependencies": {
"Microsoft.CSharp": {
"target": "Package",
"version": "[4.7.0, )"
},
"Microsoft.Windows.CsWin32": {
"suppressParent": "All",
"target": "Package",
"version": "[0.3.49-beta, )"
},
"System.Runtime.CompilerServices.Unsafe": {
"target": "Package",
"version": "[6.1.0, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"NETStandard.Library": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.400\\RuntimeIdentifierGraph.json"
}
}
}
}
}
@@ -13,13 +13,8 @@
"packagesPath": "C:\\Users\\Youmu\\.nuget\\packages\\",
"outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\Youmu\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
"C:\\Users\\Youmu\\AppData\\Roaming\\NuGet\\NuGet.Config"
],
"originalTargetFrameworks": [
"netstandard2.1"
@@ -59,6 +54,10 @@
"suppressParent": "All",
"target": "Package",
"version": "[0.3.49-beta, )"
},
"System.Runtime.CompilerServices.Unsafe": {
"target": "Package",
"version": "[6.1.0, )"
}
},
"imports": [
@@ -103,7 +103,7 @@
}
}
},
"System.Runtime.CompilerServices.Unsafe/6.0.0": {
"System.Runtime.CompilerServices.Unsafe/6.1.0": {
"type": "package",
"compile": {
"lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": {
@@ -370,58 +370,50 @@
"version.txt"
]
},
"System.Runtime.CompilerServices.Unsafe/6.0.0": {
"sha512": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==",
"System.Runtime.CompilerServices.Unsafe/6.1.0": {
"sha512": "5o/HZxx6RVqYlhKSq8/zronDkALJZUT2Vz0hx43f0gwe8mwlM0y2nYlqdBwLMzr262Bwvpikeb/yEwkAa5PADg==",
"type": "package",
"path": "system.runtime.compilerservices.unsafe/6.0.0",
"path": "system.runtime.compilerservices.unsafe/6.1.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"Icon.png",
"LICENSE.TXT",
"THIRD-PARTY-NOTICES.TXT",
"PACKAGE.md",
"buildTransitive/net461/System.Runtime.CompilerServices.Unsafe.targets",
"buildTransitive/net462/_._",
"buildTransitive/net6.0/_._",
"buildTransitive/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.targets",
"buildTransitive/netcoreapp3.1/_._",
"lib/net461/System.Runtime.CompilerServices.Unsafe.dll",
"lib/net461/System.Runtime.CompilerServices.Unsafe.xml",
"lib/net6.0/System.Runtime.CompilerServices.Unsafe.dll",
"lib/net6.0/System.Runtime.CompilerServices.Unsafe.xml",
"lib/netcoreapp3.1/System.Runtime.CompilerServices.Unsafe.dll",
"lib/netcoreapp3.1/System.Runtime.CompilerServices.Unsafe.xml",
"lib/net462/System.Runtime.CompilerServices.Unsafe.dll",
"lib/net462/System.Runtime.CompilerServices.Unsafe.xml",
"lib/net7.0/_._",
"lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll",
"lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.xml",
"system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512",
"system.runtime.compilerservices.unsafe.nuspec",
"useSharedDesignerContext.txt"
"system.runtime.compilerservices.unsafe.6.1.0.nupkg.sha512",
"system.runtime.compilerservices.unsafe.nuspec"
]
}
},
"projectFileDependencyGroups": {
".NETStandard,Version=v2.1": [
"Microsoft.CSharp >= 4.7.0",
"Microsoft.Windows.CsWin32 >= 0.3.49-beta"
"Microsoft.Windows.CsWin32 >= 0.3.49-beta",
"System.Runtime.CompilerServices.Unsafe >= 6.1.0"
]
},
"packageFolders": {
"C:\\Users\\Youmu\\.nuget\\packages\\": {},
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {}
"C:\\Users\\Youmu\\.nuget\\packages\\": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp\\StgSharp.csproj",
"projectName": "StgSharp",
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp\\StgSharp.csproj",
"projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp\\StgSharp.Commom.csproj",
"projectName": "StgSharp.Commom",
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp\\StgSharp.Commom.csproj",
"packagesPath": "C:\\Users\\Youmu\\.nuget\\packages\\",
"outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\Youmu\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
"C:\\Users\\Youmu\\AppData\\Roaming\\NuGet\\NuGet.Config"
],
"originalTargetFrameworks": [
"netstandard2.1"
@@ -461,6 +453,10 @@
"suppressParent": "All",
"target": "Package",
"version": "[0.3.49-beta, )"
},
"System.Runtime.CompilerServices.Unsafe": {
"target": "Package",
"version": "[6.1.0, )"
}
},
"imports": [
@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+63c3cd17e2188771886daeb4046edf28633fa949")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6cfaa42ff31cf213685faf60a3fcde42b99f0224")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Commom")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6cfaa42ff31cf213685faf60a3fcde42b99f0224")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Commom")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Commom")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://github.com/Nitload-NSI/StgSharp.git")]
// 由 MSBuild WriteCodeFragment 类生成。