TerrainGenerator.html 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>TerrainGenerator - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <h1 translate="no">TerrainGenerator</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>Bakes a procedural mountain range into a single THREE.BufferGeometry and
  16. returns a <code>THREE.Group</code> ready to add to a scene.</p>
  17. <p>The heightfield is a derivative-damped fractal sum ( Quilez's fake erosion ): each
  18. octave is suppressed where the running slope is already steep, concentrating detail
  19. into weathered ridgelines, and a low-frequency domain warp makes those ridges
  20. meander. A few passes of thermal ( talus ) erosion then relax any slope past the
  21. angle of repose, settling the fractal's needle-spikes into real crests.</p>
  22. <p>The grid is triangulated with alternating quad diagonals ( a diamond pattern ), so a
  23. coarse mesh holds its silhouette without a one-way grain. The surface shades itself
  24. from altitude and slope in TSL — grass, forest, rock, scree and snow, with detail
  25. normals and aerial perspective — so no material or textures are needed.</p>
  26. <p>The baked height grid is exposed through TerrainGenerator#sampleHeight so a
  27. scattered forest ( or anything else ) can sit exactly on the surface.</p></div>
  28. <h2>Code Example</h2>
  29. <div translate="no"><pre><code class="language-js">const terrain = new TerrainGenerator( { seed: 1 } );
  30. scene.add( terrain.build() );
  31. </code></pre></div>
  32. </header>
  33. <article>
  34. <div class="container-overview">
  35. <h2>Constructor</h2>
  36. <h3 class="name name-method" id="TerrainGenerator" translate="no">new <a href="#TerrainGenerator">TerrainGenerator</a><span class="signature">()</span> </h3>
  37. <div class="method">
  38. </div>
  39. </div>
  40. <h2 class="subsection-title">Source</h2>
  41. <p>
  42. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/generators/TerrainGenerator.js" translate="no" target="_blank" rel="noopener">examples/jsm/generators/TerrainGenerator.js</a>
  43. </p>
  44. </article>
  45. </section>
  46. <script src="../scripts/linenumber.js"></script>
  47. <script src="../scripts/page.js"></script>
  48. </body>
  49. </html>
粤ICP备19079148号