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 tex_layout;
|
|
|
|
layout(bindless_sampler) uniform sampler2D tex_detail0;
|
|
|
|
layout(bindless_sampler) uniform sampler2D tex_detail1;
|
|
|
|
layout(bindless_sampler) uniform sampler2D tex_detail2;
|
|
|
|
layout(bindless_sampler) uniform sampler2D tex_detail3;
|
|
|
|
#else
|
2011-11-30 11:56:04 -05:00
|
|
|
uniform sampler2D tex_layout;
|
|
|
|
uniform sampler2D tex_detail0;
|
|
|
|
uniform sampler2D tex_detail1;
|
2011-11-30 14:34:37 -05:00
|
|
|
uniform sampler2D tex_detail2;
|
|
|
|
uniform sampler2D tex_detail3;
|
2014-08-18 11:49:44 -04:00
|
|
|
#endif
|
2013-11-30 16:33:06 -05:00
|
|
|
|
2014-01-08 19:17:28 -05:00
|
|
|
in vec2 uv;
|
|
|
|
in vec2 uv_bis;
|
2014-01-19 13:31:00 -05:00
|
|
|
out vec4 FragColor;
|
2014-02-28 11:29:05 -05:00
|
|
|
|
2014-11-22 09:59:22 -05:00
|
|
|
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
2013-12-18 19:13:17 -05:00
|
|
|
|
2013-11-30 16:33:06 -05:00
|
|
|
void main() {
|
2014-08-09 14:05:49 -04:00
|
|
|
// Splatting part
|
|
|
|
vec4 splatting = texture(tex_layout, uv_bis);
|
|
|
|
vec4 detail0 = texture(tex_detail0, uv);
|
|
|
|
vec4 detail1 = texture(tex_detail1, uv);
|
|
|
|
vec4 detail2 = texture(tex_detail2, uv);
|
|
|
|
vec4 detail3 = texture(tex_detail3, uv);
|
|
|
|
vec4 detail4 = vec4(0.0);
|
2014-12-18 16:09:14 -05:00
|
|
|
#ifdef Use_Bindless_Texture
|
2014-08-28 15:59:55 -04:00
|
|
|
#ifdef SRGBBindlessFix
|
2014-08-18 11:49:44 -04:00
|
|
|
detail0.xyz = pow(detail0.xyz, vec3(2.2));
|
|
|
|
detail1.xyz = pow(detail1.xyz, vec3(2.2));
|
|
|
|
detail2.xyz = pow(detail2.xyz, vec3(2.2));
|
|
|
|
detail3.xyz = pow(detail3.xyz, vec3(2.2));
|
2014-08-28 15:59:55 -04:00
|
|
|
#endif
|
2014-08-18 11:49:44 -04:00
|
|
|
#endif
|
2013-11-30 16:33:06 -05:00
|
|
|
|
2014-08-09 14:05:49 -04:00
|
|
|
vec4 splatted = splatting.r * detail0 +
|
|
|
|
splatting.g * detail1 +
|
|
|
|
splatting.b * detail2 +
|
|
|
|
max(0., (1.0 - splatting.r - splatting.g - splatting.b)) * detail3;
|
2013-11-30 16:33:06 -05:00
|
|
|
|
2014-11-22 09:59:22 -05:00
|
|
|
FragColor = vec4(getLightFactor(splatted.xyz, vec3(1.), 0., 0.), 1.);
|
2011-11-30 11:56:04 -05:00
|
|
|
}
|