using Godot; /// /// The terrain DETAIL passes (terrain-water task 10) — pure numeric functions /// (D-035; a named future C++ candidate, kept standalone): /// /// PASS A — shelf micro-relief: a medium-frequency noise skin (±ShelfReliefAmp, /// default 3 m) weighted by shelf-ness, so the compressed shelves get their /// rolling texture back while risers and peaks stay untouched. /// /// Output-height only; the classify map never sees it. /// /// NOTE — what this file deliberately no longer contains: the task-10 draft's D8 /// steepest-descent flow routing, accumulation and drainage incision. It shipped, /// and it produced the canonical grid artifact — thousands of straight, /// disconnected, pooling scratches running along the eight D8 neighbour /// directions, because per-cell steepest descent on a regular grid can only ever /// route along those eight headings. It is reverted whole. Rivers and erosion are /// Phase C work: a hydraulic-erosion pass over FINAL terrain, not a routing carve /// on a grid mid-pipeline. /// public static class TerrainDetailPass { // The TDTL body version is owned by the format (Core); the pass just stamps it. public const ushort VERSION = IslaApocalypse.Core.BlueprintFormat.TDTL_VERSION; // Pass A — micro-relief. public const float RELIEF_AMP_DEFAULT_M = 3f; // config dial: ShelfReliefAmp (metres) public const float RELIEF_FREQ_ISLANDS = 40f; // ~40 undulations per island width (~200 m features) public const int RELIEF_SEED_OFFSET = 7409; /// /// Shelf-ness weight from the RAW input height: 1 mid-shelf, feathering to 0 /// through the risers (feather extends 30 % of the band half-width past each /// shelf edge). Covers both shelves. /// public static float ShelfWeight(float raw, CurveKnots k) { return Mathf.Max(BandBump(raw, k.K3, k.K4), BandBump(raw, k.K5, k.K6)); } private static float BandBump(float h, float lo, float hi) { float half = (hi - lo) * 0.5f; float t = Mathf.Abs(h - (lo + half)) / half; // 0 centre, 1 at band edge // full inside 60 % of the band, linear feather to zero at 130 % return Mathf.Clamp(1f - (t - 0.6f) / 0.7f, 0f, 1f); } }