fix terrain sky to match projection FOV

Joe Groff 2009-05-11 12:36:04 -05:00
parent 33dc2fd715
commit 0116556762
1 changed files with 5 additions and 2 deletions

View File

@ -8,11 +8,14 @@ varying vec3 direction;
void main()
{
vec4 v = vec4(gl_Vertex.xy, -1.0, 1.0);
vec4 v = vec4(gl_Vertex.xy, 1.0, 1.0);
gl_Position = v;
vec4 p = (gl_ProjectionMatrixInverse * v) * vec4(1,1,-1,1);
float s = sin(sky_theta), c = cos(sky_theta);
direction = mat3(1, 0, 0, 0, c, s, 0, -s, c)
* (gl_ModelViewMatrixInverse * vec4(v.xyz, 0.0)).xyz;
* (gl_ModelViewMatrixInverse * vec4(p.xyz, 0.0)).xyz;
}
;