SunMesh support for JSON planets (#8882)

* Single-color SunMesh support

* This should work now

* No more crap code
This commit is contained in:
Slotterleet
2023-08-01 23:11:22 +03:00
committed by GitHub
parent 12b6604143
commit bd0592a54c

View File

@@ -879,6 +879,17 @@ public class ContentParser{
Color.valueOf(data.getString("color2", data.getString("color", "ffffff"))),
data.getInt("colorOct", 1), data.getFloat("colorPersistence", 0.5f), data.getFloat("colorScale", 1f),
data.getFloat("colorThreshold", 0.5f));
case "SunMesh" -> {
var cvals = data.get("colors").asStringArray();
var colors = new Color[cvals.length];
for(int i=0; i<cvals.length; i++){
colors[i] = Color.valueOf(cvals[i]);
}
yield new SunMesh(planet, data.getInt("divisions", 1), data.getInt("octaves", 1), data.getFloat("persistence", 0.5f),
data.getFloat("scl", 1f), data.getFloat("pow", 1f), data.getFloat("mag", 0.5f),
data.getFloat("colorScale", 1f), colors);
}
case "HexSkyMesh" -> new HexSkyMesh(planet,
data.getInt("seed", 0), data.getFloat("speed", 0), data.getFloat("radius", 1f),
data.getInt("divisions", 3), Color.valueOf(data.getString("color", "ffffff")), data.getInt("octaves", 1),