summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/18-ibl/fs_ibl_skybox.sc
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/examples/18-ibl/fs_ibl_skybox.sc')
-rw-r--r--3rdparty/bgfx/examples/18-ibl/fs_ibl_skybox.sc19
1 files changed, 14 insertions, 5 deletions
diff --git a/3rdparty/bgfx/examples/18-ibl/fs_ibl_skybox.sc b/3rdparty/bgfx/examples/18-ibl/fs_ibl_skybox.sc
index 790fc0144fc..d895037b26a 100644
--- a/3rdparty/bgfx/examples/18-ibl/fs_ibl_skybox.sc
+++ b/3rdparty/bgfx/examples/18-ibl/fs_ibl_skybox.sc
@@ -1,22 +1,31 @@
$input v_dir
/*
- * Copyright 2014 Dario Manesku. All rights reserved.
+ * Copyright 2014-2016 Dario Manesku. All rights reserved.
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
#include "../common/common.sh"
+#include "uniforms.sh"
SAMPLERCUBE(s_texCube, 0);
-
-uniform vec4 u_params;
-#define u_exposure u_params.y
+SAMPLERCUBE(s_texCubeIrr, 1);
void main()
{
vec3 dir = normalize(v_dir);
- vec4 color = textureCubeLod(s_texCube, dir, 0.0);
+ vec4 color;
+ if (u_bgType == 7.0)
+ {
+ color = toLinear(textureCube(s_texCubeIrr, dir));
+ }
+ else
+ {
+ float lod = u_bgType;
+ dir = fixCubeLookup(dir, lod, 256.0);
+ color = toLinear(textureCubeLod(s_texCube, dir, lod));
+ }
color *= exp2(u_exposure);
gl_FragColor = toFilmic(color);