19 lines
464 B
GLSL
19 lines
464 B
GLSL
#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;
|
|
in vec4 fragNormal;
|
|
in vec3 v_surfaceToLight;
|
|
|
|
uniform vec4 u_color;
|
|
uniform vec3 u_light;
|
|
uniform vec3 u_lightPos;
|
|
|
|
out vec4 outColor;
|
|
|
|
void main() {
|
|
float light = max(dot(fragNormal.xyz, normalize(v_surfaceToLight).xyz), u_light.x);
|
|
outColor = u_color;
|
|
outColor.rgb *= light;
|
|
} |