2014-01-21 15:18:48 +00:00
|
|
|
#version 400
|
2014-01-02 02:35:38 +00:00
|
|
|
|
2014-01-21 15:18:48 +00:00
|
|
|
smooth in vec3 teNormal;
|
|
|
|
in vec4 teColor;
|
2014-01-02 02:35:38 +00:00
|
|
|
|
2014-01-21 15:18:48 +00:00
|
|
|
out vec4 fgColor;
|
|
|
|
|
|
|
|
uniform mat4 ViewMatrix;
|
2014-01-02 02:35:38 +00:00
|
|
|
|
|
|
|
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);
|
2014-01-03 02:01:54 +00:00
|
|
|
}
|