From 42e1a127140965cac1be6e51e48192e341c2a29e Mon Sep 17 00:00:00 2001 From: Paramat Date: Wed, 27 Mar 2019 00:18:43 +0000 Subject: Require 'waving = 3' in a nodedef to apply the liquid waving shader (#8418) Makes the liquid waving shader per-nodedef like waving leaves/plants, instead of being applied to all liquids. Like the waving leaves/plants shaders, the liquid waving shader can also be applied to meshes and nodeboxes. Derived from a PR by t0ny2. --- src/nodedef.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/nodedef.cpp') diff --git a/src/nodedef.cpp b/src/nodedef.cpp index 03a163bd3..83e3968c3 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -798,6 +798,8 @@ void ContentFeatures::updateTextures(ITextureSource *tsrc, IShaderSource *shdsrc material_type = TILE_MATERIAL_WAVING_PLANTS; else if (waving == 2) material_type = TILE_MATERIAL_WAVING_LEAVES; + else if (waving == 3) + material_type = TILE_MATERIAL_WAVING_LIQUID_BASIC; break; case NDT_TORCHLIKE: case NDT_SIGNLIKE: @@ -815,8 +817,14 @@ void ContentFeatures::updateTextures(ITextureSource *tsrc, IShaderSource *shdsrc correctAlpha(tdef, 6); correctAlpha(tdef_overlay, 6); correctAlpha(tdef_spec, CF_SPECIAL_COUNT); - material_type = (alpha == 255) ? - TILE_MATERIAL_LIQUID_OPAQUE : TILE_MATERIAL_LIQUID_TRANSPARENT; + + if (waving == 3) { + material_type = (alpha == 255) ? TILE_MATERIAL_WAVING_LIQUID_OPAQUE : + TILE_MATERIAL_WAVING_LIQUID_TRANSPARENT; + } else { + material_type = (alpha == 255) ? TILE_MATERIAL_LIQUID_OPAQUE : + TILE_MATERIAL_LIQUID_TRANSPARENT; + } } u32 tile_shader = shdsrc->getShader("nodes_shader", material_type, drawtype); -- cgit v1.2.3