|
| 1 | +(ns earthgen.generation.predefined |
| 2 | + (:require [earthgen.generation.operations :as ops])) |
| 3 | + |
| 4 | +(defn supercontinents [] |
| 5 | + (let |
| 6 | + [amplitude 4000 |
| 7 | + sea-level 500 |
| 8 | + glacial-sea-level (- sea-level 200)] |
| 9 | + (ops/terrain nil |
| 10 | + sea-level |
| 11 | + (ops/heightmap-let |
| 12 | + [["landform" (ops/heightmap {:granularity 1 :irregularity 0.2 :amplitude amplitude})] |
| 13 | + ["sea-level-adjusted" (ops/op- "landform" glacial-sea-level)] |
| 14 | + ["flatten" (ops/op* (ops/op- "landform" sea-level) |
| 15 | + (ops/sigmoid-at [0 0.75] [0.2 sea-level] [0.8 (+ sea-level 200)] "landform"))] |
| 16 | + ["land?" (ops/sigmoid-at [0 1] [0.2 (- glacial-sea-level 200)] [0.8 sea-level] "landform")] |
| 17 | + ["ocean?" (ops/sigmoid-at [0 1] [0.1 -200] [0.9 -400] "sea-level-adjusted")] |
| 18 | + ["highlands" (ops/abs (ops/heightmap {:granularity 1 :irregularity 0.3 :amplitude 1}))] |
| 19 | + ["highlands?" (ops/sigmoid-at [0 1] [0.8 0.14] [0.1 0.16] "highlands")] |
| 20 | + ["highland-elevation" (ops/sigmoid-at [600 1000] [0.1 0] [0.8 500] (ops/abs (ops/heightmap {:granularity 2 :irregularity 0.2 :amplitude 1000})))] |
| 21 | + ["coastal?" (ops/sigmoid-at [0 1] [0.2 300] [0.8 150] (ops/abs "sea-level-adjusted"))] |
| 22 | + ["coast-sign" (ops/sigmoid-at [-1 1] [0.2 -50] [0.8 50] (ops/max "sea-level-adjusted" (ops/min 0 (ops/heightmap {:granularity 2 :irregularity 0.2 :amplitude 1000}))))] |
| 23 | + ["coastal-mountain-elevation" (ops/max 0 (ops/heightmap {:granularity 3 :irregularity 0.2 :amplitude 6000}))] |
| 24 | + |
| 25 | + ["mountains" (ops/abs (ops/heightmap {:granularity 2 :irregularity 0.2 :amplitude 1}))] |
| 26 | + ["mountains?" (ops/sigmoid-at [0 1] [0.8 0.02] [0.1 0.1] "mountains")] |
| 27 | + ["mountain-elevation" (ops/abs (ops/heightmap {:granularity 2 :irregularity 0.2 :amplitude 5000}))]] |
| 28 | + |
| 29 | + (ops/op+ (ops/op- "landform" "flatten") |
| 30 | + (ops/op* 3 "ocean?" "sea-level-adjusted") |
| 31 | + (ops/op* "land?" "highlands?" "highland-elevation") |
| 32 | + (ops/op* (ops/op- 1 "coastal?") "land?" "mountains?" "mountain-elevation") |
| 33 | + (ops/op* "coastal?" "coast-sign" "coastal-mountain-elevation")))))) |
| 34 | + |
| 35 | +(defn continents [] |
| 36 | + (let |
| 37 | + [amplitude 4000 |
| 38 | + sea-level 800 |
| 39 | + glacial-sea-level (- sea-level 200)] |
| 40 | + (ops/terrain nil |
| 41 | + sea-level |
| 42 | + (ops/heightmap-let |
| 43 | + [["ocean" (ops/op+ 1000 (ops/heightmap {:granularity 1 :irregularity 0.2 :amplitude (* 2 amplitude)}))] |
| 44 | + ["continents" (ops/heightmap {:granularity 2 :irregularity 0.1 :amplitude amplitude})] |
| 45 | + ["smooth" (ops/sigmoid-at [0 1] [0.2 -200] [0.8 200] "ocean")] |
| 46 | + ["landform" (ops/op+ (ops/op* "smooth" "continents") |
| 47 | + (ops/op* (ops/op- 1 "smooth") (ops/min "continents" "ocean")))] |
| 48 | + |
| 49 | + ["sea-level-adjusted" (ops/op- "landform" glacial-sea-level)] |
| 50 | + ["flatten" (ops/op* (ops/op- "landform" sea-level) |
| 51 | + (ops/sigmoid-at [0 0.75] [0.2 sea-level] [0.8 (+ sea-level 200)] "landform"))] |
| 52 | + ["land?" (ops/sigmoid-at [0 1] [0.2 (- glacial-sea-level 200)] [0.8 sea-level] "landform")] |
| 53 | + ["ocean?" (ops/sigmoid-at [0 1] [0.1 -200] [0.9 -400] "sea-level-adjusted")] |
| 54 | + ["highlands" (ops/abs (ops/heightmap {:granularity 2 :irregularity 0.2 :amplitude 1}))] |
| 55 | + ["highlands?" (ops/sigmoid-at [0 1] [0.8 0.14] [0.1 0.16] "highlands")] |
| 56 | + ["highland-elevation" (ops/sigmoid-at [600 1000] [0.1 0] [0.8 500] (ops/abs (ops/heightmap {:granularity 2 :irregularity 0.2 :amplitude 1000})))] |
| 57 | + ["coastal?" (ops/sigmoid-at [0 1] [0.2 350] [0.8 150] (ops/abs "sea-level-adjusted"))] |
| 58 | + ["coast-sign" (ops/sigmoid-at [-1 1] [0.2 -50] [0.8 50] (ops/max "sea-level-adjusted" (ops/min 0 (ops/heightmap {:granularity 2 :irregularity 0.2 :amplitude 1000}))))] |
| 59 | + ["coastal-mountain-elevation" (ops/max 0 (ops/heightmap {:granularity 1 :irregularity 0.2 :amplitude 6000}))] |
| 60 | + |
| 61 | + ["mountains" (ops/abs (ops/heightmap {:granularity 3 :irregularity 0.2 :amplitude 1}))] |
| 62 | + ["mountains?" (ops/sigmoid-at [0 1] [0.8 0.02] [0.1 0.1] "mountains")] |
| 63 | + ["mountain-elevation" (ops/abs (ops/heightmap {:granularity 2 :irregularity 0.2 :amplitude 5000}))]] |
| 64 | + |
| 65 | + (ops/op+ (ops/op- "landform" "flatten") |
| 66 | + (ops/op* 2 "ocean?" "sea-level-adjusted") |
| 67 | + (ops/op* "land?" "highlands?" "highland-elevation") |
| 68 | + (ops/op* (ops/op- 1 "coastal?") "land?" "mountains?" "mountain-elevation") |
| 69 | + (ops/op* "coastal?" "coast-sign" "coastal-mountain-elevation")))))) |
| 70 | + |
| 71 | +(defn archipelago [] |
| 72 | + (let |
| 73 | + [amplitude 1500 |
| 74 | + sea-level 1200] |
| 75 | + (ops/terrain nil |
| 76 | + sea-level |
| 77 | + (ops/heightmap-let |
| 78 | + [["landform" (ops/heightmap {:granularity 0 :irregularity 0.25 :amplitude amplitude})] |
| 79 | + ["deep?" (ops/sigmoid-at [0 4] [0.1 (- sea-level 1000)] [0.8 (- sea-level 1500)] "landform")] |
| 80 | + ["extra-depth" (ops/op* "deep?" (ops/op- (ops/abs "landform")))] |
| 81 | + ["shallow?" (ops/sigmoid-at [0 1] [0.1 (- sea-level 1200)] [0.8 (- sea-level 1000)] "landform")] |
| 82 | + ["islands" (ops/abs (ops/heightmap {:granularity 2 :irregularity 0.15 :amplitude 1}))] |
| 83 | + ["islands?" (ops/sigmoid-at [0 1] [0.8 0.02] [0.1 0.08] "islands")] |
| 84 | + ["island-elevation" (ops/abs (ops/heightmap {:granularity 5 :irregularity 0.3 :amplitude 5000}))]] |
| 85 | + (ops/op+ "landform" "extra-depth" (ops/op* "shallow?" "islands?" "island-elevation")))))) |
0 commit comments