| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>GLSLNodeBuilder - 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="NodeBuilder.html">NodeBuilder</a> → </p>
- <h1 translate="no">GLSLNodeBuilder</h1>
- <section>
- <header>
- <div class="class-description"><p>A node builder targeting GLSL.</p>
- <p>This module generates GLSL shader code from node materials and also
- generates the respective bindings and vertex buffer definitions. These
- data are later used by the renderer to create render and compute pipelines
- for render objects.</p></div>
- </header>
- <article>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="GLSLNodeBuilder" translate="no">new <a href="#GLSLNodeBuilder">GLSLNodeBuilder</a><span class="signature">( object : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, renderer : <span class="param-type"><a href="Renderer.html">Renderer</a></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new GLSL node builder renderer.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>object</strong>
- </td>
- <td class="description last">
- <p>The 3D object.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>renderer</strong>
- </td>
- <td class="description last">
- <p>The renderer.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="builtins" translate="no">.<a href="#builtins">builtins</a><span class="type-signature"> : Object.<string, Array.<string>></span> </h3>
- <div class="description">
- <p>A dictionary that holds for each shader stage an Array of used builtins.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="extensions" translate="no">.<a href="#extensions">extensions</a><span class="type-signature"> : Object.<string, Map.<string, Object>></span> </h3>
- <div class="description">
- <p>A dictionary that holds for each shader stage a Map of used extensions.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="transforms" translate="no">.<a href="#transforms">transforms</a><span class="type-signature"> : Array.<Object.<string, (<a href="AttributeNode.html">AttributeNode</a>|string)>></span> </h3>
- <div class="description">
- <p>An array that holds objects defining the varying and attribute data in
- context of Transform Feedback.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="uniformGroups" translate="no">.<a href="#uniformGroups">uniformGroups</a><span class="type-signature"> : Object.<string, Object.<string, <a href="NodeUniformsGroup.html">NodeUniformsGroup</a>>></span> </h3>
- <div class="description">
- <p>A dictionary holds for each shader stage ('vertex', 'fragment', 'compute')
- another dictionary which manages UBOs per group ('render','frame','object').</p>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <h3 class="name name-method" id="buildCode" translate="no">.<a href="#buildCode">buildCode</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Controls the code build of the shader stages.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#buildCode">NodeBuilder#buildCode</a></dt>
- </dl>
- </div>
- <h3 class="name name-method" id="buildFunctionCode" translate="no">.<a href="#buildFunctionCode">buildFunctionCode</a><span class="signature">( shaderNode : <span class="param-type">ShaderNodeInternal</span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Builds the given shader node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>shaderNode</strong>
- </td>
- <td class="description last">
- <p>The shader node.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#buildFunctionCode">NodeBuilder#buildFunctionCode</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The GLSL function code.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="enableExtension" translate="no">.<a href="#enableExtension">enableExtension</a><span class="signature">( name : <span class="param-type">string</span>, behavior : <span class="param-type">string</span>, shaderStage : <span class="param-type">string</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Enables the given extension.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>name</strong>
- </td>
- <td class="description last">
- <p>The extension name.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>behavior</strong>
- </td>
- <td class="description last">
- <p>The extension behavior.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage.</p>
- <p>Default is <code>this.shaderStage</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h3 class="name name-method" id="enableHardwareClipping" translate="no">.<a href="#enableHardwareClipping">enableHardwareClipping</a><span class="signature">( planeCount : <span class="param-type">string</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Enables hardware clipping.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>planeCount</strong>
- </td>
- <td class="description last">
- <p>The clipping plane count.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h3 class="name name-method" id="enableMultiview" translate="no">.<a href="#enableMultiview">enableMultiview</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Enables multiview.</p>
- </div>
- </div>
- <h3 class="name name-method" id="generatePBO" translate="no">.<a href="#generatePBO">generatePBO</a><span class="signature">( storageArrayElementNode : <span class="param-type"><a href="StorageArrayElementNode.html">StorageArrayElementNode</a></span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Setups the Pixel Buffer Object (PBO) for the given storage
- buffer node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>storageArrayElementNode</strong>
- </td>
- <td class="description last">
- <p>The storage array element node.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The property name.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="generateTexture" translate="no">.<a href="#generateTexture">generateTexture</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, textureProperty : <span class="param-type">string</span>, uvSnippet : <span class="param-type">string</span>, depthSnippet : <span class="param-type">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 GLSL snippet for sampling/loading the given texture.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>texture</strong>
- </td>
- <td class="description last">
- <p>The texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>textureProperty</strong>
- </td>
- <td class="description last">
- <p>The name of the texture uniform in the shader.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>uvSnippet</strong>
- </td>
- <td class="description last">
- <p>A GLSL snippet that represents texture coordinates used for sampling.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>depthSnippet</strong>
- </td>
- <td class="description last">
- <p>A GLSL snippet that represents the 0-based texture array index to sample.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>offsetSnippet</strong>
- </td>
- <td class="description last">
- <p>A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#generateTexture">NodeBuilder#generateTexture</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The GLSL snippet.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="generateTextureBias" translate="no">.<a href="#generateTextureBias">generateTextureBias</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, textureProperty : <span class="param-type">string</span>, uvSnippet : <span class="param-type">string</span>, biasSnippet : <span class="param-type">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 GLSL snippet when sampling textures with a bias to the mip level.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>texture</strong>
- </td>
- <td class="description last">
- <p>The texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>textureProperty</strong>
- </td>
- <td class="description last">
- <p>The name of the texture uniform in the shader.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>uvSnippet</strong>
- </td>
- <td class="description last">
- <p>A GLSL snippet that represents texture coordinates used for sampling.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>biasSnippet</strong>
- </td>
- <td class="description last">
- <p>A GLSL snippet that represents the bias to apply to the mip level before sampling.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>offsetSnippet</strong>
- </td>
- <td class="description last">
- <p>A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The GLSL snippet.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="generateTextureCompare" translate="no">.<a href="#generateTextureCompare">generateTextureCompare</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, textureProperty : <span class="param-type">string</span>, uvSnippet : <span class="param-type">string</span>, compareSnippet : <span class="param-type">string</span>, depthSnippet : <span class="param-type">string</span>, offsetSnippet : <span class="param-type">string</span>, shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Generates the GLSL snippet for sampling a depth texture and comparing the sampled depth values
- against a reference value.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>texture</strong>
- </td>
- <td class="description last">
- <p>The texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>textureProperty</strong>
- </td>
- <td class="description last">
- <p>The name of the texture uniform in the shader.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>uvSnippet</strong>
- </td>
- <td class="description last">
- <p>A GLSL snippet that represents texture coordinates used for sampling.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>compareSnippet</strong>
- </td>
- <td class="description last">
- <p>A GLSL snippet that represents the reference value.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>depthSnippet</strong>
- </td>
- <td class="description last">
- <p>A GLSL snippet that represents 0-based texture array index to sample.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>offsetSnippet</strong>
- </td>
- <td class="description last">
- <p>A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage this code snippet is generated for.</p>
- <p>Default is <code>this.shaderStage</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The GLSL snippet.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="generateTextureGrad" translate="no">.<a href="#generateTextureGrad">generateTextureGrad</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, textureProperty : <span class="param-type">string</span>, uvSnippet : <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 GLSL snippet for sampling/loading the given texture using explicit gradients.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>texture</strong>
- </td>
- <td class="description last">
- <p>The texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>textureProperty</strong>
- </td>
- <td class="description last">
- <p>The name of the texture uniform in the shader.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>uvSnippet</strong>
- </td>
- <td class="description last">
- <p>A GLSL snippet that represents texture coordinates used for sampling.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>gradSnippet</strong>
- </td>
- <td class="description last">
- <p>An array holding both gradient GLSL snippets.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>offsetSnippet</strong>
- </td>
- <td class="description last">
- <p>A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The GLSL snippet.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="generateTextureLevel" translate="no">.<a href="#generateTextureLevel">generateTextureLevel</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, textureProperty : <span class="param-type">string</span>, uvSnippet : <span class="param-type">string</span>, levelSnippet : <span class="param-type">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 GLSL snippet when sampling textures with explicit mip level.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>texture</strong>
- </td>
- <td class="description last">
- <p>The texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>textureProperty</strong>
- </td>
- <td class="description last">
- <p>The name of the texture uniform in the shader.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>uvSnippet</strong>
- </td>
- <td class="description last">
- <p>A GLSL snippet that represents texture coordinates used for sampling.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>levelSnippet</strong>
- </td>
- <td class="description last">
- <p>A GLSL snippet that represents the mip level, with level 0 containing a full size version of the texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>offsetSnippet</strong>
- </td>
- <td class="description last">
- <p>A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The GLSL snippet.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="generateTextureLoad" translate="no">.<a href="#generateTextureLoad">generateTextureLoad</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, textureProperty : <span class="param-type">string</span>, uvIndexSnippet : <span class="param-type">string</span>, levelSnippet : <span class="param-type">string</span>, depthSnippet : <span class="param-type">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 GLSL snippet that reads a single texel from a texture without sampling or filtering.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>texture</strong>
- </td>
- <td class="description last">
- <p>The texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>textureProperty</strong>
- </td>
- <td class="description last">
- <p>The name of the texture uniform in the shader.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>uvIndexSnippet</strong>
- </td>
- <td class="description last">
- <p>A GLSL snippet that represents texture coordinates used for sampling.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>levelSnippet</strong>
- </td>
- <td class="description last">
- <p>A GLSL snippet that represents the mip level, with level 0 containing a full size version of the texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>depthSnippet</strong>
- </td>
- <td class="description last">
- <p>A GLSL snippet that represents the 0-based texture array index to sample.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>offsetSnippet</strong>
- </td>
- <td class="description last">
- <p>A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The GLSL snippet.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getAttributes" translate="no">.<a href="#getAttributes">getAttributes</a><span class="signature">( shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the shader attributes of the given shader stage as a GLSL string.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getAttributes">NodeBuilder#getAttributes</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The GLSL snippet that defines the shader attributes.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getBitcastMethod" translate="no">.<a href="#getBitcastMethod">getBitcastMethod</a><span class="signature">( type : <span class="param-type">string</span>, inputType : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the bitcast method name for a given input and outputType.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>type</strong>
- </td>
- <td class="description last">
- <p>The output type to bitcast to.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>inputType</strong>
- </td>
- <td class="description last">
- <p>The input type of the.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The resolved WGSL bitcast invocation.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getClipDistance" translate="no">.<a href="#getClipDistance">getClipDistance</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the clip distances builtin.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The clip distances builtin.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getDrawIndex" translate="no">.<a href="#getDrawIndex">getDrawIndex</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the draw index builtin.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getDrawIndex">NodeBuilder#getDrawIndex</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The drawIndex shader string. Returns <code>null</code> if <code>WEBGL_multi_draw</code> isn't supported by the device.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getExtensions" translate="no">.<a href="#getExtensions">getExtensions</a><span class="signature">( shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the enabled extensions of the given shader stage as a GLSL string.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The GLSL snippet that defines the enabled extensions.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getFloatPackingMethod" translate="no">.<a href="#getFloatPackingMethod">getFloatPackingMethod</a><span class="signature">( encoding : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the float packing method name for a given numeric encoding.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>encoding</strong>
- </td>
- <td class="description last">
- <p>The numeric encoding that describes how the float values are mapped to the integer range.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The resolved GLSL float packing method name.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getFloatUnpackingMethod" translate="no">.<a href="#getFloatUnpackingMethod">getFloatUnpackingMethod</a><span class="signature">( encoding : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the float unpacking method name for a given numeric encoding.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>encoding</strong>
- </td>
- <td class="description last">
- <p>The numeric encoding that describes how the integer values are mapped to the float range.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The resolved GLSL float unpacking method name.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getFragCoord" translate="no">.<a href="#getFragCoord">getFragCoord</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the frag coord builtin.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getFragCoord">NodeBuilder#getFragCoord</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The frag coord builtin.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getFragDepth" translate="no">.<a href="#getFragDepth">getFragDepth</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the frag depth builtin.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The frag depth builtin.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getFrontFacing" translate="no">.<a href="#getFrontFacing">getFrontFacing</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the front facing builtin.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getFrontFacing">NodeBuilder#getFrontFacing</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The front facing builtin.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getInstanceIndex" translate="no">.<a href="#getInstanceIndex">getInstanceIndex</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Contextually returns either the vertex stage instance index builtin
- or the linearized index of an compute invocation within a grid of workgroups.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getInstanceIndex">NodeBuilder#getInstanceIndex</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The instance index.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getInvocationLocalIndex" translate="no">.<a href="#getInvocationLocalIndex">getInvocationLocalIndex</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns a builtin representing the index of an invocation within its workgroup.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The invocation local index.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getInvocationSubgroupIndex" translate="no">.<a href="#getInvocationSubgroupIndex">getInvocationSubgroupIndex</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns a builtin representing the index of an invocation within its subgroup.</p>
- </div>
- </div>
- <h3 class="name name-method" id="getMethod" translate="no">.<a href="#getMethod">getMethod</a><span class="signature">( method : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the native shader method name for a given generic name.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>method</strong>
- </td>
- <td class="description last">
- <p>The method name to resolve.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getMethod">NodeBuilder#getMethod</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The resolved GLSL method name.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getOutputStructName" translate="no">.<a href="#getOutputStructName">getOutputStructName</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the output struct name. Not relevant for GLSL.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getOutputStructName">NodeBuilder#getOutputStructName</a></dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getPropertyName" translate="no">.<a href="#getPropertyName">getPropertyName</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span>, shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns a GLSL snippet that represents the property name of the given node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>node</strong>
- </td>
- <td class="description last">
- <p>The node.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage this code snippet is generated for.</p>
- <p>Default is <code>this.shaderStage</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getPropertyName">NodeBuilder#getPropertyName</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The property name.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getStructMembers" translate="no">.<a href="#getStructMembers">getStructMembers</a><span class="signature">( struct : <span class="param-type"><a href="StructTypeNode.html">StructTypeNode</a></span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the members of the given struct type node as a GLSL string.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>struct</strong>
- </td>
- <td class="description last">
- <p>The struct type node.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The GLSL snippet that defines the struct members.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getStructs" translate="no">.<a href="#getStructs">getStructs</a><span class="signature">( shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the structs of the given shader stage as a GLSL string.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The GLSL snippet that defines the structs.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getSubgroupIndex" translate="no">.<a href="#getSubgroupIndex">getSubgroupIndex</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns a builtin representing the index of the current invocation's subgroup within its workgroup.</p>
- </div>
- </div>
- <h3 class="name name-method" id="getSubgroupSize" translate="no">.<a href="#getSubgroupSize">getSubgroupSize</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns a builtin representing the size of a subgroup within the current shader.</p>
- </div>
- </div>
- <h3 class="name name-method" id="getTernary" translate="no">.<a href="#getTernary">getTernary</a><span class="signature">( condSnippet : <span class="param-type">string</span>, ifSnippet : <span class="param-type">string</span>, elseSnippet : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the native snippet for a ternary operation.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>condSnippet</strong>
- </td>
- <td class="description last">
- <p>The condition determining which expression gets resolved.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>ifSnippet</strong>
- </td>
- <td class="description last">
- <p>The expression to resolve to if the condition is true.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>elseSnippet</strong>
- </td>
- <td class="description last">
- <p>The expression to resolve to if the condition is false.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getTernary">NodeBuilder#getTernary</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The resolved method name.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getTransforms" translate="no">.<a href="#getTransforms">getTransforms</a><span class="signature">( shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the transforms of the given shader stage as a GLSL string.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The GLSL snippet that defines the transforms.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getTypeFromAttribute" translate="no">.<a href="#getTypeFromAttribute">getTypeFromAttribute</a><span class="signature">( attribute : <span class="param-type"><a href="BufferAttribute.html">BufferAttribute</a></span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the type for a given buffer attribute.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>attribute</strong>
- </td>
- <td class="description last">
- <p>The buffer attribute.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getTypeFromAttribute">NodeBuilder#getTypeFromAttribute</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The type.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getUniformFromNode" translate="no">.<a href="#getUniformFromNode">getUniformFromNode</a><span class="signature">( node : <span class="param-type"><a href="UniformNode.html">UniformNode</a></span>, type : <span class="param-type">string</span>, shaderStage : <span class="param-type">string</span>, name : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="NodeUniform.html">NodeUniform</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>This method is one of the more important ones since it's responsible
- for generating a matching binding instance for the given uniform node.</p>
- <p>These bindings are later used in the renderer to create bind groups
- and layouts.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>node</strong>
- </td>
- <td class="description last">
- <p>The uniform node.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>type</strong>
- </td>
- <td class="description last">
- <p>The node data type.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>name</strong>
- </td>
- <td class="description last">
- <p>An optional uniform name.</p>
- <p>Default is <code>null</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getUniformFromNode">NodeBuilder#getUniformFromNode</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The node uniform object.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getUniforms" translate="no">.<a href="#getUniforms">getUniforms</a><span class="signature">( shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the uniforms of the given shader stage as a GLSL string.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getUniforms">NodeBuilder#getUniforms</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The GLSL snippet that defines the uniforms.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getVars" translate="no">.<a href="#getVars">getVars</a><span class="signature">( shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the variables of the given shader stage as a GLSL string.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getVars">NodeBuilder#getVars</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The GLSL snippet that defines the variables.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getVaryings" translate="no">.<a href="#getVaryings">getVaryings</a><span class="signature">( shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the varyings of the given shader stage as a GLSL string.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getVaryings">NodeBuilder#getVaryings</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The GLSL snippet that defines the varyings.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getVertexIndex" translate="no">.<a href="#getVertexIndex">getVertexIndex</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the vertex index builtin.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getVertexIndex">NodeBuilder#getVertexIndex</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The vertex index.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="isAvailable" translate="no">.<a href="#isAvailable">isAvailable</a><span class="signature">( name : <span class="param-type">string</span> )</span><span class="type-signature"> : boolean</span> </h3>
- <div class="method">
- <div class="description">
- <p>Whether the requested feature is available or not.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>name</strong>
- </td>
- <td class="description last">
- <p>The requested feature.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#isAvailable">NodeBuilder#isAvailable</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> Whether the requested feature is supported or not.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="isFlipY" translate="no">.<a href="#isFlipY">isFlipY</a><span class="signature">()</span><span class="type-signature"> : boolean</span> </h3>
- <div class="method">
- <div class="description">
- <p>Whether to flip texture data along its vertical axis or not.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#isFlipY">NodeBuilder#isFlipY</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> Returns always <code>true</code> in context of GLSL.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="needsToWorkingColorSpace" translate="no">.<a href="#needsToWorkingColorSpace">needsToWorkingColorSpace</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
- <div class="method">
- <div class="description">
- <p>Checks if the given texture requires a manual conversion to the working color space.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>texture</strong>
- </td>
- <td class="description last">
- <p>The texture to check.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#needsToWorkingColorSpace">NodeBuilder#needsToWorkingColorSpace</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> Whether the given texture requires a conversion to working color space or not.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="registerTransform" translate="no">.<a href="#registerTransform">registerTransform</a><span class="signature">( varyingName : <span class="param-type">string</span>, attributeNode : <span class="param-type"><a href="AttributeNode.html">AttributeNode</a></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Registers a transform in context of Transform Feedback.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>varyingName</strong>
- </td>
- <td class="description last">
- <p>The varying name.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>attributeNode</strong>
- </td>
- <td class="description last">
- <p>The attribute node.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h3 class="name name-method" id="setupPBO" translate="no">.<a href="#setupPBO">setupPBO</a><span class="signature">( storageBufferNode : <span class="param-type"><a href="StorageBufferNode.html">StorageBufferNode</a></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Setups the Pixel Buffer Object (PBO) for the given storage
- buffer node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>storageBufferNode</strong>
- </td>
- <td class="description last">
- <p>The storage buffer node.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js" translate="no" target="_blank" rel="noopener">src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|