diff options
author | Lars Hofhansl <larsh@apache.org> | 2019-11-19 19:42:52 -0800 |
---|---|---|
committer | Lars Hofhansl <larsh@apache.org> | 2019-11-19 19:42:52 -0800 |
commit | 60bff1e6cbf56e9a248bc4b0928dfc716cf04131 (patch) | |
tree | d7ca7c327f9c3a007c7e2eb97818603fccf75802 /src/client | |
parent | b3c245bb46890d2355ba6456062db65eda475e28 (diff) | |
download | minetest-60bff1e6cbf56e9a248bc4b0928dfc716cf04131.tar.gz minetest-60bff1e6cbf56e9a248bc4b0928dfc716cf04131.tar.bz2 minetest-60bff1e6cbf56e9a248bc4b0928dfc716cf04131.zip |
Waves generated with Perlin-type noise #8994
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/mapblock_mesh.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/client/mapblock_mesh.cpp b/src/client/mapblock_mesh.cpp index 2bfaa7a4f..a5bee6b88 100644 --- a/src/client/mapblock_mesh.cpp +++ b/src/client/mapblock_mesh.cpp @@ -795,6 +795,7 @@ static void getTileInfo( v3s16 &p_corrected, v3s16 &face_dir_corrected, u16 *lights, + u8 &waving, TileSpec &tile ) { @@ -842,6 +843,7 @@ static void getTileInfo( getNodeTile(n, p_corrected, face_dir_corrected, data, tile); const ContentFeatures &f = ndef->get(n); + waving = f.waving; tile.emissive_light = f.light_source; // eg. water and glass @@ -876,6 +878,10 @@ static void updateFastFaceRow( const v3s16 &&face_dir, std::vector<FastFace> &dest) { + static thread_local const bool waving_liquids = + g_settings->getBool("enable_shaders") && + g_settings->getBool("enable_waving_water"); + v3s16 p = startpos; u16 continuous_tiles_count = 1; @@ -884,10 +890,11 @@ static void updateFastFaceRow( v3s16 p_corrected; v3s16 face_dir_corrected; u16 lights[4] = {0, 0, 0, 0}; + u8 waving; TileSpec tile; getTileInfo(data, p, face_dir, makes_face, p_corrected, face_dir_corrected, - lights, tile); + lights, waving, tile); // Unroll this variable which has a significant build cost TileSpec next_tile; @@ -910,12 +917,15 @@ static void updateFastFaceRow( getTileInfo(data, p_next, face_dir, next_makes_face, next_p_corrected, next_face_dir_corrected, next_lights, + waving, next_tile); if (next_makes_face == makes_face && next_p_corrected == p_corrected + translate_dir && next_face_dir_corrected == face_dir_corrected && memcmp(next_lights, lights, ARRLEN(lights) * sizeof(u16)) == 0 + // Don't apply fast faces to waving water. + && (waving != 3 || !waving_liquids) && next_tile.isTileable(tile)) { next_is_different = false; continuous_tiles_count++; |