stk-code_catmod/data/shaders/object_pass1.frag

24 lines
435 B
GLSL
Raw Normal View History

2014-08-18 11:49:44 -04:00
#ifdef GL_ARB_bindless_texture
layout(bindless_sampler) uniform sampler2D tex;
#else
2014-04-06 16:19:10 -04:00
uniform sampler2D tex;
2014-08-18 11:49:44 -04:00
#endif
2014-04-06 16:19:10 -04:00
#if __VERSION__ >= 130
in vec3 nor;
2014-04-06 16:19:10 -04:00
in vec2 uv;
out vec3 EncodedNormal;
#else
varying vec3 nor;
#define EncodedNormal gl_FragColor.xy
#endif
vec2 EncodeNormal(vec3 n);
void main(void)
{
float glossmap = texture(tex, uv).x;
2014-04-06 16:19:10 -04:00
EncodedNormal.xy = 0.5 * EncodeNormal(normalize(nor)) + 0.5;
EncodedNormal.z = glossmap;
}