summaryrefslogtreecommitdiff
path: root/engine/light.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'engine/light.glsl')
-rw-r--r--engine/light.glsl15
1 files changed, 10 insertions, 5 deletions
diff --git a/engine/light.glsl b/engine/light.glsl
index 04a42f5..e9b2a61 100644
--- a/engine/light.glsl
+++ b/engine/light.glsl
@@ -21,16 +21,19 @@ struct PointLight {
float linear;
float quadratic;
};
-
-uniform Material material;
-uniform PointLight light;
-vec3 calc_ambient_light(in vec2 texture_coords)
+vec3 calc_ambient_light(in Material material, in vec2 texture_coords)
{
return vec3(texture(material.ambient_map, texture_coords)) * material.ambient;
}
-vec3 calc_diffuse_light(in vec3 light_dir, in vec3 norm, in vec2 texture_coords)
+vec3 calc_diffuse_light(
+ in Material material,
+ in PointLight light,
+ in vec3 light_dir,
+ in vec3 norm,
+ in vec2 texture_coords
+)
{
float diff = max(dot(norm, light_dir), 0.0);
@@ -40,6 +43,8 @@ vec3 calc_diffuse_light(in vec3 light_dir, in vec3 norm, in vec2 texture_coords)
}
vec3 calc_specular_light(
+ in Material material,
+ in PointLight light,
in vec3 light_dir,
in vec3 norm,
in vec3 view_pos,