2020-04-05 15:28:22 +02:00
|
|
|
#version 300 es
|
|
|
|
|
|
|
|
// fragment shaders don't have a default precision so we need
|
|
|
|
// to pick one. mediump is a good default. It means "medium precision"
|
|
|
|
precision highp float;
|
2020-04-07 21:44:46 +02:00
|
|
|
in vec4 fragNormal;
|
2020-04-05 15:28:22 +02:00
|
|
|
in vec3 v_surfaceToLight;
|
|
|
|
|
|
|
|
uniform vec4 u_color;
|
2020-04-07 21:44:46 +02:00
|
|
|
uniform vec3 u_light;
|
2020-04-05 15:28:22 +02:00
|
|
|
uniform vec3 u_lightPos;
|
|
|
|
|
|
|
|
out vec4 outColor;
|
|
|
|
|
|
|
|
void main() {
|
2020-04-07 21:44:46 +02:00
|
|
|
float light = max(dot(fragNormal.xyz, normalize(v_surfaceToLight).xyz), u_light.x);
|
2020-04-05 15:28:22 +02:00
|
|
|
outColor = u_color;
|
2020-04-07 21:44:46 +02:00
|
|
|
outColor.rgb *= light;
|
2020-04-05 15:28:22 +02:00
|
|
|
}
|