Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uniform vec3 lightLocation; //Just set to 10, 10, 10 in the game class
- vec3 lightColor = vec3(100, 100, 100); //The lights color
- varying vec3 normal; //Normal (not setup through batch yet)
- varying vec3 vertex; //Vertex from last stage
- void main(){
- vec3 light = normalize(lightLocation.xyz - vertex); //Normalize length between the light location, and vertex location
- vec4 diffuse = vec4(lightColor, 1.0) * max(dot(normal, light), 0.0); //Diffuse color (light color)
- diffuse = clamp(diffuse, 0.0, 1.0); //Final light color
- gl_FragColor = gl_Color * diffuse; //Vertex color + light color
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement