Fast color calculation
This commit is contained in:
@@ -675,24 +675,7 @@ public class Block extends BlockStorage{
|
||||
|
||||
if(!synthetic()){
|
||||
PixmapRegion image = Core.atlas.getPixmap((AtlasRegion)icon(Cicon.full));
|
||||
|
||||
Color average = this.color;
|
||||
Color color = new Color();
|
||||
for(int x = 0; x < image.width; x++){
|
||||
for(int y = 0; y < image.height; y++){
|
||||
image.getPixel(x, y, color);
|
||||
average.r += color.r;
|
||||
average.g += color.g;
|
||||
average.b += color.b;
|
||||
}
|
||||
}
|
||||
average.mul(1f / (image.width * image.height));
|
||||
if(isFloor()){
|
||||
average.mul(0.8f);
|
||||
}else{
|
||||
average.mul(1.1f);
|
||||
}
|
||||
average.a = 1f;
|
||||
color.set(image.getPixel(image.width/2, image.height/2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user