Log atlas utilization

This commit is contained in:
Anuken
2022-04-20 10:38:57 -04:00
parent c883fbdb81
commit 6441d0b2d5
2 changed files with 10 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ import arc.graphics.*;
import arc.graphics.Texture.*;
import arc.graphics.g2d.*;
import arc.util.*;
import arc.util.Log.*;
import mindustry.*;
public class MultiPacker implements Disposable{
@@ -27,13 +28,20 @@ public class MultiPacker implements Disposable{
}
public void printStats(){
if(Log.level != LogLevel.debug) return;
for(PageType type : PageType.all){
var packer = packers[type.ordinal()];
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" : "");
int i = 0;
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 ++;
}