1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-11-13 07:15:28 +03:00

Fallback atlas / Bugfixes / Cleanup

This commit is contained in:
Anuken 2020-06-11 15:25:46 -04:00
parent 1e954dc2be
commit ce9f515543
22 changed files with 19361 additions and 2346 deletions

View File

@ -2,7 +2,7 @@
duplicatePadding: true,
combineSubdirectories: true,
flattenPaths: true,
maxWidth: 2048,
maxHeight: 2048,
maxWidth: 4096,
maxHeight: 4096,
fast: true
}

View File

@ -2,7 +2,7 @@
duplicatePadding: true,
combineSubdirectories: true,
flattenPaths: true,
maxWidth: 2048,
maxHeight: 2048,
maxWidth: 4096,
maxHeight: 4096,
fast: true
}

View File

@ -2,8 +2,7 @@
duplicatePadding: true,
combineSubdirectories: true,
flattenPaths: true,
maxWidth: 2048,
maxHeight: 2048,
fast: true,
bleedIterations: 4
maxWidth: 4096,
maxHeight: 4096,
fast: true
}

View File

@ -2,7 +2,7 @@
duplicatePadding: true,
combineSubdirectories: true,
flattenPaths: true,
maxWidth: 2048,
maxHeight: 2048,
maxWidth: 4096,
maxHeight: 4096,
fast: true
}

View File

@ -2,7 +2,7 @@
duplicatePadding: true,
combineSubdirectories: true,
flattenPaths: true,
maxWidth: 2048,
maxHeight: 2048,
maxWidth: 4096,
maxHeight: 4096,
fast: true
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 757 B

After

Width:  |  Height:  |  Size: 771 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 897 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 847 KiB

After

Width:  |  Height:  |  Size: 880 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 301 KiB

After

Width:  |  Height:  |  Size: 271 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 KiB

After

Width:  |  Height:  |  Size: 276 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 915 KiB

After

Width:  |  Height:  |  Size: 949 KiB

View File

@ -40,6 +40,11 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
Vars.platform = this;
beginTime = Time.millis();
//debug GL information
Log.info("[GL] Version: @", graphics.getGLVersion());
Log.info("[GL] Max texture size: @", Gl.getInt(Gl.maxTextureSize));
Log.info("[GL] OpenGL 3.0 context: @", gl30 != null);
Time.setDeltaProvider(() -> {
float result = Core.graphics.getDeltaTime() * 60f;
return (Float.isNaN(result) || Float.isInfinite(result)) ? 1f : Mathf.clamp(result, 0.0001f, 60f / 10f);
@ -65,7 +70,8 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
Fonts.loadDefaultFont();
assets.load(new AssetDescriptor<>("sprites/sprites.atlas", TextureAtlas.class)).loaded = t -> {
//load fallback atlas if max texture size is below 4096
assets.load(new AssetDescriptor<>(Gl.getInt(Gl.maxTextureSize) >= 4096 ? "sprites/sprites.atlas" : "sprites/fallback/sprites.atlas", TextureAtlas.class)).loaded = t -> {
atlas = (TextureAtlas)t;
Fonts.mergeFontAtlas(atlas);
};

View File

@ -26,7 +26,7 @@ public class BlockRenderer implements Disposable{
public final FloorRenderer floor = new FloorRenderer();
private Seq<Tile> requests = new Seq<>(false, initialRequests, Tile.class);
private Seq<Tile> tileview = new Seq<>(false, initialRequests, Tile.class);
private int lastCamX, lastCamY, lastRangeX, lastRangeY;
private float brokenFade = 0f;
@ -34,6 +34,7 @@ public class BlockRenderer implements Disposable{
private FrameBuffer fog = new FrameBuffer();
private Seq<Tilec> outArray2 = new Seq<>();
private Seq<Tile> shadowEvents = new Seq<>();
private IntSet processedEntities = new IntSet();
private boolean displayStatus = false;
public BlockRenderer(){
@ -185,7 +186,8 @@ public class BlockRenderer implements Disposable{
return;
}
requests.clear();
tileview.clear();
processedEntities.clear();
int minx = Math.max(avgx - rangex - expandr, 0);
int miny = Math.max(avgy - rangey - expandr, 0);
@ -197,16 +199,19 @@ public class BlockRenderer implements Disposable{
boolean expanded = (Math.abs(x - avgx) > rangex || Math.abs(y - avgy) > rangey);
Tile tile = world.rawTile(x, y);
Block block = tile.block();
//link to center
if(tile.entity != null) tile = tile.entity.tile();
if(block != Blocks.air && tile.isCenter() && block.cacheLayer == CacheLayer.normal){
if(block != Blocks.air && block.cacheLayer == CacheLayer.normal && (tile.entity == null || !processedEntities.contains(tile.entity.id()))){
if(block.expanded || !expanded){
requests.add(tile);
tileview.add(tile);
if(tile.entity != null) processedEntities.add(tile.entity.id());
}
if(tile.entity != null && tile.entity.power() != null && tile.entity.power().links.size > 0){
for(Tilec other : tile.entity.getPowerConnections(outArray2)){
if(other.block() instanceof PowerNode){ //TODO need a generic way to render connections!
requests.add(other.tile());
tileview.add(other.tile());
}
}
}
@ -223,8 +228,8 @@ public class BlockRenderer implements Disposable{
public void drawBlocks(){
drawDestroyed();
for(int i = 0; i < requests.size; i++){
Tile tile = requests.items[i];
for(int i = 0; i < tileview.size; i++){
Tile tile = tileview.items[i];
Block block = tile.block();
Tilec entity = tile.entity;

View File

@ -367,8 +367,20 @@ task pack(dependsOn: classes){
e.printStackTrace()
}
println("\n\nPacking normal 4096 sprites...\n\n")
//pack normal sprites
TexturePacker.process("core/assets-raw/sprites_out/", "core/assets/sprites/", "sprites.atlas")
println("\n\nPacking fallback 2048 sprites...\n\n")
//replace config file contents
fileTree(dir: '../core/assets-raw/sprites_out/', include: "**/*.json").visit{ file ->
if(!file.isDirectory()) file.file.text = file.file.text.replace("4096", "2048")
}
//pack fallback 2048x2048 sprites
TexturePacker.process("core/assets-raw/sprites_out/", "core/assets/sprites/fallback/", "sprites.atlas")
}
}