From 4afef4503af2e1759bb7e174b9e17a5067441808 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Wed, 5 Sep 2018 19:03:29 -0500 Subject: [PATCH] Add hide-land option for Underwater view shader (default = true) --- .../org/dynmap/hdmap/TexturePackHDUnderwaterShader.java | 5 ++++- DynmapCore/src/main/resources/shaders.txt | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/DynmapCore/src/main/java/org/dynmap/hdmap/TexturePackHDUnderwaterShader.java b/DynmapCore/src/main/java/org/dynmap/hdmap/TexturePackHDUnderwaterShader.java index d1e3080c..68c50283 100644 --- a/DynmapCore/src/main/java/org/dynmap/hdmap/TexturePackHDUnderwaterShader.java +++ b/DynmapCore/src/main/java/org/dynmap/hdmap/TexturePackHDUnderwaterShader.java @@ -7,6 +7,7 @@ import org.dynmap.utils.MapChunkCache; import org.dynmap.utils.MapIterator; public class TexturePackHDUnderwaterShader extends TexturePackHDShader { + private boolean hide_land = true; class UnderwaterShaderState extends TexturePackHDShader.ShaderState { private boolean ready; @@ -19,7 +20,7 @@ public class TexturePackHDUnderwaterShader extends TexturePackHDShader { @Override public void reset(HDPerspectiveState ps) { super.reset(ps); - ready = false; + ready = (!hide_land); // Start ready if not hiding land } /** * Process next ray step - called for each block on route @@ -30,12 +31,14 @@ public class TexturePackHDUnderwaterShader extends TexturePackHDShader { if (bs.isWater() || bs.isWaterlogged()) { ready = true; this.lastblk = full_water; + this.lastblkhit = full_water; } return ready ? super.processBlock(ps) : false; } } public TexturePackHDUnderwaterShader(DynmapCore core, ConfigurationNode configuration) { super(core, configuration); + hide_land = configuration.getBoolean("hide-land", true); } @Override public HDShaderState getStateInstance(HDMap map, MapChunkCache cache, MapIterator mapiter, int scale) { diff --git a/DynmapCore/src/main/resources/shaders.txt b/DynmapCore/src/main/resources/shaders.txt index bd68d80c..4144bef4 100644 --- a/DynmapCore/src/main/resources/shaders.txt +++ b/DynmapCore/src/main/resources/shaders.txt @@ -80,6 +80,12 @@ shaders: - class: org.dynmap.hdmap.TexturePackHDUnderwaterShader name: stdtexture-underwater texturepack: standard + + # Standard texture underwater view shader (with land not hidden) + - class: org.dynmap.hdmap.TexturePackHDUnderwaterShader + name: stdtexture-underwater-keep-land + texturepack: standard + hide-land: false # Texture pack based shader for standard Minecraft textures, without biome-tinted grass/leaves - class: org.dynmap.hdmap.TexturePackHDShader