public static float GetRiverStrength(BlockCoordinates blockPos, OverworldGeneratorV2 generator) { int worldX = blockPos.X; int worldZ = blockPos.Z; double pX = worldX; double pZ = worldZ; var jitterData = SimplexData2D.NewDisk(); //New river curve function. No longer creates worldwide curve correlations along cardinal axes. generator.SimplexInstance(1).GetValue((float)worldX / 240.0f, (float)worldZ / 240.0f, jitterData); pX += jitterData.GetDeltaX() * generator.RiverLargeBendSize; pZ += jitterData.GetDeltaY() * generator.RiverLargeBendSize; generator.SimplexInstance(2).GetValue((float)worldX / 80.0f, (float)worldZ / 80.0f, jitterData); pX += jitterData.GetDeltaX() * generator.RiverSmallBendSize; pZ += jitterData.GetDeltaY() * generator.RiverSmallBendSize; pX /= generator.RiverSeperation; pZ /= generator.RiverSeperation; //New cellular noise. double riverFactor = generator.CellularInstance(0).Eval2D(pX, pZ).InteriorValue; // the output is a curved function of relative distance from the center, so adjust to make it flatter riverFactor = BayesianAdjustment((float)riverFactor, 0.5f); if (riverFactor > generator.RiverValleyLevel) { return(0); } // no river effect return((float)(riverFactor / generator.RiverValleyLevel - 1d)); }
public float LakePressure(OverworldGeneratorV2 generator, int x, int y, float border, float lakeInterval, float largeBendSize, float mediumBendSize, float smallBendSize) { if (!this.Config.AllowScenicLakes) { return(1f); } double pX = x; double pY = y; ISimplexData2D jitterData = SimplexData2D.NewDisk(); generator.SimplexInstance(1).GetValue(x / 240.0d, y / 240.0d, jitterData); pX += jitterData.GetDeltaX() * largeBendSize; pY += jitterData.GetDeltaY() * largeBendSize; generator.SimplexInstance(0).GetValue(x / 80.0d, y / 80.0d, jitterData); pX += jitterData.GetDeltaX() * mediumBendSize; pY += jitterData.GetDeltaY() * mediumBendSize; generator.SimplexInstance(4).GetValue(x / 30.0d, y / 30.0d, jitterData); pX += jitterData.GetDeltaX() * smallBendSize; pY += jitterData.GetDeltaY() * smallBendSize; VoronoiResult lakeResults = generator.CellularInstance(0).Eval2D(pX / lakeInterval, pY / lakeInterval); return((float)(1.0d - lakeResults.InteriorValue)); }
public float MinimumDivisor = 0;//low divisors can produce excessive rates of change public override float Added(OverworldGeneratorV2 generator, float x, float y) { VoronoiResult points = generator.CellularInstance(1).Eval2D(x / PointWavelength, y / PointWavelength); float raise = (float)(points.InteriorValue); raise = 1.0f - raise; //raise = TerrainBase.blendedHillHeight(raise, floor); return(raise); }
public override float Added(OverworldGeneratorV2 generator, float x, float y) { var evaluateAt = new Vector2(x / PointWavelength, y / PointWavelength); var points = generator.CellularInstance(1).Eval2D(evaluateAt.X, evaluateAt.Y); float raise = (float)(points.InteriorValue); // now we're going to get an adjustment value which will be the same // for all points on a given vector from the voronoi basin center var adjustAt = points.ToLength(evaluateAt, AdjustmentRadius); float multiplier = 1.3f; float noZeros = 0.1f; float adjustment = (float)generator.CellularInstance(2).Eval2D(adjustAt.X, adjustAt.Y).InteriorValue *multiplier + noZeros; float reAdjustment = (float)generator.CellularInstance(3).Eval2D(adjustAt.X, adjustAt.Y).InteriorValue *multiplier + noZeros; // 0 to 1 which is currently undesirable so increase to average closer to 1 adjustment = TerrainBase.BayesianAdjustment(adjustment, reAdjustment); raise = TerrainBase.BayesianAdjustment(raise, adjustment); return(raise); }
public static float TerrainVolcano(int x, int y, OverworldGeneratorV2 generator, float border, float baseHeight) { var simplex = generator.SimplexInstance(0); var cellularNoise = generator.CellularInstance(0); float st = 15f - (float)(cellularNoise.Eval2D(x / 500d, y / 500d).ShortestDistance * 42d) + (simplex.GetValue(x / 30f, y / 30f) * 2f); float h = st < 0f ? 0f : st; h = h < 0f ? 0f : h; h += (h * 0.4f) * ((h * 0.4f) * 2f); if (h > 10f) { float d2 = (h - 10f) / 1.5f > 30f ? 30f : (h - 10f) / 1.5f; h += (float)cellularNoise.Eval2D(x / 25D, y / 25D).ShortestDistance *d2; } h += simplex.GetValue(x / 18f, y / 18f) * 3; h += simplex.GetValue(x / 8f, y / 8f) * 2; return(baseHeight + h * border); }