mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-11 11:17:11 +07:00
Cleanup
This commit is contained in:
parent
dabc891791
commit
2cb9cfb097
@ -678,6 +678,7 @@ setting.pixelate.name = Pixelate
|
|||||||
setting.minimap.name = Show Minimap
|
setting.minimap.name = Show Minimap
|
||||||
setting.position.name = Show Player Position
|
setting.position.name = Show Player Position
|
||||||
setting.musicvol.name = Music Volume
|
setting.musicvol.name = Music Volume
|
||||||
|
setting.atmosphere.name = Show Planet Atmosphere
|
||||||
setting.ambientvol.name = Ambient Volume
|
setting.ambientvol.name = Ambient Volume
|
||||||
setting.mutemusic.name = Mute Music
|
setting.mutemusic.name = Mute Music
|
||||||
setting.sfxvol.name = SFX Volume
|
setting.sfxvol.name = SFX Volume
|
||||||
|
@ -1,34 +1,16 @@
|
|||||||
#ifdef GL_ES
|
#ifdef GL_ES
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
precision lowp int;
|
precision lowp int;
|
||||||
#define INTEGER lowp int
|
|
||||||
#else
|
|
||||||
#define INTEGER int
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#define GRADIENTS
|
|
||||||
#define step 0.5
|
#define step 0.5
|
||||||
|
|
||||||
const int MAX_COLORS = 10;
|
const int MAX_COLORS = 10;
|
||||||
|
|
||||||
uniform INTEGER u_colornum;
|
|
||||||
uniform vec4 u_colors[MAX_COLORS];
|
|
||||||
|
|
||||||
varying float v_height;
|
varying float v_height;
|
||||||
|
|
||||||
void main() {
|
uniform sampler2D u_colors;
|
||||||
#ifdef GRADIENTS
|
|
||||||
|
|
||||||
int from = int(v_height * float(u_colornum));
|
void main(){
|
||||||
int to = int(clamp(float(int(v_height * float(u_colornum) + 1.0)), 0.0, float(u_colornum)-1.0));
|
gl_FragColor = texture2D(u_colors, vec2(v_height, 0.0));
|
||||||
float alpha = fract(v_height * float(u_colornum));
|
|
||||||
alpha = floor(alpha / step) * step;
|
|
||||||
|
|
||||||
gl_FragColor = vec4(mix(u_colors[from], u_colors[to], alpha));
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
gl_FragColor = u_colors[int(v_height * float(u_colornum))];
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
@ -1,9 +1,6 @@
|
|||||||
#ifdef GL_ES
|
#ifdef GL_ES
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
precision lowp int;
|
precision lowp int;
|
||||||
#define INTEGER lowp int
|
|
||||||
#else
|
|
||||||
#define INTEGER int
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
attribute vec4 a_position;
|
attribute vec4 a_position;
|
||||||
@ -22,8 +19,6 @@ uniform float u_spread;
|
|||||||
uniform float u_magnitude;
|
uniform float u_magnitude;
|
||||||
uniform float u_seed;
|
uniform float u_seed;
|
||||||
|
|
||||||
uniform INTEGER u_colornum;
|
|
||||||
|
|
||||||
varying float v_height;
|
varying float v_height;
|
||||||
|
|
||||||
float rand(vec2 co){
|
float rand(vec2 co){
|
||||||
|
@ -156,6 +156,13 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
|
|||||||
Call.onTileConfig(null, this, value);
|
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){
|
public void applyBoost(float intensity, float duration){
|
||||||
timeScale = Math.max(timeScale, intensity);
|
timeScale = Math.max(timeScale, intensity);
|
||||||
timeScaleDuration = Math.max(timeScaleDuration, duration);
|
timeScaleDuration = Math.max(timeScaleDuration, duration);
|
||||||
|
@ -27,7 +27,7 @@ public class LoadRenderer implements Disposable{
|
|||||||
private static final String red = "[#" + colorRed + "]";
|
private static final String red = "[#" + colorRed + "]";
|
||||||
private static final String orange = "[#" + color + "]";
|
private static final String orange = "[#" + color + "]";
|
||||||
private static final FloatArray floats = new FloatArray();
|
private static final FloatArray floats = new FloatArray();
|
||||||
private static final boolean preview = true;
|
private static final boolean preview = false;
|
||||||
|
|
||||||
private float testprogress = 0f;
|
private float testprogress = 0f;
|
||||||
private StringBuilder assetText = new StringBuilder();
|
private StringBuilder assetText = new StringBuilder();
|
||||||
@ -137,6 +137,7 @@ public class LoadRenderer implements Disposable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Draw.flush();
|
||||||
|
|
||||||
float aspect = 1.94f;
|
float aspect = 1.94f;
|
||||||
|
|
||||||
@ -228,10 +229,13 @@ public class LoadRenderer implements Disposable{
|
|||||||
}else if(panei == 1){
|
}else if(panei == 1){
|
||||||
float height = maxy - miny;
|
float height = maxy - miny;
|
||||||
float barpad = s * 8f;
|
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;
|
float barheight = barspace * 0.8f;
|
||||||
|
|
||||||
for(int i = 0; i < bars.length; i++){
|
for(int i = 0; i < barsUsed; i++){
|
||||||
Bar bar = bars[i];
|
Bar bar = bars[i];
|
||||||
if(bar.valid()){
|
if(bar.valid()){
|
||||||
Draw.color(bar.red() ? colorRed : color);
|
Draw.color(bar.red() ? colorRed : color);
|
||||||
|
@ -108,8 +108,7 @@ public class Shaders{
|
|||||||
public static class SunShader extends LoadShader{
|
public static class SunShader extends LoadShader{
|
||||||
public int octaves = 5;
|
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 falloff = 0.5f, scale = 1f, power = 1.3f, magnitude = 0.6f, speed = 99999999999f, spread = 1.3f, seed = Mathf.random(9999f);
|
||||||
|
public Texture colors;
|
||||||
public float[] colorValues;
|
|
||||||
|
|
||||||
public SunShader(){
|
public SunShader(){
|
||||||
super("sun", "sun");
|
super("sun", "sun");
|
||||||
@ -117,6 +116,10 @@ public class Shaders{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(){
|
public void apply(){
|
||||||
|
colors.bind(1);
|
||||||
|
Gl.activeTexture(Gl.texture0);
|
||||||
|
|
||||||
|
setUniformi("u_colors", 1);
|
||||||
setUniformi("u_octaves", octaves);
|
setUniformi("u_octaves", octaves);
|
||||||
setUniformf("u_falloff", falloff);
|
setUniformf("u_falloff", falloff);
|
||||||
setUniformf("u_scale", scale);
|
setUniformf("u_scale", scale);
|
||||||
@ -125,9 +128,6 @@ public class Shaders{
|
|||||||
setUniformf("u_time", Time.globalTime() / speed);
|
setUniformf("u_time", Time.globalTime() / speed);
|
||||||
setUniformf("u_seed", seed);
|
setUniformf("u_seed", seed);
|
||||||
setUniformf("u_spread", spread);
|
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.*;
|
||||||
import arc.graphics.gl.*;
|
import arc.graphics.gl.*;
|
||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
|
import arc.util.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
|
|
||||||
/** Defines a mesh that is rendered for a planet. Subclasses provide a mesh and a shader. */
|
/** 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 Mesh mesh;
|
||||||
protected final Planet planet;
|
protected final Planet planet;
|
||||||
protected final Shader shader;
|
protected final Shader shader;
|
||||||
@ -28,4 +29,9 @@ public abstract class PlanetMesh{
|
|||||||
shader.apply();
|
shader.apply();
|
||||||
mesh.render(shader, Gl.triangles);
|
mesh.render(shader, Gl.triangles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose(){
|
||||||
|
mesh.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package mindustry.graphics.g3d;
|
|||||||
|
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
|
import arc.util.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.graphics.Shaders.*;
|
import mindustry.graphics.Shaders.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
@ -9,25 +10,19 @@ import mindustry.type.*;
|
|||||||
public class SunMesh extends ShaderSphereMesh{
|
public class SunMesh extends ShaderSphereMesh{
|
||||||
public int octaves = 5;
|
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 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){
|
public SunMesh(Planet planet, int divisions){
|
||||||
super(planet, Shaders.sun, divisions);
|
super(planet, Shaders.sun, divisions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColors(Color... colors){
|
|
||||||
setColors(1f, colors);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setColors(float scl, Color... colors){
|
public void setColors(float scl, Color... colors){
|
||||||
colorValues = new float[colors.length*4];
|
Pixmap pix = new Pixmap(colors.length, 1);
|
||||||
|
for(int i = 0; i < colors.length; i++){
|
||||||
for(int i = 0; i < colors.length; i ++){
|
pix.draw(i, 0, Tmp.c1.set(colors[i]).mul(scl));
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
this.colors = new Texture(pix);
|
||||||
|
pix.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -40,6 +35,12 @@ public class SunMesh extends ShaderSphereMesh{
|
|||||||
s.magnitude = magnitude;
|
s.magnitude = magnitude;
|
||||||
s.speed = speed;
|
s.speed = speed;
|
||||||
s.seed = seed;
|
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);
|
projector.proj(cam.combined);
|
||||||
batch.proj(cam.combined);
|
batch.proj(cam.combined);
|
||||||
|
|
||||||
bloom.capture();
|
beginBloom();
|
||||||
|
|
||||||
skybox.render(cam.combined);
|
skybox.render(cam.combined);
|
||||||
|
|
||||||
renderPlanet(solarSystem);
|
renderPlanet(solarSystem);
|
||||||
|
|
||||||
bloom.render();
|
endBloom();
|
||||||
|
|
||||||
Gl.enable(Gl.blend);
|
Gl.enable(Gl.blend);
|
||||||
|
|
||||||
@ -217,6 +217,14 @@ public class PlanetDialog extends FloatingDialog{
|
|||||||
cam.update();
|
cam.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void beginBloom(){
|
||||||
|
bloom.capture();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void endBloom(){
|
||||||
|
bloom.render();
|
||||||
|
}
|
||||||
|
|
||||||
private void renderPlanet(Planet planet){
|
private void renderPlanet(Planet planet){
|
||||||
//render planet at offsetted position in the world
|
//render planet at offsetted position in the world
|
||||||
planet.mesh.render(cam.combined, planet.getTransform(mat));
|
planet.mesh.render(cam.combined, planet.getTransform(mat));
|
||||||
@ -227,7 +235,7 @@ public class PlanetDialog extends FloatingDialog{
|
|||||||
renderSectors(planet);
|
renderSectors(planet);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(planet.parent != null && planet.hasAtmosphere){
|
if(planet.parent != null && planet.hasAtmosphere && Core.settings.getBool("atmosphere")){
|
||||||
Blending.additive.apply();
|
Blending.additive.apply();
|
||||||
|
|
||||||
Shaders.atmosphere.camera = cam;
|
Shaders.atmosphere.camera = cam;
|
||||||
|
@ -317,6 +317,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
graphics.checkPref("effects", true);
|
graphics.checkPref("effects", true);
|
||||||
|
graphics.checkPref("atmosphere", !mobile);
|
||||||
graphics.checkPref("destroyedblocks", true);
|
graphics.checkPref("destroyedblocks", true);
|
||||||
graphics.checkPref("blockstatus", false);
|
graphics.checkPref("blockstatus", false);
|
||||||
graphics.checkPref("playerchat", true);
|
graphics.checkPref("playerchat", true);
|
||||||
|
@ -140,7 +140,7 @@ public class Sorter extends Block{
|
|||||||
@Override
|
@Override
|
||||||
public boolean onConfigureTileTapped(Tilec other){
|
public boolean onConfigureTileTapped(Tilec other){
|
||||||
if(this == other){
|
if(this == other){
|
||||||
control.input.frag.config.hideConfig();
|
deselect();
|
||||||
configure(null);
|
configure(null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ public class MessageBlock extends Block{
|
|||||||
});
|
});
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
control.input.frag.config.hideConfig();
|
deselect();
|
||||||
}).size(40f);
|
}).size(40f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public class LightBlock extends Block{
|
|||||||
public void buildConfiguration(Table table){
|
public void buildConfiguration(Table table){
|
||||||
table.button(Icon.pencil, () -> {
|
table.button(Icon.pencil, () -> {
|
||||||
ui.picker.show(Tmp.c1.set(color).a(0.5f), false, res -> configure(res.rgba()));
|
ui.picker.show(Tmp.c1.set(color).a(0.5f), false, res -> configure(res.rgba()));
|
||||||
control.input.frag.config.hideConfig();
|
deselect();
|
||||||
}).size(40f);
|
}).size(40f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,9 @@ public class PowerNode extends PowerBlock{
|
|||||||
|
|
||||||
tempTileEnts.each(valid, t -> {
|
tempTileEnts.each(valid, t -> {
|
||||||
graphs.add(t.power().graph);
|
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
|
@Override
|
||||||
public boolean onConfigureTileTapped(Tilec other){
|
public boolean onConfigureTileTapped(Tilec other){
|
||||||
if(this == other){
|
if(this == other){
|
||||||
control.input.frag.config.hideConfig();
|
deselect();
|
||||||
configure(null);
|
configure(null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ public class LiquidSource extends Block{
|
|||||||
@Override
|
@Override
|
||||||
public boolean onConfigureTileTapped(Tilec other){
|
public boolean onConfigureTileTapped(Tilec other){
|
||||||
if(this == other){
|
if(this == other){
|
||||||
control.input.frag.config.hideConfig();
|
deselect();
|
||||||
configure(null);
|
configure(null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ public class Unloader extends Block{
|
|||||||
@Override
|
@Override
|
||||||
public boolean onConfigureTileTapped(Tilec other){
|
public boolean onConfigureTileTapped(Tilec other){
|
||||||
if(this == other){
|
if(this == other){
|
||||||
control.input.frag.config.hideConfig();
|
deselect();
|
||||||
configure(null);
|
configure(null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user