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
@@ -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
}
}