Multiplier cache doesn't work - drop it

This commit is contained in:
Mike Primm 2012-01-16 23:20:11 -06:00
parent 497071aac9
commit 525adf1d73
2 changed files with 12 additions and 34 deletions

View File

@ -1301,11 +1301,8 @@ public class TexturePack {
LoadedImage li = null;
int clrmult = -1;
/* See if multiplier is cached */
int c_mult = ss.getCachedMult(mapiter.getX(), mapiter.getY(), mapiter.getZ());
if(c_mult == Integer.MIN_VALUE) {
/* Switch based on texture modifier */
switch(textop) {
/* Switch based on texture modifier */
switch(textop) {
case COLORMOD_GRASSTONED:
li = imgs[IMG_GRASSCOLOR];
break;
@ -1329,21 +1326,17 @@ public class TexturePack {
if(ss.do_water_shading)
li = imgs[IMG_WATERCOLOR];
break;
}
if(li != null) {
if((li.argb == null) || (!ss.do_biome_shading)) {
clrmult = li.trivial_color;
}
else {
clrmult = biomeLookup(li.argb, li.width, mapiter.getRawBiomeRainfall(), mapiter.getRawBiomeTemperature());
}
if(ss.do_swamp_shading && (mapiter.getBiome() == BiomeMap.SWAMPLAND))
clrmult = (clrmult & 0xFF000000) | (((clrmult & 0x00FEFEFE) + 0x4E0E4E) / 2);
}
ss.setCachedMult(mapiter.getX(), mapiter.getY(), mapiter.getZ(), clrmult);
}
else
clrmult = c_mult;
if(li != null) {
if((li.argb == null) || (!ss.do_biome_shading)) {
clrmult = li.trivial_color;
}
else {
clrmult = biomeLookup(li.argb, li.width, mapiter.getRawBiomeRainfall(), mapiter.getRawBiomeTemperature());
}
if(ss.do_swamp_shading && (mapiter.getBiome() == BiomeMap.SWAMPLAND))
clrmult = (clrmult & 0xFF000000) | (((clrmult & 0x00FEFEFE) + 0x4E0E4E) / 2);
}
if((clrmult != -1) && (clrmult != 0)) {
rslt.blendColor(clrmult);
}

View File

@ -81,8 +81,6 @@ public class TexturePackHDShader implements HDShader {
boolean do_swamp_shading;
boolean do_water_shading;
boolean do_better_grass;
/* Cached color multiplier */
int mult_x, mult_y, mult_z, mult;
private ShaderState(MapIterator mapiter, HDMap map, MapChunkCache cache) {
this.mapiter = mapiter;
@ -103,7 +101,6 @@ public class TexturePackHDShader implements HDShader {
do_swamp_shading = do_biome_shading && swamp_shaded;
do_water_shading = do_biome_shading && waterbiomeshaded;
do_better_grass = bettergrass;
mult = Integer.MIN_VALUE;
}
/**
* Get our shader
@ -223,18 +220,6 @@ public class TexturePackHDShader implements HDShader {
*/
public void cleanup() {
}
/*
* Get cached multiplier, if available
*/
public int getCachedMult(int x, int y, int z) {
if((x == mult_x) && (y == mult_y) && (z == mult_z))
return mult;
else
return Integer.MIN_VALUE;
}
public void setCachedMult(int x, int y, int z, int m) {
mult_x = x; mult_y = y; mult_z = z; mult = m;
}
}
/**