2014-08-18 11:49:44 -04:00
|
|
|
#ifdef GL_ARB_bindless_texture
|
|
|
|
layout(bindless_sampler) uniform sampler2D tex;
|
2014-09-20 13:28:06 -04:00
|
|
|
layout(bindless_sampler) uniform sampler2D glosstex;
|
2014-08-18 11:49:44 -04:00
|
|
|
#else
|
2014-01-18 19:32:08 -05:00
|
|
|
uniform sampler2D tex;
|
2014-09-20 13:28:06 -04:00
|
|
|
uniform sampler2D glosstex;
|
2014-08-18 11:49:44 -04:00
|
|
|
#endif
|
2014-01-18 19:32:08 -05:00
|
|
|
|
2014-02-28 11:29:05 -05:00
|
|
|
#if __VERSION__ >= 130
|
|
|
|
in vec3 nor;
|
2014-01-18 19:32:08 -05:00
|
|
|
in vec2 uv;
|
2014-04-06 16:19:10 -04:00
|
|
|
out vec3 EncodedNormal;
|
2014-02-28 11:29:05 -05:00
|
|
|
#else
|
|
|
|
varying vec3 nor;
|
|
|
|
varying vec2 uv;
|
|
|
|
#define EncodedNormal gl_FragColor.xy
|
|
|
|
#endif
|
|
|
|
|
2014-03-21 13:10:54 -04:00
|
|
|
vec2 EncodeNormal(vec3 n);
|
2014-01-18 19:32:08 -05:00
|
|
|
|
|
|
|
void main() {
|
2014-01-19 12:53:35 -05:00
|
|
|
vec4 col = texture(tex, uv);
|
2014-01-18 19:32:08 -05:00
|
|
|
if (col.a < 0.5)
|
|
|
|
discard;
|
2014-09-20 13:28:06 -04:00
|
|
|
float glossmap = texture(glosstex, uv).x;
|
2014-04-06 16:19:10 -04:00
|
|
|
EncodedNormal.xy = 0.5 * EncodeNormal(normalize(nor)) + 0.5;
|
2014-09-20 13:28:06 -04:00
|
|
|
EncodedNormal.z = exp2(10. * glossmap + 1.);
|
2014-01-18 19:32:08 -05:00
|
|
|
}
|
|
|
|
|