bgfx/examples/18-ibl/fs_ibl_skybox.sc
Бранимир Караџић 4581f14cd4 Happy New Year!
2022-01-15 11:59:06 -08:00

33 lines
595 B
Scala

$input v_dir
/*
* Copyright 2014-2016 Dario Manesku. All rights reserved.
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*/
#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);
}