This commit is contained in:
Anuken 2020-11-16 19:43:56 -05:00
parent 3b609f698a
commit f296d23cfa
17 changed files with 52 additions and 19 deletions

View File

@ -138,7 +138,7 @@ public class AndroidLauncher extends AndroidApplication{
if(open){
new FileChooser(title, file -> Structs.contains(extensions, file.extension().toLowerCase()), true, cons).show();
}else{
super.showFileChooser(open, extension, cons);
super.showFileChooser(open, "@open", extension, cons);
}
}
}

View File

@ -544,6 +544,7 @@ sectors.select = Select
sectors.nonelaunch = [lightgray]none (sun)
sectors.rename = Rename Sector
sector.curcapture = Sector Captured
sector.missingresources = [scarlet]Insufficient Core Resources
sector.attacked = Sector [accent]{0}[white] under attack!
sector.lost = Sector [accent]{0}[white] lost!

View File

@ -17,9 +17,9 @@ const float shinelen = 0.2;
void main(){
vec3 norc = u_ambientColor * (diffuse + vec3(clamp((dot(a_normal, u_lightdir) + 1.0) / 2.0, 0.0, 1.0)));
float shinedot = max((-dot(u_camdir, a_normal) - (1.0 - shinelen)) / shinelen, 0.0);
float shinyness = (1.0 - a_color.a) * pow(shinedot, shinefalloff);
float albedo = (1.0 - a_color.a) * pow(shinedot, shinefalloff);
vec4 baseCol = vec4(a_color.rgb, 1.0);
v_col = mix(baseCol * vec4(norc, 1.0), vec4(1.0), shinyness * norc.r);
v_col = mix(baseCol * vec4(norc, 1.0), vec4(1.0), albedo * norc.r);
gl_Position = u_proj * u_trans * a_position;
}

View File

@ -36,6 +36,8 @@ public class Planets implements ContentList{
generator = new SerpuloPlanetGenerator();
meshLoader = () -> new HexMesh(this, 6);
atmosphereColor = Color.valueOf("3c1b8f");
atmosphereRadIn = 0.02f;
atmosphereRadOut = 0.3f;
startSector = 15;
}};
}

View File

