Add 'fence-to-block-join' flag to enable 1.9+ fence rendering behavior

This commit is contained in:
Mike Primm 2011-10-01 07:49:28 +08:00 committed by mikeprimm
parent 842d255c07
commit bd182ef9df
3 changed files with 20 additions and 5 deletions

View file

@ -45,6 +45,7 @@ public class IsoHDPerspective implements HDPerspective {
public double scale; /* Scale - tile pixel widths per block */
public double maxheight;
public double minheight;
private boolean fencejoin;
/* Coordinate space for tiles consists of a plane (X, Y), corresponding to the projection of each tile on to the
* plane of the bottom of the world (X positive to the right, Y positive to the top), with Z+ corresponding to the
* height above this plane on a vector towards the viewer). Logically, this makes the parallelogram representing the
@ -345,22 +346,26 @@ public class IsoHDPerspective implements HDPerspective {
int id;
/* Check north */
id = mapiter.getBlockTypeIDAt(BlockStep.X_MINUS);
if((id == blkid) || (id == FENCEGATE_BLKTYPEID)) { /* Fence? */
if((id == blkid) || (id == FENCEGATE_BLKTYPEID) ||
(fencejoin && (id > 0) && (HDTextureMap.getTransparency(id) == BlockTransparency.OPAQUE))) { /* Fence? */
blockdata |= 1;
}
/* Look east */
id = mapiter.getBlockTypeIDAt(BlockStep.Z_MINUS);
if((id == blkid) || (id == FENCEGATE_BLKTYPEID)) { /* Fence? */
if((id == blkid) || (id == FENCEGATE_BLKTYPEID) ||
(fencejoin && (id > 0) && (HDTextureMap.getTransparency(id) == BlockTransparency.OPAQUE))) { /* Fence? */
blockdata |= 2;
}
/* Look south */
id = mapiter.getBlockTypeIDAt(BlockStep.X_PLUS);
if((id == blkid) || (id == FENCEGATE_BLKTYPEID)) { /* Fence? */
if((id == blkid) || (id == FENCEGATE_BLKTYPEID) ||
(fencejoin && (id > 0) && (HDTextureMap.getTransparency(id) == BlockTransparency.OPAQUE))) { /* Fence? */
blockdata |= 4;
}
/* Look west */
id = mapiter.getBlockTypeIDAt(BlockStep.Z_PLUS);
if((id == blkid) || (id == FENCEGATE_BLKTYPEID)) { /* Fence? */
if((id == blkid) || (id == FENCEGATE_BLKTYPEID) ||
(fencejoin && (id > 0) && (HDTextureMap.getTransparency(id) == BlockTransparency.OPAQUE))) { /* Fence? */
blockdata |= 8;
}
return blockdata;
@ -739,6 +744,8 @@ public class IsoHDPerspective implements HDPerspective {
if(maxheight > 127) maxheight = 127;
minheight = configuration.getInteger("minimumheight", 0);
if(minheight < 0) minheight = 0;
/* Fence-to-block-join setting */
fencejoin = configuration.getBoolean("fence-to-block-join", MapManager.mapman.getFenceJoin());
/* Generate transform matrix for world-to-tile coordinate mapping */
/* First, need to fix basic coordinate mismatches before rotation - we want zero azimuth to have north to top