mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-12 01:01:30 -05:00
32 lines
596 B
Scala
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);
|
|
}
|