mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-25 01:57:53 +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;
|
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 hitcnt = 0;
|
||||||
int water_hit = Integer.MAX_VALUE; // hit index of first water hit
|
int water_hit = Integer.MAX_VALUE; // hit index of first water hit
|
||||||
/* Loop through patches : compute intercept values for each */
|
/* Loop through patches : compute intercept values for each */
|
||||||
@ -481,9 +481,6 @@ public class IsoHDPerspective implements HDPerspective {
|
|||||||
hitcnt = handlePatch((PatchDefinition)patches[i], hitcnt);
|
hitcnt = handlePatch((PatchDefinition)patches[i], hitcnt);
|
||||||
}
|
}
|
||||||
if ((fluidpatches != null) && (fluidpatches.length > 0)) {
|
if ((fluidpatches != null) && (fluidpatches.length > 0)) {
|
||||||
if (full_water == null) {
|
|
||||||
full_water = DynmapBlockState.getBaseStateByName(DynmapBlockState.WATER_BLOCK);
|
|
||||||
}
|
|
||||||
int prev_hitcnt = hitcnt;
|
int prev_hitcnt = hitcnt;
|
||||||
for(int i = 0; i < fluidpatches.length; i++) {
|
for(int i = 0; i < fluidpatches.length; i++) {
|
||||||
hitcnt = handlePatch((PatchDefinition)fluidpatches[i], hitcnt);
|
hitcnt = handlePatch((PatchDefinition)fluidpatches[i], hitcnt);
|
||||||
@ -521,7 +518,7 @@ public class IsoHDPerspective implements HDPerspective {
|
|||||||
cur_patch_t = best_t;
|
cur_patch_t = best_t;
|
||||||
// If the water patch, switch to water state and patch index
|
// If the water patch, switch to water state and patch index
|
||||||
if (best_patch >= water_hit) {
|
if (best_patch >= water_hit) {
|
||||||
blocktype = full_water;
|
blocktype = fluidstate;
|
||||||
}
|
}
|
||||||
/* Process the shaders */
|
/* Process the shaders */
|
||||||
boolean done = true;
|
boolean done = true;
|
||||||
@ -602,7 +599,7 @@ public class IsoHDPerspective implements HDPerspective {
|
|||||||
if (fluidstate != null) {
|
if (fluidstate != null) {
|
||||||
fluidpatches = getPatches(fluidstate, true);
|
fluidpatches = getPatches(fluidstate, true);
|
||||||
}
|
}
|
||||||
return handlePatches(patches, shaderstate, shaderdone, fluidpatches);
|
return handlePatches(patches, shaderstate, shaderdone, fluidstate, fluidpatches);
|
||||||
}
|
}
|
||||||
else if ((model = scalemodels.getScaledModel(blocktype)) != null) {
|
else if ((model = scalemodels.getScaledModel(blocktype)) != null) {
|
||||||
return handleSubModel(model, shaderstate, shaderdone);
|
return handleSubModel(model, shaderstate, shaderdone);
|
||||||
|
@ -2731,7 +2731,7 @@ public class TexturePack {
|
|||||||
/* If clear-inside op, get out early */
|
/* If clear-inside op, get out early */
|
||||||
if((textop == COLORMOD_CLEARINSIDE) || (textop == COLORMOD_MULTTONED_CLEARINSIDE)) {
|
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 */
|
/* 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();
|
rslt.setTransparent();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -47,11 +47,16 @@ public class FluidStateRenderer extends CustomRenderer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RenderPatch[] getRenderPatchList(MapDataContext ctx) {
|
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)) {
|
if ((idx == 0) || (idx >= 8)) {
|
||||||
DynmapBlockState up = ctx.getBlockTypeAt(0, 1, 0);
|
DynmapBlockState up = ctx.getBlockTypeAt(0, 1, 0);
|
||||||
if (up.isWater() || up.isWaterlogged())
|
if (up.isWaterFilled()) {
|
||||||
return full_mesh;
|
return full_mesh;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (idx < 8) ? flat_meshes[idx] : flat_meshes[0];
|
return (idx < 8) ? flat_meshes[idx] : flat_meshes[0];
|
||||||
}
|
}
|
||||||
|
@ -292,6 +292,12 @@ public class DynmapBlockState {
|
|||||||
public final void setWaterlogged() {
|
public final void setWaterlogged() {
|
||||||
matchflags |= MATCH_WATERLOGGED;
|
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
|
* Test if block is leaves
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user