mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-24 17:47:40 +01:00
Add TexturePackHDUnderwaterShader (clear view underwater)
This commit is contained in:
parent
2ebab4b7fc
commit
25eb57c658
@ -15,6 +15,7 @@ processResources {
|
||||
include 'core.yml'
|
||||
include 'lightings.txt'
|
||||
include 'perspectives.txt'
|
||||
include 'shaders.txt'
|
||||
include 'extracted/web/version.js'
|
||||
include 'extracted/web/index.html'
|
||||
include 'extracted/web/login.html'
|
||||
|
@ -107,7 +107,7 @@ public class TexturePackHDShader implements HDShader {
|
||||
final protected HDMap map;
|
||||
final private TexturePack scaledtp;
|
||||
final private HDLighting lighting;
|
||||
private DynmapBlockState lastblk;
|
||||
protected DynmapBlockState lastblk;
|
||||
final boolean do_biome_shading;
|
||||
final boolean do_better_grass;
|
||||
DynLongHashMap ctm_cache;
|
||||
|
@ -0,0 +1,44 @@
|
||||
package org.dynmap.hdmap;
|
||||
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapCore;
|
||||
import org.dynmap.renderer.DynmapBlockState;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
|
||||
public class TexturePackHDUnderwaterShader extends TexturePackHDShader {
|
||||
|
||||
class UnderwaterShaderState extends TexturePackHDShader.ShaderState {
|
||||
private boolean ready;
|
||||
private DynmapBlockState full_water;
|
||||
|
||||
protected UnderwaterShaderState(MapIterator mapiter, HDMap map, MapChunkCache cache, int scale) {
|
||||
super(mapiter, map, cache, scale);
|
||||
full_water = DynmapBlockState.getBaseStateByName(DynmapBlockState.WATER_BLOCK);
|
||||
}
|
||||
@Override
|
||||
public void reset(HDPerspectiveState ps) {
|
||||
super.reset(ps);
|
||||
ready = false;
|
||||
}
|
||||
/**
|
||||
* Process next ray step - called for each block on route
|
||||
* @return true if ray is done, false if ray needs to continue
|
||||
*/
|
||||
public boolean processBlock(HDPerspectiveState ps) {
|
||||
DynmapBlockState bs = ps.getBlockState();
|
||||
if (bs.isWater() || bs.isWaterlogged()) {
|
||||
ready = true;
|
||||
this.lastblk = full_water;
|
||||
}
|
||||
return ready ? super.processBlock(ps) : false;
|
||||
}
|
||||
}
|
||||
public TexturePackHDUnderwaterShader(DynmapCore core, ConfigurationNode configuration) {
|
||||
super(core, configuration);
|
||||
}
|
||||
@Override
|
||||
public HDShaderState getStateInstance(HDMap map, MapChunkCache cache, MapIterator mapiter, int scale) {
|
||||
return new UnderwaterShaderState(mapiter, map, cache, scale);
|
||||
}
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
version: ${version}
|
||||
#
|
||||
# This file contains default standard shader definitions. The contents of this file are replaced and updated
|
||||
# during upgrades, so new or updated shader definitions should be done in the custom-shaders.txt file
|
||||
@ -74,6 +75,11 @@ shaders:
|
||||
texturepack: standard
|
||||
max-sky-light: 0
|
||||
min-emitted-light: 1
|
||||
|
||||
# Standard texture underwater view shader
|
||||
- class: org.dynmap.hdmap.TexturePackHDUnderwaterShader
|
||||
name: stdtexture-underwater
|
||||
texturepack: standard
|
||||
|
||||
# Texture pack based shader for standard Minecraft textures, without biome-tinted grass/leaves
|
||||
- class: org.dynmap.hdmap.TexturePackHDShader
|
||||
|
Loading…
Reference in New Issue
Block a user