1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

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.
This commit is contained in:
Paramat 2019-03-27 00:18:43 +00:00 committed by GitHub
parent 5e7662ca16
commit 42e1a12714
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 13 deletions

View file

@ -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);