19 lines
537 B
GLSL
19 lines
537 B
GLSL
#version 430 core
|
|
|
|
uniform vec3 objectColor;
|
|
uniform vec3 lightDir;
|
|
uniform vec3 positiveColor;
|
|
uniform vec3 negativeColor;
|
|
|
|
in vec3 interpNormal;
|
|
in vec3 localPos;
|
|
|
|
void main()
|
|
{
|
|
vec3 normal = normalize(interpNormal);
|
|
float diffuse = max(dot(normal, -lightDir), 0.0);
|
|
|
|
if(sin(localPos.y) > 0) gl_FragColor = vec4(positiveColor.x * diffuse, positiveColor.y * diffuse, positiveColor.z * diffuse, 1.0);
|
|
else gl_FragColor = vec4(negativeColor.x * diffuse, negativeColor.y * diffuse, negativeColor.z * diffuse, 1.0);
|
|
}
|