bgfx/examples/18-ibl/fs_ibl_skybox.sc
Branimir Karadžić 4752d567e4 Cleanup.
2016-02-28 19:52:15 -08:00

32 lines
596 B
Scala

$input v_dir
/*
* 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);
SAMPLERCUBE(s_texCubeIrr, 1);
void main()
{
vec3 dir = normalize(v_dir);
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);
}