Add hide-land option for Underwater view shader (default = true)

This commit is contained in:
Mike Primm 2018-09-05 19:03:29 -05:00
parent 01fc9a3e9e
commit 288a7ad9ea
2 changed files with 10 additions and 1 deletions

View file

@ -7,6 +7,7 @@ import org.dynmap.utils.MapChunkCache;
import org.dynmap.utils.MapIterator; import org.dynmap.utils.MapIterator;
public class TexturePackHDUnderwaterShader extends TexturePackHDShader { public class TexturePackHDUnderwaterShader extends TexturePackHDShader {
private boolean hide_land = true;
class UnderwaterShaderState extends TexturePackHDShader.ShaderState { class UnderwaterShaderState extends TexturePackHDShader.ShaderState {
private boolean ready; private boolean ready;
@ -19,7 +20,7 @@ public class TexturePackHDUnderwaterShader extends TexturePackHDShader {
@Override @Override
public void reset(HDPerspectiveState ps) { public void reset(HDPerspectiveState ps) {
super.reset(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 * Process next ray step - called for each block on route
@ -30,12 +31,14 @@ public class TexturePackHDUnderwaterShader extends TexturePackHDShader {
if (bs.isWater() || bs.isWaterlogged()) { if (bs.isWater() || bs.isWaterlogged()) {
ready = true; ready = true;
this.lastblk = full_water; this.lastblk = full_water;
this.lastblkhit = full_water;
} }
return ready ? super.processBlock(ps) : false; return ready ? super.processBlock(ps) : false;
} }
} }
public TexturePackHDUnderwaterShader(DynmapCore core, ConfigurationNode configuration) { public TexturePackHDUnderwaterShader(DynmapCore core, ConfigurationNode configuration) {
super(core, configuration); super(core, configuration);
hide_land = configuration.getBoolean("hide-land", true);
} }
@Override @Override
public HDShaderState getStateInstance(HDMap map, MapChunkCache cache, MapIterator mapiter, int scale) { public HDShaderState getStateInstance(HDMap map, MapChunkCache cache, MapIterator mapiter, int scale) {

View file

@ -81,6 +81,12 @@ shaders:
name: stdtexture-underwater name: stdtexture-underwater
texturepack: standard 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 # Texture pack based shader for standard Minecraft textures, without biome-tinted grass/leaves
- class: org.dynmap.hdmap.TexturePackHDShader - class: org.dynmap.hdmap.TexturePackHDShader
name: stdtexture-nobiome name: stdtexture-nobiome