summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorSmallJoker <mk939@ymail.com>2020-02-16 14:08:48 +0100
committerSmallJoker <mk939@ymail.com>2020-02-16 14:14:34 +0100
commit478e7532985320c5ddacc0280f77b67956715a65 (patch)
treea88eae61317e0738045731de7c6083f361663eba /client
parent3f675490df7d4dd0cdd3ac4afe2683fe8678b24d (diff)
downloadminetest-478e7532985320c5ddacc0280f77b67956715a65.tar.gz
minetest-478e7532985320c5ddacc0280f77b67956715a65.tar.bz2
minetest-478e7532985320c5ddacc0280f77b67956715a65.zip
Shaders: Fix OpenGL < 4.3 compatibility
Diffstat (limited to 'client')
-rw-r--r--client/shaders/nodes_shader/opengl_vertex.glsl14
1 files changed, 6 insertions, 8 deletions
diff --git a/client/shaders/nodes_shader/opengl_vertex.glsl b/client/shaders/nodes_shader/opengl_vertex.glsl
index f56aaefaa..ccff1260d 100644
--- a/client/shaders/nodes_shader/opengl_vertex.glsl
+++ b/client/shaders/nodes_shader/opengl_vertex.glsl
@@ -46,9 +46,8 @@ float smoothTriangleWave(float x)
return smoothCurve(triangleWave(x)) * 2.0 - 1.0;
}
-#if (MATERIAL_TYPE == TILE_MATERIAL_WAVING_LIQUID_TRANSPARENT || \
- MATERIAL_TYPE == TILE_MATERIAL_WAVING_LIQUID_OPAQUE || \
- MATERIAL_TYPE == TILE_MATERIAL_WAVING_LIQUID_BASIC) && ENABLE_WAVING_WATER
+// OpenGL < 4.3 does not support continued preprocessor lines
+#if (MATERIAL_TYPE == TILE_MATERIAL_WAVING_LIQUID_TRANSPARENT || MATERIAL_TYPE == TILE_MATERIAL_WAVING_LIQUID_OPAQUE || MATERIAL_TYPE == TILE_MATERIAL_WAVING_LIQUID_BASIC) && ENABLE_WAVING_WATER
//
// Simple, fast noise function.
@@ -115,9 +114,8 @@ float disp_z;
worldPosition = (mWorld * gl_Vertex).xyz;
-#if (MATERIAL_TYPE == TILE_MATERIAL_WAVING_LIQUID_TRANSPARENT || \
- MATERIAL_TYPE == TILE_MATERIAL_WAVING_LIQUID_OPAQUE || \
- MATERIAL_TYPE == TILE_MATERIAL_WAVING_LIQUID_BASIC) && ENABLE_WAVING_WATER
+// OpenGL < 4.3 does not support continued preprocessor lines
+#if (MATERIAL_TYPE == TILE_MATERIAL_WAVING_LIQUID_TRANSPARENT || MATERIAL_TYPE == TILE_MATERIAL_WAVING_LIQUID_OPAQUE || MATERIAL_TYPE == TILE_MATERIAL_WAVING_LIQUID_BASIC) && ENABLE_WAVING_WATER
// Generate waves with Perlin-type noise.
// The constants are calibrated such that they roughly
// correspond to the old sine waves.
@@ -188,12 +186,12 @@ float disp_z;
color.rgb = gl_Color.rgb * (gl_Color.a * dayLight.rgb +
nightRatio * artificialLight.rgb) * 2;
color.a = 1;
-
+
// Emphase blue a bit in darker places
// See C++ implementation in mapblock_mesh.cpp final_color_blend()
float brightness = (color.r + color.g + color.b) / 3;
color.b += max(0.0, 0.021 - abs(0.2 * brightness - 0.021) +
0.07 * brightness);
-
+
gl_FrontColor = gl_BackColor = clamp(color, 0.0, 1.0);
}