Batch optimizations

This commit is contained in:
Anuken 2024-07-23 11:31:34 -04:00
parent 995014cbe4
commit a594d796ad
8 changed files with 12 additions and 10 deletions

View File

@ -70,7 +70,7 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
});
UI.loadColors();
batch = new SortedSpriteBatch();
batch = new SpriteBatch();
assets = new AssetManager();
assets.setLoader(Texture.class, "." + mapExtension, new MapPreviewLoader());

View File

@ -79,7 +79,7 @@ public class ParticleEffect extends Effect{
float x = rv.x, y = rv.y;
Lines.lineAngle(ox + x, oy + y, Mathf.angle(x, y), len, cap);
Drawf.light(ox + x, oy + y, len * lightScl, lightColor, lightOpacity * Draw.getColor().a);
Drawf.light(ox + x, oy + y, len * lightScl, lightColor, lightOpacity * Draw.getColorAlpha());
}
}else{
rand.setSeed(e.id);
@ -89,7 +89,7 @@ public class ParticleEffect extends Effect{
float x = rv.x, y = rv.y;
Draw.rect(tex, ox + x, oy + y, rad, rad / tex.ratio(), realRotation + offset + e.time * spin);
Drawf.light(ox + x, oy + y, rad * lightScl, lightColor, lightOpacity * Draw.getColor().a);
Drawf.light(ox + x, oy + y, rad * lightScl, lightColor, lightOpacity * Draw.getColorAlpha());
}
}
}

View File

@ -480,7 +480,7 @@ public class Drawf{
/** Draws a sprite that should be light-wise correct, when rotated. Provided sprite must be symmetrical in shape. */
public static void spinSprite(TextureRegion region, float x, float y, float r){
float a = Draw.getColor().a;
float a = Draw.getColorAlpha();
r = Mathf.mod(r, 90f);
Draw.rect(region, x, y, r);
Draw.alpha(r / 90f*a);

View File

@ -70,7 +70,7 @@ public class LightRenderer{
float rot = Mathf.angleExact(x2 - x, y2 - y);
TextureRegion ledge = Core.atlas.find("circle-end"), lmid = Core.atlas.find("circle-mid");
float color = Draw.getColor().toFloatBits();
float color = Draw.getColorPacked();
float u = lmid.u;
float v = lmid.v2;
float u2 = lmid.u2;

View File

@ -161,7 +161,7 @@ public class Weather extends UnlockableContent{
Core.camera.bounds(Tmp.r2);
int total = (int)(Tmp.r1.area() / density * intensity);
Lines.stroke(stroke);
float alpha = Draw.getColor().a;
float alpha = Draw.getColorAlpha();
Draw.color(color);
for(int i = 0; i < total; i++){

View File

@ -238,13 +238,15 @@ public class ItemBridge extends Block{
Lines.stroke(2.5f);
Lines.line(tx + Tmp.v2.x, ty + Tmp.v2.y, ox - Tmp.v2.x, oy - Tmp.v2.y);
float color = (linked ? Pal.place : Pal.accent).toFloatBits();
//draw foreground colors
Draw.color(linked ? Pal.place : Pal.accent);
Draw.color(color);
Lines.stroke(1f);
Lines.line(tx + Tmp.v2.x, ty + Tmp.v2.y, ox - Tmp.v2.x, oy - Tmp.v2.y);
Lines.square(ox, oy, 2f, 45f);
Draw.mixcol(Draw.getColor(), 1f);
Draw.mixcol(color);
Draw.color();
Draw.rect(arrowRegion, x, y, rel * 90);
Draw.mixcol();

View File

@ -292,7 +292,7 @@ public class CoreBlock extends StorageBlock{
protected void drawLandingThrusters(float x, float y, float rotation, float frame){
float length = thrusterLength * (frame - 1f) - 1f/4f;
float alpha = Draw.getColor().a;
float alpha = Draw.getColorAlpha();
//two passes for consistent lighting
for(int j = 0; j < 2; j++){

View File

@ -26,4 +26,4 @@ org.gradle.caching=true
org.gradle.internal.http.socketTimeout=100000
org.gradle.internal.http.connectionTimeout=100000
android.enableR8.fullMode=false
archash=96cd86d08a
archash=8055a9104d