Multiplier cache doesn't work - drop it

This commit is contained in:
Mike Primm 2012-01-16 23:20:11 -06:00
parent 93ead80920
commit c9465f7ea1
2 changed files with 12 additions and 34 deletions

View file

@ -1301,11 +1301,8 @@ public class TexturePack {
LoadedImage li = null; LoadedImage li = null;
int clrmult = -1; int clrmult = -1;
/* See if multiplier is cached */ /* Switch based on texture modifier */
int c_mult = ss.getCachedMult(mapiter.getX(), mapiter.getY(), mapiter.getZ()); switch(textop) {
if(c_mult == Integer.MIN_VALUE) {
/* Switch based on texture modifier */
switch(textop) {
case COLORMOD_GRASSTONED: case COLORMOD_GRASSTONED:
li = imgs[IMG_GRASSCOLOR]; li = imgs[IMG_GRASSCOLOR];
break; break;
@ -1329,21 +1326,17 @@ public class TexturePack {
if(ss.do_water_shading) if(ss.do_water_shading)
li = imgs[IMG_WATERCOLOR]; li = imgs[IMG_WATERCOLOR];
break; 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 if(li != null) {
clrmult = c_mult; 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)) { if((clrmult != -1) && (clrmult != 0)) {
rslt.blendColor(clrmult); rslt.blendColor(clrmult);
} }

View file

@ -81,8 +81,6 @@ public class TexturePackHDShader implements HDShader {
boolean do_swamp_shading; boolean do_swamp_shading;
boolean do_water_shading; boolean do_water_shading;
boolean do_better_grass; boolean do_better_grass;
/* Cached color multiplier */
int mult_x, mult_y, mult_z, mult;
private ShaderState(MapIterator mapiter, HDMap map, MapChunkCache cache) { private ShaderState(MapIterator mapiter, HDMap map, MapChunkCache cache) {
this.mapiter = mapiter; this.mapiter = mapiter;
@ -103,7 +101,6 @@ public class TexturePackHDShader implements HDShader {
do_swamp_shading = do_biome_shading && swamp_shaded; do_swamp_shading = do_biome_shading && swamp_shaded;
do_water_shading = do_biome_shading && waterbiomeshaded; do_water_shading = do_biome_shading && waterbiomeshaded;
do_better_grass = bettergrass; do_better_grass = bettergrass;
mult = Integer.MIN_VALUE;
} }
/** /**
* Get our shader * Get our shader
@ -223,18 +220,6 @@ public class TexturePackHDShader implements HDShader {
*/ */
public void cleanup() { 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;
}
} }
/** /**