@ -41,7 +41,7 @@ public class SectorPresets implements ContentList{
difficulty = 2;
}};
ruinousShores = new SectorPreset("ruinousShores", serpulo, 19){{
ruinousShores = new SectorPreset("ruinousShores", serpulo, 213){{
captureWave = 30;
difficulty = 3;
}};

View File

@ -53,7 +53,7 @@ public class Weathers implements ContentList{
baseSpeed = 5.4f;
attrs.set(Attribute.light, -0.1f);
attrs.set(Attribute.water, -0.1f);
opacityMultiplier = 0.8f;
opacityMultiplier = 0.5f;
force = 0.1f;
sound = Sounds.wind;
soundVol = 0.3f;
@ -74,7 +74,7 @@ public class Weathers implements ContentList{
attrs.set(Attribute.spores, 1f);
attrs.set(Attribute.light, -0.15f);
status = StatusEffects.sporeSlowed;
opacityMultiplier = 0.85f;
opacityMultiplier = 0.75f;
force = 0.1f;
sound = Sounds.wind;
soundVol = 0.3f;

View File

@ -1358,6 +1358,8 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
@Final
@Override
public void update(){
if(state.isEditor()) return;
timeScaleDuration -= Time.delta;
if(timeScaleDuration <= 0f || !block.canOverdrive){
timeScale = 1f;

View File

@ -71,8 +71,8 @@ public class Shaders{
setUniformf("u_rcampos", Tmp.v31.set(camera.position).sub(planet.position));
setUniformf("u_light", planet.getLightNormal());
setUniformf("u_color", planet.atmosphereColor.r, planet.atmosphereColor.g, planet.atmosphereColor.b);
setUniformf("u_innerRadius", planet.radius + 0.02f);
setUniformf("u_outerRadius", planet.radius * 1.3f);
setUniformf("u_innerRadius", planet.radius + planet.atmosphereRadIn);
setUniformf("u_outerRadius", planet.radius + planet.atmosphereRadOut);
setUniformMatrix4("u_model", planet.getTransform(mat).val);
setUniformMatrix4("u_projection", camera.combined.val);

View File

@ -77,8 +77,6 @@ public class MeshBuilder{
if(c.length > 5){
verts(c[0].v, c[4].v, c[5].v, nor, color);
}else{
verts(c[0].v, c[3].v, c[4].v, nor, color);
}
}

View File

@ -57,6 +57,7 @@ public class PlanetRenderer implements Disposable{
camPos.set(0, 0f, camLength);
projector.setScaling(1f / 150f);
cam.fov = 60f;
cam.far = 150f;
}
/** Render the entire planet scene to the screen. */
@ -93,6 +94,8 @@ public class PlanetRenderer implements Disposable{
renderPlanet(solarSystem);
renderTransparent(solarSystem);
endBloom();
Events.fire(Trigger.universeDrawEnd);
@ -125,11 +128,21 @@ public class PlanetRenderer implements Disposable{
renderOrbit(planet);
for(Planet child : planet.children){
renderPlanet(child);
}
}
public void renderTransparent(Planet planet){
if(!planet.visible()) return;
if(planet.isLandable() && planet == this.planet){
renderSectors(planet);
}
if(planet.parent != null && planet.hasAtmosphere && Core.settings.getBool("atmosphere")){
Gl.depthMask(false);
Blending.additive.apply();
Shaders.atmosphere.camera = cam;
@ -140,10 +153,12 @@ public class PlanetRenderer implements Disposable{
atmosphere.render(Shaders.atmosphere, Gl.triangles);
Blending.normal.apply();
Gl.depthMask(true);
}
for(Planet child : planet.children){
renderPlanet(child);
renderTransparent(child);
}
}

View File

@ -11,6 +11,7 @@ import mindustry.world.*;
public abstract class PlanetGenerator extends BasicGenerator implements HexMesher{
protected IntSeq ints = new IntSeq();
protected Sector sector;
protected Simplex noise = new Simplex();
/** Should generate sector bases for a planet. */
public void generateSector(Sector sector){
@ -46,6 +47,12 @@ public abstract class PlanetGenerator extends BasicGenerator implements HexMeshe
}
@Override
protected float noise(float x, float y, double octaves, double falloff, double scl, double mag){
Vec3 v = sector.rect.project(x, y);
return (float)noise.octaveNoise3D(octaves, falloff, 1f / scl, v.x, v.y, v.z) * (float)mag;
}
public void generate(Tiles tiles, Sector sec){
this.tiles = tiles;
this.sector = sec;

View File

@ -16,7 +16,6 @@ import mindustry.world.*;
import static mindustry.Vars.*;
public class SerpuloPlanetGenerator extends PlanetGenerator{
Simplex noise = new Simplex();
RidgedPerlin rid = new RidgedPerlin(1, 2);
BaseGenerator basegen = new BaseGenerator();
float scl = 5f;

View File

@ -18,7 +18,7 @@ import static mindustry.Vars.*;
public class Planet extends UnlockableContent{
/** Default spacing between planet orbits in world units. */
private static final float orbitSpacing = 10f;
private static final float orbitSpacing = 9f;
/** intersect() temp var. */
private static final Vec3 intersectResult = new Vec3();
/** Mesh used for rendering. Created on load() - will be null on the server! */
@ -33,6 +33,8 @@ public class Planet extends UnlockableContent{
public Seq<Sector> sectors;
/** Radius of this planet's sphere. Does not take into account sattelites. */
public float radius;
/** Atmosphere radius adjustment parameters. */
public float atmosphereRadIn = 0, atmosphereRadOut = 0.3f;
/** Orbital radius around the sun. Do not change unless you know exactly what you are doing.*/
public float orbitRadius;
/** Total radius of this planet and all its children. */

View File

@ -103,7 +103,7 @@ public class Sector{
/** @return whether the enemy has a generated base here. */
public boolean hasEnemyBase(){
return generateEnemyBase && (save == null || info.attack);
return ((generateEnemyBase && preset == null) || (preset != null && preset.captureWave == 0)) && (save == null || info.attack);
}
public boolean isBeingPlayed(){

View File

@ -283,7 +283,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
}
}
Sector current = state.getSector() != null && state.getSector().isBeingPlayed() ? state.getSector() : null;
Sector current = state.getSector() != null && state.getSector().isBeingPlayed() && state.getSector().planet == planets.planet ? state.getSector() : null;
if(current != null){
planets.fill(current, hoverColor, -0.001f);
@ -418,6 +418,8 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
Planet planet = content.planets().get(i);
if(planet.accessible){
pt.button(planet.localizedName, Styles.clearTogglet, () -> {
selected = null;
launchSector = null;
renderer.planets.planet = planet;
}).width(200).height(40).growX().update(bb -> bb.setChecked(renderer.planets.planet == planet));
pt.row();

View File

@ -749,6 +749,14 @@ public class HudFragment extends Fragment{
return builder;
}
if(!state.rules.waves && state.isCampaign()){
builder.append("[lightgray]").append(Core.bundle.get("sector.curcapture"));
}
if(!state.rules.waves){
return builder;
}
if(state.rules.winWave > 1 && state.rules.winWave >= state.wave && state.isCampaign()){
builder.append(wavefc.get(state.wave, state.rules.winWave));
}else{
@ -774,9 +782,6 @@ public class HudFragment extends Fragment{
return builder;
}).growX().pad(8f);
table.update(() -> {
//table.background(state.rules.waves ? Tex.wavepane : null);
});
table.touchable(() -> state.rules.waves ? Touchable.enabled : Touchable.disabled);
return table;

View File

@ -1,3 +1,3 @@
org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=079640f8ea3e46c1aff497f5f8a5e5f9c5197282
archash=f1feed86eb643c2e5dbcee013b1b186644b5cf98