29 lines
965 B
C#

using LearnOpenTK.Common;
using OpenTK.Graphics.OpenGL;
using OpenTK.Mathematics;
namespace TheLabs;
public struct Lighting
{
public Vector3 position;
public Vector3 ambientColour;
public Vector3 diffuseColour;
public Vector3 specularColour;
public Lighting(Vector3 pos, Vector3 ambient, Vector3 diffuse, Vector3 specular)
{
position = pos;
ambientColour = ambient;
diffuseColour = diffuse;
specularColour = specular;
}
public void Apply(Shader shader)
{
GL.Uniform3(GL.GetUniformLocation(shader.Handle, "uPointLight.position"), ref position);
GL.Uniform3(GL.GetUniformLocation(shader.Handle, "uPointLight.ambientColour"), ref ambientColour);
GL.Uniform3(GL.GetUniformLocation(shader.Handle, "uPointLight.diffuseColour"), ref diffuseColour);
GL.Uniform3(GL.GetUniformLocation(shader.Handle, "uPointLight.specularColour"), ref specularColour);
}
}