Fallback atlas / Bugfixes / Cleanup
@ -2,7 +2,7 @@
|
||||
duplicatePadding: true,
|
||||
combineSubdirectories: true,
|
||||
flattenPaths: true,
|
||||
maxWidth: 2048,
|
||||
maxHeight: 2048,
|
||||
maxWidth: 4096,
|
||||
maxHeight: 4096,
|
||||
fast: true
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
duplicatePadding: true,
|
||||
combineSubdirectories: true,
|
||||
flattenPaths: true,
|
||||
maxWidth: 2048,
|
||||
maxHeight: 2048,
|
||||
maxWidth: 4096,
|
||||
maxHeight: 4096,
|
||||
fast: true
|
||||
}
|
||||
|
@ -2,8 +2,7 @@
|
||||
duplicatePadding: true,
|
||||
combineSubdirectories: true,
|
||||
flattenPaths: true,
|
||||
maxWidth: 2048,
|
||||
maxHeight: 2048,
|
||||
fast: true,
|
||||
bleedIterations: 4
|
||||
maxWidth: 4096,
|
||||
maxHeight: 4096,
|
||||
fast: true
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
duplicatePadding: true,
|
||||
combineSubdirectories: true,
|
||||
flattenPaths: true,
|
||||
maxWidth: 2048,
|
||||
maxHeight: 2048,
|
||||
maxWidth: 4096,
|
||||
maxHeight: 4096,
|
||||
fast: true
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
duplicatePadding: true,
|
||||
combineSubdirectories: true,
|
||||
flattenPaths: true,
|
||||
maxWidth: 2048,
|
||||
maxHeight: 2048,
|
||||
maxWidth: 4096,
|
||||
maxHeight: 4096,
|
||||
fast: true
|
||||
}
|
||||
|
Before Width: | Height: | Size: 757 B After Width: | Height: | Size: 771 B |
16671
core/assets/sprites/fallback/sprites.atlas
Normal file
BIN
core/assets/sprites/fallback/sprites.png
Normal file
After Width: | Height: | Size: 607 KiB |
BIN
core/assets/sprites/fallback/sprites2.png
Normal file
After Width: | Height: | Size: 175 KiB |
BIN
core/assets/sprites/fallback/sprites3.png
Normal file
After Width: | Height: | Size: 124 KiB |
BIN
core/assets/sprites/fallback/sprites4.png
Normal file
After Width: | Height: | Size: 279 KiB |
BIN
core/assets/sprites/fallback/sprites5.png
Normal file
After Width: | Height: | Size: 277 KiB |
BIN
core/assets/sprites/fallback/sprites6.png
Normal file
After Width: | Height: | Size: 897 KiB |
Before Width: | Height: | Size: 847 KiB After Width: | Height: | Size: 880 KiB |
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 125 KiB |
Before Width: | Height: | Size: 301 KiB After Width: | Height: | Size: 271 KiB |
Before Width: | Height: | Size: 279 KiB After Width: | Height: | Size: 276 KiB |
Before Width: | Height: | Size: 915 KiB After Width: | Height: | Size: 949 KiB |
@ -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);
|
||||
};
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|