Use sampleTextureLayer in shader files

This commit is contained in:
Benau 2018-01-22 10:43:22 +08:00
parent 39f4f8e966
commit 4025883243
16 changed files with 89 additions and 89 deletions

View File

@ -14,7 +14,7 @@ layout(location = 2) out vec2 o_gloss_map;
void main(void)
{
vec4 col = sampleTextureSlot0(uv);
vec4 col = sampleTextureLayer0(uv);
if (col.a * color.a < 0.5)
{
discard;
@ -40,7 +40,7 @@ void main(void)
o_diffuse_color = vec4(final_color, 1.0);
#if defined(Advanced_Lighting_Enabled)
vec4 layer_2 = sampleTextureSlot2(uv);
vec4 layer_2 = sampleTextureLayer2(uv);
o_normal_depth.xy = 0.5 * EncodeNormal(normalize(normal)) + 0.5;
o_normal_depth.z = layer_2.x;
o_gloss_map = layer_2.yz;

View File

@ -11,8 +11,8 @@ layout(location = 2) out vec2 o_gloss_map;
void main(void)
{
vec4 color = sampleTextureSlot0(uv);
vec4 layer_two_tex = sampleTextureSlot1(uv_two);
vec4 color = sampleTextureLayer0(uv);
vec4 layer_two_tex = sampleTextureLayer1(uv_two);
layer_two_tex.rgb = layer_two_tex.a * layer_two_tex.rgb;
vec3 final_color = layer_two_tex.rgb + color.rgb * (1.0 - layer_two_tex.a);
@ -26,7 +26,7 @@ void main(void)
o_diffuse_color = vec4(final_color, 1.0);
#if defined(Advanced_Lighting_Enabled)
vec4 layer_2 = sampleTextureSlot2(uv);
vec4 layer_2 = sampleTextureLayer2(uv);
o_normal_depth.xy = 0.5 * EncodeNormal(normalize(normal)) + 0.5;
o_normal_depth.z = layer_2.x;
o_gloss_map = layer_2.yz;

View File

@ -41,7 +41,7 @@ void main()
tc += (mask < 1.) ? vec2(0.) : shift;
vec4 col = texture(color_tex, tc);
vec4 blend_tex = sampleTextureSlot0(uv);
vec4 blend_tex = sampleTextureLayer0(uv);
col.rgb = blend_tex.rgb * blend_tex.a + (1. - blend_tex.a) * col.rgb;
o_diffuse_color = vec4(col.rgb, 1.);
}

View File

@ -11,7 +11,7 @@ out vec4 o_diffuse_color;
void main()
{
vec4 col = sampleTextureSlot0(uv);
vec4 col = sampleTextureLayer0(uv);
if (hue_change > 0.0)
{
float mask = col.a;

View File

@ -13,7 +13,7 @@ layout(location = 2) out vec2 o_gloss_map;
void main(void)
{
vec4 col = sampleTextureSlot0(uv);
vec4 col = sampleTextureLayer0(uv);
if (col.a < 0.5)
{
discard;
@ -38,7 +38,7 @@ void main(void)
o_diffuse_color = vec4(final_color, 1.0);
#if defined(Advanced_Lighting_Enabled)
vec4 layer_2 = sampleTextureSlot2(uv);
vec4 layer_2 = sampleTextureLayer2(uv);
o_normal_depth.xy = 0.5 * EncodeNormal(normalize(normal)) + 0.5;
o_normal_depth.z = layer_2.x;
o_gloss_map = 0.1 * layer_2.yz;

View File

@ -16,7 +16,7 @@ layout(location = 2) out vec2 o_gloss_map;
void main()
{
vec4 col = sampleTextureSlot0(uv);
vec4 col = sampleTextureLayer0(uv);
if (hue_change > 0.0)
{
float mask = col.a;
@ -44,7 +44,7 @@ void main()
o_diffuse_color = vec4(final_color, 1.0);
#if defined(Advanced_Lighting_Enabled)
vec4 layer_3 = sampleTextureSlot3(uv);
vec4 layer_3 = sampleTextureLayer3(uv);
vec3 tangent_space_normal = 2.0 * layer_3.xyz - 1.0;
vec3 frag_tangent = normalize(tangent);
vec3 frag_bitangent = normalize(bitangent);
@ -52,7 +52,7 @@ void main()
mat3 t_b_n = mat3(frag_tangent, frag_bitangent, frag_normal);
vec3 world_normal = t_b_n * tangent_space_normal;
vec4 layer_2 = sampleTextureSlot2(uv);
vec4 layer_2 = sampleTextureLayer2(uv);
o_normal_depth.xy = 0.5 * EncodeNormal(normalize(world_normal)) + 0.5;
o_normal_depth.z = layer_2.x;
o_gloss_map = layer_2.yz;

View File

@ -5,7 +5,7 @@ out vec4 o_frag_color;
void main(void)
{
vec4 col = sampleTextureSlot0(uv);
vec4 col = sampleTextureLayer0(uv);
if (col.a < 0.5)
{
discard;

View File

@ -14,7 +14,7 @@ layout(location = 2) out vec2 o_gloss_map;
void main(void)
{
vec4 col = sampleTextureSlot0(uv);
vec4 col = sampleTextureLayer0(uv);
if (hue_change > 0.0)
{
float mask = col.a;
@ -42,7 +42,7 @@ void main(void)
o_diffuse_color = vec4(final_color, 1.0);
#if defined(Advanced_Lighting_Enabled)
vec4 layer_2 = sampleTextureSlot2(uv);
vec4 layer_2 = sampleTextureLayer2(uv);
o_normal_depth.xy = 0.5 * EncodeNormal(normalize(normal)) + 0.5;
o_normal_depth.z = layer_2.x;
o_gloss_map = layer_2.yz;

View File

@ -9,7 +9,7 @@ out vec4 o_diffuse_color;
void main()
{
vec4 diffusecolor = sampleTextureSlot0(uv);
vec4 diffusecolor = sampleTextureLayer0(uv);
vec4 finalcolor = vec4(0.);
if (fog_enabled == 0)
{

View File

@ -11,7 +11,7 @@ layout(location = 2) out vec2 o_gloss_map;
void main(void)
{
vec4 col = sampleTextureSlot0(uv);
vec4 col = sampleTextureLayer0(uv);
if (col.a < 0.5)
{
discard;

View File

@ -1,4 +1,4 @@
// Wrapper to allow easy sampling for material texture slots
// Wrapper to allow easy sampling for material texture layers
uniform sampler2D tex_layer_0;
uniform sampler2D tex_layer_1;
uniform sampler2D tex_layer_2;
@ -6,32 +6,32 @@ uniform sampler2D tex_layer_3;
uniform sampler2D tex_layer_4;
uniform sampler2D tex_layer_5;
vec4 sampleTextureSlot0(vec2 uv)
vec4 sampleTextureLayer0(vec2 uv)
{
return texture(tex_layer_0, uv);
}
vec4 sampleTextureSlot1(vec2 uv)
vec4 sampleTextureLayer1(vec2 uv)
{
return texture(tex_layer_1, uv);
}
vec4 sampleTextureSlot2(vec2 uv)
vec4 sampleTextureLayer2(vec2 uv)
{
return texture(tex_layer_2, uv);
}
vec4 sampleTextureSlot3(vec2 uv)
vec4 sampleTextureLayer3(vec2 uv)
{
return texture(tex_layer_3, uv);
}
vec4 sampleTextureSlot4(vec2 uv)
vec4 sampleTextureLayer4(vec2 uv)
{
return texture(tex_layer_4, uv);
}
vec4 sampleTextureSlot5(vec2 uv)
vec4 sampleTextureLayer5(vec2 uv)
{
return texture(tex_layer_5, uv);
}