| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>MaterialLoader - 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">MaterialLoader</h1>
- <section>
- <header>
- <div class="class-description"><p>Class for loading geometries. The files are internally
- loaded via <a href="FileLoader.html">FileLoader</a>.</p>
- <p>This loader does not support node materials. Use <a href="NodeMaterialLoader.html">NodeMaterialLoader</a> instead.</p></div>
- <h2>Code Example</h2>
- <div translate="no"><pre><code class="language-js">const loader = new THREE.MaterialLoader();
- const material = await loader.loadAsync( 'material.json' );
- </code></pre></div>
- </header>
- <article>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="MaterialLoader" translate="no">new <a href="#MaterialLoader">MaterialLoader</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 material 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">Properties</h2>
- <div class="member">
- <h3 class="name" id="textures" translate="no">.<a href="#textures">textures</a><span class="type-signature"> : Object.<string, <a href="Texture.html">Texture</a>></span> </h3>
- <div class="description">
- <p>A dictionary holding textures used by the material.</p>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <h3 class="name name-method" id="createMaterialFromType" translate="no">.<a href="#createMaterialFromType">createMaterialFromType</a><span class="signature">( type : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="Material.html">Material</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Creates a material for the given type.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>type</strong>
- </td>
- <td class="description last">
- <p>The material type.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The new material.</dt>
- </dl>
- </div>
- <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 pass the loaded material 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">( json : <span class="param-type">Object</span> )</span><span class="type-signature"> : <a href="Material.html">Material</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Parses the given JSON object and returns a material.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>json</strong>
- </td>
- <td class="description last">
- <p>The serialized material.</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 material.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setTextures" translate="no">.<a href="#setTextures">setTextures</a><span class="signature">( value : <span class="param-type">Object</span> )</span><span class="type-signature"> : <a href="MaterialLoader.html">MaterialLoader</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Textures are not embedded in the material JSON so they have
- to be injected before the loading process starts.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>value</strong>
- </td>
- <td class="description last">
- <p>A dictionary holding textures for material properties.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this material loader.</dt>
- </dl>
- </div>
- <h2 class="subsection-title">Static Methods</h2>
- <h3 class="name name-method" id=".createMaterialFromType" translate="no">.<a href="#.createMaterialFromType">createMaterialFromType</a><span class="signature">( type : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="Material.html">Material</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Creates a material for the given type.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>type</strong>
- </td>
- <td class="description last">
- <p>The material type.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The new material.</dt>
- </dl>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/src/loaders/MaterialLoader.js" translate="no" target="_blank" rel="noopener">src/loaders/MaterialLoader.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|