Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #version 110
- #define PI 3.141592653589793238462643383279
- #define HALF_PI 1.5707963267948966192313216916398
- uniform samplerCube cubeMap;
- //whether or not to flip the image
- uniform int flip;
- //direction correction in radiants
- uniform float yawCorrection;
- uniform float pitchCorrection;
- void main() {
- float x = gl_TexCoord[0].x;
- float y = gl_TexCoord[0].y;
- if (flip == 0) {
- y = 1.0 - gl_TexCoord[0].y; //image is flipped by default. unflip it.
- }
- vec2 textureCoordinates = vec2(x, y);
- vec2 thetaphi = ((textureCoordinates * 2.0) - vec2(1.0)) * vec2(PI, HALF_PI);
- vec3 rayDirection = vec3(cos(thetaphi.y) * cos(thetaphi.x), sin(thetaphi.y), cos(thetaphi.y) * sin(thetaphi.x));
- gl_FragColor = textureCube(cubeMap, rayDirection);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement