stk-code_catmod/data/shaders/utils/getLightFactor.frag

19 lines
614 B
GLSL
Raw Normal View History

2014-08-18 11:49:44 -04:00
#ifdef GL_ARB_bindless_texture
layout(bindless_sampler) uniform sampler2D DiffuseMap;
layout(bindless_sampler) uniform sampler2D SpecularMap;
layout(bindless_sampler) uniform sampler2D SSAO;
#else
2014-03-21 13:36:47 -04:00
uniform sampler2D DiffuseMap;
uniform sampler2D SpecularMap;
uniform sampler2D SSAO;
2014-08-18 11:49:44 -04:00
#endif
2014-03-21 13:36:47 -04:00
vec3 getLightFactor(float specMapValue)
{
vec2 tc = gl_FragCoord.xy / screen;
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
float ao = texture(SSAO, tc).x;
vec3 tmp = DiffuseComponent + SpecularComponent * specMapValue;
2014-03-30 16:38:58 -04:00
return tmp * ao;
2014-03-21 13:36:47 -04:00
}