terrain-map
ARCHIVED - repo for blog post http://www.vogt.world/writing/procedural-terrain-generation/
git clone https://git.vogt.world/terrain-map.git
Log | Files | README.md
← Commit log
commit
message
adding smooth-complex-erosion set
author
Ben Vogt <[email protected]>
date
2016-05-18 02:55:20
stats
2 file(s) changed, 45 insertions(+), 0 deletions(-)
files
index.html
worker.js
 1diff --git a/index.html b/index.html
 2index 29f414a..555d37a 100644
 3--- a/index.html
 4+++ b/index.html
 5@@ -123,6 +123,15 @@
 6         </p>
 7       </div>
 8       <div class="set" id="container-many"></div>
 9+      <br>
10+      <div class="row">
11+        <h4>Smooth Erosion Map</h4>
12+        <p>
13+          Eroding a map before applying smoothing. <code>regular -> complexErosion -> smooth</code>
14+          <button class="run button-primary" id="smooth-complex-erosion">GENERATE</button>
15+        </p>
16+      </div>
17+      <div class="set" id="container-smooth-complex-erosion"></div>
18       <hr>
19     </div>
20     <!-- hidden canvas for rendering-->
21diff --git a/worker.js b/worker.js
22index 57c4db4..45ba566 100644
23--- a/worker.js
24+++ b/worker.js
25@@ -3,6 +3,42 @@ self.addEventListener('message', function(e) {
26   var data = e.data;
27   var terrain;
28   switch (data) {
29+    case 'smooth-complex-erosion':
30+      terrain = new LandMap({
31+        containerId: "container-smooth-complex-erosion"
32+      });
33+      terrain.generate({
34+        deviation: 0.75,
35+        feature: "m1"
36+      });
37+      terrain.complexErosion({
38+        carryingCapacity: 1.5,
39+        depositionSpeed: 0.03,
40+        iterations: 3,
41+        drops: 8000000,
42+        one: "m1",
43+        two: "m2"
44+      });
45+      terrain.smooth({
46+        amount: 2,
47+        from: "m2",
48+        to: "m3"
49+      });
50+      break;
51+      //combining
52+      terrain.combine({
53+        one: "p2",
54+        two: "p3",
55+        three: "m2",
56+        result: "c1 from (p2,p3,m2)"
57+      });
58+      terrain.combine({
59+        one: "p3",
60+        two: "p2",
61+        three: "m2",
62+        result: "c2 from (p3,p2,m2)"
63+      });
64+      break;
65     case 'many':
66       terrain = new LandMap({
67         containerId: "container-many"