Island shape fix
This commit is contained in:
parent
9f99a0e99e
commit
23b4382231
2 changed files with 8 additions and 9 deletions
|
@ -14,7 +14,6 @@ import ru.betterend.util.sdf.SDF;
|
||||||
import ru.betterend.util.sdf.operator.SDFScale;
|
import ru.betterend.util.sdf.operator.SDFScale;
|
||||||
import ru.betterend.util.sdf.operator.SDFSmoothUnion;
|
import ru.betterend.util.sdf.operator.SDFSmoothUnion;
|
||||||
import ru.betterend.util.sdf.operator.SDFTranslate;
|
import ru.betterend.util.sdf.operator.SDFTranslate;
|
||||||
import ru.betterend.util.sdf.operator.SDFUnion;
|
|
||||||
import ru.betterend.util.sdf.primitive.SDFCappedCone;
|
import ru.betterend.util.sdf.primitive.SDFCappedCone;
|
||||||
|
|
||||||
public class IslandLayer {
|
public class IslandLayer {
|
||||||
|
@ -123,8 +122,8 @@ public class IslandLayer {
|
||||||
SDF cone3 = makeCone(0.5F, 0.45F, 0.03F, 0.0F);
|
SDF cone3 = makeCone(0.5F, 0.45F, 0.03F, 0.0F);
|
||||||
SDF cone4 = makeCone(0.45F, 0, 0.02F, 0.03F);
|
SDF cone4 = makeCone(0.45F, 0, 0.02F, 0.03F);
|
||||||
|
|
||||||
SDF coneBottom = new SDFUnion().setSourceA(cone1).setSourceB(cone2);
|
SDF coneBottom = new SDFSmoothUnion().setRadius(0.02F).setSourceA(cone1).setSourceB(cone2);
|
||||||
SDF coneTop = new SDFUnion().setSourceA(cone3).setSourceB(cone4);
|
SDF coneTop = new SDFSmoothUnion().setRadius(0.02F).setSourceA(cone3).setSourceB(cone4);
|
||||||
|
|
||||||
ISLAND = new SDFSmoothUnion().setRadius(0.01F).setSourceA(coneTop).setSourceB(coneBottom);
|
ISLAND = new SDFSmoothUnion().setRadius(0.01F).setSourceA(coneTop).setSourceB(coneBottom);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,9 +29,9 @@ public class TerrainGenerator {
|
||||||
|
|
||||||
public static void initNoise(long seed) {
|
public static void initNoise(long seed) {
|
||||||
Random random = new Random(seed);
|
Random random = new Random(seed);
|
||||||
largeIslands = new IslandLayer(random.nextInt(), 300, 200, 63, 0);
|
largeIslands = new IslandLayer(random.nextInt(), 300, 200, 70, 10);
|
||||||
mediumIslands = new IslandLayer(random.nextInt(), 150, 100, 63, 16);
|
mediumIslands = new IslandLayer(random.nextInt(), 150, 100, 70, 20);
|
||||||
smallIslands = new IslandLayer(random.nextInt(), 60, 50, 63, 32);
|
smallIslands = new IslandLayer(random.nextInt(), 60, 50, 70, 30);
|
||||||
noise1 = new OpenSimplexNoise(random.nextInt());
|
noise1 = new OpenSimplexNoise(random.nextInt());
|
||||||
noise2 = new OpenSimplexNoise(random.nextInt());
|
noise2 = new OpenSimplexNoise(random.nextInt());
|
||||||
}
|
}
|
||||||
|
@ -70,9 +70,9 @@ public class TerrainGenerator {
|
||||||
dist = dist > 1 ? dist : MHelper.max(dist, mediumIslands.getDensity(px, py, pz));
|
dist = dist > 1 ? dist : MHelper.max(dist, mediumIslands.getDensity(px, py, pz));
|
||||||
dist = dist > 1 ? dist : MHelper.max(dist, smallIslands.getDensity(px, py, pz));
|
dist = dist > 1 ? dist : MHelper.max(dist, smallIslands.getDensity(px, py, pz));
|
||||||
if (dist > -0.5F) {
|
if (dist > -0.5F) {
|
||||||
dist += noise1.eval(px * 0.01, py * 0.01, pz * 0.01) * 0.04;
|
dist += noise1.eval(px * 0.01, py * 0.01, pz * 0.01) * 0.02 + 0.02;
|
||||||
dist += noise2.eval(px * 0.05, py * 0.05, pz * 0.05) * 0.02;
|
dist += noise2.eval(px * 0.05, py * 0.05, pz * 0.05) * 0.01 + 0.01;
|
||||||
dist += noise1.eval(px * 0.1, py * 0.1, pz * 0.1) * 0.01;
|
dist += noise1.eval(px * 0.1, py * 0.1, pz * 0.1) * 0.005 + 0.005;
|
||||||
}
|
}
|
||||||
buffer[y] = dist;
|
buffer[y] = dist;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue