pioneers/shaders/fragment.shader

23 lines
465 B
Plaintext
Raw Normal View History

2014-01-21 15:18:48 +00:00
#version 400
2014-01-21 15:18:48 +00:00
smooth in vec3 teNormal;
in vec4 teColor;
2014-01-21 15:18:48 +00:00
out vec4 fgColor;
uniform mat4 ViewMatrix;
void main(void)
{
2014-01-21 15:18:48 +00:00
//heliospheric lighting
vec4 light = vec4(1.0,1.0,1.0,1.0);
vec4 dark = vec4(0.0,0.0,0.0,1.0);
//direction to sun from origin
vec3 lightDir = normalize(ViewMatrix * vec4(5.0,5.0,1.0,0.0)).xyz;
float costheta = dot(teNormal, lightDir);
float a = costheta * 0.5 + 0.5;
fgColor = teColor * mix(dark, light, a);
}