private void SetColorUniform() { Shader shader = OpenTKSharedResources.shaders["SolidColor3D"]; shader.UseProgram(); shader.SetVector4("color", color); }
public void SetShaderUniforms(Shader shader) { foreach (var uniform in intUniformsByName) { shader.SetInt(uniform.Key, uniform.Value); } foreach (var uniform in floatUniformsByName) { shader.SetFloat(uniform.Key, uniform.Value); } foreach (var uniform in vec2UniformsByName) { shader.SetVector2(uniform.Key, uniform.Value); } foreach (var uniform in vec3UniformsByName) { shader.SetVector3(uniform.Key, uniform.Value); } foreach (var uniform in vec4UniformsByName) { shader.SetVector4(uniform.Key, uniform.Value); } foreach (var uniform in mat4UniformsByName) { Matrix4 value = uniform.Value; shader.SetMatrix4x4(uniform.Key, ref value); } }
private static void SetShaderUniforms(Matrix4 mvpMatrix, float scaleX, float scaleY, float scaleZ, float centerX, float centerY, float centerZ, Shader shader) { shader.SetVector3("center", centerX, centerY, centerZ); shader.SetVector3("scale", scaleX, scaleY, scaleZ); shader.SetVector4("color", new Vector4(1, 0, 1, 1)); Matrix4 matrix = mvpMatrix; shader.SetMatrix4x4("mvpMatrix", ref matrix); }