fix terrain sky to match projection FOV
parent
30bfce2ce0
commit
1e09ac31c5
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
Loading…
Reference in New Issue