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
30 lines
978 B
C#
30 lines
978 B
C#
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);
|
|
}
|
|
|
|
} |