summaryrefslogtreecommitdiffstats
path: root/src/extras/shaders/gl3/normaldiffusemap.frag
diff options
context:
space:
mode:
Diffstat (limited to 'src/extras/shaders/gl3/normaldiffusemap.frag')
-rw-r--r--src/extras/shaders/gl3/normaldiffusemap.frag12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/extras/shaders/gl3/normaldiffusemap.frag b/src/extras/shaders/gl3/normaldiffusemap.frag
index e814da22f..1266cafa0 100644
--- a/src/extras/shaders/gl3/normaldiffusemap.frag
+++ b/src/extras/shaders/gl3/normaldiffusemap.frag
@@ -9,8 +9,8 @@ uniform sampler2D diffuseTexture;
uniform sampler2D normalTexture;
// TODO: Replace with a struct
-uniform vec3 ka; // Ambient reflectivity
-uniform vec3 ks; // Specular reflectivity
+uniform vec4 ka; // Ambient reflectivity
+uniform vec4 ks; // Specular reflectivity
uniform float shininess; // Specular shininess factor
uniform vec3 eyePosition;
@@ -31,10 +31,6 @@ void main()
vec3 wNormal = normalize(invertTangentMatrix * tNormal);
- // Calculate the lighting model, keeping the specular component separate
- vec3 diffuseColor, specularColor;
- adsModel(worldPosition, wNormal, eyePosition, shininess, diffuseColor, specularColor);
-
- // Combine spec with ambient+diffuse for final fragment color
- fragColor = vec4( ka + diffuseTextureColor.rgb * diffuseColor + ks * specularColor, 1.0 );
+ vec3 worldView = normalize(eyePosition - worldPosition);
+ fragColor = phongFunction(ka, diffuseTextureColor, ks, shininess, worldPosition, worldView, wNormal);
}