Log atlas utilization
This commit is contained in:
@@ -4,6 +4,7 @@ import arc.graphics.*;
|
|||||||
import arc.graphics.Texture.*;
|
import arc.graphics.Texture.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
|
import arc.util.Log.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
|
|
||||||
public class MultiPacker implements Disposable{
|
public class MultiPacker implements Disposable{
|
||||||
@@ -27,13 +28,20 @@ public class MultiPacker implements Disposable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void printStats(){
|
public void printStats(){
|
||||||
|
if(Log.level != LogLevel.debug) return;
|
||||||
|
|
||||||
for(PageType type : PageType.all){
|
for(PageType type : PageType.all){
|
||||||
var packer = packers[type.ordinal()];
|
var packer = packers[type.ordinal()];
|
||||||
Log.debug("[Atlas] [&ly@&fr]", type);
|
Log.debug("[Atlas] [&ly@&fr]", type);
|
||||||
Log.debug("[Atlas] - " + (packer.getPages().size > 1 ? "&fb&lr" : "&lg") + "@ page@&r", packer.getPages().size, packer.getPages().size > 1 ? "s" : "");
|
Log.debug("[Atlas] - " + (packer.getPages().size > 1 ? "&fb&lr" : "&lg") + "@ page@&r", packer.getPages().size, packer.getPages().size > 1 ? "s" : "");
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(var page : packer.getPages()){
|
for(var page : packer.getPages()){
|
||||||
Log.debug("[Atlas] - [@] @x@", i, page.getPixmap().width, page.getPixmap().height);
|
float totalArea = 0;
|
||||||
|
for(var region : page.getRects().values()){
|
||||||
|
totalArea += region.area();
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.debug("[Atlas] - [@] @x@ (&lk@% used&fr)", i, page.getPixmap().width, page.getPixmap().height, (int)(totalArea / (page.getPixmap().width * page.getPixmap().height) * 100f));
|
||||||
|
|
||||||
i ++;
|
i ++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ public class Mods implements Loadable{
|
|||||||
if(!mods.contains(LoadedMod::enabled)) return;
|
if(!mods.contains(LoadedMod::enabled)) return;
|
||||||
Time.mark();
|
Time.mark();
|
||||||
|
|
||||||
|
//TODO this should estimate sprite sizes per page
|
||||||
packer = new MultiPacker();
|
packer = new MultiPacker();
|
||||||
//all packing tasks to await
|
//all packing tasks to await
|
||||||
var tasks = new Seq<Future<Runnable>>();
|
var tasks = new Seq<Future<Runnable>>();
|
||||||
|
|||||||
Reference in New Issue
Block a user