| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>PLYLoader - 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>
- <p class="inheritance" translate="no"><a href="Loader.html">Loader</a> → </p>
- <h1 translate="no">PLYLoader</h1>
- <section>
- <header>
- <div class="class-description"><p>A loader for PLY the PLY format (known as the Polygon
- File Format or the Stanford Triangle Format).</p>
- <p>Limitations:</p>
- <ul>
- <li>ASCII decoding assumes file is UTF-8.</li>
- </ul></div>
- <h2>Code Example</h2>
- <div translate="no"><pre><code class="language-js">const loader = new PLYLoader();
- const geometry = await loader.loadAsync( './models/ply/ascii/dolphins.ply' );
- scene.add( new THREE.Mesh( geometry ) );
- </code></pre></div>
- </header>
- <article>
- <h2 class="subsection-title">Import</h2>
- <p><span translate="no">PLYLoader</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
- <pre><code class="language-js">import { PLYLoader } from 'three/addons/loaders/PLYLoader.js';</code></pre>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="PLYLoader" translate="no">new <a href="#PLYLoader">PLYLoader</a><span class="signature">( manager : <span class="param-type"><a href="LoadingManager.html">LoadingManager</a></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new PLY loader.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>manager</strong>
- </td>
- <td class="description last">
- <p>The loading manager.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <h3 class="name name-method" id="load" translate="no">.<a href="#load">load</a><span class="signature">( url : <span class="param-type">string</span>, onLoad : <span class="param-type">function</span>, onProgress : <span class="param-type"><a href="global.html#onProgressCallback">onProgressCallback</a></span>, onError : <span class="param-type"><a href="global.html#onErrorCallback">onErrorCallback</a></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Starts loading from the given URL and passes the loaded PLY asset
- to the <code>onLoad()</code> callback.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>url</strong>
- </td>
- <td class="description last">
- <p>The path/URL of the file to be loaded. This can also be a data URI.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>onLoad</strong>
- </td>
- <td class="description last">
- <p>Executed when the loading process has been finished.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>onProgress</strong>
- </td>
- <td class="description last">
- <p>Executed while the loading is in progress.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>onError</strong>
- </td>
- <td class="description last">
- <p>Executed when errors occur.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Loader.html#load">Loader#load</a></dt>
- </dl>
- </div>
- <h3 class="name name-method" id="parse" translate="no">.<a href="#parse">parse</a><span class="signature">( data : <span class="param-type">ArrayBuffer</span> )</span><span class="type-signature"> : <a href="BufferGeometry.html">BufferGeometry</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Parses the given PLY data and returns the resulting geometry.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>data</strong>
- </td>
- <td class="description last">
- <p>The raw PLY data as an array buffer.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Loader.html#parse">Loader#parse</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The parsed geometry.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setCustomPropertyNameMapping" translate="no">.<a href="#setCustomPropertyNameMapping">setCustomPropertyNameMapping</a><span class="signature">( mapping : <span class="param-type">Object</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Custom properties outside of the defaults for position, uv, normal
- and color attributes can be added using the setCustomPropertyNameMapping method.
- For example, the following maps the element properties “custom_property_a”
- and “custom_property_b” to an attribute “customAttribute” with an item size of 2.
- Attribute item sizes are set from the number of element properties in the property array.</p>
- <pre><code class="language-js">loader.setCustomPropertyNameMapping( {
- customAttribute: ['custom_property_a', 'custom_property_b'],
- } );
- </code></pre>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>mapping</strong>
- </td>
- <td class="description last">
- <p>The mapping dictionary.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h3 class="name name-method" id="setPropertyNameMapping" translate="no">.<a href="#setPropertyNameMapping">setPropertyNameMapping</a><span class="signature">( mapping : <span class="param-type">Object</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets a property name mapping that maps default property names
- to custom ones. For example, the following maps the properties
- “diffuse_(red|green|blue)” in the file to standard color names.</p>
- <pre><code class="language-js">loader.setPropertyNameMapping( {
- diffuse_red: 'red',
- diffuse_green: 'green',
- diffuse_blue: 'blue'
- } );
- </code></pre>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>mapping</strong>
- </td>
- <td class="description last">
- <p>The mapping dictionary.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/PLYLoader.js" translate="no" target="_blank" rel="noopener">examples/jsm/loaders/PLYLoader.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|