daily update on 20240104 by nitload youmu, double threading not work
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
@@ -14,13 +15,13 @@ namespace StgSharp.Graphics
|
||||
private IglFunc GL;
|
||||
|
||||
internal unsafe Uniform(
|
||||
Form.Shader program, string name, IglFunc gL)
|
||||
uint shaderID, string name, IglFunc gL)
|
||||
{
|
||||
byte[] namearray = Encoding.ASCII.GetBytes(name);
|
||||
GL = gL;
|
||||
fixed (byte* ptr = namearray)
|
||||
{
|
||||
id = GL.GetUniformLocation(program.programID, ptr);
|
||||
id = GL.GetUniformLocation(shaderID, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +41,7 @@ namespace StgSharp.Graphics
|
||||
private IglFunc GL;
|
||||
|
||||
internal unsafe Uniform(
|
||||
Form.Shader program, string name, IglFunc glFunc)
|
||||
Shader program, string name, IglFunc glFunc)
|
||||
{
|
||||
byte[] namearray = Encoding.ASCII.GetBytes(name);
|
||||
GL = glFunc;
|
||||
@@ -64,7 +65,7 @@ namespace StgSharp.Graphics
|
||||
internal int id;
|
||||
private IglFunc GL;
|
||||
|
||||
public unsafe Uniform(Form.Shader program, string name, IglFunc glFunc)
|
||||
public unsafe Uniform(Shader program, string name, IglFunc glFunc)
|
||||
{
|
||||
byte[] namearray = Encoding.ASCII.GetBytes(name);
|
||||
GL = glFunc;
|
||||
@@ -89,7 +90,7 @@ namespace StgSharp.Graphics
|
||||
internal int id;
|
||||
private IglFunc GL;
|
||||
|
||||
internal unsafe Uniform(Form.Shader program, string name, IglFunc glFunc)
|
||||
internal unsafe Uniform(Shader program, string name, IglFunc glFunc)
|
||||
{
|
||||
byte[] namearray = Encoding.ASCII.GetBytes(name);
|
||||
fixed (byte* ptr = namearray)
|
||||
@@ -108,125 +109,107 @@ namespace StgSharp.Graphics
|
||||
|
||||
internal partial class GLonRender : IglFunc
|
||||
{
|
||||
/// <summary>
|
||||
/// Set data value to a float <see cref="Uniform{T}"/>,
|
||||
/// all types of parameters are float.
|
||||
/// </summary>
|
||||
/// <param name="uniform">The <see cref="Uniform{T}"/> target</param>
|
||||
/// <param name="v0">The value to be set</param>
|
||||
void IglFunc.SetValue(Uniform<float> uniform, float v0)
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
unsafe void IglFunc.SetValue(Uniform<float> uniform, float v0)
|
||||
{
|
||||
api.Uniform1f(uniform.id, v0);
|
||||
api->glUniform1f(uniform.id, v0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set data value to a int <see cref="Uniform{T}"/>,
|
||||
/// all types of parameters are int.
|
||||
/// </summary>
|
||||
/// <param name="uniform">The <see cref="Uniform{T}"/> target</param>
|
||||
/// <param name="i0">The value to be set</param>
|
||||
void IglFunc.SetValue(Uniform<int> uniform, int i0)
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
unsafe void IglFunc.SetValue(Uniform<int> uniform, int i0)
|
||||
{
|
||||
api.Uniform1i(uniform.id, i0);
|
||||
api->glUniform1i(uniform.id, i0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set data value to a float <see cref="Uniform{T,U}"/>,
|
||||
/// all types of parameters are float.
|
||||
/// </summary>
|
||||
/// <param name="uniform">The <see cref="Uniform{T,U}"/> target</param>
|
||||
/// <param name="v0">The first value to be set</param>
|
||||
/// <param name="v1">The second value to be set</param>
|
||||
void IglFunc.SetValue(Uniform<float, float> uniform, float v0, float v1)
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
unsafe void IglFunc.SetValue(Uniform<float, float> uniform, float v0, float v1)
|
||||
{
|
||||
api.Uniform2f(uniform.id, v0, v1);
|
||||
api->glUniform2f(uniform.id, v0, v1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set data value to a float <see cref="Uniform{T,U,V}"/>,
|
||||
/// all types of parameters are float.
|
||||
/// </summary>
|
||||
/// <param name="uniform">The <see cref="Uniform{T,U,V}"/> target</param>
|
||||
/// <param name="v0">The first value to be set</param>
|
||||
/// <param name="v1">The second value to be set</param>
|
||||
/// <param name="v2">The third value to be set</param>
|
||||
void IglFunc.SetValue(Uniform<float, float, float> uniform, float v0, float v1, float v2)
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
unsafe void IglFunc.SetValue(Uniform<float, float, float> uniform, float v0, float v1, float v2)
|
||||
{
|
||||
api.Uniform3f(uniform.id, v0, v1, v2);
|
||||
api->glUniform3f(uniform.id, v0, v1, v2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set data value to a float <see cref="Uniform{T,U,V,W}"/>,
|
||||
/// all types of parameters are float.
|
||||
/// </summary>
|
||||
/// <param name="uniform">The <see cref="Uniform{T,U,V,W}"/> target</param>
|
||||
/// <param name="v0">The first value to be set</param>
|
||||
/// <param name="v1">The second value to be set</param>
|
||||
/// <param name="v2">The third value to be set</param>
|
||||
/// <param name="v3">The forth value to be set</param>
|
||||
void IglFunc.SetValue(Uniform<float, float, float, float> uniform, float v0, float v1, float v2, float v3)
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
unsafe void IglFunc.SetValue(Uniform<float, float, float, float> uniform, float v0, float v1, float v2, float v3)
|
||||
{
|
||||
api.Uniform4f(uniform.id, v0, v1, v2, v3);
|
||||
api->glUniform4f(uniform.id, v0, v1, v2, v3);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set data value to a float <see cref="Uniform{T,U,V,W}"/>,
|
||||
/// all types of parameters are float.
|
||||
/// </summary>
|
||||
/// <param name="uniform">The <see cref="Uniform{T,U,V,W}"/> target</param>
|
||||
/// <param name="vec">A <see cref="Vec4d"/> packing four parameters of the uniform </param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public unsafe void SetValue(Uniform<float, float, float, float> uniform, Vec4d vec)
|
||||
{
|
||||
api.Uniform1fv(uniform.id, 4, &vec.fvec);
|
||||
api->glUniform1fv(uniform.id, 4, &vec);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set data value to a float <see cref="Uniform{T}"/>,
|
||||
/// all types of parameters are <see cref="Vec4d"/>.
|
||||
/// </summary>
|
||||
/// <param name="uniform">The <see cref="Uniform{T}"/> target</param>
|
||||
/// <param name="vec">A <see cref="Vec4d"/> value of the uniform </param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public unsafe void SetValue(Uniform<Vec4d> uniform, Vec4d vec)
|
||||
{
|
||||
api.Uniform1fv(uniform.id, 4, &vec.fvec);
|
||||
api->glUniform1fv(uniform.id, 4, &vec);
|
||||
}
|
||||
}
|
||||
|
||||
internal partial class GLonUpdate
|
||||
{
|
||||
void IglFunc.SetValue(Uniform<float, float, float> uniform, float v0, float v1, float v2)
|
||||
unsafe void IglFunc.SetValue(Uniform<float, float, float> uniform, float v0, float v1, float v2)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
glActionQueue.Enqueue(
|
||||
() => { api->glUniform3f(uniform.id, v0, v1, v2); }
|
||||
);
|
||||
}
|
||||
|
||||
void IglFunc.SetValue(Uniform<float, float> uniform, float v0, float v1)
|
||||
unsafe void IglFunc.SetValue(Uniform<float, float> uniform, float v0, float v1)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
glActionQueue.Enqueue(
|
||||
() => { api->glUniform2f(uniform.id, v0, v1); }
|
||||
);
|
||||
}
|
||||
|
||||
void IglFunc.SetValue(Uniform<float, float, float, float> uniform, float v0, float v1, float v2, float v3)
|
||||
unsafe void IglFunc.SetValue(Uniform<float, float, float, float> uniform, float v0, float v1, float v2, float v3)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
glActionQueue.Enqueue(
|
||||
() => { api->glUniform4f(uniform.id, v0, v1, v2, v3); }
|
||||
);
|
||||
}
|
||||
|
||||
void IglFunc.SetValue(Uniform<float, float, float, float> uniform, Vec4d vec)
|
||||
unsafe void IglFunc.SetValue(Uniform<float, float, float, float> uniform, Vec4d vec)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
glActionQueue.Enqueue(
|
||||
() =>
|
||||
{
|
||||
Vec4d cache = vec;
|
||||
api->glUniform1fv(uniform.id, 4, &cache);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void IglFunc.SetValue(Uniform<float> uniform, float v0)
|
||||
unsafe void IglFunc.SetValue(Uniform<float> uniform, float v0)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
glActionQueue.Enqueue(
|
||||
() => { api->glUniform1f(uniform.id, v0); }
|
||||
);
|
||||
}
|
||||
|
||||
void IglFunc.SetValue(Uniform<int> uniform, int i0)
|
||||
unsafe void IglFunc.SetValue(Uniform<int> uniform, int i0)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
glActionQueue.Enqueue(
|
||||
() => { api->glUniform1d(uniform.id, i0); }
|
||||
);
|
||||
}
|
||||
|
||||
void IglFunc.SetValue(Uniform<Vec4d> uniform, Vec4d vec)
|
||||
unsafe void IglFunc.SetValue(Uniform<Vec4d> uniform, Vec4d vec)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
glActionQueue.Enqueue(
|
||||
() =>
|
||||
{
|
||||
Vec4d cache = vec;
|
||||
api->glUniform1fv(uniform.id, 4, &cache);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user