From 01015ee03992ae5a633f81aab434c905e1250c21 Mon Sep 17 00:00:00 2001 From: Travis CI Date: Mon, 28 Nov 2016 12:49:04 +0000 Subject: Gem 83e036efcfb97e8901669d4a49273f2f30283745 linux/amd64 built 'master:83e036efcfb97e8901669d4a49273f2f30283745' for linux/amd64 --- Gem/cubemaptosphere.frag | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Gem/cubemaptosphere.frag (limited to 'Gem/cubemaptosphere.frag') 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; +} -- cgit v1.2.1