Multithreaded packing
This commit is contained in:
@@ -9090,6 +9090,96 @@ wraith-factory-icon-editor
|
|||||||
index: -1
|
index: -1
|
||||||
|
|
||||||
sprites4.png
|
sprites4.png
|
||||||
|
size: 1024,1024
|
||||||
|
format: RGBA8888
|
||||||
|
filter: Nearest,Nearest
|
||||||
|
repeat: none
|
||||||
|
zone-craters
|
||||||
|
rotate: false
|
||||||
|
xy: 605, 767
|
||||||
|
size: 256, 256
|
||||||
|
orig: 256, 256
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
zone-desertWastes
|
||||||
|
rotate: false
|
||||||
|
xy: 303, 461
|
||||||
|
size: 260, 260
|
||||||
|
orig: 260, 260
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
zone-desolateRift
|
||||||
|
rotate: false
|
||||||
|
xy: 817, 163
|
||||||
|
size: 100, 350
|
||||||
|
orig: 100, 350
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
zone-frozenForest
|
||||||
|
rotate: false
|
||||||
|
xy: 303, 1
|
||||||
|
size: 200, 200
|
||||||
|
orig: 200, 200
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
zone-fungalPass
|
||||||
|
rotate: false
|
||||||
|
xy: 863, 773
|
||||||
|
size: 150, 250
|
||||||
|
orig: 150, 250
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
zone-groundZero
|
||||||
|
rotate: false
|
||||||
|
xy: 303, 203
|
||||||
|
size: 256, 256
|
||||||
|
orig: 256, 256
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
zone-nuclearComplex
|
||||||
|
rotate: false
|
||||||
|
xy: 605, 515
|
||||||
|
size: 250, 250
|
||||||
|
orig: 250, 250
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
zone-overgrowth
|
||||||
|
rotate: false
|
||||||
|
xy: 1, 723
|
||||||
|
size: 300, 300
|
||||||
|
orig: 300, 300
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
zone-ruinousShores
|
||||||
|
rotate: false
|
||||||
|
xy: 1, 421
|
||||||
|
size: 300, 300
|
||||||
|
orig: 300, 300
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
zone-saltFlats
|
||||||
|
rotate: false
|
||||||
|
xy: 303, 723
|
||||||
|
size: 300, 300
|
||||||
|
orig: 300, 300
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
zone-stainedMountains
|
||||||
|
rotate: false
|
||||||
|
xy: 1, 119
|
||||||
|
size: 300, 300
|
||||||
|
orig: 300, 300
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
zone-tarFields
|
||||||
|
rotate: false
|
||||||
|
xy: 565, 263
|
||||||
|
size: 250, 250
|
||||||
|
orig: 250, 250
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
|
||||||
|
sprites5.png
|
||||||
size: 2048,1024
|
size: 2048,1024
|
||||||
format: RGBA8888
|
format: RGBA8888
|
||||||
filter: Nearest,Nearest
|
filter: Nearest,Nearest
|
||||||
@@ -19107,93 +19197,3 @@ window-empty
|
|||||||
orig: 27, 61
|
orig: 27, 61
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
|
|
||||||
sprites5.png
|
|
||||||
size: 1024,1024
|
|
||||||
format: RGBA8888
|
|
||||||
filter: Nearest,Nearest
|
|
||||||
repeat: none
|
|
||||||
zone-craters
|
|
||||||
rotate: false
|
|
||||||
xy: 605, 767
|
|
||||||
size: 256, 256
|
|
||||||
orig: 256, 256
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
zone-desertWastes
|
|
||||||
rotate: false
|
|
||||||
xy: 303, 461
|
|
||||||
size: 260, 260
|
|
||||||
orig: 260, 260
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
zone-desolateRift
|
|
||||||
rotate: false
|
|
||||||
xy: 817, 163
|
|
||||||
size: 100, 350
|
|
||||||
orig: 100, 350
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
zone-frozenForest
|
|
||||||
rotate: false
|
|
||||||
xy: 303, 1
|
|
||||||
size: 200, 200
|
|
||||||
orig: 200, 200
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
zone-fungalPass
|
|
||||||
rotate: false
|
|
||||||
xy: 863, 773
|
|
||||||
size: 150, 250
|
|
||||||
orig: 150, 250
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
zone-groundZero
|
|
||||||
rotate: false
|
|
||||||
xy: 303, 203
|
|
||||||
size: 256, 256
|
|
||||||
orig: 256, 256
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
zone-nuclearComplex
|
|
||||||
rotate: false
|
|
||||||
xy: 605, 515
|
|
||||||
size: 250, 250
|
|
||||||
orig: 250, 250
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
zone-overgrowth
|
|
||||||
rotate: false
|
|
||||||
xy: 1, 723
|
|
||||||
size: 300, 300
|
|
||||||
orig: 300, 300
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
zone-ruinousShores
|
|
||||||
rotate: false
|
|
||||||
xy: 1, 421
|
|
||||||
size: 300, 300
|
|
||||||
orig: 300, 300
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
zone-saltFlats
|
|
||||||
rotate: false
|
|
||||||
xy: 303, 723
|
|
||||||
size: 300, 300
|
|
||||||
orig: 300, 300
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
zone-stainedMountains
|
|
||||||
rotate: false
|
|
||||||
xy: 1, 119
|
|
||||||
size: 300, 300
|
|
||||||
orig: 300, 300
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
zone-tarFields
|
|
||||||
rotate: false
|
|
||||||
xy: 565, 263
|
|
||||||
size: 250, 250
|
|
||||||
orig: 250, 250
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 893 KiB After Width: | Height: | Size: 134 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 893 KiB |
@@ -5,12 +5,18 @@ sourceSets.main.java.srcDirs = ["src/"]
|
|||||||
|
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.utils.*
|
|
||||||
import com.badlogic.gdx.tools.texturepacker.TexturePacker
|
import com.badlogic.gdx.tools.texturepacker.TexturePacker
|
||||||
|
import com.badlogic.gdx.utils.IntArray
|
||||||
|
import com.badlogic.gdx.utils.IntIntMap
|
||||||
|
import com.badlogic.gdx.utils.IntMap
|
||||||
|
|
||||||
import javax.imageio.ImageIO
|
import javax.imageio.ImageIO
|
||||||
import java.awt.Graphics2D
|
import java.awt.*
|
||||||
import java.awt.image.BufferedImage
|
import java.awt.image.BufferedImage
|
||||||
|
import java.util.List
|
||||||
|
import java.util.concurrent.ExecutorService
|
||||||
|
import java.util.concurrent.Executors
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
def genFolder = "../core/assets-raw/sprites_out/generated/"
|
def genFolder = "../core/assets-raw/sprites_out/generated/"
|
||||||
def doAntialias = !project.hasProperty("disableAntialias")
|
def doAntialias = !project.hasProperty("disableAntialias")
|
||||||
@@ -46,6 +52,7 @@ def antialias = { File file ->
|
|||||||
def color = new Color()
|
def color = new Color()
|
||||||
def sum = new Color()
|
def sum = new Color()
|
||||||
def suma = new Color()
|
def suma = new Color()
|
||||||
|
int[] p = new int[9]
|
||||||
|
|
||||||
for(int x = 0; x < image.getWidth(); x++){
|
for(int x = 0; x < image.getWidth(); x++){
|
||||||
for(int y = 0; y < image.getHeight(); y++){
|
for(int y = 0; y < image.getHeight(); y++){
|
||||||
@@ -59,20 +66,20 @@ def antialias = { File file ->
|
|||||||
H = getRGB(x, y - 1),
|
H = getRGB(x, y - 1),
|
||||||
I = getRGB(x + 1, y - 1)
|
I = getRGB(x + 1, y - 1)
|
||||||
|
|
||||||
int p1 = E, p2 = E, p3 = E, p4 = E, p5 = E, p6 = E, p7 = E, p8 = E, p9 = E
|
Arrays.fill(p, E);
|
||||||
if(D == B && D != H && B != F) p1 = D
|
|
||||||
if((D == B && D != H && B != F && E != C) || (B == F && B != D && F != H && E != A)) p2 = B
|
if(D == B && D != H && B != F) p[0] = D
|
||||||
if(B == F && B != D && F != H) p3 = F
|
if((D == B && D != H && B != F && E != C) || (B == F && B != D && F != H && E != A)) p[1] = B
|
||||||
if((H == D && H != F && D != B && E != A) || (D == B && D != H && B != F && E != G)) p4 = D
|
if(B == F && B != D && F != H) p[2] = F
|
||||||
p5 = E
|
if((H == D && H != F && D != B && E != A) || (D == B && D != H && B != F && E != G)) p[3] = D
|
||||||
if((B == F && B != D && F != H && E != I) || (F == H && F != B && H != D && E != C)) p6 = F
|
if((B == F && B != D && F != H && E != I) || (F == H && F != B && H != D && E != C)) p[5] = F
|
||||||
if(H == D && H != F && D != B) p7 = D
|
if(H == D && H != F && D != B) p[6] = D
|
||||||
if((F == H && F != B && H != D && E != G) || (H == D && H != F && D != B && E != I)) p8 = H
|
if((F == H && F != B && H != D && E != G) || (H == D && H != F && D != B && E != I)) p[7] = H
|
||||||
if(F == H && F != B && H != D) p9 = F
|
if(F == H && F != B && H != D) p[8] = F
|
||||||
|
|
||||||
suma.set(0)
|
suma.set(0)
|
||||||
|
|
||||||
[p1, p2, p3, p4, p5, p6, p7, p8, p9].each{ val ->
|
for(int val : p){
|
||||||
Color.argb8888ToColor(color, val)
|
Color.argb8888ToColor(color, val)
|
||||||
suma.r += color.r * color.a
|
suma.r += color.r * color.a
|
||||||
suma.g += color.g * color.a
|
suma.g += color.g * color.a
|
||||||
@@ -85,7 +92,7 @@ def antialias = { File file ->
|
|||||||
float total = 0
|
float total = 0
|
||||||
sum.set(0)
|
sum.set(0)
|
||||||
|
|
||||||
[p1, p2, p3, p4, p5, p6, p7, p8, p9].each{ val ->
|
for(int val : p){
|
||||||
Color.argb8888ToColor(color, val)
|
Color.argb8888ToColor(color, val)
|
||||||
float a = color.a
|
float a = color.a
|
||||||
color.lerp(suma, (float) (1f - a))
|
color.lerp(suma, (float) (1f - a))
|
||||||
@@ -318,11 +325,22 @@ task pack(dependsOn: classes){
|
|||||||
delete "../core/assets-raw/sprites_out/ui/icons"
|
delete "../core/assets-raw/sprites_out/ui/icons"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExecutorService executor = Executors.newFixedThreadPool(16)
|
||||||
|
|
||||||
//antialias everything except UI elements
|
//antialias everything except UI elements
|
||||||
fileTree(dir: '../core/assets-raw/sprites_out/', include: "**/*.png").visit{ file ->
|
fileTree(dir: '../core/assets-raw/sprites_out/', include: "**/*.png").visit{ file ->
|
||||||
if(file.isDirectory() || file.toString().replace("\\", "/").contains("zones/") || (file.toString().replace("\\", "/").contains("/ui/") && file.toString().startsWith("icon-"))) return
|
if(file.isDirectory() || file.toString().replace("\\", "/").contains("zones/") || (file.toString().replace("\\", "/").contains("/ui/") && file.toString().startsWith("icon-"))) return
|
||||||
|
|
||||||
antialias(file.file)
|
executor.submit{
|
||||||
|
antialias(file.file)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
executor.shutdown();
|
||||||
|
try{
|
||||||
|
executor.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
|
||||||
|
}catch(InterruptedException e){
|
||||||
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
|
|
||||||
//pack normal sprites
|
//pack normal sprites
|
||||||
|
|||||||
Reference in New Issue
Block a user