2014-08-22 18:18:14 -04:00
|
|
|
#ifndef GL_ARB_bindless_texture
|
2014-09-17 17:50:16 -04:00
|
|
|
uniform sampler2D glosstex;
|
2014-08-22 18:18:14 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GL_ARB_bindless_texture
|
2014-09-17 17:50:16 -04:00
|
|
|
flat in sampler2D secondhandle;
|
2014-08-22 18:18:14 -04:00
|
|
|
#endif
|
|
|
|
in vec3 nor;
|
|
|
|
in vec2 uv;
|
|
|
|
out vec3 EncodedNormal;
|
|
|
|
|
|
|
|
vec2 EncodeNormal(vec3 n);
|
|
|
|
|
|
|
|
void main(void)
|
|
|
|
{
|
|
|
|
#ifdef GL_ARB_bindless_texture
|
2014-09-17 17:50:16 -04:00
|
|
|
float glossmap = texture(secondhandle, uv).x;
|
2014-08-22 18:18:14 -04:00
|
|
|
#else
|
2014-09-17 17:50:16 -04:00
|
|
|
float glossmap = texture(glosstex, uv).x;
|
2014-08-22 18:18:14 -04:00
|
|
|
#endif
|
|
|
|
EncodedNormal.xy = 0.5 * EncodeNormal(normalize(nor)) + 0.5;
|
2014-11-20 20:44:27 -05:00
|
|
|
EncodedNormal.z = exp2(20. * glossmap + 1.);
|
2014-08-22 18:18:14 -04:00
|
|
|
}
|