| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>ForestGenerator - Three.js Docs</title>
- <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
- <script src="../scripts/highlight.min.js"></script>
- <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
- <link type="text/css" rel="stylesheet" href="../styles/page.css">
- </head>
- <body>
- <h1 translate="no">ForestGenerator</h1>
- <section>
- <header>
- <div class="class-description"><p>Carpets a <a href="TerrainGenerator.html">TerrainGenerator</a> ( or anything exposing <code>sampleHeight</code>,
- <code>sampleSlope</code>, <code>minY</code>, <code>maxY</code> and <code>parameters.size</code> ) with a forest of hundreds
- of thousands of trees in a single draw call.</p>
- <p>Each tree is the cheapest thing that still reads as a tree: a ~20-face icosphere
- squashed into a tapered teardrop and lumped with a little noise, carrying a baked
- dark-base / bright-top gradient. Tens of triangles each, so a single
- THREE.InstancedMesh of half a million of them costs one draw call. Trees
- are placed by rejection sampling against ecological rules — a min/max altitude
- band ( above the mist floor, below the snowline ), a slope limit ( none on
- cliffs ) and a low-frequency density mask that opens clearings — then jittered in
- yaw, lean and ( squared-biased ) scale so the stand never reads as copies.</p></div>
- <h2>Code Example</h2>
- <div translate="no"><pre><code class="language-js">const forest = new ForestGenerator( { count: 500000 } );
- scene.add( forest.build( terrain ) );
- </code></pre></div>
- </header>
- <article>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="ForestGenerator" translate="no">new <a href="#ForestGenerator">ForestGenerator</a><span class="signature">()</span> </h3>
- <div class="method">
- </div>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/generators/ForestGenerator.js" translate="no" target="_blank" rel="noopener">examples/jsm/generators/ForestGenerator.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|