summaryrefslogtreecommitdiff
path: root/engine/light.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'engine/light.glsl')
-rw-r--r--engine/light.glsl31
1 files changed, 15 insertions, 16 deletions
diff --git a/engine/light.glsl b/engine/light.glsl
index 7516a58..6bc730a 100644
--- a/engine/light.glsl
+++ b/engine/light.glsl
@@ -4,23 +4,23 @@
#define LIGHT_GLSL
struct Material {
- vec3 ambient;
- vec3 diffuse;
- vec3 specular;
- sampler2D ambient_map;
- sampler2D diffuse_map;
- sampler2D specular_map;
- float shininess;
-};
+ vec3 ambient;
+ vec3 diffuse;
+ vec3 specular;
+ sampler2D ambient_map;
+ sampler2D diffuse_map;
+ sampler2D specular_map;
+ float shininess;
+};
struct PointLight {
vec3 position;
- vec3 diffuse;
- vec3 specular;
- float constant;
- float linear;
- float quadratic;
-};
+ vec3 diffuse;
+ vec3 specular;
+ float constant;
+ float linear;
+ float quadratic;
+};
vec3 calc_ambient_light(in Material material, in vec2 texture_coords)
{
@@ -55,7 +55,7 @@ vec3 calc_specular_light(
vec3 view_direction = normalize(view_pos - frag_pos);
vec3 reflect_direction = reflect(-light_dir, norm);
-
+
float spec =
pow(max(dot(view_direction, reflect_direction), 0.0), material.shininess);
@@ -111,5 +111,4 @@ vec3 calc_point_light(
return diffuse_light + specular_light;
}
-
#endif