mirror of
https://github.com/UOH-CS-Level5/551455-graphics-programming-2526-the-repo-Zyb3rWolfi.git
synced 2025-11-29 00:43:08 +00:00
29 lines
965 B
C#
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);
|
|
}
|
|
} |