mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-11 00:07:46 +07:00
Batch optimizations
This commit is contained in:
@ -70,7 +70,7 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
|
|||||||
});
|
});
|
||||||
|
|
||||||
UI.loadColors();
|
UI.loadColors();
|
||||||
batch = new SortedSpriteBatch();
|
batch = new SpriteBatch();
|
||||||
assets = new AssetManager();
|
assets = new AssetManager();
|
||||||
assets.setLoader(Texture.class, "." + mapExtension, new MapPreviewLoader());
|
assets.setLoader(Texture.class, "." + mapExtension, new MapPreviewLoader());
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ public class ParticleEffect extends Effect{
|
|||||||
float x = rv.x, y = rv.y;
|
float x = rv.x, y = rv.y;
|
||||||
|
|
||||||
Lines.lineAngle(ox + x, oy + y, Mathf.angle(x, y), len, cap);
|
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{
|
}else{
|
||||||
rand.setSeed(e.id);
|
rand.setSeed(e.id);
|
||||||
@ -89,7 +89,7 @@ public class ParticleEffect extends Effect{
|
|||||||
float x = rv.x, y = rv.y;
|
float x = rv.x, y = rv.y;
|
||||||
|
|
||||||
Draw.rect(tex, ox + x, oy + y, rad, rad / tex.ratio(), realRotation + offset + e.time * spin);
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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. */
|
/** 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){
|
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);
|
r = Mathf.mod(r, 90f);
|
||||||
Draw.rect(region, x, y, r);
|
Draw.rect(region, x, y, r);
|
||||||
Draw.alpha(r / 90f*a);
|
Draw.alpha(r / 90f*a);
|
||||||
|
@ -70,7 +70,7 @@ public class LightRenderer{
|
|||||||
float rot = Mathf.angleExact(x2 - x, y2 - y);
|
float rot = Mathf.angleExact(x2 - x, y2 - y);
|
||||||
TextureRegion ledge = Core.atlas.find("circle-end"), lmid = Core.atlas.find("circle-mid");
|
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 u = lmid.u;
|
||||||
float v = lmid.v2;
|
float v = lmid.v2;
|
||||||
float u2 = lmid.u2;
|
float u2 = lmid.u2;
|
||||||
|
@ -161,7 +161,7 @@ public class Weather extends UnlockableContent{
|
|||||||
Core.camera.bounds(Tmp.r2);
|
Core.camera.bounds(Tmp.r2);
|
||||||
int total = (int)(Tmp.r1.area() / density * intensity);
|
int total = (int)(Tmp.r1.area() / density * intensity);
|
||||||
Lines.stroke(stroke);
|
Lines.stroke(stroke);
|
||||||
float alpha = Draw.getColor().a;
|
float alpha = Draw.getColorAlpha();
|
||||||
Draw.color(color);
|
Draw.color(color);
|
||||||
|
|
||||||
for(int i = 0; i < total; i++){
|
for(int i = 0; i < total; i++){
|
||||||
|
@ -238,13 +238,15 @@ public class ItemBridge extends Block{
|
|||||||
Lines.stroke(2.5f);
|
Lines.stroke(2.5f);
|
||||||
Lines.line(tx + Tmp.v2.x, ty + Tmp.v2.y, ox - Tmp.v2.x, oy - Tmp.v2.y);
|
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 foreground colors
|
||||||
Draw.color(linked ? Pal.place : Pal.accent);
|
Draw.color(color);
|
||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
Lines.line(tx + Tmp.v2.x, ty + Tmp.v2.y, ox - Tmp.v2.x, oy - Tmp.v2.y);
|
Lines.line(tx + Tmp.v2.x, ty + Tmp.v2.y, ox - Tmp.v2.x, oy - Tmp.v2.y);
|
||||||
|
|
||||||
Lines.square(ox, oy, 2f, 45f);
|
Lines.square(ox, oy, 2f, 45f);
|
||||||
Draw.mixcol(Draw.getColor(), 1f);
|
Draw.mixcol(color);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
Draw.rect(arrowRegion, x, y, rel * 90);
|
Draw.rect(arrowRegion, x, y, rel * 90);
|
||||||
Draw.mixcol();
|
Draw.mixcol();
|
||||||
|
@ -292,7 +292,7 @@ public class CoreBlock extends StorageBlock{
|
|||||||
|
|
||||||
protected void drawLandingThrusters(float x, float y, float rotation, float frame){
|
protected void drawLandingThrusters(float x, float y, float rotation, float frame){
|
||||||
float length = thrusterLength * (frame - 1f) - 1f/4f;
|
float length = thrusterLength * (frame - 1f) - 1f/4f;
|
||||||
float alpha = Draw.getColor().a;
|
float alpha = Draw.getColorAlpha();
|
||||||
|
|
||||||
//two passes for consistent lighting
|
//two passes for consistent lighting
|
||||||
for(int j = 0; j < 2; j++){
|
for(int j = 0; j < 2; j++){
|
||||||
|
@ -26,4 +26,4 @@ org.gradle.caching=true
|
|||||||
org.gradle.internal.http.socketTimeout=100000
|
org.gradle.internal.http.socketTimeout=100000
|
||||||
org.gradle.internal.http.connectionTimeout=100000
|
org.gradle.internal.http.connectionTimeout=100000
|
||||||
android.enableR8.fullMode=false
|
android.enableR8.fullMode=false
|
||||||
archash=96cd86d08a
|
archash=8055a9104d
|
||||||
|
Reference in New Issue
Block a user