Serpulo clouds, now with 2 layers
This commit is contained in:
@@ -83,7 +83,10 @@ public class Planets implements ContentList{
|
|||||||
serpulo = new Planet("serpulo", sun, 1, 3){{
|
serpulo = new Planet("serpulo", sun, 1, 3){{
|
||||||
generator = new SerpuloPlanetGenerator();
|
generator = new SerpuloPlanetGenerator();
|
||||||
meshLoader = () -> new HexMesh(this, 6);
|
meshLoader = () -> new HexMesh(this, 6);
|
||||||
cloudMeshLoader = () -> new HexSkyMesh(this, 0.17f, 5, Color.white.cpy().lerp(Pal.spore, 0.7f).a(0.7f), 2, 0.5f, 1.1f, 0.45f);
|
cloudMeshLoader = () -> new MultiMesh(
|
||||||
|
new HexSkyMesh(this, 0, 0.6f, 0.01f + 0.18f, 5, Color.white.cpy().lerp(Pal.spore, 0.75f).a(0.7f), 2, 0.5f, 1.1f, 0.42f),
|
||||||
|
new HexSkyMesh(this, 10, 0.25f, 0.01f + 0.16f, 5, new Color().set(Pal.spore).mul(0.9f).a(0.7f), 2, 0.5f, 1f, 0.37f)
|
||||||
|
);
|
||||||
atmosphereColor = Color.valueOf("3c1b8f");
|
atmosphereColor = Color.valueOf("3c1b8f");
|
||||||
atmosphereRadIn = 0.02f;
|
atmosphereRadIn = 0.02f;
|
||||||
atmosphereRadOut = 0.3f;
|
atmosphereRadOut = 0.3f;
|
||||||
|
|||||||
@@ -2,14 +2,18 @@ package mindustry.graphics.g3d;
|
|||||||
|
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
|
import arc.util.*;
|
||||||
import arc.util.noise.*;
|
import arc.util.noise.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
|
|
||||||
public class HexSkyMesh extends PlanetMesh{
|
public class HexSkyMesh extends PlanetMesh{
|
||||||
|
static Mat3D mat = new Mat3D();
|
||||||
|
|
||||||
public HexSkyMesh(Planet planet, float radius, int divisions, Color color, int octaves, float persistence, float scl, float thresh){
|
public float speed = 0f;
|
||||||
|
|
||||||
|
public HexSkyMesh(Planet planet, int seed, float speed, float radius, int divisions, Color color, int octaves, float persistence, float scl, float thresh){
|
||||||
super(planet, MeshBuilder.buildHex(new HexMesher(){
|
super(planet, MeshBuilder.buildHex(new HexMesher(){
|
||||||
@Override
|
@Override
|
||||||
public float getHeight(Vec3 position){
|
public float getHeight(Vec3 position){
|
||||||
@@ -23,17 +27,33 @@ public class HexSkyMesh extends PlanetMesh{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean skip(Vec3 position){
|
public boolean skip(Vec3 position){
|
||||||
return Simplex.noise3d(planet.id, octaves, persistence, scl, position.x, position.y * 3f, position.z) >= thresh;
|
return Simplex.noise3d(planet.id + seed, octaves, persistence, scl, position.x, position.y * 3f, position.z) >= thresh;
|
||||||
}
|
}
|
||||||
}, divisions, false, planet.radius, radius), Shaders.clouds);
|
}, divisions, false, planet.radius, radius), Shaders.clouds);
|
||||||
|
|
||||||
|
this.speed = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HexSkyMesh(){
|
public HexSkyMesh(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float relRot(){
|
||||||
|
return Time.globalTime * speed / 34f;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Mat3D projection, Mat3D transform){
|
||||||
|
preRender();
|
||||||
|
shader.bind();
|
||||||
|
shader.setUniformMatrix4("u_proj", projection.val);
|
||||||
|
shader.setUniformMatrix4("u_trans", mat.setToTranslation(planet.position).rotate(Vec3.Y, planet.getRotation() + relRot()).val);
|
||||||
|
shader.apply();
|
||||||
|
mesh.render(shader, Gl.triangles);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preRender(){
|
public void preRender(){
|
||||||
Shaders.clouds.lightDir.set(planet.solarSystem.position).sub(planet.position).rotate(Vec3.Y, planet.getRotation()).nor();
|
Shaders.clouds.lightDir.set(planet.solarSystem.position).sub(planet.position).rotate(Vec3.Y, planet.getRotation() + relRot()).nor();
|
||||||
Shaders.clouds.ambientColor.set(planet.solarSystem.lightColor);
|
Shaders.clouds.ambientColor.set(planet.solarSystem.lightColor);
|
||||||
Shaders.clouds.alpha = 1f - Vars.ui.planet.planets.orbitAlpha;
|
Shaders.clouds.alpha = 1f - Vars.ui.planet.planets.orbitAlpha;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -11,4 +11,4 @@ android.useAndroidX=true
|
|||||||
#used for slow jitpack builds; TODO see if this actually works
|
#used for slow jitpack builds; TODO see if this actually works
|
||||||
http.socketTimeout=80000
|
http.socketTimeout=80000
|
||||||
http.connectionTimeout=80000
|
http.connectionTimeout=80000
|
||||||
archash=98c420de77661889ab0330a956d50721f27f33d9
|
archash=
|
||||||
|
|||||||
Reference in New Issue
Block a user