20 lines
391 B
GLSL
20 lines
391 B
GLSL
R"(#version 330 core
|
|
out vec4 color;
|
|
uniform vec3 u_color;
|
|
|
|
in vec3 normal;
|
|
in vec4 pos;
|
|
|
|
void main()
|
|
{
|
|
vec3 norm = normalize(normal);
|
|
vec3 lightDir = normalize(vec3(4.0,3.0,3.0) - pos.xyz);
|
|
|
|
float diff = max(dot(norm, lightDir), 0.0);
|
|
|
|
// set light color
|
|
vec3 diffuse = diff * vec3(1.0,1.0,1.0);
|
|
|
|
vec3 result = (diffuse) * u_color;
|
|
color = vec4(result,0.0);
|
|
})"; |