Remove some ifdef

This commit is contained in:
Benau 2017-12-29 18:10:51 +08:00
parent 711fb8211a
commit d71ea71e35
11 changed files with 26 additions and 172 deletions

View File

@ -1,19 +1,3 @@
#ifdef Use_Bindless_Texture
flat in sampler2D tex_layer_0;
flat in sampler2D tex_layer_2;
#else
// spm layer 1 texture
uniform sampler2D tex_layer_0;
// gloss map
uniform sampler2D tex_layer_2;
#endif
#ifdef Use_Array_Texture
uniform sampler2DArray tex_array;
flat in float array_0;
flat in float array_2;
#endif
flat in float hue_change;
in vec4 color;
@ -26,16 +10,11 @@ layout(location = 2) out vec2 o_gloss_map;
#stk_include "utils/encode_normal.frag"
#stk_include "utils/rgb_conversion.frag"
#stk_include "utils/sp_texture_sampling.frag"
void main(void)
{
#ifdef Use_Array_Texture
vec4 col = texture(tex_array, vec3(uv, array_0));
#else
vec4 col = texture(tex_layer_0, uv);
#endif
vec4 col = sampleTextureSlot0(uv);
if (col.a * color.a < 0.5)
{
discard;
@ -61,16 +40,9 @@ void main(void)
o_diffuse_color = vec4(final_color, 1.0);
#if defined(Advanced_Lighting_Enabled)
#ifdef Use_Array_Texture
vec4 layer_2 = texture(tex_array, vec3(uv, array_2));
#else
vec4 layer_2 = texture(tex_layer_2, uv);
#endif
vec4 layer_2 = sampleTextureSlot2(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;
#endif
}

View File

@ -1,23 +1,3 @@
#ifdef Use_Bindless_Texture
flat in sampler2D tex_layer_0;
flat in sampler2D tex_layer_1;
flat in sampler2D tex_layer_2;
#else
// spm layer 1 texture
uniform sampler2D tex_layer_0;
// spm layer 1 texture
uniform sampler2D tex_layer_1;
// gloss map
uniform sampler2D tex_layer_2;
#endif
#ifdef Use_Array_Texture
uniform sampler2DArray tex_array;
flat in float array_0;
flat in float array_1;
flat in float array_2;
#endif
in vec3 normal;
in vec2 uv;
in vec2 uv_two;
@ -27,17 +7,12 @@ layout(location = 1) out vec3 o_normal_depth;
layout(location = 2) out vec2 o_gloss_map;
#stk_include "utils/encode_normal.frag"
#stk_include "utils/sp_texture_sampling.frag"
void main(void)
{
#ifdef Use_Array_Texture
vec4 color = texture(tex_array, vec3(uv, array_0));
vec4 layer_two_tex = texture(tex_array, vec3(uv_two, array_1));
#else
vec4 color = texture(tex_layer_0, uv);
vec4 layer_two_tex = texture(tex_layer_1, uv_two);
#endif
vec4 color = sampleTextureSlot0(uv);
vec4 layer_two_tex = sampleTextureSlot1(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);
@ -51,17 +26,9 @@ void main(void)
o_diffuse_color = vec4(final_color, 1.0);
#if defined(Advanced_Lighting_Enabled)
#ifdef Use_Array_Texture
vec4 layer_2 = texture(tex_array, vec3(uv, array_2));
#else
vec4 layer_2 = texture(tex_layer_2, uv);
#endif
vec4 layer_2 = sampleTextureSlot2(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;
#endif
}

View File

@ -2,24 +2,14 @@ uniform sampler2D displacement_tex;
uniform sampler2D mask_tex;
uniform sampler2D color_tex;
#ifdef Use_Bindless_Texture
flat in sampler2D tex_layer_0;
#else
// spm layer 1 texture
uniform sampler2D tex_layer_0;
#endif
#ifdef Use_Array_Texture
uniform sampler2DArray tex_array;
flat in float array_0;
#endif
#stk_include "utils/sp_texture_sampling.frag"
uniform vec4 direction;
in vec2 uv;
in float camdist;
out vec4 o_frag_color;
out vec4 o_diffuse_color;
const float maxlen = 0.02;
@ -51,13 +41,7 @@ void main()
tc += (mask < 1.) ? vec2(0.) : shift;
vec4 col = texture(color_tex, tc);
#ifdef Use_Array_Texture
vec4 blend_tex = texture(tex_array, vec3(uv, array_0));
#else
vec4 blend_tex = texture(tex_layer_0, uv);
#endif
vec4 blend_tex = sampleTextureSlot0(uv);
col.rgb = blend_tex.rgb * blend_tex.a + (1. - blend_tex.a) * col.rgb;
o_frag_color = vec4(col.rgb, 1.);
o_diffuse_color = vec4(col.rgb, 1.);
}

View File

@ -1,15 +1,3 @@
#ifdef Use_Bindless_Texture
flat in sampler2D tex_layer_0;
#else
// spm layer 1 texture
uniform sampler2D tex_layer_0;
#endif
#ifdef Use_Array_Texture
uniform sampler2DArray tex_array;
flat in float array_0;
#endif
uniform float custom_alpha;
flat in float hue_change;
@ -19,16 +7,11 @@ in vec4 color;
out vec4 o_diffuse_color;
#stk_include "utils/rgb_conversion.frag"
#stk_include "utils/sp_texture_sampling.frag"
void main()
{
#ifdef Use_Array_Texture
vec4 col = texture(tex_array, vec3(uv, array_0));
#else
vec4 col = texture(tex_layer_0, uv);
#endif
vec4 col = sampleTextureSlot0(uv);
if (hue_change > 0.0)
{
float mask = col.a;

View File

@ -37,8 +37,10 @@ void main(void)
#endif
o_diffuse_color = vec4(final_color, 1.0);
#if defined(Advanced_Lighting_Enabled)
vec4 layer_2 = sampleTextureSlot2(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;
#endif
}

View File

@ -43,6 +43,7 @@ void main()
#endif
o_diffuse_color = vec4(final_color, 1.0);
#if defined(Advanced_Lighting_Enabled)
vec4 layer_3 = sampleTextureSlot3(uv);
vec3 tangent_space_normal = 2.0 * layer_3.xyz - 1.0;
vec3 frag_tangent = normalize(tangent);
@ -55,4 +56,5 @@ void main()
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;
#endif
}

View File

@ -1,7 +0,0 @@
out vec4 o_frag_color;
void main()
{
o_frag_color = vec4(exp(32.0 * (2.0 * gl_FragCoord.z - 1.) /
gl_FragCoord.w));
}

View File

@ -1,27 +1,11 @@
#ifdef Use_Bindless_Texture
flat in sampler2D tex_layer_0;
#else
// spm layer 1 texture
uniform sampler2D tex_layer_0;
#endif
#ifdef Use_Array_Texture
uniform sampler2DArray tex_array;
flat in float array_0;
#endif
#stk_include "utils/sp_texture_sampling.frag"
in vec2 uv;
out vec4 o_frag_color;
void main(void)
{
#ifdef Use_Array_Texture
vec4 col = texture(tex_array, vec3(uv, array_0));
#else
vec4 col = texture(tex_layer_0, uv);
#endif
vec4 col = sampleTextureSlot0(uv);
if (col.a < 0.5)
{
discard;

View File

@ -41,8 +41,10 @@ void main(void)
#endif
o_diffuse_color = vec4(final_color, 1.0);
#if defined(Advanced_Lighting_Enabled)
vec4 layer_2 = sampleTextureSlot2(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;
#endif
}

View File

@ -1,15 +1,3 @@
#ifdef Use_Bindless_Texture
flat in sampler2D tex_layer_0;
#else
// spm layer 1 texture
uniform sampler2D tex_layer_0;
#endif
#ifdef Use_Array_Texture
uniform sampler2DArray tex_array;
flat in float array_0;
#endif
uniform int fog_enabled;
uniform float custom_alpha;
@ -17,15 +5,11 @@ in vec2 uv;
in vec4 color;
out vec4 o_diffuse_color;
#stk_include "utils/sp_texture_sampling.frag"
void main()
{
#ifdef Use_Array_Texture
vec4 diffusecolor = texture(tex_array, vec3(uv, array_0));
#else
vec4 diffusecolor = texture(tex_layer_0, uv);
#endif
vec4 diffusecolor = sampleTextureSlot0(uv);
vec4 finalcolor = vec4(0.);
if (fog_enabled == 0)
{

View File

@ -1,16 +1,3 @@
#ifdef Use_Bindless_Texture
flat in sampler2D tex_layer_0;
#else
// spm layer 1 texture
uniform sampler2D tex_layer_0;
#endif
#ifdef Use_Array_Texture
uniform sampler2DArray tex_array;
flat in float array_0;
flat in float array_2;
#endif
in vec4 color;
in vec3 normal;
in vec2 uv;
@ -20,17 +7,11 @@ layout(location = 1) out vec3 o_normal_depth;
layout(location = 2) out vec2 o_gloss_map;
#stk_include "utils/encode_normal.frag"
#stk_include "utils/rgb_conversion.frag"
#stk_include "utils/sp_texture_sampling.frag"
void main(void)
{
#ifdef Use_Array_Texture
vec4 col = texture(tex_array, vec3(uv, array_0));
#else
vec4 col = texture(tex_layer_0, uv);
#endif
vec4 col = sampleTextureSlot0(uv);
if (col.a < 0.5)
{
discard;