Fixed antialiasing

This commit is contained in:
Anuken
2020-03-30 12:00:08 -04:00
parent 084c90ba9f
commit 9081f3ff03
9 changed files with 593 additions and 589 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 KiB

After

Width:  |  Height:  |  Size: 691 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 241 KiB

After

Width:  |  Height:  |  Size: 284 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

After

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 704 KiB

After

Width:  |  Height:  |  Size: 867 KiB

View File

@ -1,5 +1,6 @@
package mindustry.entities.units; package mindustry.entities.units;
import arc.math.*;
import arc.math.geom.*; import arc.math.geom.*;
import arc.util.*; import arc.util.*;
import mindustry.entities.*; import mindustry.entities.*;
@ -17,6 +18,10 @@ public class AIController implements UnitController{
protected Teamc target; protected Teamc target;
protected Interval timer = new Interval(4); protected Interval timer = new Interval(4);
{
timer.reset(0, Mathf.random(40f));
}
protected void targetClosestAllyFlag(BlockFlag flag){ protected void targetClosestAllyFlag(BlockFlag flag){
Tile target = Geometry.findClosest(unit.x(), unit.y(), indexer.getAllied(unit.team(), flag)); Tile target = Geometry.findClosest(unit.x(), unit.y(), indexer.getAllied(unit.team(), flag));
if(target != null) this.target = target.entity; if(target != null) this.target = target.entity;

View File

@ -77,7 +77,7 @@ def antialias = { File file ->
suma.set(0) suma.set(0)
for(int val : p){ for(int val : p){
Color.argb8888ToColor(color, val) color.argb8888(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
suma.b += color.b * color.a suma.b += color.b * color.a
@ -91,7 +91,7 @@ def antialias = { File file ->
sum.set(0) sum.set(0)
for(int val : p){ for(int val : p){
Color.argb8888ToColor(color, val) color.argb8888(val)
float a = color.a float a = color.a
color.lerp(suma, (float) (1f - a)) color.lerp(suma, (float) (1f - a))
sum.r += color.r sum.r += color.r
@ -103,8 +103,7 @@ def antialias = { File file ->
fm = (float)(1f / total) fm = (float)(1f / total)
sum.mul(fm, fm, fm, fm) sum.mul(fm, fm, fm, fm)
int result = Color.argb8888(sum) out.setRGB(x, y, sum.argb8888())
out.setRGB(x, y, result)
sum.set(0) sum.set(0)
} }
} }
@ -315,7 +314,7 @@ task pack(dependsOn: classes){
//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("/ui/") && file.toString().startsWith("icon-"))) return
executor.submit{ executor.submit{
antialias(file.file) antialias(file.file)