2014-12-18 16:09:14 -05:00
|
|
|
#ifndef Use_Bindless_Texture
|
2014-08-22 18:18:14 -04:00
|
|
|
uniform sampler2D tex;
|
2014-09-17 17:50:16 -04:00
|
|
|
uniform sampler2D glosstex;
|
2014-08-22 18:18:14 -04:00
|
|
|
#endif
|
|
|
|
|
2014-12-18 16:09:14 -05:00
|
|
|
#ifdef Use_Bindless_Texture
|
2014-08-22 18:18:14 -04:00
|
|
|
flat in sampler2D handle;
|
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() {
|
2014-12-18 16:09:14 -05:00
|
|
|
#ifdef Use_Bindless_Texture
|
2014-08-22 18:18:14 -04:00
|
|
|
vec4 col = texture(handle, uv);
|
2014-09-17 17:50:16 -04:00
|
|
|
float glossmap = texture(secondhandle, uv).x;
|
2014-08-22 18:18:14 -04:00
|
|
|
#else
|
|
|
|
vec4 col = texture(tex, uv);
|
2014-09-17 17:50:16 -04:00
|
|
|
float glossmap = texture(glosstex, uv).x;
|
2014-08-22 18:18:14 -04:00
|
|
|
#endif
|
|
|
|
if (col.a < 0.5)
|
|
|
|
discard;
|
|
|
|
EncodedNormal.xy = 0.5 * EncodeNormal(normalize(nor)) + 0.5;
|
2014-12-04 18:09:15 -05:00
|
|
|
EncodedNormal.z = glossmap;
|
2014-08-22 18:18:14 -04:00
|
|
|
}
|
|
|
|
|