Erekir clouds
This commit is contained in:
@@ -44,6 +44,10 @@ public class Planets{
|
||||
erekir = new Planet("erekir", sun, 1f, 2){{
|
||||
generator = new ErekirPlanetGenerator();
|
||||
meshLoader = () -> new HexMesh(this, 5);
|
||||
cloudMeshLoader = () -> new MultiMesh(
|
||||
new HexSkyMesh(this, 2, 0.15f, 0.14f, 5, Color.valueOf("eba768").a(0.75f), 2, 0.42f, 1f, 0.43f),
|
||||
new HexSkyMesh(this, 3, 0.6f, 0.15f, 5, Color.valueOf("eea293").a(0.75f), 2, 0.42f, 1.2f, 0.45f)
|
||||
);
|
||||
atmosphereColor = Color.valueOf("f07218");
|
||||
startSector = 10;
|
||||
atmosphereRadIn = 0.02f;
|
||||
|
||||
@@ -97,6 +97,7 @@ public class Shaders{
|
||||
public Vec3 lightDir = new Vec3(1, 1, 1).nor();
|
||||
public Color ambientColor = Color.white.cpy();
|
||||
public Vec3 camDir = new Vec3();
|
||||
public Vec3 camPos = new Vec3();
|
||||
public Planet planet;
|
||||
|
||||
public PlanetShader(){
|
||||
@@ -110,6 +111,7 @@ public class Shaders{
|
||||
setUniformf("u_lightdir", lightDir);
|
||||
setUniformf("u_ambientColor", ambientColor.r, ambientColor.g, ambientColor.b);
|
||||
setUniformf("u_camdir", camDir);
|
||||
setUniformf("u_campos", renderer.planets.cam.position);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -228,8 +228,8 @@ public class PlanetRenderer implements Disposable{
|
||||
batch.flush(Gl.lineStrip);
|
||||
}
|
||||
|
||||
public void drawBorders(Sector sector, Color base){
|
||||
Color color = Tmp.c1.set(base).a(base.a + 0.3f + Mathf.absin(Time.globalTime, 5f, 0.3f));
|
||||
public void drawBorders(Sector sector, Color base, float alpha){
|
||||
Color color = Tmp.c1.set(base).a((base.a + 0.3f + Mathf.absin(Time.globalTime, 5f, 0.3f)) * alpha);
|
||||
|
||||
float r1 = 1f;
|
||||
float r2 = outlineRad + 0.001f;
|
||||
@@ -284,8 +284,8 @@ public class PlanetRenderer implements Disposable{
|
||||
}
|
||||
}
|
||||
|
||||
public void drawSelection(Sector sector){
|
||||
drawSelection(sector, Pal.accent, 0.04f, 0.001f);
|
||||
public void drawSelection(Sector sector, float alpha){
|
||||
drawSelection(sector, Tmp.c1.set(Pal.accent).a(alpha), 0.04f, 0.001f);
|
||||
}
|
||||
|
||||
public void drawSelection(Sector sector, Color color, float stroke, float length){
|
||||
|
||||
@@ -37,7 +37,7 @@ public class TantrosPlanetGenerator extends PlanetGenerator{
|
||||
@Override
|
||||
public Color getColor(Vec3 position){
|
||||
float depth = Simplex.noise3d(seed, 2, 0.56, 1.7f, position.x, position.y, position.z) / 2f;
|
||||
return c1.write(out).lerp(c2, Mathf.clamp(Mathf.round(depth, 0.15f))).a(0.6f);
|
||||
return c1.write(out).lerp(c2, Mathf.clamp(Mathf.round(depth, 0.15f))).a(0.2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -366,19 +366,19 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
Sector current = Vars.state.getSector() != null && Vars.state.getSector().isBeingPlayed() && Vars.state.getSector().planet == state.planet ? Vars.state.getSector() : null;
|
||||
|
||||
if(current != null){
|
||||
planets.fill(current, hoverColor, -0.001f);
|
||||
planets.fill(current, hoverColor.write(Tmp.c1).mulA(state.uiAlpha), -0.001f);
|
||||
}
|
||||
|
||||
//draw hover border
|
||||
if(hovered != null){
|
||||
planets.fill(hovered, hoverColor, -0.001f);
|
||||
planets.drawBorders(hovered, borderColor);
|
||||
planets.fill(hovered, hoverColor.write(Tmp.c1).mulA(state.uiAlpha), -0.001f);
|
||||
planets.drawBorders(hovered, borderColor, state.uiAlpha);
|
||||
}
|
||||
|
||||
//draw selected borders
|
||||
if(selected != null){
|
||||
planets.drawSelection(selected);
|
||||
planets.drawBorders(selected, borderColor);
|
||||
planets.drawSelection(selected, state.uiAlpha);
|
||||
planets.drawBorders(selected, borderColor, state.uiAlpha);
|
||||
}
|
||||
|
||||
planets.batch.flush(Gl.triangles);
|
||||
@@ -443,9 +443,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
|
||||
Draw.reset();
|
||||
|
||||
if(hovered != null){
|
||||
if(hovered != null && state.uiAlpha > 0.01f){
|
||||
planets.drawPlane(hovered, () -> {
|
||||
Draw.color(hovered.isAttacked() ? Pal.remove : Color.white, Pal.accent, Mathf.absin(5f, 1f));
|
||||
Draw.alpha(state.uiAlpha);
|
||||
|
||||
var icon = hovered.locked() && !canSelect(hovered) ? Fonts.getLargeIcon("lock") : hovered.isAttacked() ? Fonts.getLargeIcon("warning") : hovered.icon();
|
||||
|
||||
@@ -690,6 +691,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
addChild(hoverLabel);
|
||||
hoverLabel.toFront();
|
||||
hoverLabel.touchable = Touchable.disabled;
|
||||
hoverLabel.color.a = state.uiAlpha;
|
||||
|
||||
Vec3 pos = planets.cam.project(Tmp.v31.set(hovered.tile.v).setLength(PlanetRenderer.outlineRad).rotate(Vec3.Y, -state.planet.getRotation()).add(state.planet.position));
|
||||
hoverLabel.setPosition(pos.x - Core.scene.marginLeft, pos.y - Core.scene.marginBottom, Align.center);
|
||||
|
||||
Reference in New Issue
Block a user