daily update on 20240206 by nitload youmu, token parser change to use regex generator
This commit is contained in:
@@ -39,7 +39,7 @@ using System.Threading.Tasks;
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface of all kinds OpenGL buffer objects
|
||||
/// Interface of all kinds OpenGL Buffer objects
|
||||
/// </summary>
|
||||
public abstract class BufferObjectBase : IDisposable
|
||||
{
|
||||
@@ -55,7 +55,7 @@ namespace StgSharp.Graphics
|
||||
public GlHandle this[ int index ] => _bufferHandle[ index ];
|
||||
|
||||
/// <summary>
|
||||
/// Bind a buffer instance to OpenGL
|
||||
/// Bind a Buffer instance to OpenGL
|
||||
/// </summary>
|
||||
/// <param _name="index"> Index of handle of the object in this instance to be bind </param>
|
||||
public abstract void Bind( int index );
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection of a sets of OpenGL textures. The collection can automatically select one of
|
||||
/// the texture with minimum costs to upgrade pixels to buffer. Usually <see
|
||||
/// the texture with minimum costs to upgrade pixels to Buffer. Usually <see
|
||||
/// cref="AutoTextureGL" /> is used for <see cref="IImageProvider" /> loading, but not for
|
||||
/// target of <see cref="OpenGLFunction.FrameBufferTexture2d(FrameBufferTarget, uint,
|
||||
/// Texture2DTarget, GlHandle, int)" />.
|
||||
|
||||
@@ -35,6 +35,7 @@ using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
@@ -62,11 +63,11 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
public void SetValue<T>( int index, T[] bufferArray, BufferUsage usage )
|
||||
where T: struct, IConvertible
|
||||
where T: struct, INumber<T>
|
||||
{
|
||||
GL.BindBuffer(
|
||||
BufferType.ElementArrayBuffer, _bufferHandle[ index ] );
|
||||
GL.SetBufferData(
|
||||
GL.SetBufferData<T>(
|
||||
BufferType.ElementArrayBuffer, bufferArray, usage );
|
||||
}
|
||||
|
||||
@@ -74,11 +75,11 @@ namespace StgSharp.Graphics.OpenGL
|
||||
int index,
|
||||
ReadOnlySpan<T> bufferSpan,
|
||||
BufferUsage usage )
|
||||
where T: struct, IConvertible
|
||||
where T: struct, INumber<T>
|
||||
{
|
||||
GL.BindBuffer(
|
||||
BufferType.ElementArrayBuffer, _bufferHandle[ index ] );
|
||||
GL.SetBufferData( BufferType.ElementArrayBuffer, bufferSpan,
|
||||
GL.SetBufferData<T>( BufferType.ElementArrayBuffer, bufferSpan,
|
||||
usage );
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ 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>
|
||||
@@ -74,10 +74,10 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// 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="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,7 @@
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Common.Internal.Intrinsic;
|
||||
using StgSharp.Intrinsic;
|
||||
using StgSharp.Internal.Intrinsic;
|
||||
using StgSharp.Internal.OpenGL;
|
||||
using StgSharp.Math;
|
||||
|
||||
@@ -33,6 +33,7 @@ using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Security;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -64,7 +65,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set _data to current vertex buffer object
|
||||
/// 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>
|
||||
@@ -81,7 +82,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set _data to current vertex buffer object
|
||||
/// 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>
|
||||
@@ -91,19 +92,14 @@ namespace StgSharp.Graphics.OpenGL
|
||||
int index,
|
||||
T[] bufferArray,
|
||||
BufferUsage usage )
|
||||
where T: struct,
|
||||
#if NET8_0_OR_GREATER
|
||||
INumber
|
||||
#else
|
||||
IConvertible
|
||||
#endif
|
||||
where T: struct, INumber<T>
|
||||
{
|
||||
GL.BindBuffer( BufferType.ArrayBuffer, _bufferHandle[ index ] );
|
||||
GL.SetBufferData( BufferType.ArrayBuffer, bufferArray, usage );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set _data to current vertex buffer object
|
||||
/// 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>
|
||||
@@ -113,19 +109,14 @@ namespace StgSharp.Graphics.OpenGL
|
||||
int index,
|
||||
ReadOnlySpan<T> scalerSpan,
|
||||
BufferUsage usage )
|
||||
where T: struct,
|
||||
#if NET8_0_OR_GREATER
|
||||
INumber
|
||||
#else
|
||||
IConvertible
|
||||
#endif
|
||||
where T: struct,INumber<T>
|
||||
{
|
||||
GL.BindBuffer( BufferType.ArrayBuffer, _bufferHandle[ index ] );
|
||||
GL.SetBufferData( BufferType.ArrayBuffer, scalerSpan, usage );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set _data to current vertex buffer object
|
||||
/// 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>
|
||||
@@ -142,7 +133,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set _data to current vertex buffer object
|
||||
/// 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>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Common.Internal.Intrinsic;
|
||||
using StgSharp.Intrinsic;
|
||||
using StgSharp.Math;
|
||||
using StgSharp.MVVM;
|
||||
using StgSharp.MVVM.View;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
using StgSharp.Common.Internal.Intrinsic;
|
||||
using StgSharp.Intrinsic;
|
||||
using StgSharp.Internal;
|
||||
using StgSharp.Internal.Intrinsic;
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -125,11 +126,11 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bind a frame buffer to a frame buffer target Same function as <see
|
||||
/// 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 )
|
||||
{
|
||||
@@ -274,11 +275,11 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete a render buffer object Very simlilar function as <see
|
||||
/// Delete a render Buffer object Very simlilar function as <see
|
||||
/// 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 );
|
||||
@@ -451,12 +452,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
ImageChannel channel,
|
||||
PixelChannelLayout channelLayout,
|
||||
T[] dataStream )
|
||||
where T: struct,
|
||||
#if NET8_0_OR_GREATER
|
||||
INumber
|
||||
#else
|
||||
IConvertible
|
||||
#endif
|
||||
where T: struct,INumber<T>
|
||||
{
|
||||
#pragma warning disable CS8500
|
||||
fixed( T* tptr = dataStream ) {
|
||||
@@ -578,12 +574,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
BufferType bufferType,
|
||||
T[] bufferArray,
|
||||
BufferUsage usage )
|
||||
where T: struct,
|
||||
#if NET8_0_OR_GREATER
|
||||
INumber
|
||||
#else
|
||||
IConvertible
|
||||
#endif
|
||||
where T: struct,INumber<T>
|
||||
{
|
||||
int size = bufferArray.Length * Marshal.SizeOf( typeof( T ) );
|
||||
if( bufferArray == null ) {
|
||||
@@ -591,8 +582,8 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
#pragma warning disable CS8500
|
||||
fixed( void* bufferPtr = bufferArray )
|
||||
#pragma warning restore CS8500
|
||||
{
|
||||
#pragma warning restore CS8500
|
||||
{
|
||||
Context.glBufferData(
|
||||
( uint )bufferType, ( IntPtr )size, ( IntPtr )bufferPtr,
|
||||
( uint )usage );
|
||||
@@ -604,12 +595,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
BufferType bufferType,
|
||||
ReadOnlySpan<T> bufferArray,
|
||||
BufferUsage usage )
|
||||
where T: struct,
|
||||
#if NET8_0_OR_GREATER
|
||||
INumber
|
||||
#else
|
||||
IConvertible
|
||||
#endif
|
||||
where T: struct,INumber<T>
|
||||
{
|
||||
int size = bufferArray.Length * Marshal.SizeOf( typeof( T ) );
|
||||
if( bufferArray == null ) {
|
||||
@@ -630,12 +616,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
BufferType bufferType,
|
||||
Span<T> bufferArray,
|
||||
BufferUsage usage )
|
||||
where T: struct,
|
||||
#if NET8_0_OR_GREATER
|
||||
INumber
|
||||
#else
|
||||
IConvertible
|
||||
#endif
|
||||
where T: struct, INumber<T>
|
||||
{
|
||||
int size = bufferArray.Length * Marshal.SizeOf( typeof( T ) );
|
||||
if( bufferArray == null ) {
|
||||
@@ -740,12 +721,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
ImageChannel targetChannel,
|
||||
PixelChannelLayout type,
|
||||
T[] pixels )
|
||||
where T: struct,
|
||||
#if NET8_0_OR_GREATER
|
||||
INumber
|
||||
#else
|
||||
IConvertible
|
||||
#endif
|
||||
where T: struct, INumber<T>
|
||||
{
|
||||
#pragma warning disable CS8500
|
||||
fixed( T* tptr = pixels ) {
|
||||
@@ -768,20 +744,15 @@ namespace StgSharp.Graphics.OpenGL
|
||||
ImageChannel targetChannel,
|
||||
PixelChannelLayout type,
|
||||
Span<T> pixelSpan )
|
||||
where T: struct,
|
||||
#if NET8_0_OR_GREATER
|
||||
INumber
|
||||
#else
|
||||
IConvertible
|
||||
#endif
|
||||
where T: struct, INumber<T>
|
||||
{
|
||||
#pragma warning disable CS8500
|
||||
#pragma warning disable CS8500
|
||||
fixed( T* tptr = pixelSpan ) {
|
||||
Context.glTexImage2D(
|
||||
( uint )target, level, ( uint )sourceChannel, width, height,
|
||||
0, ( uint )targetChannel, ( uint )type, tptr );
|
||||
}
|
||||
#pragma warning restore CS8500
|
||||
#pragma warning restore CS8500
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
|
||||
Reference in New Issue
Block a user