/// <summary> /// Set uniform state variable (mat* variable). /// </summary> /// <param name="uniformName"> /// A <see cref="String"/> that specify the variable name in the shader source. /// </param> /// <param name="m"> /// A <see cref="Matrix"/> holding the uniform variabile data. /// </param> public void SetUniform(string uniformName, Matrix m) { UniformSegment uniform = GetUniform(uniformName); if (uniform == null) { return; } Set(m.ToArray(), (ulong)uniform.Offset); }
/// <summary> /// Set uniform state variable (vec3 variable). /// </summary> /// <param name="ctx"> /// A <see cref="GraphicsContext"/> used for operations. /// </param> /// <param name="uniformName"> /// A <see cref="String"/> that specify the variable name in the shader source. /// </param> /// <param name="v"> /// A <see cref="Vertex3f"/> holding the uniform variabile data. /// </param> public void SetUniform(string uniformName, Vertex3f v) { UniformSegment uniform = GetUniform(uniformName); if (uniform == null) { return; } uniform.CheckType(Gl.FLOAT_VEC3, Gl.BOOL_VEC3); Set(v, (ulong)uniform.Offset); }
public void SetUniform <T>(string uniformName, T v) where T : struct { UniformSegment uniform = GetUniform(uniformName); if (uniform == null) { return; } // uniform.CheckType(Gl.FLOAT_VEC2, Gl.BOOL_VEC2); Set(v, (ulong)uniform.Offset); }
/// <summary> /// Set uniform state variable (mat4 variable). /// </summary> /// <param name="uniformName"> /// A <see cref="String"/> that specify the variable name in the shader source. /// </param> /// <param name="m"> /// A <see cref="Matrix4x4f"/> holding the uniform variabile data. /// </param> public void SetUniform(string uniformName, Matrix4x4f m) { UniformSegment uniform = GetUniform(uniformName); if (uniform == null) { return; } uniform.CheckType(Gl.FLOAT_MAT4); Set(m, (ulong)uniform.Offset); }
/// <summary> /// Set uniform state variable (mat3 variable). /// </summary> /// <param name="uniformName"> /// A <see cref="String"/> that specify the variable name in the shader source. /// </param> /// <param name="m"> /// A <see cref="Matrix3x3"/> holding the uniform variabile data. /// </param> public void SetUniform(string uniformName, Matrix3x3 m) { UniformSegment uniform = GetUniform(uniformName); if (uniform == null) { return; } uniform.CheckType(Gl.FLOAT_MAT3); Set(m.ToArray(), (ulong)uniform.Offset); }
/// <summary> /// Set uniform state variable (array of vec2 variable). /// </summary> /// <param name="uniformName"> /// A <see cref="String"/> that specify the variable name in the shader source. /// </param> /// <param name="v"> /// A <see cref="T:Single[]"/> holding the uniform variabile data. /// </param> public void SetUniform(string uniformName, float[] v) { UniformSegment uniform = GetUniform(uniformName); if (uniform == null) { return; } // uniform.CheckType(Gl.FLOAT, Gl.BOOL); ulong offset = (ulong)uniform.Offset; for (int i = 0; i < v.Length; i++, offset = (ulong)uniform.ArrayStride) { Set(v[i], offset); } }