import msp_interface; import _sky; uniform sampler2D distant; #pragma MSP stage(vertex) void main() { gl_Position = vec4(vertex.xy, 1.0, 1.0); out vec4 view_dir = eye_clip_matrix*vec4(vertex.xy, -1.0, 1.0); view_dir /= view_dir.w; view_dir = world_eye_matrix*vec4(view_dir.xyz, 0.0); } #pragma MSP stage(fragment) layout(location=0) out vec4 frag_color; void main() { vec3 nview = normalize(view_dir.xyz); float azimuth = atan(nview.y, nview.x); frag_color = texture(distant, vec2(azimuth/(2*PI), nview.z*0.5+0.5))*light_color; }