WIP tank unit type

This commit is contained in:
Anuken
2021-12-12 18:29:44 -05:00
parent 86a6ec6bd2
commit 0d33768f58
19 changed files with 168 additions and 33 deletions

View File

@ -25,6 +25,7 @@ import java.util.concurrent.Executors
def genFolder = "../core/assets-raw/sprites_out/generated/"
def doAntialias = !project.hasProperty("disableAntialias")
def colorMap = new IntMap<List<Color>>(), colorIndexMap = new IntIntMap()
def enableAA = true
//on my machine, I have a native Nim AA implementation that is ~10x faster
//it's not compiled for other platforms so they don't get it
def useFastAA = project.hasProperty("fastAA") || System.getProperty("user.name") == "anuke"
@ -222,22 +223,24 @@ task pack(dependsOn: [classes, configurations.runtimeClasspath]){
delete "../core/assets-raw/sprites_out/ui/icons"
}
ExecutorService executor = Executors.newFixedThreadPool(16)
long ms = System.currentTimeMillis()
if(enableAA){
ExecutorService executor = Executors.newFixedThreadPool(16)
long ms = System.currentTimeMillis()
//antialias everything except UI elements
fileTree(dir: new File(rootDir, 'core/assets-raw/sprites_out/').absolutePath, include: "**/*.png").visit{ file ->
if(file.isDirectory() || (file.toString().replace("\\", "/").contains("/ui/") && file.toString().startsWith("icon-")) || file.toString().contains(".9.png")) return
//antialias everything except UI elements
fileTree(dir: new File(rootDir, 'core/assets-raw/sprites_out/').absolutePath, include: "**/*.png").visit{ file ->
if(file.isDirectory() || (file.toString().replace("\\", "/").contains("/ui/") && file.toString().startsWith("icon-")) || file.toString().contains(".9.png")) return
executor.submit{
antialias(file.file)
executor.submit{
antialias(file.file)
}
}
Threads.await(executor)
println "Time taken for AA: ${(System.currentTimeMillis() - ms) / 1000f}"
}
Threads.await(executor)
println "Time taken for AA: ${(System.currentTimeMillis() - ms) / 1000f}"
println("\n\nPacking normal 4096 sprites...\n\n")
//pack normal sprites

View File

@ -514,6 +514,7 @@ public class Generators{
outliner.get(type.legBaseRegion);
outliner.get(type.baseJointRegion);
if(sample instanceof Legsc) outliner.get(type.legRegion);
if(sample instanceof Tankc) outliner.get(type.treadRegion);
Pixmap image = type.segments > 0 ? get(type.segmentRegions[0]) : outline.get(get(type.region));
@ -529,7 +530,12 @@ public class Generators{
save(image, type.name);
}
save(image, type.name + "-outline");
//outline only needs to be different if there's a weapon that draws under; most units don't have this, and it saves significant space.
if(type.weapons.contains(w -> !w.top)){
save(image, type.name + "-outline");
}else{
replace(type.name, image);
}
//draw mech parts
if(sample instanceof Mechc){