Fixed mod alpha bleeding not applying correctly

This commit is contained in:
Anuken
2021-09-08 15:09:05 -04:00
parent 2222330b43
commit a5697a7d4b
4 changed files with 13 additions and 8 deletions

View File

@@ -177,7 +177,7 @@ public class Mods implements Loadable{
} }
private void packSprites(Seq<Fi> sprites, LoadedMod mod, boolean prefix, Seq<AsyncResult<Runnable>> tasks){ private void packSprites(Seq<Fi> sprites, LoadedMod mod, boolean prefix, Seq<AsyncResult<Runnable>> tasks){
boolean linear = Core.settings.getBool("linear"); boolean linear = Core.settings.getBool("linear", true);
for(Fi file : sprites){ for(Fi file : sprites){
//read and bleed pixmaps in parallel //read and bleed pixmaps in parallel
@@ -186,7 +186,7 @@ public class Mods implements Loadable{
Pixmap pix = new Pixmap(file.readBytes()); Pixmap pix = new Pixmap(file.readBytes());
//only bleeds when linear filtering is on at startup //only bleeds when linear filtering is on at startup
if(linear){ if(linear){
Pixmaps.bleed(pix); Pixmaps.bleed(pix, 2);
} }
//this returns a *runnable* which actually packs the resulting pixmap; this has to be done synchronously outside the method //this returns a *runnable* which actually packs the resulting pixmap; this has to be done synchronously outside the method
return () -> { return () -> {
@@ -269,7 +269,7 @@ public class Mods implements Loadable{
} }
}; };
TextureFilter filter = Core.settings.getBool("linear") ? TextureFilter.linear : TextureFilter.nearest; TextureFilter filter = Core.settings.getBool("linear", true) ? TextureFilter.linear : TextureFilter.nearest;
Time.mark(); Time.mark();
//generate new icons //generate new icons

View File

@@ -448,7 +448,7 @@ public class UnitType extends UnlockableContent{
if(!packer.has(name + "-outline")){ if(!packer.has(name + "-outline")){
PixmapRegion base = Core.atlas.getPixmap(region); PixmapRegion base = Core.atlas.getPixmap(region);
var result = Pixmaps.outline(base, outlineColor, outlineRadius); var result = Pixmaps.outline(base, outlineColor, outlineRadius);
if(Core.settings.getBool("linear")){ if(Core.settings.getBool("linear", true)){
Pixmaps.bleed(result); Pixmaps.bleed(result);
} }
packer.add(PageType.main, name + "-outline", result); packer.add(PageType.main, name + "-outline", result);

View File

@@ -912,12 +912,17 @@ public class Block extends UnlockableContent{
for(int x = 0; x < base.width; x++){ for(int x = 0; x < base.width; x++){
for(int y = 0; y < base.height; y++){ for(int y = 0; y < base.height; y++){
int color = base.get(x, y); int color = base.get(x, y);
int index = color == 0xffffffff ? 0 : color == 0xdcc6c6ff ? 1 : color == 0x9d7f7fff ? 2 : -1; int index = switch(color){
case 0xffffffff -> 0;
case 0xdcc6c6ff, 0xdbc5c5ff -> 1;
case 0x9d7f7fff, 0x9e8080ff -> 2;
default -> -1;
};
out.setRaw(x, y, index == -1 ? base.get(x, y) : team.palettei[index]); out.setRaw(x, y, index == -1 ? base.get(x, y) : team.palettei[index]);
} }
} }
if(Core.settings.getBool("linear")){ if(Core.settings.getBool("linear", true)){
Pixmaps.bleed(out); Pixmaps.bleed(out);
} }
@@ -938,7 +943,7 @@ public class Block extends UnlockableContent{
if(outlineIcon){ if(outlineIcon){
PixmapRegion region = Core.atlas.getPixmap(gen[outlinedIcon >= 0 ? outlinedIcon : gen.length -1]); PixmapRegion region = Core.atlas.getPixmap(gen[outlinedIcon >= 0 ? outlinedIcon : gen.length -1]);
Pixmap out = last = Pixmaps.outline(region, outlineColor, outlineRadius); Pixmap out = last = Pixmaps.outline(region, outlineColor, outlineRadius);
if(Core.settings.getBool("linear")){ if(Core.settings.getBool("linear", true)){
Pixmaps.bleed(out); Pixmaps.bleed(out);
} }
packer.add(PageType.main, name, out); packer.add(PageType.main, name, out);

View File

@@ -11,4 +11,4 @@ android.useAndroidX=true
#used for slow jitpack builds; TODO see if this actually works #used for slow jitpack builds; TODO see if this actually works
http.socketTimeout=80000 http.socketTimeout=80000
http.connectionTimeout=80000 http.connectionTimeout=80000
archash=f1cd1594796e87b469da17d274f78a595e000c4f archash=bd75f040406626ad933b54f1c06d16c1c0af8d14