2014-12-18 16:09:14 -05:00
|
|
|
#ifdef Use_Bindless_Texture
|
2014-08-18 11:49:44 -04:00
|
|
|
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
|
|
|
|
2014-11-22 09:59:22 -05:00
|
|
|
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue)
|
2014-03-21 13:36:47 -04:00
|
|
|
{
|
|
|
|
vec2 tc = gl_FragCoord.xy / screen;
|
|
|
|
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
|
|
|
|
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
|
|
|
|
float ao = texture(SSAO, tc).x;
|
2014-10-05 15:53:06 -04:00
|
|
|
vec3 tmp = diffuseMatColor * DiffuseComponent * (1. - specMapValue) + specularMatColor * SpecularComponent * specMapValue;
|
2014-11-22 09:59:22 -05:00
|
|
|
vec3 emitCol = diffuseMatColor.xyz * diffuseMatColor.xyz * diffuseMatColor.xyz * 15.;
|
|
|
|
return tmp * ao + (emitMapValue * emitCol);
|
|
|
|
}
|