2014-05-03 13:17:33 +00:00
|
|
|
#version 330
|
|
|
|
|
2014-05-16 07:10:09 +00:00
|
|
|
in vec3 vPosition;
|
|
|
|
in vec3 vNormal;
|
2014-05-03 13:17:33 +00:00
|
|
|
|
|
|
|
out vec4 fgColor;
|
|
|
|
|
2014-08-24 21:47:17 +00:00
|
|
|
uniform mat4 ViewMatrix;
|
|
|
|
|
2014-05-16 07:10:09 +00:00
|
|
|
void main () {
|
2014-08-24 21:47:17 +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(vNormal, lightDir);
|
|
|
|
float a = costheta * 0.5 + 0.5;
|
|
|
|
|
|
|
|
fgColor = vec4(0.5,0.5,0.5,1)*mix(dark,light,a);
|
2014-05-16 07:10:09 +00:00
|
|
|
}
|