2014-12-18 22:09:14 +01:00
|
|
|
#ifndef Use_Bindless_Texture
|
2014-08-23 00:18:14 +02:00
|
|
|
uniform sampler2D Albedo;
|
2014-10-05 02:30:01 +02:00
|
|
|
uniform sampler2D SpecMap;
|
2014-08-23 00:18:14 +02:00
|
|
|
#endif
|
|
|
|
|
2014-12-18 22:09:14 +01:00
|
|
|
#ifdef Use_Bindless_Texture
|
2014-08-23 00:18:14 +02:00
|
|
|
flat in sampler2D handle;
|
2014-10-05 02:30:01 +02:00
|
|
|
flat in sampler2D secondhandle;
|
2014-08-23 00:18:14 +02:00
|
|
|
#endif
|
|
|
|
in vec2 uv;
|
|
|
|
in vec4 color;
|
|
|
|
out vec4 FragColor;
|
|
|
|
|
2014-11-22 15:59:22 +01:00
|
|
|
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
2014-08-23 00:18:14 +02:00
|
|
|
|
|
|
|
void main(void)
|
|
|
|
{
|
2014-12-18 22:09:14 +01:00
|
|
|
#ifdef Use_Bindless_Texture
|
2014-08-23 00:18:14 +02:00
|
|
|
vec4 col = texture(handle, uv);
|
2014-10-05 02:30:01 +02:00
|
|
|
float specmap = texture(secondhandle, uv).g;
|
2014-08-28 21:59:55 +02:00
|
|
|
#ifdef SRGBBindlessFix
|
2014-08-23 00:18:14 +02:00
|
|
|
col.xyz = pow(col.xyz, vec3(2.2));
|
2014-08-28 21:59:55 +02:00
|
|
|
#endif
|
2014-08-23 00:18:14 +02:00
|
|
|
#else
|
|
|
|
vec4 col = texture(Albedo, uv);
|
2014-10-05 02:30:01 +02:00
|
|
|
float specmap = texture(SpecMap, uv).g;
|
2014-08-23 00:18:14 +02:00
|
|
|
#endif
|
|
|
|
col.xyz *= pow(color.xyz, vec3(2.2));
|
|
|
|
if (col.a * color.a < 0.5) discard;
|
2014-11-22 15:59:22 +01:00
|
|
|
FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap, 0.), 1.);
|
2014-08-23 00:18:14 +02:00
|
|
|
}
|