Daily update on 20250618-051714 by Nitload Youmu. Additional Message : Brief support to collection operation in EXPRESS. A collection type added in core lib and compilestack.
Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
@@ -28,7 +28,6 @@
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
using StgSharp.Commom.Collections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -42,11 +41,11 @@ using System.Threading.Tasks;
|
||||
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
|
||||
/// cref="AutoTextureGL" /> is used for <see cref="IImageProvider" /> loading, but not for
|
||||
/// target of <see cref="OpenGLFunction.FrameBufferTexture2d(FrameBufferTarget, uint,
|
||||
/// Texture2DTarget, GlHandle, int)" />.
|
||||
/// 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
|
||||
/// cref="AutoTextureGL" /> is used for <see cref="IImageProvider" /> loading, but not for
|
||||
/// target of <see cref="OpenGLFunction.FrameBufferTexture2d(FrameBufferTarget, uint,
|
||||
/// Texture2DTarget, GlHandle, int)" />.
|
||||
/// </summary>
|
||||
public sealed class AutoTextureGL
|
||||
{
|
||||
@@ -54,8 +53,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
private TextureProperty[] propertyCache;
|
||||
private BidirectionalDictionary<Image, int> imageIndexMap = new BidirectionalDictionary<Image, int>(
|
||||
);
|
||||
private Dictionary<Image, int> imageUpdateIndex = new Dictionary<Image, int>(
|
||||
);
|
||||
private Dictionary<Image, int> imageUpdateIndex = new Dictionary<Image, int>();
|
||||
|
||||
private int _size, _currentIndex;
|
||||
private LinkedList<int> usedTextureIndex;
|
||||
@@ -69,8 +67,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
texturePackage = texture;
|
||||
_size = texture.Count;
|
||||
imageIndexMap = new BidirectionalDictionary<Image, int>();
|
||||
unusedTextureUnitIndex = new Queue<int>(
|
||||
Enumerable.Range( 0, _size ) );
|
||||
unusedTextureUnitIndex = new Queue<int>( Enumerable.Range( 0, _size ) );
|
||||
usedTextureIndex = new LinkedList<int>();
|
||||
propertyCache = new TextureProperty[_size];
|
||||
}
|
||||
@@ -80,8 +77,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
this._size = textureObjectSize;
|
||||
imageIndexMap = new BidirectionalDictionary<Image, int>();
|
||||
texturePackage = new TextureGL( textureObjectSize, binding );
|
||||
unusedTextureUnitIndex = new Queue<int>(
|
||||
Enumerable.Range( 0, _size ) );
|
||||
unusedTextureUnitIndex = new Queue<int>( Enumerable.Range( 0, _size ) );
|
||||
usedTextureIndex = new LinkedList<int>();
|
||||
propertyCache = new TextureProperty[_size];
|
||||
}
|
||||
@@ -105,29 +101,34 @@ namespace StgSharp.Graphics.OpenGL
|
||||
SelectTextureAndBind( i, property );
|
||||
}
|
||||
|
||||
public void SelectTextureAndBind(
|
||||
[NotNull]Image i,
|
||||
TextureProperty property )
|
||||
public void SelectTextureAndBind( [NotNull]Image i, TextureProperty property )
|
||||
{
|
||||
//usable texture with image match
|
||||
if( imageIndexMap.TryGetValue( i, out int index ) ) {
|
||||
if( imageIndexMap.TryGetValue( i, out int index ) )
|
||||
{
|
||||
//prop setting match
|
||||
if( propertyCache[ index ] == property ) {
|
||||
if( propertyCache[ index ] == property )
|
||||
{
|
||||
_currentIndex = index; //GL.Assert(true);
|
||||
texturePackage.Bind2D( index ); //GL.Assert(true);
|
||||
if( i.PixelUpdateCount != imageUpdateIndex[ i ] ) {
|
||||
if( i.PixelUpdateCount != imageUpdateIndex[ i ] )
|
||||
{
|
||||
texturePackage.LoadTexture( index, i ); //GL.Assert(true);
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
_currentIndex = index; //GL.Assert(true);
|
||||
texturePackage.Bind2D( index ); //GL.Assert(true);
|
||||
texturePackage.Set2dProperty( index, property ); //GL.Assert(true);
|
||||
if( i.PixelUpdateCount != imageUpdateIndex[ i ] ) {
|
||||
if( i.PixelUpdateCount != imageUpdateIndex[ i ] )
|
||||
{
|
||||
texturePackage.LoadTexture( index, i ); //GL.Assert(true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if( unusedTextureUnitIndex.TryDequeue( out int newIndex ) ) {
|
||||
} else
|
||||
{
|
||||
if( unusedTextureUnitIndex.TryDequeue( out int newIndex ) )
|
||||
{
|
||||
//has extra unused texture object
|
||||
imageIndexMap.Add( i, index );
|
||||
texturePackage.Bind2D( index );
|
||||
@@ -136,7 +137,8 @@ namespace StgSharp.Graphics.OpenGL
|
||||
usedTextureIndex.AddLast( newIndex );
|
||||
propertyCache[ newIndex ] = property;
|
||||
imageUpdateIndex[ i ] = i.PixelUpdateCount;
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
//recycle from current
|
||||
int reusedIndex = usedTextureIndex.First!.Value;
|
||||
usedTextureIndex.RemoveFirst();
|
||||
@@ -151,8 +153,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
public static AutoTextureGL ToAuto( [NotNull]TextureGL texture )
|
||||
{
|
||||
if( texture.IndexOfCurrentTexture != -1 ) {
|
||||
throw new InvalidOperationException(
|
||||
"Texture to be converted has been editted." );
|
||||
throw new InvalidOperationException( "Texture to be converted has been editted." );
|
||||
}
|
||||
return new AutoTextureGL( texture );
|
||||
}
|
||||
|
||||
@@ -43,9 +43,9 @@ using System.Text;
|
||||
namespace StgSharp.Graphics.OpenGL
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection of handle to Element Buffer Object in OpenglFunc. Each <see langword="uint" />
|
||||
/// value indexed from instance of this class this is the only handle to one Element Buffer
|
||||
/// Object.
|
||||
/// A collection of handle to Element Buffer Object in OpenglFunc. Each <see langword="uint"
|
||||
/// /> value indexed from instance of this class this is the only handle to one Element Buffer
|
||||
/// Object.
|
||||
/// </summary>
|
||||
public sealed unsafe class ElementBuffer : GlBufferObjectBase
|
||||
{
|
||||
@@ -58,29 +58,21 @@ namespace StgSharp.Graphics.OpenGL
|
||||
|
||||
public override sealed void Bind( int index )
|
||||
{
|
||||
GL.BindBuffer(
|
||||
BufferType.ElementArrayBuffer, _bufferHandle[ index ] );
|
||||
GL.BindBuffer( BufferType.ElementArrayBuffer, _bufferHandle[ index ] );
|
||||
}
|
||||
|
||||
public void SetValue<T>( int index, T[] bufferArray, BufferUsage usage )
|
||||
where T: struct, INumber<T>
|
||||
{
|
||||
GL.BindBuffer(
|
||||
BufferType.ElementArrayBuffer, _bufferHandle[ index ] );
|
||||
GL.SetBufferData<T>(
|
||||
BufferType.ElementArrayBuffer, bufferArray, usage );
|
||||
GL.BindBuffer( BufferType.ElementArrayBuffer, _bufferHandle[ index ] );
|
||||
GL.SetBufferData<T>( BufferType.ElementArrayBuffer, bufferArray, usage );
|
||||
}
|
||||
|
||||
public void SetValue<T>(
|
||||
int index,
|
||||
ReadOnlySpan<T> bufferSpan,
|
||||
BufferUsage usage )
|
||||
public void SetValue<T>( int index, ReadOnlySpan<T> bufferSpan, BufferUsage usage )
|
||||
where T: struct, INumber<T>
|
||||
{
|
||||
GL.BindBuffer(
|
||||
BufferType.ElementArrayBuffer, _bufferHandle[ index ] );
|
||||
GL.SetBufferData<T>( BufferType.ElementArrayBuffer, bufferSpan,
|
||||
usage );
|
||||
GL.BindBuffer( BufferType.ElementArrayBuffer, _bufferHandle[ index ] );
|
||||
GL.SetBufferData<T>( BufferType.ElementArrayBuffer, bufferSpan, usage );
|
||||
}
|
||||
|
||||
protected override sealed void Dispose( bool disposing )
|
||||
|
||||
@@ -63,10 +63,13 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// Bind the frame Buffer object with _label 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 _label="index">
|
||||
/// Index of object to be binded in handle set
|
||||
/// </param>
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public override unsafe void Bind( int index )
|
||||
{
|
||||
@@ -74,11 +77,15 @@ 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 _label 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 _label="target">
|
||||
/// The frame Buffer target of the binding operation.
|
||||
/// </param>
|
||||
/// <param _label="index">
|
||||
/// Index of object to be binded in handle set
|
||||
/// </param>
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public unsafe void Bind( FrameBufferTarget target, int index )
|
||||
{
|
||||
@@ -88,8 +95,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static void BindNull()
|
||||
{
|
||||
OpenGLFunction.CurrentGL
|
||||
.BindFrameBuffer( FrameBufferTarget.All, GlHandle.Zero );
|
||||
OpenGLFunction.CurrentGL.BindFrameBuffer( FrameBufferTarget.All, GlHandle.Zero );
|
||||
}
|
||||
|
||||
protected override void Dispose( bool disposing )
|
||||
|
||||
@@ -51,19 +51,17 @@ namespace StgSharp.Graphics.OpenGL
|
||||
GL.BindRenderBuffer( this[ index ] );
|
||||
}
|
||||
|
||||
public void Store(
|
||||
RenderBufferInternalFormat format,
|
||||
(int width, int height) size )
|
||||
public void Store( RenderBufferInternalFormat format, (int width, int height) size )
|
||||
{
|
||||
if( ( size.width > binding.Width ) || ( size.height > binding.Height ) ) {
|
||||
StgSharp.LogWarning(
|
||||
"FrameBuffer is larger than current canvas binding" );
|
||||
World.LogWarning( "FrameBuffer is larger than current canvas binding" );
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
foreach( GlHandle item in _bufferHandle ) {
|
||||
foreach( GlHandle item in _bufferHandle )
|
||||
{
|
||||
Console.WriteLine( "removing a render buffer" );
|
||||
GL.DeleteRenderBuffer( item );
|
||||
}
|
||||
|
||||
@@ -84,16 +84,20 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load an <see cref="Image" /> to certain texture.
|
||||
/// Load an <see cref="Image" /> to certain texture.
|
||||
/// </summary>
|
||||
/// <param _name="index"> </param>
|
||||
/// <param _name="i"> </param>
|
||||
/// <param _label="index">
|
||||
///
|
||||
/// </param>
|
||||
/// <param _label="i">
|
||||
///
|
||||
/// </param>
|
||||
public unsafe void LoadTexture( int index, Image i )
|
||||
{
|
||||
byte[] handle = i.PixelBuffer;
|
||||
_gl.TextureImage2d(
|
||||
Texture2DTarget.Texture2D, 0, i.Channel, ( uint )i.Width,
|
||||
( uint )i.Height, i.Channel, i.PixelLayout, pixels: handle );
|
||||
Texture2DTarget.Texture2D, 0, i.Channel, ( uint )i.Width, ( uint )i.Height,
|
||||
i.Channel, i.PixelLayout, pixels: handle );
|
||||
_gl.GenerateMipmap( Texture2DTarget.Texture2D );
|
||||
}
|
||||
|
||||
@@ -101,50 +105,45 @@ namespace StgSharp.Graphics.OpenGL
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public void Set2dFilterProperty(
|
||||
int index,
|
||||
TextureFilter onMinify,
|
||||
TextureFilter onMagnify )
|
||||
int index,
|
||||
TextureFilter onMinify,
|
||||
TextureFilter onMagnify )
|
||||
{
|
||||
#if DEBUG
|
||||
if( index != currentEditingTextureIndex ) {
|
||||
if( index != currentEditingTextureIndex )
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Texture to be editted is not the one being activated." );
|
||||
}
|
||||
#endif
|
||||
_gl.TextureParameter(
|
||||
glConst.TEXTURE_2D, glConst.TEXTURE_MIN_FILTER,
|
||||
( int )onMinify );
|
||||
_gl.TextureParameter(
|
||||
glConst.TEXTURE_2D, glConst.TEXTURE_MAG_FILTER,
|
||||
( int )onMagnify );
|
||||
_gl.TextureParameter( glConst.TEXTURE_2D, glConst.TEXTURE_MIN_FILTER, ( int )onMinify );
|
||||
_gl.TextureParameter( glConst.TEXTURE_2D, glConst.TEXTURE_MAG_FILTER,
|
||||
( int )onMagnify );
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public void Set2dWrapProperty(
|
||||
int index,
|
||||
TextureWrap onHorizontial,
|
||||
TextureWrap onVertical )
|
||||
int index,
|
||||
TextureWrap onHorizontial,
|
||||
TextureWrap onVertical )
|
||||
{
|
||||
#if DEBUG
|
||||
if( index != currentEditingTextureIndex ) {
|
||||
if( index != currentEditingTextureIndex )
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Texture to be editted is not the one being activated." );
|
||||
}
|
||||
#endif
|
||||
_gl.TextureParameter(
|
||||
glConst.TEXTURE_2D, glConst.TEXTURE_WRAP_S,
|
||||
( int )onHorizontial );
|
||||
_gl.TextureParameter(
|
||||
glConst.TEXTURE_2D, glConst.TEXTURE_WRAP_T, ( int )onVertical );
|
||||
_gl.TextureParameter( glConst.TEXTURE_2D, glConst.TEXTURE_WRAP_S,
|
||||
( int )onHorizontial );
|
||||
_gl.TextureParameter( glConst.TEXTURE_2D, glConst.TEXTURE_WRAP_T, ( int )onVertical );
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public void Set2dProperty( int index, TextureProperty property )
|
||||
{
|
||||
Set2dFilterProperty(
|
||||
index, property.FilterOnMinify, property.FilterOnMagnify );
|
||||
Set2dWrapProperty(
|
||||
index, property.WrapOnHorizontial, property.WrapOnVertical );
|
||||
Set2dFilterProperty( index, property.FilterOnMinify, property.FilterOnMagnify );
|
||||
Set2dWrapProperty( index, property.WrapOnHorizontial, property.WrapOnVertical );
|
||||
}
|
||||
|
||||
#endregion texture setting
|
||||
@@ -162,10 +161,10 @@ namespace StgSharp.Graphics.OpenGL
|
||||
[FieldOffset( 12 )] private TextureWrap vert;
|
||||
|
||||
public TextureProperty(
|
||||
TextureFilter onMagnify,
|
||||
TextureFilter onMinify,
|
||||
TextureWrap onHorizontial,
|
||||
TextureWrap onVertical )
|
||||
TextureFilter onMagnify,
|
||||
TextureFilter onMinify,
|
||||
TextureWrap onHorizontial,
|
||||
TextureWrap onVertical )
|
||||
{
|
||||
FilterOnMagnify = onMagnify;
|
||||
FilterOnMinify = onMinify;
|
||||
@@ -205,8 +204,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(
|
||||
FilterOnMagnify, FilterOnMagnify, WrapOnHorizontial,
|
||||
WrapOnVertical );
|
||||
FilterOnMagnify, FilterOnMagnify, WrapOnHorizontial, WrapOnVertical );
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@@ -214,30 +212,25 @@ namespace StgSharp.Graphics.OpenGL
|
||||
return $"FilterOnMagnify:{FilterOnMagnify}, " + $"FilterOnMagnify:{FilterOnMagnify}, " + $"WrapOnHorizontial:{WrapOnHorizontial}, " + $"WrapOnVertical:{WrapOnVertical}";
|
||||
}
|
||||
|
||||
public static bool operator !=(
|
||||
TextureProperty left,
|
||||
TextureProperty right )
|
||||
public static bool operator !=( TextureProperty left, TextureProperty right )
|
||||
{
|
||||
return left.mask != right.mask;
|
||||
}
|
||||
|
||||
public static bool operator ==(
|
||||
TextureProperty left,
|
||||
TextureProperty right )
|
||||
public static bool operator ==( TextureProperty left, TextureProperty right )
|
||||
{
|
||||
return left.mask == right.mask;
|
||||
}
|
||||
|
||||
public static implicit operator TextureProperty(
|
||||
(
|
||||
(
|
||||
TextureFilter onMagnify, TextureFilter onMinify,
|
||||
TextureWrap onHorizontial, TextureWrap onVertical
|
||||
) propertyValueTuple )
|
||||
{
|
||||
return new TextureProperty(
|
||||
propertyValueTuple.onMagnify, propertyValueTuple.onMinify,
|
||||
propertyValueTuple.onHorizontial,
|
||||
propertyValueTuple.onVertical );
|
||||
propertyValueTuple.onHorizontial, propertyValueTuple.onVertical );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="VAO.cs"
|
||||
// Project: StgSharp
|
||||
// Project: StepVisualizer
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
@@ -28,7 +28,6 @@
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
@@ -59,15 +58,15 @@ namespace StgSharp.Graphics.OpenGL
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public void SetVertexAttribute(
|
||||
uint index,
|
||||
int vertexLength,
|
||||
TypeCode dataType,
|
||||
bool isNomalized,
|
||||
uint stride,
|
||||
int pointer )
|
||||
uint attributeIndex,
|
||||
int vertexLength,
|
||||
TypeCode dataType,
|
||||
bool isNomalized,
|
||||
uint stride,
|
||||
int pointer )
|
||||
{
|
||||
GL.SetVertexAttribute(
|
||||
index, vertexLength, dataType, isNomalized, stride, pointer );
|
||||
attributeIndex, vertexLength, dataType, isNomalized, stride, pointer );
|
||||
}
|
||||
|
||||
protected override sealed void Dispose( bool disposing )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="VBO.cs"
|
||||
// Project: StgSharp
|
||||
// Project: StepVisualizer
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
@@ -65,16 +65,21 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set _data to current vertex Buffer object
|
||||
/// Set _data to current vertex Buffer object
|
||||
/// </summary>
|
||||
/// <typeparam _name="TItem"> 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,
|
||||
BufferUsage usage )
|
||||
/// <typeparam _label="TItem">
|
||||
/// Type of bufferData
|
||||
/// </typeparam>
|
||||
/// <param _label="index">
|
||||
/// Index to find certain VBO in this instance
|
||||
/// </param>
|
||||
/// <param _label="bufferData">
|
||||
/// Data to write in
|
||||
/// </param>
|
||||
/// <param _label="usage">
|
||||
/// How OpenGL use these _data, defined by <see cref="BufferUsage" />
|
||||
/// </param>
|
||||
public void WriteMatrixData<T>( int index, T bufferData, BufferUsage usage )
|
||||
where T: struct, IMatrix<T>
|
||||
{
|
||||
GL.BindBuffer( BufferType.ArrayBuffer, _bufferHandle[ index ] );
|
||||
@@ -82,16 +87,21 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set _data to current vertex Buffer object
|
||||
/// Set _data to current vertex Buffer object
|
||||
/// </summary>
|
||||
/// <typeparam _name="TItem"> 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,
|
||||
BufferUsage usage )
|
||||
/// <typeparam _label="TItem">
|
||||
/// Type of bufferData
|
||||
/// </typeparam>
|
||||
/// <param _label="index">
|
||||
/// Index to find certain VBO in this instance
|
||||
/// </param>
|
||||
/// <param _label="bufferArray">
|
||||
/// Data to write in
|
||||
/// </param>
|
||||
/// <param _label="usage">
|
||||
/// How OpenGL use these _data, defined by <see cref="BufferUsage" />
|
||||
/// </param>
|
||||
public void WriteScalerData<T>( int index, T[] bufferArray, BufferUsage usage )
|
||||
where T: struct, INumber<T>
|
||||
{
|
||||
GL.BindBuffer( BufferType.ArrayBuffer, _bufferHandle[ index ] );
|
||||
@@ -99,16 +109,21 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set _data to current vertex Buffer object
|
||||
/// Set _data to current vertex Buffer object
|
||||
/// </summary>
|
||||
/// <typeparam _name="TItem"> 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,
|
||||
BufferUsage usage )
|
||||
/// <typeparam _label="TItem">
|
||||
/// Type of bufferData
|
||||
/// </typeparam>
|
||||
/// <param _label="index">
|
||||
/// Index to find certain VBO in this instance
|
||||
/// </param>
|
||||
/// <param _label="scalerSpan">
|
||||
/// A <see cref="Span{T}" /> of _data to write in
|
||||
/// </param>
|
||||
/// <param _label="usage">
|
||||
/// How OpenGL use these _data, defined by <see cref="BufferUsage" />
|
||||
/// </param>
|
||||
public void WriteScalerData<T>( int index, ReadOnlySpan<T> scalerSpan, BufferUsage usage )
|
||||
where T: struct,INumber<T>
|
||||
{
|
||||
GL.BindBuffer( BufferType.ArrayBuffer, _bufferHandle[ index ] );
|
||||
@@ -116,16 +131,21 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set _data to current vertex Buffer object
|
||||
/// Set data to current vertex Buffer object
|
||||
/// </summary>
|
||||
/// <typeparam _name="TItem"> 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,
|
||||
BufferUsage usage )
|
||||
/// <typeparam _label="TItem">
|
||||
/// Type of bufferData
|
||||
/// </typeparam>
|
||||
/// <param _label="index">
|
||||
/// Index to find certain VBO in this instance
|
||||
/// </param>
|
||||
/// <param _label="vectorSpan">
|
||||
/// A <see cref="Span{T}" /> of data to write in
|
||||
/// </param>
|
||||
/// <param _label="usage">
|
||||
/// How OpenGL use these data, defined by <see cref="BufferUsage" />
|
||||
/// </param>
|
||||
public void WriteVectorData<T>( int index, ReadOnlySpan<T> vectorSpan, BufferUsage usage )
|
||||
where T: struct, IVector<T>
|
||||
{
|
||||
GL.BindBuffer( BufferType.ArrayBuffer, _bufferHandle[ index ] );
|
||||
@@ -133,21 +153,25 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set _data to current vertex Buffer object
|
||||
/// Set _data to current vertex Buffer object
|
||||
/// </summary>
|
||||
/// <typeparam _name="TItem"> 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,
|
||||
BufferUsage usage )
|
||||
/// <typeparam _label="TItem">
|
||||
/// Type of bufferData
|
||||
/// </typeparam>
|
||||
/// <param _label="index">
|
||||
/// Index to find certain VBO in this instance
|
||||
/// </param>
|
||||
/// <param _label="vectorArray">
|
||||
/// A array of _data to write in
|
||||
/// </param>
|
||||
/// <param _label="usage">
|
||||
/// How OpenGL use these _data, defined by <see cref="BufferUsage" />
|
||||
/// </param>
|
||||
public void WriteVectorData<T>( int index, T[] vectorArray, BufferUsage usage )
|
||||
where T: struct, IVector<T>
|
||||
{
|
||||
GL.BindBuffer( BufferType.ArrayBuffer, _bufferHandle[ index ] );
|
||||
GL.SetBufferVectorData( BufferType.ArrayBuffer, vectorArray,
|
||||
usage );
|
||||
GL.SetBufferVectorData( BufferType.ArrayBuffer, vectorArray, usage );
|
||||
}
|
||||
|
||||
protected override sealed void Dispose( bool disposing )
|
||||
|
||||
Reference in New Issue
Block a user