Handle negative Y in topo shader

This commit is contained in:
Mike Primm 2021-12-12 01:42:39 -06:00
parent 9d1bca9922
commit 0d477db78b

View File

@ -202,10 +202,12 @@ public class TopoHDShader implements HDShader {
if (isHidden(blocktype)) { if (isHidden(blocktype)) {
return false; return false;
} }
int y = mapiter.getY();
if (y < 0) y = 0; // Clamp at zero for now
/* See if we're close to an edge */ /* See if we're close to an edge */
int[] xyz = ps.getSubblockCoord(); int[] xyz = ps.getSubblockCoord();
// Only color lines when spacing is matched // Only color lines when spacing is matched
Color lcolor = ((ps.getMapIterator().getY() % linespacing) == 0)?linecolor:null; Color lcolor = ((y % linespacing) == 0)?linecolor:null;
/* See which face we're on (only do lines on top face) */ /* See which face we're on (only do lines on top face) */
switch(ps.getLastBlockStep()) { switch(ps.getLastBlockStep()) {
@ -229,7 +231,7 @@ public class TopoHDShader implements HDShader {
} }
} }
else { else {
c.setColor(fillcolor[mapiter.getY() >> heightshift]); c.setColor(fillcolor[y >> heightshift]);
inWater = false; inWater = false;
} }
break; break;
@ -248,7 +250,7 @@ public class TopoHDShader implements HDShader {
} }
} }
else { else {
c.setColor(fillcolor[mapiter.getY() >> heightshift]); c.setColor(fillcolor[y >> heightshift]);
inWater = false; inWater = false;
} }
break; break;