diff --git a/data/shaders/coloredquad.frag b/data/shaders/coloredquad.frag index b7f48cc65..66d7f1b32 100644 --- a/data/shaders/coloredquad.frag +++ b/data/shaders/coloredquad.frag @@ -1,8 +1,8 @@ -uniform ivec4 color; - -out vec4 FragColor; - -void main() -{ - FragColor = vec4(color) / 255.; -} +uniform ivec4 color; + +out vec4 FragColor; + +void main() +{ + FragColor = vec4(color) / 255.; +} diff --git a/data/shaders/coloredquad.vert b/data/shaders/coloredquad.vert index ab0095d52..da923df49 100644 --- a/data/shaders/coloredquad.vert +++ b/data/shaders/coloredquad.vert @@ -1,14 +1,14 @@ -uniform vec2 center; -uniform vec2 size; - -#ifdef Explicit_Attrib_Location_Usable -layout(location = 0) in vec2 Position; -#else -in vec2 Position; -#endif - - -void main() -{ - gl_Position = vec4(Position * size + center, 0., 1.); -} +uniform vec2 center; +uniform vec2 size; + +#ifdef Explicit_Attrib_Location_Usable +layout(location = 0) in vec2 Position; +#else +in vec2 Position; +#endif + + +void main() +{ + gl_Position = vec4(Position * size + center, 0., 1.); +} diff --git a/data/shaders/colortexturedquad.frag b/data/shaders/colortexturedquad.frag index 45aa0bf58..0f5ea8461 100644 --- a/data/shaders/colortexturedquad.frag +++ b/data/shaders/colortexturedquad.frag @@ -1,11 +1,11 @@ -uniform sampler2D tex; - -in vec2 uv; -in vec4 col; -out vec4 FragColor; - -void main() -{ - vec4 res = texture(tex, uv); - FragColor = res * col; -} +uniform sampler2D tex; + +in vec2 uv; +in vec4 col; +out vec4 FragColor; + +void main() +{ + vec4 res = texture(tex, uv); + FragColor = res * col; +} diff --git a/data/shaders/colortexturedquad.vert b/data/shaders/colortexturedquad.vert index 4c7a4b352..b1f84264f 100644 --- a/data/shaders/colortexturedquad.vert +++ b/data/shaders/colortexturedquad.vert @@ -1,24 +1,24 @@ -uniform vec2 center; -uniform vec2 size; -uniform vec2 texcenter; -uniform vec2 texsize; - -#ifdef Explicit_Attrib_Location_Usable -layout(location=0) in vec2 Position; -layout(location=3) in vec2 Texcoord; -layout(location=2) in vec4 Color; -#else -in vec2 Position; -in vec2 Texcoord; -in vec4 Color; -#endif - -out vec2 uv; -out vec4 col; - -void main() -{ - col = Color.zyxw; - uv = Texcoord * texsize + texcenter; - gl_Position = vec4(Position * size + center, 0., 1.); -} +uniform vec2 center; +uniform vec2 size; +uniform vec2 texcenter; +uniform vec2 texsize; + +#ifdef Explicit_Attrib_Location_Usable +layout(location=0) in vec2 Position; +layout(location=3) in vec2 Texcoord; +layout(location=2) in vec4 Color; +#else +in vec2 Position; +in vec2 Texcoord; +in vec4 Color; +#endif + +out vec2 uv; +out vec4 col; + +void main() +{ + col = Color.zyxw; + uv = Texcoord * texsize + texcenter; + gl_Position = vec4(Position * size + center, 0., 1.); +} diff --git a/data/shaders/sp_alpha_test.frag b/data/shaders/sp_alpha_test.frag index 1bc956365..488cbc322 100644 --- a/data/shaders/sp_alpha_test.frag +++ b/data/shaders/sp_alpha_test.frag @@ -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; diff --git a/data/shaders/sp_decal.frag b/data/shaders/sp_decal.frag index 4aa75dc6e..b392e2836 100644 --- a/data/shaders/sp_decal.frag +++ b/data/shaders/sp_decal.frag @@ -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; diff --git a/data/shaders/sp_displace.frag b/data/shaders/sp_displace.frag index 0f6aad627..e5f6e737c 100644 --- a/data/shaders/sp_displace.frag +++ b/data/shaders/sp_displace.frag @@ -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.); } diff --git a/data/shaders/sp_ghost.frag b/data/shaders/sp_ghost.frag index 24c08a95d..982872dc6 100644 --- a/data/shaders/sp_ghost.frag +++ b/data/shaders/sp_ghost.frag @@ -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; diff --git a/data/shaders/sp_grass.frag b/data/shaders/sp_grass.frag index 715c85f2e..696f98820 100644 --- a/data/shaders/sp_grass.frag +++ b/data/shaders/sp_grass.frag @@ -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; diff --git a/data/shaders/sp_normal_map.frag b/data/shaders/sp_normal_map.frag index 857da9729..9420afea6 100644 --- a/data/shaders/sp_normal_map.frag +++ b/data/shaders/sp_normal_map.frag @@ -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; diff --git a/data/shaders/sp_shadow_alpha_test.frag b/data/shaders/sp_shadow_alpha_test.frag index a1752b160..744d99530 100644 --- a/data/shaders/sp_shadow_alpha_test.frag +++ b/data/shaders/sp_shadow_alpha_test.frag @@ -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; diff --git a/data/shaders/sp_solid.frag b/data/shaders/sp_solid.frag index dd9700c7d..826809943 100644 --- a/data/shaders/sp_solid.frag +++ b/data/shaders/sp_solid.frag @@ -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; diff --git a/data/shaders/sp_transparent.frag b/data/shaders/sp_transparent.frag index 7112a3525..186f6c3aa 100644 --- a/data/shaders/sp_transparent.frag +++ b/data/shaders/sp_transparent.frag @@ -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) { diff --git a/data/shaders/sp_unlit.frag b/data/shaders/sp_unlit.frag index d97c53b9b..54c2469d4 100644 --- a/data/shaders/sp_unlit.frag +++ b/data/shaders/sp_unlit.frag @@ -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; diff --git a/data/shaders/texturedquad.frag b/data/shaders/texturedquad.frag index 904e9d8ab..991263142 100644 --- a/data/shaders/texturedquad.frag +++ b/data/shaders/texturedquad.frag @@ -1,9 +1,9 @@ -uniform sampler2D tex; - -in vec2 uv; -out vec4 FragColor; - -void main() -{ - FragColor = texture(tex, uv); +uniform sampler2D tex; + +in vec2 uv; +out vec4 FragColor; + +void main() +{ + FragColor = texture(tex, uv); } \ No newline at end of file diff --git a/data/shaders/utils/sp_texture_sampling.frag b/data/shaders/utils/sp_texture_sampling.frag index 04f9d4121..1dfbab0df 100644 --- a/data/shaders/utils/sp_texture_sampling.frag +++ b/data/shaders/utils/sp_texture_sampling.frag @@ -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); }