Fix translucent tiles being dropped (water edges), improve biome workaround

This commit is contained in:
Mike Primm 2011-09-27 01:27:51 -05:00
parent 6348fbe789
commit 7d79301293
3 changed files with 22 additions and 8 deletions

View File

@ -1088,19 +1088,22 @@ public class IsoHDPerspective implements HDPerspective {
rendered[i] = true;
}
shaderstate[i].getRayColor(rslt, 0);
if(isjpg[i] && rslt.isTransparent()) {
int c_argb = rslt.getARGB();
if(c_argb != 0) rendered[i] = true;
if(isjpg[i] && (c_argb == 0)) {
argb_buf[i][(tileHeight-y-1)*tileWidth + x] = bgnight[i];
}
else {
argb_buf[i][(tileHeight-y-1)*tileWidth + x] = rslt.getARGB();
argb_buf[i][(tileHeight-y-1)*tileWidth + x] = c_argb;
}
if(day_argb_buf[i] != null) {
shaderstate[i].getRayColor(rslt, 1);
if(isjpg[i] && rslt.isTransparent()) {
c_argb = rslt.getARGB();
if(isjpg[i] && (c_argb == 0)) {
day_argb_buf[i][(tileHeight-y-1)*tileWidth + x] = bgday[i];
}
else {
day_argb_buf[i][(tileHeight-y-1)*tileWidth + x] = rslt.getARGB();
day_argb_buf[i][(tileHeight-y-1)*tileWidth + x] = c_argb;
}
}
}

View File

@ -31,7 +31,7 @@ public class TexturePackHDShader implements HDShader {
@Override
public boolean isBiomeDataNeeded() {
return true;
return swamp_shaded;
}
@Override

View File

@ -41,7 +41,7 @@ public class NewMapChunkCache implements MapChunkCache {
private boolean do_generate = false;
private boolean do_save = false;
private boolean isempty = true;
private static final Biome[] EMPTYBIOME = new Biome[256];
private ChunkSnapshot[] snaparray; /* Index = (x-x_min) + ((z-z_min)*x_dim) */
private Biome[][] biomess; /* Biome snapshots (workaround) - same index as snaparray */
@ -54,6 +54,7 @@ public class NewMapChunkCache implements MapChunkCache {
public class OurMapIterator implements MapIterator {
private int x, y, z, chunkindex, bx, bz;
private ChunkSnapshot snap;
private Biome[] bio;
private BlockStep laststep;
private int typeid = -1;
private int blkdata = -1;
@ -70,8 +71,10 @@ public class NewMapChunkCache implements MapChunkCache {
this.bz = z & 0xF;
try {
snap = snaparray[chunkindex];
bio = biomess[chunkindex];
} catch (ArrayIndexOutOfBoundsException aioobx) {
snap = EMPTY;
bio = EMPTYBIOME;
}
laststep = BlockStep.Y_MINUS;
typeid = blkdata = -1;
@ -96,7 +99,7 @@ public class NewMapChunkCache implements MapChunkCache {
return snap.getBlockEmittedLight(bx, y, bz);
}
public Biome getBiome() {
return biomess[chunkindex][bx | (bz<<4)];
return bio[bx | (bz<<4)];
}
public double getRawBiomeTemperature() {
return snap.getRawBiomeTemperature(bx, bz);
@ -117,8 +120,10 @@ public class NewMapChunkCache implements MapChunkCache {
bx = 0;
chunkindex++;
snap = snaparray[chunkindex];
bio = biomess[chunkindex];
} catch (ArrayIndexOutOfBoundsException aioobx) {
snap = EMPTY;
bio = EMPTYBIOME;
}
}
break;
@ -133,8 +138,10 @@ public class NewMapChunkCache implements MapChunkCache {
bz = 0;
chunkindex += x_dim;
snap = snaparray[chunkindex];
bio = biomess[chunkindex];
} catch (ArrayIndexOutOfBoundsException aioobx) {
snap = EMPTY;
bio = EMPTYBIOME;
}
}
break;
@ -146,8 +153,10 @@ public class NewMapChunkCache implements MapChunkCache {
bx = 15;
chunkindex--;
snap = snaparray[chunkindex];
bio = biomess[chunkindex];
} catch (ArrayIndexOutOfBoundsException aioobx) {
snap = EMPTY;
bio = EMPTYBIOME;
}
}
break;
@ -162,8 +171,10 @@ public class NewMapChunkCache implements MapChunkCache {
bz = 15;
chunkindex -= x_dim;
snap = snaparray[chunkindex];
bio = biomess[chunkindex];
} catch (ArrayIndexOutOfBoundsException aioobx) {
snap = EMPTY;
bio = EMPTYBIOME;
}
}
break;
@ -375,6 +386,7 @@ public class NewMapChunkCache implements MapChunkCache {
}
snaparray = new ChunkSnapshot[x_dim * (z_max-z_min+1)];
biomess = new Biome[snaparray.length][];
}
public int loadChunks(int max_to_load) {
@ -410,7 +422,6 @@ public class NewMapChunkCache implements MapChunkCache {
for(int ii = 0; ii < 256; ii++) {
b[ii] = w.getBiome((chunk.x<<4)+(ii & 0xF), (chunk.z<<4) + (ii >> 4));
}
if(biomess == null) biomess = new Biome[snaparray.length][];
biomess[(chunk.x-x_min) + (chunk.z - z_min)*x_dim] = b;
}
/* Check if cached chunk snapshot found */