Finish fixing new water

This commit is contained in:
Mike Primm 2018-09-01 19:16:55 -05:00
parent ea139caeab
commit a18a1ddc06
6 changed files with 32 additions and 46 deletions

View File

@ -433,9 +433,6 @@ public class DynmapCore implements DynmapCommonAPI {
defaultStorage.setLoginEnabled(this); defaultStorage.setLoginEnabled(this);
} }
/* Add options to avoid 0.29 re-render (fixes very inconsistent with previous maps) */
HDMapManager.waterlightingfix = configuration.getBoolean("correct-water-lighting", false);
HDMapManager.biomeshadingfix = configuration.getBoolean("correct-biome-shading", false);
/* Load control for leaf transparency (spout lighting bug workaround) */ /* Load control for leaf transparency (spout lighting bug workaround) */
transparentLeaves = configuration.getBoolean("transparent-leaves", true); transparentLeaves = configuration.getBoolean("transparent-leaves", true);
/* Get default image format */ /* Get default image format */

View File

@ -51,7 +51,7 @@ public class HDBlockStateTextureMap {
} }
// Shallow copy state from another state map // Shallow copy state from another state map
public HDBlockStateTextureMap(HDBlockStateTextureMap map) { public HDBlockStateTextureMap(HDBlockStateTextureMap map, BlockTransparency bt) {
this.faces = map.faces; this.faces = map.faces;
this.layers = map.layers; this.layers = map.layers;
this.blockset = map.blockset; this.blockset = map.blockset;
@ -59,7 +59,10 @@ public class HDBlockStateTextureMap {
this.custColorMult = map.custColorMult; this.custColorMult = map.custColorMult;
this.stdrotate = map.stdrotate; this.stdrotate = map.stdrotate;
this.colorMapping = map.colorMapping; this.colorMapping = map.colorMapping;
this.trans = map.trans; if (bt != null)
this.trans = bt;
else
this.trans = map.trans;
} }
// Get texture index for given face // Get texture index for given face
@ -143,7 +146,12 @@ public class HDBlockStateTextureMap {
// Copy given block state to given state index // Copy given block state to given state index
public static void copyToStateIndex(DynmapBlockState blk, HDBlockStateTextureMap map) { public static void copyToStateIndex(DynmapBlockState blk, HDBlockStateTextureMap map) {
resize(blk.globalStateIndex); resize(blk.globalStateIndex);
texmaps[blk.globalStateIndex] = new HDBlockStateTextureMap(map); TexturePack.BlockTransparency trans = map.trans;
// Force waterloogged blocks to use SEMITRANSPARENT (same as water)
if ((trans == TexturePack.BlockTransparency.TRANSPARENT) && blk.isWaterlogged()) {
trans = TexturePack.BlockTransparency.SEMITRANSPARENT;
}
texmaps[blk.globalStateIndex] = new HDBlockStateTextureMap(map, trans);
} }
// Copy textures from source block ID to destination // Copy textures from source block ID to destination
public static void remapTexture(String dest, String src) { public static void remapTexture(String dest, String src) {
@ -153,7 +161,7 @@ public class HDBlockStateTextureMap {
for (int i = 0; i < mincnt; i++) { for (int i = 0; i < mincnt; i++) {
int didx = dblk.getState(i).globalStateIndex; int didx = dblk.getState(i).globalStateIndex;
int sidx = sblk.getState(i).globalStateIndex; int sidx = sblk.getState(i).globalStateIndex;
texmaps[didx] = new HDBlockStateTextureMap(texmaps[sidx]); texmaps[didx] = new HDBlockStateTextureMap(texmaps[sidx], null);
} }
} }
// Get by global state index // Get by global state index

View File

@ -21,9 +21,6 @@ public class HDMapManager {
public HashSet<HDMap> maps = new HashSet<HDMap>(); public HashSet<HDMap> maps = new HashSet<HDMap>();
public HashMap<String, ArrayList<HDMap>> maps_by_world_perspective = new HashMap<String, ArrayList<HDMap>>(); public HashMap<String, ArrayList<HDMap>> maps_by_world_perspective = new HashMap<String, ArrayList<HDMap>>();
public static boolean waterlightingfix;
public static boolean biomeshadingfix;
public void loadHDShaders(DynmapCore core) { public void loadHDShaders(DynmapCore core) {
Log.verboseinfo("Loading shaders..."); Log.verboseinfo("Loading shaders...");
/* Update mappings, if needed */ /* Update mappings, if needed */

View File

@ -188,24 +188,24 @@ public class TexturePack {
private static final int TILEINDEX_SHULKER_COUNT = 6; private static final int TILEINDEX_SHULKER_COUNT = 6;
/* Indexes of faces in the BED format tile file */ /* Indexes of faces in the BED format tile file */
private static final int TILEINDEX_BED_HEAD_TOP = 0; //private static final int TILEINDEX_BED_HEAD_TOP = 0;
private static final int TILEINDEX_BED_HEAD_BOTTOM = 1; //private static final int TILEINDEX_BED_HEAD_BOTTOM = 1;
private static final int TILEINDEX_BED_HEAD_LEFT = 2; //private static final int TILEINDEX_BED_HEAD_LEFT = 2;
private static final int TILEINDEX_BED_HEAD_RIGHT = 3; //private static final int TILEINDEX_BED_HEAD_RIGHT = 3;
private static final int TILEINDEX_BED_HEAD_END = 4; //private static final int TILEINDEX_BED_HEAD_END = 4;
private static final int TILEINDEX_BED_FOOT_TOP = 5; //private static final int TILEINDEX_BED_FOOT_TOP = 5;
private static final int TILEINDEX_BED_FOOT_BOTTOM = 6; //private static final int TILEINDEX_BED_FOOT_BOTTOM = 6;
private static final int TILEINDEX_BED_FOOT_LEFT = 7; //private static final int TILEINDEX_BED_FOOT_LEFT = 7;
private static final int TILEINDEX_BED_FOOT_RIGHT = 8; //private static final int TILEINDEX_BED_FOOT_RIGHT = 8;
private static final int TILEINDEX_BED_FOOT_END = 9; //private static final int TILEINDEX_BED_FOOT_END = 9;
private static final int TILEINDEX_BED_HEAD_LEFTLEG_1 = 10; //private static final int TILEINDEX_BED_HEAD_LEFTLEG_1 = 10;
private static final int TILEINDEX_BED_HEAD_LEFTLEG_2 = 11; //private static final int TILEINDEX_BED_HEAD_LEFTLEG_2 = 11;
private static final int TILEINDEX_BED_HEAD_RIGHTLEG_1 = 12; //private static final int TILEINDEX_BED_HEAD_RIGHTLEG_1 = 12;
private static final int TILEINDEX_BED_HEAD_RIGHTLEG_2 = 13; //private static final int TILEINDEX_BED_HEAD_RIGHTLEG_2 = 13;
private static final int TILEINDEX_BED_FOOT_LEFTLEG_1 = 14; //private static final int TILEINDEX_BED_FOOT_LEFTLEG_1 = 14;
private static final int TILEINDEX_BED_FOOT_LEFTLEG_2 = 15; //private static final int TILEINDEX_BED_FOOT_LEFTLEG_2 = 15;
private static final int TILEINDEX_BED_FOOT_RIGHTLEG_1 = 16; //private static final int TILEINDEX_BED_FOOT_RIGHTLEG_1 = 16;
private static final int TILEINDEX_BED_FOOT_RIGHTLEG_2 = 17; //private static final int TILEINDEX_BED_FOOT_RIGHTLEG_2 = 17;
private static final int TILEINDEX_BED_COUNT = 18; private static final int TILEINDEX_BED_COUNT = 18;
public static enum TileFileFormat { public static enum TileFileFormat {
@ -421,7 +421,6 @@ public class TexturePack {
private int colorMultBirch = 0x80a755; /* From ColorizerFoliage.java in MCP */ private int colorMultBirch = 0x80a755; /* From ColorizerFoliage.java in MCP */
private int colorMultPine = 0x619961; /* From ColorizerFoliage.java in MCP */ private int colorMultPine = 0x619961; /* From ColorizerFoliage.java in MCP */
private int colorMultLily = 0x208030; /* from BlockLilyPad.java in MCP */ private int colorMultLily = 0x208030; /* from BlockLilyPad.java in MCP */
private int colorMultWater = 0xFFFFFF;
private static final int IMG_GRASSCOLOR = 0; private static final int IMG_GRASSCOLOR = 0;
private static final int IMG_FOLIAGECOLOR = 1; private static final int IMG_FOLIAGECOLOR = 1;
@ -2103,10 +2102,6 @@ public class TexturePack {
else else
trans = BlockTransparency.OPAQUE; trans = BlockTransparency.OPAQUE;
} }
/* If no water lighting fix */
if((blknames.contains(DynmapBlockState.WATER_BLOCK) || blknames.contains(DynmapBlockState.FLOWING_WATER_BLOCK)) && (HDMapManager.waterlightingfix == false)) {
trans = BlockTransparency.TRANSPARENT; /* Treat water as transparent if no fix */
}
} }
else if(av[0].equals("colorMult")) { else if(av[0].equals("colorMult")) {
colorMult = (int)Long.parseLong(av[1], 16); colorMult = (int)Long.parseLong(av[1], 16);
@ -2211,10 +2206,6 @@ public class TexturePack {
else else
trans = BlockTransparency.OPAQUE; trans = BlockTransparency.OPAQUE;
} }
/* If no water lighting fix */
if((blknames.contains(DynmapBlockState.WATER_BLOCK) || blknames.contains(DynmapBlockState.FLOWING_WATER_BLOCK)) && (HDMapManager.waterlightingfix == false)) {
trans = BlockTransparency.TRANSPARENT; /* Treat water as transparent if no fix */
}
} }
} }
/* If we have everything, build block */ /* If we have everything, build block */
@ -2336,10 +2327,6 @@ public class TexturePack {
else else
trans = BlockTransparency.OPAQUE; trans = BlockTransparency.OPAQUE;
} }
/* If no water lighting fix */
if((blknames.contains(DynmapBlockState.WATER_BLOCK) || blknames.contains(DynmapBlockState.FLOWING_WATER_BLOCK)) && (HDMapManager.waterlightingfix == false)) {
trans = BlockTransparency.TRANSPARENT; /* Treat water as transparent if no fix */
}
} }
else if(av[0].equals("colorMult")) { else if(av[0].equals("colorMult")) {
colorMult = Integer.valueOf(av[1], 16); colorMult = Integer.valueOf(av[1], 16);

View File

@ -5,10 +5,7 @@ import java.util.BitSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.dynmap.hdmap.HDBlockStateTextureMap;
import org.dynmap.hdmap.TexturePack.BlockTransparency;
import org.dynmap.renderer.CustomRenderer; import org.dynmap.renderer.CustomRenderer;
import org.dynmap.renderer.DynmapBlockState;
import org.dynmap.renderer.MapDataContext; import org.dynmap.renderer.MapDataContext;
import org.dynmap.renderer.RenderPatch; import org.dynmap.renderer.RenderPatch;
import org.dynmap.renderer.RenderPatchFactory; import org.dynmap.renderer.RenderPatchFactory;

View File

@ -1997,10 +1997,10 @@ texture:id=sea_pickle
texture:id=conduit texture:id=conduit
# Kelp # Kelp
block:id=kelp,patch0-1=1000:kelp,stdrot=true,transparency=TRANSPARENT block:id=kelp,patch0-1=1000:kelp,transparency=TRANSPARENT
# Kelp plant # Kelp plant
block:id=kelp_plant,patch0-1=1000:kelp_plant,stdrot=true,transparency=TRANSPARENT block:id=kelp_plant,patch0-1=1000:kelp_plant,transparency=TRANSPARENT
# Dried kelp block # Dried kelp block
block:id=dried_kelp_block,allsides=0:dried_kelp_side,top=0:dried_kelp_top,bottom=0:dried_kelp_bottom,stdrot=true block:id=dried_kelp_block,allsides=0:dried_kelp_side,top=0:dried_kelp_top,bottom=0:dried_kelp_bottom,stdrot=true