Cleanup
This commit is contained in:
@@ -156,6 +156,13 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
|
||||
Call.onTileConfig(null, this, value);
|
||||
}
|
||||
|
||||
/** Deselect this tile from configuration. */
|
||||
public void deselect(){
|
||||
if(!headless && control.input.frag.config.getSelectedTile() == this){
|
||||
control.input.frag.config.hideConfig();
|
||||
}
|
||||
}
|
||||
|
||||
public void applyBoost(float intensity, float duration){
|
||||
timeScale = Math.max(timeScale, intensity);
|
||||
timeScaleDuration = Math.max(timeScaleDuration, duration);
|
||||
|
||||
@@ -27,7 +27,7 @@ public class LoadRenderer implements Disposable{
|
||||
private static final String red = "[#" + colorRed + "]";
|
||||
private static final String orange = "[#" + color + "]";
|
||||
private static final FloatArray floats = new FloatArray();
|
||||
private static final boolean preview = true;
|
||||
private static final boolean preview = false;
|
||||
|
||||
private float testprogress = 0f;
|
||||
private StringBuilder assetText = new StringBuilder();
|
||||
@@ -137,6 +137,7 @@ public class LoadRenderer implements Disposable{
|
||||
}
|
||||
}
|
||||
|
||||
Draw.flush();
|
||||
|
||||
float aspect = 1.94f;
|
||||
|
||||
@@ -228,10 +229,13 @@ public class LoadRenderer implements Disposable{
|
||||
}else if(panei == 1){
|
||||
float height = maxy - miny;
|
||||
float barpad = s * 8f;
|
||||
float barspace = (height - barpad) / bars.length;
|
||||
|
||||
int barsUsed = Math.min((int)((height - barpad) / (font.getLineHeight() * 1.4f)), bars.length);
|
||||
|
||||
float barspace = (height - barpad) / barsUsed;
|
||||
float barheight = barspace * 0.8f;
|
||||
|
||||
for(int i = 0; i < bars.length; i++){
|
||||
for(int i = 0; i < barsUsed; i++){
|
||||
Bar bar = bars[i];
|
||||
if(bar.valid()){
|
||||
Draw.color(bar.red() ? colorRed : color);
|
||||
|
||||
@@ -108,8 +108,7 @@ public class Shaders{
|
||||
public static class SunShader extends LoadShader{
|
||||
public int octaves = 5;
|
||||
public float falloff = 0.5f, scale = 1f, power = 1.3f, magnitude = 0.6f, speed = 99999999999f, spread = 1.3f, seed = Mathf.random(9999f);
|
||||
|
||||
public float[] colorValues;
|
||||
public Texture colors;
|
||||
|
||||
public SunShader(){
|
||||
super("sun", "sun");
|
||||
@@ -117,6 +116,10 @@ public class Shaders{
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
colors.bind(1);
|
||||
Gl.activeTexture(Gl.texture0);
|
||||
|
||||
setUniformi("u_colors", 1);
|
||||
setUniformi("u_octaves", octaves);
|
||||
setUniformf("u_falloff", falloff);
|
||||
setUniformf("u_scale", scale);
|
||||
@@ -125,9 +128,6 @@ public class Shaders{
|
||||
setUniformf("u_time", Time.globalTime() / speed);
|
||||
setUniformf("u_seed", seed);
|
||||
setUniformf("u_spread", spread);
|
||||
|
||||
setUniformi("u_colornum", colorValues.length / 4);
|
||||
setUniform4fv("u_colors[0]", colorValues, 0, colorValues.length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,11 @@ package mindustry.graphics.g3d;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.gl.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.util.*;
|
||||
import mindustry.type.*;
|
||||
|
||||
/** Defines a mesh that is rendered for a planet. Subclasses provide a mesh and a shader. */
|
||||
public abstract class PlanetMesh{
|
||||
public abstract class PlanetMesh implements Disposable{
|
||||
protected final Mesh mesh;
|
||||
protected final Planet planet;
|
||||
protected final Shader shader;
|
||||
@@ -28,4 +29,9 @@ public abstract class PlanetMesh{
|
||||
shader.apply();
|
||||
mesh.render(shader, Gl.triangles);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose(){
|
||||
mesh.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package mindustry.graphics.g3d;
|
||||
|
||||
import arc.graphics.*;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.graphics.Shaders.*;
|
||||
import mindustry.type.*;
|
||||
@@ -9,25 +10,19 @@ import mindustry.type.*;
|
||||
public class SunMesh extends ShaderSphereMesh{
|
||||
public int octaves = 5;
|
||||
public float falloff = 0.5f, scale = 1f, power = 1.3f, magnitude = 0.6f, speed = 99999999999f, spread = 1.3f, seed = Mathf.random(9999f);
|
||||
public float[] colorValues;
|
||||
public Texture colors;
|
||||
|
||||
public SunMesh(Planet planet, int divisions){
|
||||
super(planet, Shaders.sun, divisions);
|
||||
}
|
||||
|
||||
public void setColors(Color... colors){
|
||||
setColors(1f, colors);
|
||||
}
|
||||
|
||||
public void setColors(float scl, Color... colors){
|
||||
colorValues = new float[colors.length*4];
|
||||
|
||||
for(int i = 0; i < colors.length; i ++){
|
||||
colorValues[i*4] = colors[i].r * scl;
|
||||
colorValues[i*4 + 1] = colors[i].g * scl;
|
||||
colorValues[i*4 + 2] = colors[i].b * scl;
|
||||
colorValues[i*4 + 3] = colors[i].a * scl;
|
||||
Pixmap pix = new Pixmap(colors.length, 1);
|
||||
for(int i = 0; i < colors.length; i++){
|
||||
pix.draw(i, 0, Tmp.c1.set(colors[i]).mul(scl));
|
||||
}
|
||||
this.colors = new Texture(pix);
|
||||
pix.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -40,6 +35,12 @@ public class SunMesh extends ShaderSphereMesh{
|
||||
s.magnitude = magnitude;
|
||||
s.speed = speed;
|
||||
s.seed = seed;
|
||||
s.colorValues = colorValues;
|
||||
s.colors = colors;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose(){
|
||||
super.dispose();
|
||||
colors.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,13 +177,13 @@ public class PlanetDialog extends FloatingDialog{
|
||||
projector.proj(cam.combined);
|
||||
batch.proj(cam.combined);
|
||||
|
||||
bloom.capture();
|
||||
beginBloom();
|
||||
|
||||
skybox.render(cam.combined);
|
||||
|
||||
renderPlanet(solarSystem);
|
||||
|
||||
bloom.render();
|
||||
endBloom();
|
||||
|
||||
Gl.enable(Gl.blend);
|
||||
|
||||
@@ -217,6 +217,14 @@ public class PlanetDialog extends FloatingDialog{
|
||||
cam.update();
|
||||
}
|
||||
|
||||
private void beginBloom(){
|
||||
bloom.capture();
|
||||
}
|
||||
|
||||
private void endBloom(){
|
||||
bloom.render();
|
||||
}
|
||||
|
||||
private void renderPlanet(Planet planet){
|
||||
//render planet at offsetted position in the world
|
||||
planet.mesh.render(cam.combined, planet.getTransform(mat));
|
||||
@@ -227,7 +235,7 @@ public class PlanetDialog extends FloatingDialog{
|
||||
renderSectors(planet);
|
||||
}
|
||||
|
||||
if(planet.parent != null && planet.hasAtmosphere){
|
||||
if(planet.parent != null && planet.hasAtmosphere && Core.settings.getBool("atmosphere")){
|
||||
Blending.additive.apply();
|
||||
|
||||
Shaders.atmosphere.camera = cam;
|
||||
|
||||
@@ -317,6 +317,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
}
|
||||
|
||||
graphics.checkPref("effects", true);
|
||||
graphics.checkPref("atmosphere", !mobile);
|
||||
graphics.checkPref("destroyedblocks", true);
|
||||
graphics.checkPref("blockstatus", false);
|
||||
graphics.checkPref("playerchat", true);
|
||||
|
||||
@@ -140,7 +140,7 @@ public class Sorter extends Block{
|
||||
@Override
|
||||
public boolean onConfigureTileTapped(Tilec other){
|
||||
if(this == other){
|
||||
control.input.frag.config.hideConfig();
|
||||
deselect();
|
||||
configure(null);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public class MessageBlock extends Block{
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
control.input.frag.config.hideConfig();
|
||||
deselect();
|
||||
}).size(40f);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public class LightBlock extends Block{
|
||||
public void buildConfiguration(Table table){
|
||||
table.button(Icon.pencil, () -> {
|
||||
ui.picker.show(Tmp.c1.set(color).a(0.5f), false, res -> configure(res.rgba()));
|
||||
control.input.frag.config.hideConfig();
|
||||
deselect();
|
||||
}).size(40f);
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +194,9 @@ public class PowerNode extends PowerBlock{
|
||||
|
||||
tempTileEnts.each(valid, t -> {
|
||||
graphs.add(t.power().graph);
|
||||
others.get(t);
|
||||
if(t.power().graph != tile.entity.power().graph){
|
||||
others.get(t);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ public class ItemSource extends Block{
|
||||
@Override
|
||||
public boolean onConfigureTileTapped(Tilec other){
|
||||
if(this == other){
|
||||
control.input.frag.config.hideConfig();
|
||||
deselect();
|
||||
configure(null);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class LiquidSource extends Block{
|
||||
@Override
|
||||
public boolean onConfigureTileTapped(Tilec other){
|
||||
if(this == other){
|
||||
control.input.frag.config.hideConfig();
|
||||
deselect();
|
||||
configure(null);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class Unloader extends Block{
|
||||
@Override
|
||||
public boolean onConfigureTileTapped(Tilec other){
|
||||
if(this == other){
|
||||
control.input.frag.config.hideConfig();
|
||||
deselect();
|
||||
configure(null);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user