using LearnOpenTK.Common; using OpenTK.Graphics.OpenGL; using OpenTK.Mathematics; namespace TheLabs; public struct Material { public Vector3 ambientColour; public Vector3 diffuseColour; public Vector3 specularColour; public float shininess; public Material(Vector3 ambient, Vector3 diffuse, Vector3 specular, float shininessFactor) { ambientColour = ambient; diffuseColour = diffuse; specularColour = specular; shininess = shininessFactor; } public void Apply(Shader shader) { GL.Uniform3(GL.GetUniformLocation(shader.Handle, "uMaterial.ambientColour"), ref ambientColour); GL.Uniform3(GL.GetUniformLocation(shader.Handle, "uMaterial.diffuseColour"), ref diffuseColour); GL.Uniform3(GL.GetUniformLocation(shader.Handle, "uMaterial.specularColour"), ref specularColour); GL.Uniform1(GL.GetUniformLocation(shader.Handle, "uMaterial.shininess"), shininess); } }