From 86cdae23995796ea689942183a8a1f932941cfb2 Mon Sep 17 00:00:00 2001 From: Zeno410 Date: Sun, 3 Apr 2016 07:55:23 -0700 Subject: [PATCH] Flat-topped BoP Crag --- .../biomesoplenty/RealisticBiomeBOPCrag.java | 2 +- .../terrain/biomesoplenty/TerrainBOPCrag.java | 63 ++++++------------- 2 files changed, 21 insertions(+), 44 deletions(-) diff --git a/src/main/java/rtg/world/biome/realistic/biomesoplenty/RealisticBiomeBOPCrag.java b/src/main/java/rtg/world/biome/realistic/biomesoplenty/RealisticBiomeBOPCrag.java index 3fac69f52..d13922f53 100755 --- a/src/main/java/rtg/world/biome/realistic/biomesoplenty/RealisticBiomeBOPCrag.java +++ b/src/main/java/rtg/world/biome/realistic/biomesoplenty/RealisticBiomeBOPCrag.java @@ -19,7 +19,7 @@ public RealisticBiomeBOPCrag(BiomeConfig config) { super(config, bopBiome, BiomeGenBase.river, - new TerrainBOPCrag(false, new float[]{2.0f, 0.5f, 6.0f, 0.5f, 10.0f, 0.5f, 14.0f, 0.5f, 18.0f, 0.5f, 22.0f, 0.5f, 26.0f, 0.5f, 30.0f, 0.5f, 34.0f, 0.5f}, 40f, 1f, 1f, 0.5f, 120f), + new TerrainBOPCrag(90f), new SurfaceBOPCrag(config, topBlock, fillerBlock, topBlock) ); this.generatesEmeralds = true; diff --git a/src/main/java/rtg/world/gen/terrain/biomesoplenty/TerrainBOPCrag.java b/src/main/java/rtg/world/gen/terrain/biomesoplenty/TerrainBOPCrag.java index 6b33ca54c..3bb894cbd 100755 --- a/src/main/java/rtg/world/gen/terrain/biomesoplenty/TerrainBOPCrag.java +++ b/src/main/java/rtg/world/gen/terrain/biomesoplenty/TerrainBOPCrag.java @@ -7,50 +7,13 @@ public class TerrainBOPCrag extends TerrainBase { - private boolean booRiver; - private float[] height; - private int heightLength; - private float strength; - private float cWidth; - private float cHeigth; - private float cStrength; - private float base; - private float pointHeightVariation = 20f; private float pointHeightWavelength = 400f;// deep variation private float pointHeight = 50; - private float pointWavelength = 20; - /* - * Example parameters: - * - * allowed to generate rivers? - * riverGen = true - * - * canyon jump heights - * heightArray = new float[]{2.0f, 0.5f, 6.5f, 0.5f, 14.0f, 0.5f, 19.0f, 0.5f} - * - * strength of canyon jump heights - * heightStrength = 35f - * - * canyon width (cliff to cliff) - * canyonWidth = 160f - * - * canyon heigth (total heigth) - * canyonHeight = 60f - * - * canyon strength - * canyonStrength = 40f - * - */ - public TerrainBOPCrag(boolean riverGen, float[] heightArryay, float heightStrength, float canyonWidth, float canyonHeight, float canyonStrength, float baseHeight) + private float pointWavelength = 50; + + public TerrainBOPCrag( float baseHeight) { - booRiver = riverGen; - height = heightArryay; - strength = heightStrength; - heightLength = height.length; - cWidth = canyonWidth; - cHeigth = canyonHeight; - cStrength = canyonStrength; base = baseHeight; } @@ -69,10 +32,24 @@ public float generateNoise(OpenSimplexNoise simplex, CellNoise cell, int x, int if (multiplier <0) multiplier = 0; if (multiplier >1) multiplier = 1; double [] points = cell.octave(1).eval((float)pX/pointWavelength, (float)pY/pointWavelength); - float p = (float)((points[1]-points[0])*(pointHeight + - pointHeightVariation*simplex.noise((float)x/pointHeightWavelength, (float)y/pointHeightWavelength))); + float raise = (float)((points[1]-points[0])/points[1]); + raise = raise * 3f; + if (raise>1) raise = 1; + float topHeight = (float)(pointHeight + + pointHeightVariation*simplex.noise((float)x/pointHeightWavelength, (float)y/pointHeightWavelength)); - return riverized(base,river) + p; + float p = raise*topHeight; + if (border >= 1f) return base+p; + if (border > 0.65) { + // we need to adjust for the border adjustments to the height to make the base work + // it actaully doesn't always help + float missingBase = (1f-border) *(base-70f); // shortfall at the top + float pStretch = (topHeight+missingBase)/topHeight; + p = p*pStretch; + p = borderAdjusted(p, border, 0.75f, 0.65f); + return base + p; + } + return base; //return terrainCanyon(x, y, simplex, river, height, border, strength, heightLength, booRiver); } }