| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>TextureNode - 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="EventDispatcher.html">EventDispatcher</a> → <a href="Node.html">Node</a> → <a href="InputNode.html">InputNode</a> → <a href="UniformNode.html">UniformNode</a> → </p>
- <h1 translate="no">TextureNode</h1>
- <section>
- <header>
- <div class="class-description"><p>This type of uniform node represents a 2D texture.</p></div>
- </header>
- <article>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="TextureNode" translate="no">new <a href="#TextureNode">TextureNode</a><span class="signature">( value : <span class="param-type"><a href="Texture.html">Texture</a></span>, uvNode : <span class="param-type"><a href="Node.html">Node</a>.<(vec2|vec3)></span>, levelNode : <span class="param-type"><a href="Node.html">Node</a>.<int></span>, biasNode : <span class="param-type"><a href="Node.html">Node</a>.<float></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new texture node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>value</strong>
- </td>
- <td class="description last">
- <p>The texture.</p>
- <p>Default is <code>EmptyTexture</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>uvNode</strong>
- </td>
- <td class="description last">
- <p>The uv node.</p>
- <p>Default is <code>null</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>levelNode</strong>
- </td>
- <td class="description last">
- <p>The level node.</p>
- <p>Default is <code>null</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>biasNode</strong>
- </td>
- <td class="description last">
- <p>The bias node.</p>
- <p>Default is <code>null</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="biasNode" translate="no">.<a href="#biasNode">biasNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.<float></span> </h3>
- <div class="description">
- <p>Represents the bias to be applied during level-of-detail computation.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="compareNode" translate="no">.<a href="#compareNode">compareNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.<float></span> </h3>
- <div class="description">
- <p>Represents a reference value a texture sample is compared to.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="depthNode" translate="no">.<a href="#depthNode">depthNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.<int></span> </h3>
- <div class="description">
- <p>When using texture arrays, the depth node defines the layer to select.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="gradNode" translate="no">.<a href="#gradNode">gradNode</a><span class="type-signature"> : Array.<<a href="Node.html">Node</a>.<vec2>></span> </h3>
- <div class="description">
- <p>When defined, a texture is sampled using explicit gradients.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="isTextureNode" translate="no">.<a href="#isTextureNode">isTextureNode</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>This flag can be used for type testing.</p>
- <p>Default is <code>true</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="levelNode" translate="no">.<a href="#levelNode">levelNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.<int></span> </h3>
- <div class="description">
- <p>Represents the mip level that should be selected.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="offsetNode" translate="no">.<a href="#offsetNode">offsetNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.<(ivec2|ivec3)></span> </h3>
- <div class="description">
- <p>Represents the optional texel offset applied to the unnormalized texture
- coordinate before sampling the texture.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="referenceNode" translate="no">.<a href="#referenceNode">referenceNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
- <div class="description">
- <p>The reference node.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="sampler" translate="no">.<a href="#sampler">sampler</a><span class="type-signature"> : boolean</span> </h3>
- <div class="description">
- <p>Whether texture values should be sampled or fetched.</p>
- <p>Default is <code>true</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="updateMatrix" translate="no">.<a href="#updateMatrix">updateMatrix</a><span class="type-signature"> : boolean</span> </h3>
- <div class="description">
- <p>Whether the uv transformation matrix should be
- automatically updated or not. Use <code>setUpdateMatrix()</code>
- if you want to change the value of the property.</p>
- <p>Default is <code>false</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="updateType" translate="no">.<a href="#updateType">updateType</a><span class="type-signature"> : string</span> </h3>
- <div class="description">
- <p>By default the <code>update()</code> method is not executed. Depending on
- whether a uv transformation matrix and/or flipY is applied, <code>update()</code>
- is executed per object.</p>
- <p>Default is <code>'none'</code>.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="UniformNode.html#updateType">UniformNode#updateType</a></dt>
- </dl>
- </div>
- <div class="member">
- <h3 class="name" id="uvNode" translate="no">.<a href="#uvNode">uvNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.<(vec2|vec3)></span> </h3>
- <div class="description">
- <p>Represents the texture coordinates.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="value" translate="no">.<a href="#value">value</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
- <div class="description">
- <p>The texture value.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="UniformNode.html#value">UniformNode#value</a></dt>
- </dl>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <h3 class="name name-method" id="bias" translate="no">.<a href="#bias">bias</a><span class="signature">( biasNode : <span class="param-type"><a href="Node.html">Node</a>.<float></span> )</span><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Samples the texture with the given bias.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>biasNode</strong>
- </td>
- <td class="description last">
- <p>The bias node.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A texture node representing the texture sample.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="blur" translate="no">.<a href="#blur">blur</a><span class="signature">( amountNode : <span class="param-type"><a href="Node.html">Node</a>.<float></span> )</span><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Samples a blurred version of the texture by defining an internal bias.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>amountNode</strong>
- </td>
- <td class="description last">
- <p>How blurred the texture should be.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A texture node representing the texture sample.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="clone" translate="no">.<a href="#clone">clone</a><span class="signature">()</span><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Clones the texture node.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The cloned texture node.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="compare" translate="no">.<a href="#compare">compare</a><span class="signature">( compareNode : <span class="param-type"><a href="Node.html">Node</a>.<float></span> )</span><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Samples the texture by executing a compare operation.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>compareNode</strong>
- </td>
- <td class="description last">
- <p>The node that defines the compare value.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A texture node representing the texture sample.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="depth" translate="no">.<a href="#depth">depth</a><span class="signature">( depthNode : <span class="param-type"><a href="Node.html">Node</a>.<int></span> )</span><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Samples the texture by defining a depth node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>depthNode</strong>
- </td>
- <td class="description last">
- <p>The depth node.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A texture node representing the texture sample.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="generate" translate="no">.<a href="#generate">generate</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span>, output : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Generates the code snippet of the texture node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>builder</strong>
- </td>
- <td class="description last">
- <p>The current node builder.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>output</strong>
- </td>
- <td class="description last">
- <p>The current output.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="UniformNode.html#generate">UniformNode#generate</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The generated code snippet.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="generateOffset" translate="no">.<a href="#generateOffset">generateOffset</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span>, offsetNode : <span class="param-type"><a href="Node.html">Node</a></span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Generates the offset code snippet.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>builder</strong>
- </td>
- <td class="description last">
- <p>The current node builder.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>offsetNode</strong>
- </td>
- <td class="description last">
- <p>The offset node to generate code for.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The generated code snippet.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="generateSnippet" translate="no">.<a href="#generateSnippet">generateSnippet</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span>, textureProperty : <span class="param-type">string</span>, uvSnippet : <span class="param-type">string</span>, levelSnippet : <span class="param-type">string</span>, biasSnippet : <span class="param-type">string</span>, depthSnippet : <span class="param-type">string</span>, compareSnippet : <span class="param-type">string</span>, gradSnippet : <span class="param-type">Array.<string></span>, offsetSnippet : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Generates the snippet for the texture sampling.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>builder</strong>
- </td>
- <td class="description last">
- <p>The current node builder.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>textureProperty</strong>
- </td>
- <td class="description last">
- <p>The texture property.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>uvSnippet</strong>
- </td>
- <td class="description last">
- <p>The uv snippet.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>levelSnippet</strong>
- </td>
- <td class="description last">
- <p>The level snippet.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>biasSnippet</strong>
- </td>
- <td class="description last">
- <p>The bias snippet.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>depthSnippet</strong>
- </td>
- <td class="description last">
- <p>The depth snippet.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>compareSnippet</strong>
- </td>
- <td class="description last">
- <p>The compare snippet.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>gradSnippet</strong>
- </td>
- <td class="description last">
- <p>The grad snippet.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>offsetSnippet</strong>
- </td>
- <td class="description last">
- <p>The offset snippet.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The generated code snippet.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="generateUV" translate="no">.<a href="#generateUV">generateUV</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span>, uvNode : <span class="param-type"><a href="Node.html">Node</a></span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Generates the uv code snippet.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>builder</strong>
- </td>
- <td class="description last">
- <p>The current node builder.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>uvNode</strong>
- </td>
- <td class="description last">
- <p>The uv node to generate code for.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The generated code snippet.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getBase" translate="no">.<a href="#getBase">getBase</a><span class="signature">()</span><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the base texture of this node.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The base texture node.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getDefaultUV" translate="no">.<a href="#getDefaultUV">getDefaultUV</a><span class="signature">()</span><span class="type-signature"> : <a href="AttributeNode.html">AttributeNode</a>.<vec2></span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns a default uvs based on the current texture's channel.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The default uvs.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getInputType" translate="no">.<a href="#getInputType">getInputType</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Overwrites the default implementation to return a fixed value <code>'texture'</code>.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>builder</strong>
- </td>
- <td class="description last">
- <p>The current node builder.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="UniformNode.html#getInputType">UniformNode#getInputType</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The input type.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getNodeType" translate="no">.<a href="#getNodeType">getNodeType</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Overwritten since the node type is inferred from the texture type.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>builder</strong>
- </td>
- <td class="description last">
- <p>The current node builder.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="UniformNode.html#getNodeType">UniformNode#getNodeType</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The node type.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getSampler" translate="no">.<a href="#getSampler">getSampler</a><span class="signature">()</span><span class="type-signature"> : boolean</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the sampler value.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The sampler value.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getTransformedUV" translate="no">.<a href="#getTransformedUV">getTransformedUV</a><span class="signature">( uvNode : <span class="param-type"><a href="Node.html">Node</a></span> )</span><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Transforms the given uv node with the texture transformation matrix.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>uvNode</strong>
- </td>
- <td class="description last">
- <p>The uv node to transform.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The transformed uv node.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getUniformHash" translate="no">.<a href="#getUniformHash">getUniformHash</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Overwritten since the uniform hash is defined by the texture's UUID.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>builder</strong>
- </td>
- <td class="description last">
- <p>The current node builder.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="UniformNode.html#getUniformHash">UniformNode#getUniformHash</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The uniform hash.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="grad" translate="no">.<a href="#grad">grad</a><span class="signature">( gradNodeX : <span class="param-type"><a href="Node.html">Node</a>.<vec2></span>, gradNodeY : <span class="param-type"><a href="Node.html">Node</a>.<vec2></span> )</span><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Samples the texture using an explicit gradient.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>gradNodeX</strong>
- </td>
- <td class="description last">
- <p>The gradX node.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>gradNodeY</strong>
- </td>
- <td class="description last">
- <p>The gradY node.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A texture node representing the texture sample.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="level" translate="no">.<a href="#level">level</a><span class="signature">( levelNode : <span class="param-type"><a href="Node.html">Node</a>.<int></span> )</span><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Samples a specific mip of the texture.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>levelNode</strong>
- </td>
- <td class="description last">
- <p>The mip level to sample.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A texture node representing the texture sample.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="load" translate="no">.<a href="#load">load</a><span class="signature">( uvNode : <span class="param-type"><a href="Node.html">Node</a>.<uvec2></span> )</span><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>TSL function for creating a texture node that fetches/loads texels without interpolation.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>uvNode</strong>
- </td>
- <td class="description last">
- <p>The uv node.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A texture node representing the texture load.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="offset" translate="no">.<a href="#offset">offset</a><span class="signature">( offsetNode : <span class="param-type"><a href="Node.html">Node</a>.<ivec2></span> )</span><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Samples the texture by defining an offset node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>offsetNode</strong>
- </td>
- <td class="description last">
- <p>The offset node.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A texture node representing the texture sample.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="sample" translate="no">.<a href="#sample">sample</a><span class="signature">( uvNode : <span class="param-type"><a href="Node.html">Node</a></span> )</span><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Samples the texture with the given uv node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>uvNode</strong>
- </td>
- <td class="description last">
- <p>The uv node.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A texture node representing the texture sample.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setSampler" translate="no">.<a href="#setSampler">setSampler</a><span class="signature">( value : <span class="param-type">boolean</span> )</span><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the sampler value.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>value</strong>
- </td>
- <td class="description last">
- <p>The sampler value to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this texture node.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setUpdateMatrix" translate="no">.<a href="#setUpdateMatrix">setUpdateMatrix</a><span class="signature">( value : <span class="param-type">boolean</span> )</span><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Defines whether the uv transformation matrix should automatically be updated or not.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>value</strong>
- </td>
- <td class="description last">
- <p>The update toggle.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this node.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setup" translate="no">.<a href="#setup">setup</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Setups texture node by preparing the internal nodes for code generation.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>builder</strong>
- </td>
- <td class="description last">
- <p>The current node builder.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="UniformNode.html#setup">UniformNode#setup</a></dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setupUV" translate="no">.<a href="#setupUV">setupUV</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span>, uvNode : <span class="param-type"><a href="Node.html">Node</a></span> )</span><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Setups the uv node. Depending on the backend as well as texture's image and type, it might be necessary
- to modify the uv node for correct sampling.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>builder</strong>
- </td>
- <td class="description last">
- <p>The current node builder.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>uvNode</strong>
- </td>
- <td class="description last">
- <p>The uv node to setup.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The updated uv node.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="size" translate="no">.<a href="#size">size</a><span class="signature">( levelNode : <span class="param-type"><a href="Node.html">Node</a>.<int></span> )</span><span class="type-signature"> : <a href="TextureSizeNode.html">TextureSizeNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the texture size of the requested level.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>levelNode</strong>
- </td>
- <td class="description last">
- <p>The level to compute the size for.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The texture size.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>The update is used to implement the update of the uv transformation matrix.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="UniformNode.html#update">UniformNode#update</a></dt>
- </dl>
- </div>
- <h3 class="name name-method" id="updateReference" translate="no">.<a href="#updateReference">updateReference</a><span class="signature">( state : <span class="param-type"><a href="global.html#any">any</a></span> )</span><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Overwritten to always return the texture reference of the node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>state</strong>
- </td>
- <td class="description last">
- <p>This method can be invocated in different contexts so <code>state</code> can refer to any object type.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="UniformNode.html#updateReference">UniformNode#updateReference</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The texture reference.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="uv" translate="no">.<a href="#uv">uv</a><span class="signature">( uvNode : <span class="param-type"><a href="Node.html">Node</a></span> )</span><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
- <div class="method">
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>uvNode</strong>
- </td>
- <td class="description last">
- <p>The uv node.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="important tag-deprecated"><strong>Deprecated:</strong> since r172. Use <a href="TextureNode.html#sample">TextureNode#sample</a> instead.</dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A texture node representing the texture sample.</dt>
- </dl>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/TextureNode.js" translate="no" target="_blank" rel="noopener">src/nodes/accessors/TextureNode.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|