mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-24 17:47:40 +01:00
More water model fixes
This commit is contained in:
parent
1495d6c2df
commit
ea139caeab
@ -473,7 +473,7 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
return hitcnt;
|
||||
}
|
||||
|
||||
private final boolean handlePatches(RenderPatch[] patches, HDShaderState[] shaderstate, boolean[] shaderdone, RenderPatch[] fluidpatches) {
|
||||
private final boolean handlePatches(RenderPatch[] patches, HDShaderState[] shaderstate, boolean[] shaderdone, DynmapBlockState fluidstate, RenderPatch[] fluidpatches) {
|
||||
int hitcnt = 0;
|
||||
int water_hit = Integer.MAX_VALUE; // hit index of first water hit
|
||||
/* Loop through patches : compute intercept values for each */
|
||||
@ -481,9 +481,6 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
hitcnt = handlePatch((PatchDefinition)patches[i], hitcnt);
|
||||
}
|
||||
if ((fluidpatches != null) && (fluidpatches.length > 0)) {
|
||||
if (full_water == null) {
|
||||
full_water = DynmapBlockState.getBaseStateByName(DynmapBlockState.WATER_BLOCK);
|
||||
}
|
||||
int prev_hitcnt = hitcnt;
|
||||
for(int i = 0; i < fluidpatches.length; i++) {
|
||||
hitcnt = handlePatch((PatchDefinition)fluidpatches[i], hitcnt);
|
||||
@ -521,7 +518,7 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
cur_patch_t = best_t;
|
||||
// If the water patch, switch to water state and patch index
|
||||
if (best_patch >= water_hit) {
|
||||
blocktype = full_water;
|
||||
blocktype = fluidstate;
|
||||
}
|
||||
/* Process the shaders */
|
||||
boolean done = true;
|
||||
@ -602,7 +599,7 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
if (fluidstate != null) {
|
||||
fluidpatches = getPatches(fluidstate, true);
|
||||
}
|
||||
return handlePatches(patches, shaderstate, shaderdone, fluidpatches);
|
||||
return handlePatches(patches, shaderstate, shaderdone, fluidstate, fluidpatches);
|
||||
}
|
||||
else if ((model = scalemodels.getScaledModel(blocktype)) != null) {
|
||||
return handleSubModel(model, shaderstate, shaderdone);
|
||||
|
@ -2731,7 +2731,7 @@ public class TexturePack {
|
||||
/* If clear-inside op, get out early */
|
||||
if((textop == COLORMOD_CLEARINSIDE) || (textop == COLORMOD_MULTTONED_CLEARINSIDE)) {
|
||||
/* Check if previous block is same block type as we are: surface is transparent if it is */
|
||||
if ((blk.matchingBaseState(lastblocktype) || (blk.isWater() && lastblocktype.isWaterlogged())) && ps.isOnFace()) {
|
||||
if ((blk.matchingBaseState(lastblocktype) || (blk.isWaterFilled() && lastblocktype.isWaterFilled())) && ps.isOnFace()) {
|
||||
rslt.setTransparent();
|
||||
return;
|
||||
}
|
||||
|
@ -47,11 +47,16 @@ public class FluidStateRenderer extends CustomRenderer {
|
||||
|
||||
@Override
|
||||
public RenderPatch[] getRenderPatchList(MapDataContext ctx) {
|
||||
int idx = ctx.getBlockType().stateIndex;
|
||||
DynmapBlockState bs = ctx.getBlockType();
|
||||
DynmapBlockState fbs = bs.getLiquidState();
|
||||
if (fbs == null)
|
||||
fbs = bs;
|
||||
int idx = fbs.stateIndex;
|
||||
if ((idx == 0) || (idx >= 8)) {
|
||||
DynmapBlockState up = ctx.getBlockTypeAt(0, 1, 0);
|
||||
if (up.isWater() || up.isWaterlogged())
|
||||
if (up.isWaterFilled()) {
|
||||
return full_mesh;
|
||||
}
|
||||
}
|
||||
return (idx < 8) ? flat_meshes[idx] : flat_meshes[0];
|
||||
}
|
||||
|
@ -292,6 +292,12 @@ public class DynmapBlockState {
|
||||
public final void setWaterlogged() {
|
||||
matchflags |= MATCH_WATERLOGGED;
|
||||
}
|
||||
/**
|
||||
* Test if block is water OR waterlogged (block filled with water)
|
||||
*/
|
||||
public final boolean isWaterFilled() {
|
||||
return (matchflags & (MATCH_WATERLOGGED | MATCH_WATER)) != 0;
|
||||
}
|
||||
/**
|
||||
* Test if block is leaves
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user