mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-19 07:11:02 +00:00
Merge pull request #962 from CocoTheOwner/render-continent-v2
Replace continent renderer with biomeStream
This commit is contained in:
@@ -19,6 +19,8 @@
|
|||||||
package com.volmit.iris.core.gui.components;
|
package com.volmit.iris.core.gui.components;
|
||||||
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
|
import com.volmit.iris.engine.object.IrisBiomeGeneratorLink;
|
||||||
import com.volmit.iris.util.interpolation.IrisInterpolation;
|
import com.volmit.iris.util.interpolation.IrisInterpolation;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -49,14 +51,23 @@ public class IrisRenderer {
|
|||||||
colorFunction = (x, z) -> renderer.getComplex().getCaveBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
|
colorFunction = (x, z) -> renderer.getComplex().getCaveBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
|
||||||
case HEIGHT ->
|
case HEIGHT ->
|
||||||
colorFunction = (x, z) -> Color.getHSBColor(renderer.getComplex().getHeightStream().get(x, z).floatValue(), 100, 100).getRGB();
|
colorFunction = (x, z) -> Color.getHSBColor(renderer.getComplex().getHeightStream().get(x, z).floatValue(), 100, 100).getRGB();
|
||||||
case CONTINENT -> {
|
case CONTINENT ->
|
||||||
double fluidHeight = renderer.getComplex().getFluidHeight();
|
|
||||||
int deltaHeight = renderer.getMaxHeight() - renderer.getMinHeight();
|
|
||||||
colorFunction = (x, z) -> {
|
colorFunction = (x, z) -> {
|
||||||
double h = renderer.getComplex().getHeightStream().get(x, z);
|
IrisBiome b = renderer.getBiome((int) Math.round(x), renderer.getMaxHeight() - 1, (int) Math.round(z));
|
||||||
return new Color((int) (h * 255d / deltaHeight), 128, h > fluidHeight ? 0 : 255).getRGB();
|
IrisBiomeGeneratorLink g = b.getGenerators().get(0);
|
||||||
};
|
Color c;
|
||||||
|
if (g.getMax() <= 0) {
|
||||||
|
// Max is below water level, so it is most likely an ocean biome
|
||||||
|
c = Color.BLUE;
|
||||||
|
} else if (g.getMin() < 0) {
|
||||||
|
// Min is below water level, but max is not, so it is most likely a shore biome
|
||||||
|
c = Color.YELLOW;
|
||||||
|
} else {
|
||||||
|
// Both min and max are above water level, so it is most likely a land biome
|
||||||
|
c = Color.GREEN;
|
||||||
}
|
}
|
||||||
|
return c.getRGB();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
double x, z;
|
double x, z;
|
||||||
|
|||||||
@@ -220,7 +220,6 @@ public class IrisComplex implements DataProvider {
|
|||||||
return seaBiomeStream;
|
return seaBiomeStream;
|
||||||
case SHORE:
|
case SHORE:
|
||||||
return shoreBiomeStream;
|
return shoreBiomeStream;
|
||||||
case DEFER:
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,5 @@ public enum InferredType {
|
|||||||
SEA,
|
SEA,
|
||||||
|
|
||||||
@Desc("Represents any cave biome type")
|
@Desc("Represents any cave biome type")
|
||||||
CAVE,
|
CAVE
|
||||||
|
|
||||||
@Desc("Defers the type to whatever another biome type that already exists is.")
|
|
||||||
DEFER
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -484,11 +484,6 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public IrisBiome infer(InferredType t, InferredType type) {
|
|
||||||
setInferredType(t.equals(InferredType.DEFER) ? type : t);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public KList<BlockData> generateSeaLayers(double wx, double wz, RNG random, int maxDepth, IrisData rdata) {
|
public KList<BlockData> generateSeaLayers(double wx, double wz, RNG random, int maxDepth, IrisData rdata) {
|
||||||
KList<BlockData> data = new KList<>();
|
KList<BlockData> data = new KList<>();
|
||||||
|
|
||||||
|
|||||||
@@ -76,17 +76,17 @@ public class IrisSpawner extends IrisRegistrant {
|
|||||||
public boolean isValid(IrisBiome biome) {
|
public boolean isValid(IrisBiome biome) {
|
||||||
return switch (group) {
|
return switch (group) {
|
||||||
case NORMAL -> switch (biome.getInferredType()) {
|
case NORMAL -> switch (biome.getInferredType()) {
|
||||||
case SHORE, SEA, CAVE, DEFER -> false;
|
case SHORE, SEA, CAVE -> false;
|
||||||
case LAND -> true;
|
case LAND -> true;
|
||||||
};
|
};
|
||||||
case CAVE -> true;
|
case CAVE -> true;
|
||||||
case UNDERWATER -> switch (biome.getInferredType()) {
|
case UNDERWATER -> switch (biome.getInferredType()) {
|
||||||
case SHORE, LAND, CAVE, DEFER -> false;
|
case SHORE, LAND, CAVE -> false;
|
||||||
case SEA -> true;
|
case SEA -> true;
|
||||||
};
|
};
|
||||||
case BEACH -> switch (biome.getInferredType()) {
|
case BEACH -> switch (biome.getInferredType()) {
|
||||||
case SHORE -> true;
|
case SHORE -> true;
|
||||||
case LAND, CAVE, SEA, DEFER -> false;
|
case LAND, CAVE, SEA -> false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user