fix terrain sky to match projection FOV

db4
Joe Groff 2009-05-11 12:36:04 -05:00
parent 30bfce2ce0
commit 1e09ac31c5
1 changed files with 5 additions and 2 deletions

View File

@ -8,11 +8,14 @@ varying vec3 direction;
void main() 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; gl_Position = v;
vec4 p = (gl_ProjectionMatrixInverse * v) * vec4(1,1,-1,1);
float s = sin(sky_theta), c = cos(sky_theta); float s = sin(sky_theta), c = cos(sky_theta);
direction = mat3(1, 0, 0, 0, c, s, 0, -s, c) 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;
} }
; ;