diff options
-rw-r--r-- | engine/light.glsl | 31 | ||||
-rw-r--r-- | engine/vertex.glsl | 2 |
2 files changed, 16 insertions, 17 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 diff --git a/engine/vertex.glsl b/engine/vertex.glsl index ac24ef2..f282864 100644 --- a/engine/vertex.glsl +++ b/engine/vertex.glsl @@ -13,7 +13,7 @@ uniform mat4 projection; void main() { - gl_Position = projection * view * model * vec4(pos, 1.0); + gl_Position = projection * view * model * vec4(pos, 1.0); in_frag_pos = vec3(model * vec4(pos, 1.0)); in_texture_coords = texture_coords; |