Projekt-GRK/shaders/shader_proc_tex.frag

19 lines
537 B
GLSL
Raw Normal View History

2018-06-20 21:34:24 +02:00
#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);
}