diff options
Diffstat (limited to 'Gem/cubemaptosphere.frag')
-rw-r--r-- | Gem/cubemaptosphere.frag | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Gem/cubemaptosphere.frag b/Gem/cubemaptosphere.frag new file mode 100644 index 0000000..cd2befb --- /dev/null +++ b/Gem/cubemaptosphere.frag @@ -0,0 +1,17 @@ +// Antoine Rousseau september 2015 +#version 120 + +uniform samplerCube envMap; +uniform float alpha = 1.0; + +void main() { + + vec2 tc = gl_TexCoord[0].st ; + vec2 thetaphi = ((tc * 2.0) - vec2(1.0)) * vec2(3.1415926535897932384626433832795, 1.5707963267948966192313216916398); + float ctpy = cos(thetaphi.y); + + vec3 rayDirection = vec3(ctpy * cos(thetaphi.x), sin(thetaphi.y), ctpy * sin(thetaphi.x)); + + gl_FragColor = textureCube(envMap, rayDirection); + gl_FragColor.a *= alpha; +} |