NodeBuilder.html 125 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>NodeBuilder - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <h1 translate="no">NodeBuilder</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>Base class for builders which generate a shader program based
  16. on a 3D object and its node material definition.</p></div>
  17. </header>
  18. <article>
  19. <div class="container-overview">
  20. <h2>Constructor</h2>
  21. <h3 class="name name-method" id="NodeBuilder" translate="no">new <a href="#NodeBuilder">NodeBuilder</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>, parser : <span class="param-type"><a href="NodeParser.html">NodeParser</a></span> )</span> </h3>
  22. <div class="method">
  23. <div class="description">
  24. <p>Constructs a new node builder.</p>
  25. </div>
  26. <table class="params">
  27. <tbody>
  28. <tr>
  29. <td class="name">
  30. <strong>object</strong>
  31. </td>
  32. <td class="description last">
  33. <p>The 3D object.</p>
  34. </td>
  35. </tr>
  36. <tr>
  37. <td class="name">
  38. <strong>renderer</strong>
  39. </td>
  40. <td class="description last">
  41. <p>The current renderer.</p>
  42. </td>
  43. </tr>
  44. <tr>
  45. <td class="name">
  46. <strong>parser</strong>
  47. </td>
  48. <td class="description last">
  49. <p>A reference to a node parser.</p>
  50. </td>
  51. </tr>
  52. </tbody>
  53. </table>
  54. </div>
  55. </div>
  56. <h2 class="subsection-title">Properties</h2>
  57. <div class="member">
  58. <h3 class="name" id="activeStacks" translate="no">.<a href="#activeStacks">activeStacks</a><span class="type-signature"> : Array.&lt;<a href="StackNode.html">StackNode</a>></span> </h3>
  59. <div class="description">
  60. <p>The active stack nodes.</p>
  61. </div>
  62. </div>
  63. <div class="member">
  64. <h3 class="name" id="attributes" translate="no">.<a href="#attributes">attributes</a><span class="type-signature"> : Array.&lt;<a href="NodeAttribute.html">NodeAttribute</a>></span> </h3>
  65. <div class="description">
  66. <p>This array holds the node attributes of this builder
  67. created via <a href="AttributeNode.html">AttributeNode</a>.</p>
  68. </div>
  69. </div>
  70. <div class="member">
  71. <h3 class="name" id="bindGroups" translate="no">.<a href="#bindGroups">bindGroups</a><span class="type-signature"> : Array.&lt;<a href="BindGroup.html">BindGroup</a>></span> </h3>
  72. <div class="description">
  73. <p>Reference to the array of bind groups.</p>
  74. </div>
  75. </div>
  76. <div class="member">
  77. <h3 class="name" id="bindings" translate="no">.<a href="#bindings">bindings</a><span class="type-signature"> : Object</span> </h3>
  78. <div class="description">
  79. <p>This dictionary holds the bindings for each shader stage.</p>
  80. </div>
  81. </div>
  82. <div class="member">
  83. <h3 class="name" id="bindingsIndexes" translate="no">.<a href="#bindingsIndexes">bindingsIndexes</a><span class="type-signature"> : Object</span> </h3>
  84. <div class="description">
  85. <p>This dictionary maintains the binding indices per bind group.</p>
  86. </div>
  87. </div>
  88. <div class="member">
  89. <h3 class="name" id="bufferAttributes" translate="no">.<a href="#bufferAttributes">bufferAttributes</a><span class="type-signature"> : Array.&lt;<a href="NodeAttribute.html">NodeAttribute</a>></span> </h3>
  90. <div class="description">
  91. <p>This array holds the node attributes of this builder
  92. created via <a href="BufferAttributeNode.html">BufferAttributeNode</a>.</p>
  93. </div>
  94. </div>
  95. <div class="member">
  96. <h3 class="name" id="buildStage" translate="no">.<a href="#buildStage">buildStage</a><span class="type-signature"> : 'setup' | 'analyze' | 'generate'</span> </h3>
  97. <div class="description">
  98. <p>The current build stage.</p>
  99. </div>
  100. </div>
  101. <div class="member">
  102. <h3 class="name" id="cache" translate="no">.<a href="#cache">cache</a><span class="type-signature"> : <a href="NodeCache.html">NodeCache</a></span> </h3>
  103. <div class="description">
  104. <p>The builder's cache.</p>
  105. </div>
  106. </div>
  107. <div class="member">
  108. <h3 class="name" id="camera" translate="no">.<a href="#camera">camera</a><span class="type-signature"> : <a href="Camera.html">Camera</a></span> </h3>
  109. <div class="description">
  110. <p>The camera the 3D object is rendered with.</p>
  111. <p>Default is <code>null</code>.</p>
  112. </div>
  113. </div>
  114. <div class="member">
  115. <h3 class="name" id="chaining" translate="no">.<a href="#chaining">chaining</a><span class="type-signature"> : Array.&lt;<a href="Node.html">Node</a>></span> </h3>
  116. <div class="description">
  117. <p>A chain of nodes.
  118. Used to check recursive calls in node-graph.</p>
  119. </div>
  120. </div>
  121. <div class="member">
  122. <h3 class="name" id="clippingContext" translate="no">.<a href="#clippingContext">clippingContext</a><span class="type-signature"> : <a href="ClippingContext.html">ClippingContext</a></span> </h3>
  123. <div class="description">
  124. <p>The current clipping context.</p>
  125. </div>
  126. </div>
  127. <div class="member">
  128. <h3 class="name" id="codes" translate="no">.<a href="#codes">codes</a><span class="type-signature"> : Object.&lt;string, Array.&lt;<a href="NodeCode.html">NodeCode</a>>></span> </h3>
  129. <div class="description">
  130. <p>This dictionary holds the (native) node codes of this builder.
  131. The codes are maintained in an array for each shader stage.</p>
  132. </div>
  133. </div>
  134. <div class="member">
  135. <h3 class="name" id="computeShader" translate="no">.<a href="#computeShader">computeShader</a><span class="type-signature"> : string</span> </h3>
  136. <div class="description">
  137. <p>The generated compute shader.</p>
  138. </div>
  139. </div>
  140. <div class="member">
  141. <h3 class="name" id="context" translate="no">.<a href="#context">context</a><span class="type-signature"> : Object</span> </h3>
  142. <div class="description">
  143. <p>The builder's context.</p>
  144. </div>
  145. </div>
  146. <div class="member">
  147. <h3 class="name" id="currentFunctionNode" translate="no">.<a href="#currentFunctionNode">currentFunctionNode</a><span class="type-signature"> : <a href="FunctionNode.html">FunctionNode</a></span> </h3>
  148. <div class="description">
  149. <p>Reference to the current function node.</p>
  150. <p>Default is <code>null</code>.</p>
  151. </div>
  152. </div>
  153. <div class="member">
  154. <h3 class="name" id="currentNode" translate="no">.<a href="#currentNode">currentNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  155. <div class="description">
  156. <p>A reference the current node which is the
  157. last node in the chain of nodes.</p>
  158. </div>
  159. </div>
  160. <div class="member">
  161. <h3 class="name" id="declarations" translate="no">.<a href="#declarations">declarations</a><span class="type-signature"> : Object</span> </h3>
  162. <div class="description">
  163. <p>This dictionary holds the declarations for each shader stage.</p>
  164. </div>
  165. </div>
  166. <div class="member">
  167. <h3 class="name" id="environmentNode" translate="no">.<a href="#environmentNode">environmentNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  168. <div class="description">
  169. <p>A reference to the current environment node.</p>
  170. <p>Default is <code>null</code>.</p>
  171. </div>
  172. </div>
  173. <div class="member">
  174. <h3 class="name" id="flow" translate="no">.<a href="#flow">flow</a><span class="type-signature"> : Object</span> </h3>
  175. <div class="description">
  176. <p>Current code flow.
  177. All code generated in this stack will be stored in <code>.flow</code>.</p>
  178. </div>
  179. </div>
  180. <div class="member">
  181. <h3 class="name" id="flowCode" translate="no">.<a href="#flowCode">flowCode</a><span class="type-signature"> : Object.&lt;string, string></span> </h3>
  182. <div class="description">
  183. <p>Nodes code from <code>.flowNodes</code>.</p>
  184. </div>
  185. </div>
  186. <div class="member">
  187. <h3 class="name" id="flowNodes" translate="no">.<a href="#flowNodes">flowNodes</a><span class="type-signature"> : Object.&lt;string, Array.&lt;<a href="Node.html">Node</a>>></span> </h3>
  188. <div class="description">
  189. <p>Nodes used in the primary flow of code generation.</p>
  190. </div>
  191. </div>
  192. <div class="member">
  193. <h3 class="name" id="fnCall" translate="no">.<a href="#fnCall">fnCall</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  194. <div class="description">
  195. <p>The current TSL function(Fn) call node.</p>
  196. <p>Default is <code>null</code>.</p>
  197. </div>
  198. </div>
  199. <div class="member">
  200. <h3 class="name" id="fogNode" translate="no">.<a href="#fogNode">fogNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  201. <div class="description">
  202. <p>A reference to the current fog node.</p>
  203. <p>Default is <code>null</code>.</p>
  204. </div>
  205. </div>
  206. <div class="member">
  207. <h3 class="name" id="fragmentShader" translate="no">.<a href="#fragmentShader">fragmentShader</a><span class="type-signature"> : string</span> </h3>
  208. <div class="description">
  209. <p>The generated fragment shader.</p>
  210. </div>
  211. </div>
  212. <div class="member">
  213. <h3 class="name" id="geometry" translate="no">.<a href="#geometry">geometry</a><span class="type-signature"> : <a href="BufferGeometry.html">BufferGeometry</a></span> </h3>
  214. <div class="description">
  215. <p>The geometry of the 3D object.</p>
  216. </div>
  217. </div>
  218. <div class="member">
  219. <h3 class="name" id="globalCache" translate="no">.<a href="#globalCache">globalCache</a><span class="type-signature"> : <a href="NodeCache.html">NodeCache</a></span> </h3>
  220. <div class="description">
  221. <p>Since the <a href="NodeBuilder.html#cache">NodeBuilder#cache</a> might be temporarily
  222. overwritten by other caches, this member retains the reference
  223. to the builder's own cache.</p>
  224. <p>Default is <code>this.cache</code>.</p>
  225. </div>
  226. </div>
  227. <div class="member">
  228. <h3 class="name" id="hashNodes" translate="no">.<a href="#hashNodes">hashNodes</a><span class="type-signature"> : Object.&lt;number, <a href="Node.html">Node</a>></span> </h3>
  229. <div class="description">
  230. <p>A dictionary that assigns each node to a unique hash.</p>
  231. </div>
  232. </div>
  233. <div class="member">
  234. <h3 class="name" id="lightsNode" translate="no">.<a href="#lightsNode">lightsNode</a><span class="type-signature"> : <a href="LightsNode.html">LightsNode</a></span> </h3>
  235. <div class="description">
  236. <p>A reference to the current lights node.</p>
  237. <p>Default is <code>null</code>.</p>
  238. </div>
  239. </div>
  240. <div class="member">
  241. <h3 class="name" id="material" translate="no">.<a href="#material">material</a><span class="type-signature"> : <a href="Material.html">Material</a></span> </h3>
  242. <div class="description">
  243. <p>The material of the 3D object.</p>
  244. </div>
  245. </div>
  246. <div class="member">
  247. <h3 class="name" id="nodes" translate="no">.<a href="#nodes">nodes</a><span class="type-signature"> : Array.&lt;<a href="Node.html">Node</a>></span> </h3>
  248. <div class="description">
  249. <p>A list of all nodes the builder is processing
  250. for this 3D object.</p>
  251. </div>
  252. </div>
  253. <div class="member">
  254. <h3 class="name" id="object" translate="no">.<a href="#object">object</a><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  255. <div class="description">
  256. <p>The 3D object.</p>
  257. </div>
  258. </div>
  259. <div class="member">
  260. <h3 class="name" id="observer" translate="no">.<a href="#observer">observer</a><span class="type-signature"> : <a href="NodeMaterialObserver.html">NodeMaterialObserver</a></span> </h3>
  261. <div class="description">
  262. <p>A reference to a node material observer.</p>
  263. <p>Default is <code>null</code>.</p>
  264. </div>
  265. </div>
  266. <div class="member">
  267. <h3 class="name" id="parser" translate="no">.<a href="#parser">parser</a><span class="type-signature"> : <a href="NodeParser.html">NodeParser</a></span> </h3>
  268. <div class="description">
  269. <p>A reference to a node parser.</p>
  270. </div>
  271. </div>
  272. <div class="member">
  273. <h3 class="name" id="renderer" translate="no">.<a href="#renderer">renderer</a><span class="type-signature"> : <a href="Renderer.html">Renderer</a></span> </h3>
  274. <div class="description">
  275. <p>The current renderer.</p>
  276. </div>
  277. </div>
  278. <div class="member">
  279. <h3 class="name" id="scene" translate="no">.<a href="#scene">scene</a><span class="type-signature"> : <a href="Scene.html">Scene</a></span> </h3>
  280. <div class="description">
  281. <p>The scene the 3D object belongs to.</p>
  282. <p>Default is <code>null</code>.</p>
  283. </div>
  284. </div>
  285. <div class="member">
  286. <h3 class="name" id="sequentialNodes" translate="no">.<a href="#sequentialNodes">sequentialNodes</a><span class="type-signature"> : Array.&lt;<a href="Node.html">Node</a>></span> </h3>
  287. <div class="description">
  288. <p>A list of all sequential nodes.</p>
  289. </div>
  290. </div>
  291. <div class="member">
  292. <h3 class="name" id="shaderStage" translate="no">.<a href="#shaderStage">shaderStage</a><span class="type-signature"> : 'vertex' | 'fragment' | 'compute' | 'any'</span> </h3>
  293. <div class="description">
  294. <p>The current shader stage.</p>
  295. </div>
  296. </div>
  297. <div class="member">
  298. <h3 class="name" id="stack" translate="no">.<a href="#stack">stack</a><span class="type-signature"> : <a href="StackNode.html">StackNode</a></span> </h3>
  299. <div class="description">
  300. <p>The current stack.
  301. This reflects the current process in the code block hierarchy,
  302. it is useful to know if the current process is inside a conditional for example.</p>
  303. </div>
  304. </div>
  305. <div class="member">
  306. <h3 class="name" id="stacks" translate="no">.<a href="#stacks">stacks</a><span class="type-signature"> : Array.&lt;<a href="StackNode.html">StackNode</a>></span> </h3>
  307. <div class="description">
  308. <p>List of stack nodes.
  309. The current stack hierarchy is stored in an array.</p>
  310. </div>
  311. </div>
  312. <div class="member">
  313. <h3 class="name" id="structs" translate="no">.<a href="#structs">structs</a><span class="type-signature"> : Object</span> </h3>
  314. <div class="description">
  315. <p>This dictionary holds the output structs of the builder.
  316. The structs are maintained in an array for each shader stage.</p>
  317. </div>
  318. </div>
  319. <div class="member">
  320. <h3 class="name" id="subBuild" translate="no">.<a href="#subBuild">subBuild</a> </h3>
  321. <div class="description">
  322. <p>Returns the current sub-build layer.</p>
  323. </div>
  324. </div>
  325. <div class="member">
  326. <h3 class="name" id="subBuildFn" translate="no">.<a href="#subBuildFn">subBuildFn</a><span class="type-signature"> : string</span> </h3>
  327. <div class="description">
  328. <p>The current sub-build TSL function(Fn).</p>
  329. <p>Default is <code>null</code>.</p>
  330. </div>
  331. </div>
  332. <div class="member">
  333. <h3 class="name" id="subBuildLayers" translate="no">.<a href="#subBuildLayers">subBuildLayers</a><span class="type-signature"> : Array.&lt;<a href="SubBuildNode.html">SubBuildNode</a>></span> </h3>
  334. <div class="description">
  335. <p>The sub-build layers.</p>
  336. <p>Default is <code>[]</code>.</p>
  337. </div>
  338. </div>
  339. <div class="member">
  340. <h3 class="name" id="tab" translate="no">.<a href="#tab">tab</a><span class="type-signature"> : string</span> </h3>
  341. <div class="description">
  342. <p>A tab value. Used for shader string generation.</p>
  343. <p>Default is <code>'\t'</code>.</p>
  344. </div>
  345. </div>
  346. <div class="member">
  347. <h3 class="name" id="types" translate="no">.<a href="#types">types</a><span class="type-signature"> : Object</span> </h3>
  348. <div class="description">
  349. <p>This dictionary holds the types of the builder.</p>
  350. </div>
  351. </div>
  352. <div class="member">
  353. <h3 class="name" id="uniforms" translate="no">.<a href="#uniforms">uniforms</a><span class="type-signature"> : Object</span> </h3>
  354. <div class="description">
  355. <p>This dictionary holds the node uniforms of the builder.
  356. The uniforms are maintained in an array for each shader stage.</p>
  357. </div>
  358. </div>
  359. <div class="member">
  360. <h3 class="name" id="updateAfterNodes" translate="no">.<a href="#updateAfterNodes">updateAfterNodes</a><span class="type-signature"> : Array.&lt;<a href="Node.html">Node</a>></span> </h3>
  361. <div class="description">
  362. <p>A list of all nodes which <a href="Node.html#updateAfter">Node#updateAfter</a> method should be executed.</p>
  363. </div>
  364. </div>
  365. <div class="member">
  366. <h3 class="name" id="updateBeforeNodes" translate="no">.<a href="#updateBeforeNodes">updateBeforeNodes</a><span class="type-signature"> : Array.&lt;<a href="Node.html">Node</a>></span> </h3>
  367. <div class="description">
  368. <p>A list of all nodes which <a href="Node.html#updateBefore">Node#updateBefore</a> method should be executed.</p>
  369. </div>
  370. </div>
  371. <div class="member">
  372. <h3 class="name" id="updateNodes" translate="no">.<a href="#updateNodes">updateNodes</a><span class="type-signature"> : Array.&lt;<a href="Node.html">Node</a>></span> </h3>
  373. <div class="description">
  374. <p>A list of all nodes which <a href="Node.html#update">Node#update</a> method should be executed.</p>
  375. </div>
  376. </div>
  377. <div class="member">
  378. <h3 class="name" id="vars" translate="no">.<a href="#vars">vars</a><span class="type-signature"> : Object.&lt;string, (Array.&lt;<a href="NodeVar.html">NodeVar</a>>|number)></span> </h3>
  379. <div class="description">
  380. <p>This dictionary holds the node variables of this builder.
  381. The variables are maintained in an array for each shader stage.
  382. This dictionary is also used to count the number of variables
  383. according to their type (const, vars).</p>
  384. </div>
  385. </div>
  386. <div class="member">
  387. <h3 class="name" id="varyings" translate="no">.<a href="#varyings">varyings</a><span class="type-signature"> : Array.&lt;<a href="NodeVarying.html">NodeVarying</a>></span> </h3>
  388. <div class="description">
  389. <p>This array holds the node varyings of this builder.</p>
  390. </div>
  391. </div>
  392. <div class="member">
  393. <h3 class="name" id="vertexShader" translate="no">.<a href="#vertexShader">vertexShader</a><span class="type-signature"> : string</span> </h3>
  394. <div class="description">
  395. <p>The generated vertex shader.</p>
  396. </div>
  397. </div>
  398. <h2 class="subsection-title">Methods</h2>
  399. <h3 class="name name-method" id="addChain" translate="no">.<a href="#addChain">addChain</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span> )</span> </h3>
  400. <div class="method">
  401. <div class="description">
  402. <p>Adds the given node to the internal node chain.
  403. This is used to check recursive calls in node-graph.</p>
  404. </div>
  405. <table class="params">
  406. <tbody>
  407. <tr>
  408. <td class="name">
  409. <strong>node</strong>
  410. </td>
  411. <td class="description last">
  412. <p>The node to add.</p>
  413. </td>
  414. </tr>
  415. </tbody>
  416. </table>
  417. </div>
  418. <h3 class="name name-method" id="addContext" translate="no">.<a href="#addContext">addContext</a><span class="signature">( context : <span class="param-type">Object</span> )</span><span class="type-signature"> : Object</span> </h3>
  419. <div class="method">
  420. <div class="description">
  421. <p>Adds context data to the builder's current context.</p>
  422. </div>
  423. <table class="params">
  424. <tbody>
  425. <tr>
  426. <td class="name">
  427. <strong>context</strong>
  428. </td>
  429. <td class="description last">
  430. <p>The context to add.</p>
  431. </td>
  432. </tr>
  433. </tbody>
  434. </table>
  435. <dl class="details">
  436. <dt class="tag-returns"><strong>Returns:</strong> The previous context.</dt>
  437. </dl>
  438. </div>
  439. <h3 class="name name-method" id="addFlow" translate="no">.<a href="#addFlow">addFlow</a><span class="signature">( shaderStage : <span class="param-type">'vertex' | 'fragment' | 'compute'</span>, node : <span class="param-type"><a href="Node.html">Node</a></span> )</span><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  440. <div class="method">
  441. <div class="description">
  442. <p>Adds the Node to a target flow so that it can generate code in the 'generate' process.</p>
  443. </div>
  444. <table class="params">
  445. <tbody>
  446. <tr>
  447. <td class="name">
  448. <strong>shaderStage</strong>
  449. </td>
  450. <td class="description last">
  451. <p>The shader stage.</p>
  452. </td>
  453. </tr>
  454. <tr>
  455. <td class="name">
  456. <strong>node</strong>
  457. </td>
  458. <td class="description last">
  459. <p>The node to add.</p>
  460. </td>
  461. </tr>
  462. </tbody>
  463. </table>
  464. <dl class="details">
  465. <dt class="tag-returns"><strong>Returns:</strong> The node.</dt>
  466. </dl>
  467. </div>
  468. <h3 class="name name-method" id="addFlowCode" translate="no">.<a href="#addFlowCode">addFlowCode</a><span class="signature">( code : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="NodeBuilder.html">NodeBuilder</a></span> </h3>
  469. <div class="method">
  470. <div class="description">
  471. <p>Adds a code to the current code flow.</p>
  472. </div>
  473. <table class="params">
  474. <tbody>
  475. <tr>
  476. <td class="name">
  477. <strong>code</strong>
  478. </td>
  479. <td class="description last">
  480. <p>Shader code.</p>
  481. </td>
  482. </tr>
  483. </tbody>
  484. </table>
  485. <dl class="details">
  486. <dt class="tag-returns"><strong>Returns:</strong> A reference to this node builder.</dt>
  487. </dl>
  488. </div>
  489. <h3 class="name name-method" id="addFlowCodeHierarchy" translate="no">.<a href="#addFlowCodeHierarchy">addFlowCodeHierarchy</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span>, nodeBlock : <span class="param-type"><a href="Node.html">Node</a></span> )</span> </h3>
  490. <div class="method">
  491. <div class="description">
  492. <p>Adds a code flow based on the code-block hierarchy.
  493. This is used so that code-blocks like If,Else create their variables locally if the Node
  494. is only used inside one of these conditionals in the current shader stage.</p>
  495. </div>
  496. <table class="params">
  497. <tbody>
  498. <tr>
  499. <td class="name">
  500. <strong>node</strong>
  501. </td>
  502. <td class="description last">
  503. <p>The node to add.</p>
  504. </td>
  505. </tr>
  506. <tr>
  507. <td class="name">
  508. <strong>nodeBlock</strong>
  509. </td>
  510. <td class="description last">
  511. <p>Node-based code-block. Usually 'ConditionalNode'.</p>
  512. </td>
  513. </tr>
  514. </tbody>
  515. </table>
  516. </div>
  517. <h3 class="name name-method" id="addFlowTab" translate="no">.<a href="#addFlowTab">addFlowTab</a><span class="signature">()</span><span class="type-signature"> : <a href="NodeBuilder.html">NodeBuilder</a></span> </h3>
  518. <div class="method">
  519. <div class="description">
  520. <p>Add tab in the code that will be generated so that other snippets respect the current tabulation.
  521. Typically used in codes with If,Else.</p>
  522. </div>
  523. <dl class="details">
  524. <dt class="tag-returns"><strong>Returns:</strong> A reference to this node builder.</dt>
  525. </dl>
  526. </div>
  527. <h3 class="name name-method" id="addInclude" translate="no">.<a href="#addInclude">addInclude</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span> )</span><span class="type-signature"> : void</span> </h3>
  528. <div class="method">
  529. <div class="description">
  530. <p>Includes a node in the current function node.</p>
  531. </div>
  532. <table class="params">
  533. <tbody>
  534. <tr>
  535. <td class="name">
  536. <strong>node</strong>
  537. </td>
  538. <td class="description last">
  539. <p>The node to include.</p>
  540. </td>
  541. </tr>
  542. </tbody>
  543. </table>
  544. </div>
  545. <h3 class="name name-method" id="addLineFlowCode" translate="no">.<a href="#addLineFlowCode">addLineFlowCode</a><span class="signature">( code : <span class="param-type">string</span>, node : <span class="param-type"><a href="Node.html">Node</a></span> )</span><span class="type-signature"> : <a href="NodeBuilder.html">NodeBuilder</a></span> </h3>
  546. <div class="method">
  547. <div class="description">
  548. <p>Add a inline-code to the current flow.</p>
  549. </div>
  550. <table class="params">
  551. <tbody>
  552. <tr>
  553. <td class="name">
  554. <strong>code</strong>
  555. </td>
  556. <td class="description last">
  557. <p>The code to add.</p>
  558. </td>
  559. </tr>
  560. <tr>
  561. <td class="name">
  562. <strong>node</strong>
  563. </td>
  564. <td class="description last">
  565. <p>Optional Node, can help the system understand if the Node is part of a code-block.</p>
  566. <p>Default is <code>null</code>.</p>
  567. </td>
  568. </tr>
  569. </tbody>
  570. </table>
  571. <dl class="details">
  572. <dt class="tag-returns"><strong>Returns:</strong> A reference to this node builder.</dt>
  573. </dl>
  574. </div>
  575. <h3 class="name name-method" id="addLineFlowCodeBlock" translate="no">.<a href="#addLineFlowCodeBlock">addLineFlowCodeBlock</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span>, code : <span class="param-type">string</span>, nodeBlock : <span class="param-type"><a href="Node.html">Node</a></span> )</span> </h3>
  576. <div class="method">
  577. <div class="description">
  578. <p>Add a inline-code to the current flow code-block.</p>
  579. </div>
  580. <table class="params">
  581. <tbody>
  582. <tr>
  583. <td class="name">
  584. <strong>node</strong>
  585. </td>
  586. <td class="description last">
  587. <p>The node to add.</p>
  588. </td>
  589. </tr>
  590. <tr>
  591. <td class="name">
  592. <strong>code</strong>
  593. </td>
  594. <td class="description last">
  595. <p>The code to add.</p>
  596. </td>
  597. </tr>
  598. <tr>
  599. <td class="name">
  600. <strong>nodeBlock</strong>
  601. </td>
  602. <td class="description last">
  603. <p>Current ConditionalNode</p>
  604. </td>
  605. </tr>
  606. </tbody>
  607. </table>
  608. </div>
  609. <h3 class="name name-method" id="addNode" translate="no">.<a href="#addNode">addNode</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span> )</span> </h3>
  610. <div class="method">
  611. <div class="description">
  612. <p>Adds a node to this builder.</p>
  613. </div>
  614. <table class="params">
  615. <tbody>
  616. <tr>
  617. <td class="name">
  618. <strong>node</strong>
  619. </td>
  620. <td class="description last">
  621. <p>The node to add.</p>
  622. </td>
  623. </tr>
  624. </tbody>
  625. </table>
  626. </div>
  627. <h3 class="name name-method" id="addSequentialNode" translate="no">.<a href="#addSequentialNode">addSequentialNode</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span> )</span> </h3>
  628. <div class="method">
  629. <div class="description">
  630. <p>It is used to add Nodes that will be used as FRAME and RENDER events,
  631. and need to follow a certain sequence in the calls to work correctly.
  632. This function should be called after 'setup()' in the 'build()' process to ensure that the child nodes are processed first.</p>
  633. </div>
  634. <table class="params">
  635. <tbody>
  636. <tr>
  637. <td class="name">
  638. <strong>node</strong>
  639. </td>
  640. <td class="description last">
  641. <p>The node to add.</p>
  642. </td>
  643. </tr>
  644. </tbody>
  645. </table>
  646. </div>
  647. <h3 class="name name-method" id="addStack" translate="no">.<a href="#addStack">addStack</a><span class="signature">()</span><span class="type-signature"> : <a href="StackNode.html">StackNode</a></span> </h3>
  648. <div class="method">
  649. <div class="description">
  650. <p>Adds a stack node to the internal stack.</p>
  651. </div>
  652. <dl class="details">
  653. <dt class="tag-returns"><strong>Returns:</strong> The added stack node.</dt>
  654. </dl>
  655. </div>
  656. <h3 class="name name-method" id="addSubBuild" translate="no">.<a href="#addSubBuild">addSubBuild</a><span class="signature">( subBuild : <span class="param-type"><a href="SubBuildNode.html">SubBuildNode</a></span> )</span> </h3>
  657. <div class="method">
  658. <div class="description">
  659. <p>Adds a sub-build layer to the node builder.</p>
  660. </div>
  661. <table class="params">
  662. <tbody>
  663. <tr>
  664. <td class="name">
  665. <strong>subBuild</strong>
  666. </td>
  667. <td class="description last">
  668. <p>The sub-build layer to add.</p>
  669. </td>
  670. </tr>
  671. </tbody>
  672. </table>
  673. </div>
  674. <h3 class="name name-method" id="build" translate="no">.<a href="#build">build</a><span class="signature">()</span><span class="type-signature"> : <a href="NodeBuilder.html">NodeBuilder</a></span> </h3>
  675. <div class="method">
  676. <div class="description">
  677. <p>Central build method which controls the build for the given object.</p>
  678. </div>
  679. <dl class="details">
  680. <dt class="tag-returns"><strong>Returns:</strong> A reference to this node builder.</dt>
  681. </dl>
  682. </div>
  683. <h3 class="name name-method" id="buildCode" translate="no">.<a href="#buildCode">buildCode</a><span class="signature">()</span> <span class="type-signature">(abstract) </span></h3>
  684. <div class="method">
  685. <div class="description">
  686. <p>Controls the code build of the shader stages.</p>
  687. </div>
  688. </div>
  689. <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> <span class="type-signature">(abstract) </span></h3>
  690. <div class="method">
  691. <div class="description">
  692. <p>Builds the given shader node.</p>
  693. </div>
  694. <table class="params">
  695. <tbody>
  696. <tr>
  697. <td class="name">
  698. <strong>shaderNode</strong>
  699. </td>
  700. <td class="description last">
  701. <p>The shader node.</p>
  702. </td>
  703. </tr>
  704. </tbody>
  705. </table>
  706. <dl class="details">
  707. <dt class="tag-returns"><strong>Returns:</strong> The function code.</dt>
  708. </dl>
  709. </div>
  710. <h3 class="name name-method" id="buildFunctionNode" translate="no">.<a href="#buildFunctionNode">buildFunctionNode</a><span class="signature">( shaderNode : <span class="param-type">ShaderNodeInternal</span> )</span><span class="type-signature"> : <a href="FunctionNode.html">FunctionNode</a></span> </h3>
  711. <div class="method">
  712. <div class="description">
  713. <p>Returns the native shader operator name for a given generic name.
  714. It is a similar type of method like <a href="NodeBuilder.html#getMethod">NodeBuilder#getMethod</a>.</p>
  715. </div>
  716. <table class="params">
  717. <tbody>
  718. <tr>
  719. <td class="name">
  720. <strong>shaderNode</strong>
  721. </td>
  722. <td class="description last">
  723. <p>The shader node to build the function node with.</p>
  724. </td>
  725. </tr>
  726. </tbody>
  727. </table>
  728. <dl class="details">
  729. <dt class="tag-returns"><strong>Returns:</strong> The build function node.</dt>
  730. </dl>
  731. </div>
  732. <h3 class="name name-method" id="buildUpdateNodes" translate="no">.<a href="#buildUpdateNodes">buildUpdateNodes</a><span class="signature">()</span> </h3>
  733. <div class="method">
  734. <div class="description">
  735. <p>Checks the update types of nodes</p>
  736. </div>
  737. </div>
  738. <h3 class="name name-method" id="changeComponentType" translate="no">.<a href="#changeComponentType">changeComponentType</a><span class="signature">( type : <span class="param-type">string</span>, newComponentType : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  739. <div class="method">
  740. <div class="description">
  741. <p>For a given type this method changes the component type to the
  742. given value. E.g. <code>vec4</code> should be changed to the new component type
  743. <code>uint</code> which results in <code>uvec4</code>.</p>
  744. </div>
  745. <table class="params">
  746. <tbody>
  747. <tr>
  748. <td class="name">
  749. <strong>type</strong>
  750. </td>
  751. <td class="description last">
  752. <p>The type.</p>
  753. </td>
  754. </tr>
  755. <tr>
  756. <td class="name">
  757. <strong>newComponentType</strong>
  758. </td>
  759. <td class="description last">
  760. <p>The new component type.</p>
  761. </td>
  762. </tr>
  763. </tbody>
  764. </table>
  765. <dl class="details">
  766. <dt class="tag-returns"><strong>Returns:</strong> The new type.</dt>
  767. </dl>
  768. </div>
  769. <h3 class="name name-method" id="createCubeRenderTarget" translate="no">.<a href="#createCubeRenderTarget">createCubeRenderTarget</a><span class="signature">( size : <span class="param-type">number</span>, options : <span class="param-type">Object</span> )</span><span class="type-signature"> : <a href="CubeRenderTarget.html">CubeRenderTarget</a></span> </h3>
  770. <div class="method">
  771. <div class="description">
  772. <p>Factory method for creating an instance of <a href="CubeRenderTarget.html">CubeRenderTarget</a> with the given
  773. dimensions and options.</p>
  774. </div>
  775. <table class="params">
  776. <tbody>
  777. <tr>
  778. <td class="name">
  779. <strong>size</strong>
  780. </td>
  781. <td class="description last">
  782. <p>The size of the cube render target.</p>
  783. </td>
  784. </tr>
  785. <tr>
  786. <td class="name">
  787. <strong>options</strong>
  788. </td>
  789. <td class="description last">
  790. <p>The options of the cube render target.</p>
  791. </td>
  792. </tr>
  793. </tbody>
  794. </table>
  795. <dl class="details">
  796. <dt class="tag-returns"><strong>Returns:</strong> The cube render target.</dt>
  797. </dl>
  798. </div>
  799. <h3 class="name name-method" id="createRenderTarget" translate="no">.<a href="#createRenderTarget">createRenderTarget</a><span class="signature">( width : <span class="param-type">number</span>, height : <span class="param-type">number</span>, options : <span class="param-type">Object</span> )</span><span class="type-signature"> : <a href="RenderTarget.html">RenderTarget</a></span> </h3>
  800. <div class="method">
  801. <div class="description">
  802. <p>Factory method for creating an instance of <a href="RenderTarget.html">RenderTarget</a> with the given
  803. dimensions and options.</p>
  804. </div>
  805. <table class="params">
  806. <tbody>
  807. <tr>
  808. <td class="name">
  809. <strong>width</strong>
  810. </td>
  811. <td class="description last">
  812. <p>The width of the render target.</p>
  813. </td>
  814. </tr>
  815. <tr>
  816. <td class="name">
  817. <strong>height</strong>
  818. </td>
  819. <td class="description last">
  820. <p>The height of the render target.</p>
  821. </td>
  822. </tr>
  823. <tr>
  824. <td class="name">
  825. <strong>options</strong>
  826. </td>
  827. <td class="description last">
  828. <p>The options of the render target.</p>
  829. </td>
  830. </tr>
  831. </tbody>
  832. </table>
  833. <dl class="details">
  834. <dt class="tag-returns"><strong>Returns:</strong> The render target.</dt>
  835. </dl>
  836. </div>
  837. <h3 class="name name-method" id="flowBuildStage" translate="no">.<a href="#flowBuildStage">flowBuildStage</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span>, buildStage : <span class="param-type">string</span>, output : <span class="param-type"><a href="Node.html">Node</a> | string</span> )</span><span class="type-signature"> : <a href="Node.html">Node</a> | string</span> </h3>
  838. <div class="method">
  839. <div class="description">
  840. <p>Executes the node in a specific build stage.</p>
  841. <p>This function can be used to arbitrarily execute the specified build stage
  842. outside of the standard build process. For instance, if a node's type depends
  843. on properties created by the 'setup' stage, then flowBuildStage(node, 'setup')
  844. can be used to execute the setup build stage and access its generated nodes
  845. before the standard build process begins.</p>
  846. </div>
  847. <table class="params">
  848. <tbody>
  849. <tr>
  850. <td class="name">
  851. <strong>node</strong>
  852. </td>
  853. <td class="description last">
  854. <p>The node to execute.</p>
  855. </td>
  856. </tr>
  857. <tr>
  858. <td class="name">
  859. <strong>buildStage</strong>
  860. </td>
  861. <td class="description last">
  862. <p>The build stage to execute the node in.</p>
  863. </td>
  864. </tr>
  865. <tr>
  866. <td class="name">
  867. <strong>output</strong>
  868. </td>
  869. <td class="description last">
  870. <p>Expected output type. For example 'vec3'.</p>
  871. <p>Default is <code>null</code>.</p>
  872. </td>
  873. </tr>
  874. </tbody>
  875. </table>
  876. <dl class="details">
  877. <dt class="tag-returns"><strong>Returns:</strong> The result of the node build.</dt>
  878. </dl>
  879. </div>
  880. <h3 class="name name-method" id="flowChildNode" translate="no">.<a href="#flowChildNode">flowChildNode</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span>, output : <span class="param-type">string</span> )</span><span class="type-signature"> : Object</span> </h3>
  881. <div class="method">
  882. <div class="description">
  883. <p>Generates a code flow based on a child Node.</p>
  884. </div>
  885. <table class="params">
  886. <tbody>
  887. <tr>
  888. <td class="name">
  889. <strong>node</strong>
  890. </td>
  891. <td class="description last">
  892. <p>The node to execute.</p>
  893. </td>
  894. </tr>
  895. <tr>
  896. <td class="name">
  897. <strong>output</strong>
  898. </td>
  899. <td class="description last">
  900. <p>Expected output type. For example 'vec3'.</p>
  901. <p>Default is <code>null</code>.</p>
  902. </td>
  903. </tr>
  904. </tbody>
  905. </table>
  906. <dl class="details">
  907. <dt class="tag-returns"><strong>Returns:</strong> The code flow.</dt>
  908. </dl>
  909. </div>
  910. <h3 class="name name-method" id="flowNode" translate="no">.<a href="#flowNode">flowNode</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span> )</span><span class="type-signature"> : Object</span> </h3>
  911. <div class="method">
  912. <div class="description">
  913. <p>Executes the node flow based on a root node to generate the final shader code.</p>
  914. </div>
  915. <table class="params">
  916. <tbody>
  917. <tr>
  918. <td class="name">
  919. <strong>node</strong>
  920. </td>
  921. <td class="description last">
  922. <p>The node to execute.</p>
  923. </td>
  924. </tr>
  925. </tbody>
  926. </table>
  927. <dl class="details">
  928. <dt class="tag-returns"><strong>Returns:</strong> The code flow.</dt>
  929. </dl>
  930. </div>
  931. <h3 class="name name-method" id="flowNodeFromShaderStage" translate="no">.<a href="#flowNodeFromShaderStage">flowNodeFromShaderStage</a><span class="signature">( shaderStage : <span class="param-type">'vertex' | 'fragment' | 'compute' | 'any'</span>, node : <span class="param-type"><a href="Node.html">Node</a></span>, output : <span class="param-type">string</span>, propertyName : <span class="param-type">string</span> )</span><span class="type-signature"> : Object | <a href="Node.html">Node</a></span> </h3>
  932. <div class="method">
  933. <div class="description">
  934. <p>Executes a flow of code in a different stage.</p>
  935. <p>Some nodes like <code>varying()</code> have the ability to compute code in vertex-stage and
  936. return the value in fragment-stage even if it is being executed in an input fragment.</p>
  937. </div>
  938. <table class="params">
  939. <tbody>
  940. <tr>
  941. <td class="name">
  942. <strong>shaderStage</strong>
  943. </td>
  944. <td class="description last">
  945. <p>The shader stage.</p>
  946. </td>
  947. </tr>
  948. <tr>
  949. <td class="name">
  950. <strong>node</strong>
  951. </td>
  952. <td class="description last">
  953. <p>The node to execute.</p>
  954. </td>
  955. </tr>
  956. <tr>
  957. <td class="name">
  958. <strong>output</strong>
  959. </td>
  960. <td class="description last">
  961. <p>Expected output type. For example 'vec3'.</p>
  962. <p>Default is <code>null</code>.</p>
  963. </td>
  964. </tr>
  965. <tr>
  966. <td class="name">
  967. <strong>propertyName</strong>
  968. </td>
  969. <td class="description last">
  970. <p>The property name to assign the result.</p>
  971. <p>Default is <code>null</code>.</p>
  972. </td>
  973. </tr>
  974. </tbody>
  975. </table>
  976. <dl class="details">
  977. <dt class="tag-returns"><strong>Returns:</strong> The code flow or node.build() result.</dt>
  978. </dl>
  979. </div>
  980. <h3 class="name name-method" id="flowShaderNode" translate="no">.<a href="#flowShaderNode">flowShaderNode</a><span class="signature">( shaderNode : <span class="param-type">ShaderNodeInternal</span> )</span><span class="type-signature"> : Object</span> </h3>
  981. <div class="method">
  982. <div class="description">
  983. <p>Generates a code flow based on a TSL function: Fn().</p>
  984. </div>
  985. <table class="params">
  986. <tbody>
  987. <tr>
  988. <td class="name">
  989. <strong>shaderNode</strong>
  990. </td>
  991. <td class="description last">
  992. <p>A function code will be generated based on the input.</p>
  993. </td>
  994. </tr>
  995. </tbody>
  996. </table>
  997. </div>
  998. <h3 class="name name-method" id="flowStagesNode" translate="no">.<a href="#flowStagesNode">flowStagesNode</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span>, output : <span class="param-type">string</span> )</span><span class="type-signature"> : Object</span> </h3>
  999. <div class="method">
  1000. <div class="description">
  1001. <p>Runs the node flow through all the steps of creation, 'setup', 'analyze', 'generate'.</p>
  1002. </div>
  1003. <table class="params">
  1004. <tbody>
  1005. <tr>
  1006. <td class="name">
  1007. <strong>node</strong>
  1008. </td>
  1009. <td class="description last">
  1010. <p>The node to execute.</p>
  1011. </td>
  1012. </tr>
  1013. <tr>
  1014. <td class="name">
  1015. <strong>output</strong>
  1016. </td>
  1017. <td class="description last">
  1018. <p>Expected output type. For example 'vec3'.</p>
  1019. <p>Default is <code>null</code>.</p>
  1020. </td>
  1021. </tr>
  1022. </tbody>
  1023. </table>
  1024. </div>
  1025. <h3 class="name name-method" id="format" translate="no">.<a href="#format">format</a><span class="signature">( snippet : <span class="param-type">string</span>, fromType : <span class="param-type">string</span>, toType : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  1026. <div class="method">
  1027. <div class="description">
  1028. <p>Formats the given shader snippet from a given type into another one. E.g.
  1029. this method might be used to convert a simple float string <code>&quot;1.0&quot;</code> into a
  1030. <code>vec3</code> representation: <code>&quot;vec3&lt;f32&gt;( 1.0 )&quot;</code>.</p>
  1031. </div>
  1032. <table class="params">
  1033. <tbody>
  1034. <tr>
  1035. <td class="name">
  1036. <strong>snippet</strong>
  1037. </td>
  1038. <td class="description last">
  1039. <p>The shader snippet.</p>
  1040. </td>
  1041. </tr>
  1042. <tr>
  1043. <td class="name">
  1044. <strong>fromType</strong>
  1045. </td>
  1046. <td class="description last">
  1047. <p>The source type.</p>
  1048. </td>
  1049. </tr>
  1050. <tr>
  1051. <td class="name">
  1052. <strong>toType</strong>
  1053. </td>
  1054. <td class="description last">
  1055. <p>The target type.</p>
  1056. </td>
  1057. </tr>
  1058. </tbody>
  1059. </table>
  1060. <dl class="details">
  1061. <dt class="tag-returns"><strong>Returns:</strong> The updated shader string.</dt>
  1062. </dl>
  1063. </div>
  1064. <h3 class="name name-method" id="generateArray" translate="no">.<a href="#generateArray">generateArray</a><span class="signature">( type : <span class="param-type">string</span>, count : <span class="param-type">number</span>, values : <span class="param-type">Array.&lt;<a href="Node.html">Node</a>></span> )</span><span class="type-signature"> : string</span> </h3>
  1065. <div class="method">
  1066. <div class="description">
  1067. <p>Generates the array shader string for the given type and value.</p>
  1068. </div>
  1069. <table class="params">
  1070. <tbody>
  1071. <tr>
  1072. <td class="name">
  1073. <strong>type</strong>
  1074. </td>
  1075. <td class="description last">
  1076. <p>The type.</p>
  1077. </td>
  1078. </tr>
  1079. <tr>
  1080. <td class="name">
  1081. <strong>count</strong>
  1082. </td>
  1083. <td class="description last">
  1084. <p>The count.</p>
  1085. </td>
  1086. </tr>
  1087. <tr>
  1088. <td class="name">
  1089. <strong>values</strong>
  1090. </td>
  1091. <td class="description last">
  1092. <p>The default values.</p>
  1093. <p>Default is <code>null</code>.</p>
  1094. </td>
  1095. </tr>
  1096. </tbody>
  1097. </table>
  1098. <dl class="details">
  1099. <dt class="tag-returns"><strong>Returns:</strong> The generated value as a shader string.</dt>
  1100. </dl>
  1101. </div>
  1102. <h3 class="name name-method" id="generateArrayDeclaration" translate="no">.<a href="#generateArrayDeclaration">generateArrayDeclaration</a><span class="signature">( type : <span class="param-type">string</span>, count : <span class="param-type">number</span> )</span><span class="type-signature"> : string</span> </h3>
  1103. <div class="method">
  1104. <div class="description">
  1105. <p>Generates the array declaration string.</p>
  1106. </div>
  1107. <table class="params">
  1108. <tbody>
  1109. <tr>
  1110. <td class="name">
  1111. <strong>type</strong>
  1112. </td>
  1113. <td class="description last">
  1114. <p>The type.</p>
  1115. </td>
  1116. </tr>
  1117. <tr>
  1118. <td class="name">
  1119. <strong>count</strong>
  1120. </td>
  1121. <td class="description last">
  1122. <p>The count.</p>
  1123. </td>
  1124. </tr>
  1125. </tbody>
  1126. </table>
  1127. <dl class="details">
  1128. <dt class="tag-returns"><strong>Returns:</strong> The generated value as a shader string.</dt>
  1129. </dl>
  1130. </div>
  1131. <h3 class="name name-method" id="generateConst" translate="no">.<a href="#generateConst">generateConst</a><span class="signature">( type : <span class="param-type">string</span>, value : <span class="param-type"><a href="global.html#any">any</a></span> )</span><span class="type-signature"> : string</span> </h3>
  1132. <div class="method">
  1133. <div class="description">
  1134. <p>Generates the shader string for the given type and value.</p>
  1135. </div>
  1136. <table class="params">
  1137. <tbody>
  1138. <tr>
  1139. <td class="name">
  1140. <strong>type</strong>
  1141. </td>
  1142. <td class="description last">
  1143. <p>The type.</p>
  1144. </td>
  1145. </tr>
  1146. <tr>
  1147. <td class="name">
  1148. <strong>value</strong>
  1149. </td>
  1150. <td class="description last">
  1151. <p>The value.</p>
  1152. <p>Default is <code>null</code>.</p>
  1153. </td>
  1154. </tr>
  1155. </tbody>
  1156. </table>
  1157. <dl class="details">
  1158. <dt class="tag-returns"><strong>Returns:</strong> The generated value as a shader string.</dt>
  1159. </dl>
  1160. </div>
  1161. <h3 class="name name-method" id="generateStruct" translate="no">.<a href="#generateStruct">generateStruct</a><span class="signature">( type : <span class="param-type">string</span>, membersLayout : <span class="param-type">Array.&lt;Object></span>, values : <span class="param-type">Array.&lt;<a href="Node.html">Node</a>></span> )</span><span class="type-signature"> : string</span> </h3>
  1162. <div class="method">
  1163. <div class="description">
  1164. <p>Generates the struct shader string.</p>
  1165. </div>
  1166. <table class="params">
  1167. <tbody>
  1168. <tr>
  1169. <td class="name">
  1170. <strong>type</strong>
  1171. </td>
  1172. <td class="description last">
  1173. <p>The type.</p>
  1174. </td>
  1175. </tr>
  1176. <tr>
  1177. <td class="name">
  1178. <strong>membersLayout</strong>
  1179. </td>
  1180. <td class="description last">
  1181. <p>The count.</p>
  1182. </td>
  1183. </tr>
  1184. <tr>
  1185. <td class="name">
  1186. <strong>values</strong>
  1187. </td>
  1188. <td class="description last">
  1189. <p>The default values.</p>
  1190. <p>Default is <code>null</code>.</p>
  1191. </td>
  1192. </tr>
  1193. </tbody>
  1194. </table>
  1195. <dl class="details">
  1196. <dt class="tag-returns"><strong>Returns:</strong> The generated value as a shader string.</dt>
  1197. </dl>
  1198. </div>
  1199. <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> )</span><span class="type-signature"> : string</span> <span class="type-signature">(abstract) </span></h3>
  1200. <div class="method">
  1201. <div class="description">
  1202. <p>Generates a texture sample shader string for the given texture data.</p>
  1203. </div>
  1204. <table class="params">
  1205. <tbody>
  1206. <tr>
  1207. <td class="name">
  1208. <strong>texture</strong>
  1209. </td>
  1210. <td class="description last">
  1211. <p>The texture.</p>
  1212. </td>
  1213. </tr>
  1214. <tr>
  1215. <td class="name">
  1216. <strong>textureProperty</strong>
  1217. </td>
  1218. <td class="description last">
  1219. <p>The texture property name.</p>
  1220. </td>
  1221. </tr>
  1222. <tr>
  1223. <td class="name">
  1224. <strong>uvSnippet</strong>
  1225. </td>
  1226. <td class="description last">
  1227. <p>Snippet defining the texture coordinates.</p>
  1228. </td>
  1229. </tr>
  1230. </tbody>
  1231. </table>
  1232. <dl class="details">
  1233. <dt class="tag-returns"><strong>Returns:</strong> The generated shader string.</dt>
  1234. </dl>
  1235. </div>
  1236. <h3 class="name name-method" id="generateTextureLod" translate="no">.<a href="#generateTextureLod">generateTextureLod</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>, levelSnippet : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> <span class="type-signature">(abstract) </span></h3>
  1237. <div class="method">
  1238. <div class="description">
  1239. <p>Generates a texture LOD shader string for the given texture data.</p>
  1240. </div>
  1241. <table class="params">
  1242. <tbody>
  1243. <tr>
  1244. <td class="name">
  1245. <strong>texture</strong>
  1246. </td>
  1247. <td class="description last">
  1248. <p>The texture.</p>
  1249. </td>
  1250. </tr>
  1251. <tr>
  1252. <td class="name">
  1253. <strong>textureProperty</strong>
  1254. </td>
  1255. <td class="description last">
  1256. <p>The texture property name.</p>
  1257. </td>
  1258. </tr>
  1259. <tr>
  1260. <td class="name">
  1261. <strong>uvSnippet</strong>
  1262. </td>
  1263. <td class="description last">
  1264. <p>Snippet defining the texture coordinates.</p>
  1265. </td>
  1266. </tr>
  1267. <tr>
  1268. <td class="name">
  1269. <strong>depthSnippet</strong>
  1270. </td>
  1271. <td class="description last">
  1272. <p>Snippet defining the 0-based texture array index to sample.</p>
  1273. </td>
  1274. </tr>
  1275. <tr>
  1276. <td class="name">
  1277. <strong>levelSnippet</strong>
  1278. </td>
  1279. <td class="description last">
  1280. <p>Snippet defining the mip level.</p>
  1281. </td>
  1282. </tr>
  1283. </tbody>
  1284. </table>
  1285. <dl class="details">
  1286. <dt class="tag-returns"><strong>Returns:</strong> The generated shader string.</dt>
  1287. </dl>
  1288. </div>
  1289. <h3 class="name name-method" id="getActiveStack" translate="no">.<a href="#getActiveStack">getActiveStack</a><span class="signature">()</span><span class="type-signature"> : <a href="StackNode.html">StackNode</a></span> </h3>
  1290. <div class="method">
  1291. <div class="description">
  1292. <p>Returns the active stack.</p>
  1293. </div>
  1294. <dl class="details">
  1295. <dt class="tag-returns"><strong>Returns:</strong> The active stack.</dt>
  1296. </dl>
  1297. </div>
  1298. <h3 class="name name-method" id="getAttribute" translate="no">.<a href="#getAttribute">getAttribute</a><span class="signature">( name : <span class="param-type">string</span>, type : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="NodeAttribute.html">NodeAttribute</a></span> </h3>
  1299. <div class="method">
  1300. <div class="description">
  1301. <p>Returns a node attribute for the given name and type.</p>
  1302. </div>
  1303. <table class="params">
  1304. <tbody>
  1305. <tr>
  1306. <td class="name">
  1307. <strong>name</strong>
  1308. </td>
  1309. <td class="description last">
  1310. <p>The attribute's name.</p>
  1311. </td>
  1312. </tr>
  1313. <tr>
  1314. <td class="name">
  1315. <strong>type</strong>
  1316. </td>
  1317. <td class="description last">
  1318. <p>The attribute's type.</p>
  1319. </td>
  1320. </tr>
  1321. </tbody>
  1322. </table>
  1323. <dl class="details">
  1324. <dt class="tag-returns"><strong>Returns:</strong> The node attribute.</dt>
  1325. </dl>
  1326. </div>
  1327. <h3 class="name name-method" id="getAttributes" translate="no">.<a href="#getAttributes">getAttributes</a><span class="signature">( shaderStage : <span class="param-type">'vertex' | 'fragment' | 'compute' | 'any'</span> )</span><span class="type-signature"> : string</span> <span class="type-signature">(abstract) </span></h3>
  1328. <div class="method">
  1329. <div class="description">
  1330. <p>Returns the attribute definitions as a shader string for the given shader stage.</p>
  1331. </div>
  1332. <table class="params">
  1333. <tbody>
  1334. <tr>
  1335. <td class="name">
  1336. <strong>shaderStage</strong>
  1337. </td>
  1338. <td class="description last">
  1339. <p>The shader stage.</p>
  1340. </td>
  1341. </tr>
  1342. </tbody>
  1343. </table>
  1344. <dl class="details">
  1345. <dt class="tag-returns"><strong>Returns:</strong> The attribute code section.</dt>
  1346. </dl>
  1347. </div>
  1348. <h3 class="name name-method" id="getAttributesArray" translate="no">.<a href="#getAttributesArray">getAttributesArray</a><span class="signature">()</span><span class="type-signature"> : Array.&lt;<a href="NodeAttribute.html">NodeAttribute</a>></span> </h3>
  1349. <div class="method">
  1350. <div class="description">
  1351. <p>Returns an array holding all node attributes of this node builder.</p>
  1352. </div>
  1353. <dl class="details">
  1354. <dt class="tag-returns"><strong>Returns:</strong> The node attributes of this builder.</dt>
  1355. </dl>
  1356. </div>
  1357. <h3 class="name name-method" id="getBaseStack" translate="no">.<a href="#getBaseStack">getBaseStack</a><span class="signature">()</span><span class="type-signature"> : <a href="StackNode.html">StackNode</a></span> </h3>
  1358. <div class="method">
  1359. <div class="description">
  1360. <p>Returns the base stack.</p>
  1361. </div>
  1362. <dl class="details">
  1363. <dt class="tag-returns"><strong>Returns:</strong> The base stack.</dt>
  1364. </dl>
  1365. </div>
  1366. <h3 class="name name-method" id="getBindGroupArray" translate="no">.<a href="#getBindGroupArray">getBindGroupArray</a><span class="signature">( groupName : <span class="param-type">string</span>, shaderStage : <span class="param-type">'vertex' | 'fragment' | 'compute' | 'any'</span> )</span><span class="type-signature"> : Array.&lt;<a href="NodeUniformsGroup.html">NodeUniformsGroup</a>></span> </h3>
  1367. <div class="method">
  1368. <div class="description">
  1369. <p>Returns an array of node uniform groups for the given group name and shader stage.</p>
  1370. </div>
  1371. <table class="params">
  1372. <tbody>
  1373. <tr>
  1374. <td class="name">
  1375. <strong>groupName</strong>
  1376. </td>
  1377. <td class="description last">
  1378. <p>The group name.</p>
  1379. </td>
  1380. </tr>
  1381. <tr>
  1382. <td class="name">
  1383. <strong>shaderStage</strong>
  1384. </td>
  1385. <td class="description last">
  1386. <p>The shader stage.</p>
  1387. </td>
  1388. </tr>
  1389. </tbody>
  1390. </table>
  1391. <dl class="details">
  1392. <dt class="tag-returns"><strong>Returns:</strong> The array of node uniform groups.</dt>
  1393. </dl>
  1394. </div>
  1395. <h3 class="name name-method" id="getBindGroupsCache" translate="no">.<a href="#getBindGroupsCache">getBindGroupsCache</a><span class="signature">()</span><span class="type-signature"> : <a href="ChainMap.html">ChainMap</a></span> </h3>
  1396. <div class="method">
  1397. <div class="description">
  1398. <p>Returns the bind groups of the current renderer.</p>
  1399. </div>
  1400. <dl class="details">
  1401. <dt class="tag-returns"><strong>Returns:</strong> The cache.</dt>
  1402. </dl>
  1403. </div>
  1404. <h3 class="name name-method" id="getBindings" translate="no">.<a href="#getBindings">getBindings</a><span class="signature">()</span><span class="type-signature"> : Array.&lt;<a href="BindGroup.html">BindGroup</a>></span> </h3>
  1405. <div class="method">
  1406. <div class="description">
  1407. <p>Returns a list bindings of all shader stages separated by groups.</p>
  1408. </div>
  1409. <dl class="details">
  1410. <dt class="tag-returns"><strong>Returns:</strong> The list of bindings.</dt>
  1411. </dl>
  1412. </div>
  1413. <h3 class="name name-method" id="getBufferAttributeFromNode" translate="no">.<a href="#getBufferAttributeFromNode">getBufferAttributeFromNode</a><span class="signature">( node : <span class="param-type"><a href="BufferAttributeNode.html">BufferAttributeNode</a></span>, type : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="NodeAttribute.html">NodeAttribute</a></span> </h3>
  1414. <div class="method">
  1415. <div class="description">
  1416. <p>Returns an instance of <a href="NodeAttribute.html">NodeAttribute</a> for the given buffer attribute node.</p>
  1417. </div>
  1418. <table class="params">
  1419. <tbody>
  1420. <tr>
  1421. <td class="name">
  1422. <strong>node</strong>
  1423. </td>
  1424. <td class="description last">
  1425. <p>The buffer attribute node.</p>
  1426. </td>
  1427. </tr>
  1428. <tr>
  1429. <td class="name">
  1430. <strong>type</strong>
  1431. </td>
  1432. <td class="description last">
  1433. <p>The node type.</p>
  1434. </td>
  1435. </tr>
  1436. </tbody>
  1437. </table>
  1438. <dl class="details">
  1439. <dt class="tag-returns"><strong>Returns:</strong> The node attribute.</dt>
  1440. </dl>
  1441. </div>
  1442. <h3 class="name name-method" id="getBuildStage" translate="no">.<a href="#getBuildStage">getBuildStage</a><span class="signature">()</span><span class="type-signature"> : 'setup' | 'analyze' | 'generate'</span> </h3>
  1443. <div class="method">
  1444. <div class="description">
  1445. <p>Returns the current build stage.</p>
  1446. </div>
  1447. <dl class="details">
  1448. <dt class="tag-returns"><strong>Returns:</strong> The current build stage.</dt>
  1449. </dl>
  1450. </div>
  1451. <h3 class="name name-method" id="getCache" translate="no">.<a href="#getCache">getCache</a><span class="signature">()</span><span class="type-signature"> : <a href="NodeCache.html">NodeCache</a></span> </h3>
  1452. <div class="method">
  1453. <div class="description">
  1454. <p>Returns the builder's current cache.</p>
  1455. </div>
  1456. <dl class="details">
  1457. <dt class="tag-returns"><strong>Returns:</strong> The builder's current cache.</dt>
  1458. </dl>
  1459. </div>
  1460. <h3 class="name name-method" id="getCacheFromNode" translate="no">.<a href="#getCacheFromNode">getCacheFromNode</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span>, parent : <span class="param-type">boolean</span> )</span><span class="type-signature"> : <a href="NodeCache.html">NodeCache</a></span> </h3>
  1461. <div class="method">
  1462. <div class="description">
  1463. <p>Returns a cache for the given node.</p>
  1464. </div>
  1465. <table class="params">
  1466. <tbody>
  1467. <tr>
  1468. <td class="name">
  1469. <strong>node</strong>
  1470. </td>
  1471. <td class="description last">
  1472. <p>The node.</p>
  1473. </td>
  1474. </tr>
  1475. <tr>
  1476. <td class="name">
  1477. <strong>parent</strong>
  1478. </td>
  1479. <td class="description last">
  1480. <p>Whether this node refers to a shared parent cache or not.</p>
  1481. <p>Default is <code>true</code>.</p>
  1482. </td>
  1483. </tr>
  1484. </tbody>
  1485. </table>
  1486. <dl class="details">
  1487. <dt class="tag-returns"><strong>Returns:</strong> The cache.</dt>
  1488. </dl>
  1489. </div>
  1490. <h3 class="name name-method" id="getClosestSubBuild" translate="no">.<a href="#getClosestSubBuild">getClosestSubBuild</a><span class="signature">( data : <span class="param-type"><a href="Node.html">Node</a> | Set.&lt;string> | Array.&lt;string></span> )</span><span class="type-signature"> : string</span> </h3>
  1491. <div class="method">
  1492. <div class="description">
  1493. <p>Returns the closest sub-build layer for the given data.</p>
  1494. </div>
  1495. <table class="params">
  1496. <tbody>
  1497. <tr>
  1498. <td class="name">
  1499. <strong>data</strong>
  1500. </td>
  1501. <td class="description last">
  1502. <p>The data to get the closest sub-build layer from.</p>
  1503. </td>
  1504. </tr>
  1505. </tbody>
  1506. </table>
  1507. <dl class="details">
  1508. <dt class="tag-returns"><strong>Returns:</strong> The closest sub-build name or null if none found.</dt>
  1509. </dl>
  1510. </div>
  1511. <h3 class="name name-method" id="getCodeFromNode" translate="no">.<a href="#getCodeFromNode">getCodeFromNode</a><span class="signature">( node : <span class="param-type"><a href="CodeNode.html">CodeNode</a></span>, type : <span class="param-type">string</span>, shaderStage : <span class="param-type">'vertex' | 'fragment' | 'compute' | 'any'</span> )</span><span class="type-signature"> : <a href="NodeCode.html">NodeCode</a></span> </h3>
  1512. <div class="method">
  1513. <div class="description">
  1514. <p>Returns an instance of <a href="NodeCode.html">NodeCode</a> for the given code node.</p>
  1515. </div>
  1516. <table class="params">
  1517. <tbody>
  1518. <tr>
  1519. <td class="name">
  1520. <strong>node</strong>
  1521. </td>
  1522. <td class="description last">
  1523. <p>The code node.</p>
  1524. </td>
  1525. </tr>
  1526. <tr>
  1527. <td class="name">
  1528. <strong>type</strong>
  1529. </td>
  1530. <td class="description last">
  1531. <p>The node type.</p>
  1532. </td>
  1533. </tr>
  1534. <tr>
  1535. <td class="name">
  1536. <strong>shaderStage</strong>
  1537. </td>
  1538. <td class="description last">
  1539. <p>The shader stage.</p>
  1540. <p>Default is <code>this.shaderStage</code>.</p>
  1541. </td>
  1542. </tr>
  1543. </tbody>
  1544. </table>
  1545. <dl class="details">
  1546. <dt class="tag-returns"><strong>Returns:</strong> The node code.</dt>
  1547. </dl>
  1548. </div>
  1549. <h3 class="name name-method" id="getCodes" translate="no">.<a href="#getCodes">getCodes</a><span class="signature">( shaderStage : <span class="param-type">'vertex' | 'fragment' | 'compute' | 'any'</span> )</span><span class="type-signature"> : string</span> </h3>
  1550. <div class="method">
  1551. <div class="description">
  1552. <p>Returns the native code definitions as a shader string for the given shader stage.</p>
  1553. </div>
  1554. <table class="params">
  1555. <tbody>
  1556. <tr>
  1557. <td class="name">
  1558. <strong>shaderStage</strong>
  1559. </td>
  1560. <td class="description last">
  1561. <p>The shader stage.</p>
  1562. </td>
  1563. </tr>
  1564. </tbody>
  1565. </table>
  1566. <dl class="details">
  1567. <dt class="tag-returns"><strong>Returns:</strong> The native code section.</dt>
  1568. </dl>
  1569. </div>
  1570. <h3 class="name name-method" id="getComponentType" translate="no">.<a href="#getComponentType">getComponentType</a><span class="signature">( type : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  1571. <div class="method">
  1572. <div class="description">
  1573. <p>Returns the component type for a given type.</p>
  1574. </div>
  1575. <table class="params">
  1576. <tbody>
  1577. <tr>
  1578. <td class="name">
  1579. <strong>type</strong>
  1580. </td>
  1581. <td class="description last">
  1582. <p>The type.</p>
  1583. </td>
  1584. </tr>
  1585. </tbody>
  1586. </table>
  1587. <dl class="details">
  1588. <dt class="tag-returns"><strong>Returns:</strong> The component type.</dt>
  1589. </dl>
  1590. </div>
  1591. <h3 class="name name-method" id="getComponentTypeFromTexture" translate="no">.<a href="#getComponentTypeFromTexture">getComponentTypeFromTexture</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span> )</span><span class="type-signature"> : string</span> </h3>
  1592. <div class="method">
  1593. <div class="description">
  1594. <p>Returns the component type of a given texture.</p>
  1595. </div>
  1596. <table class="params">
  1597. <tbody>
  1598. <tr>
  1599. <td class="name">
  1600. <strong>texture</strong>
  1601. </td>
  1602. <td class="description last">
  1603. <p>The texture.</p>
  1604. </td>
  1605. </tr>
  1606. </tbody>
  1607. </table>
  1608. <dl class="details">
  1609. <dt class="tag-returns"><strong>Returns:</strong> The component type.</dt>
  1610. </dl>
  1611. </div>
  1612. <h3 class="name name-method" id="getContext" translate="no">.<a href="#getContext">getContext</a><span class="signature">()</span><span class="type-signature"> : Object</span> </h3>
  1613. <div class="method">
  1614. <div class="description">
  1615. <p>Returns the builder's current context.</p>
  1616. </div>
  1617. <dl class="details">
  1618. <dt class="tag-returns"><strong>Returns:</strong> The builder's current context.</dt>
  1619. </dl>
  1620. </div>
  1621. <h3 class="name name-method" id="getDataFromNode" translate="no">.<a href="#getDataFromNode">getDataFromNode</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span>, shaderStage : <span class="param-type">'vertex' | 'fragment' | 'compute' | 'any'</span>, cache : <span class="param-type"><a href="NodeCache.html">NodeCache</a></span> )</span><span class="type-signature"> : Object</span> </h3>
  1622. <div class="method">
  1623. <div class="description">
  1624. <p>The builder maintains (cached) data for each node during the building process. This method
  1625. can be used to get these data for a specific shader stage and cache.</p>
  1626. </div>
  1627. <table class="params">
  1628. <tbody>
  1629. <tr>
  1630. <td class="name">
  1631. <strong>node</strong>
  1632. </td>
  1633. <td class="description last">
  1634. <p>The node to get the data for.</p>
  1635. </td>
  1636. </tr>
  1637. <tr>
  1638. <td class="name">
  1639. <strong>shaderStage</strong>
  1640. </td>
  1641. <td class="description last">
  1642. <p>The shader stage.</p>
  1643. <p>Default is <code>this.shaderStage</code>.</p>
  1644. </td>
  1645. </tr>
  1646. <tr>
  1647. <td class="name">
  1648. <strong>cache</strong>
  1649. </td>
  1650. <td class="description last">
  1651. <p>An optional cache.</p>
  1652. <p>Default is <code>null</code>.</p>
  1653. </td>
  1654. </tr>
  1655. </tbody>
  1656. </table>
  1657. <dl class="details">
  1658. <dt class="tag-returns"><strong>Returns:</strong> The node data.</dt>
  1659. </dl>
  1660. </div>
  1661. <h3 class="name name-method" id="getDrawIndex" translate="no">.<a href="#getDrawIndex">getDrawIndex</a><span class="signature">()</span><span class="type-signature"> : string</span> <span class="type-signature">(abstract) </span></h3>
  1662. <div class="method">
  1663. <div class="description">
  1664. <p>Returns the drawIndex input variable as a native shader string.
  1665. Only relevant for WebGL and its <code>WEBGL_multi_draw</code> extension.</p>
  1666. </div>
  1667. <dl class="details">
  1668. <dt class="tag-returns"><strong>Returns:</strong> The drawIndex shader string.</dt>
  1669. </dl>
  1670. </div>
  1671. <h3 class="name name-method" id="getElementType" translate="no">.<a href="#getElementType">getElementType</a><span class="signature">( type : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  1672. <div class="method">
  1673. <div class="description">
  1674. <p>Returns the element type for a given type.</p>
  1675. </div>
  1676. <table class="params">
  1677. <tbody>
  1678. <tr>
  1679. <td class="name">
  1680. <strong>type</strong>
  1681. </td>
  1682. <td class="description last">
  1683. <p>The type.</p>
  1684. </td>
  1685. </tr>
  1686. </tbody>
  1687. </table>
  1688. <dl class="details">
  1689. <dt class="tag-returns"><strong>Returns:</strong> The element type.</dt>
  1690. </dl>
  1691. </div>
  1692. <h3 class="name name-method" id="getFlowData" translate="no">.<a href="#getFlowData">getFlowData</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span>, shaderStage : <span class="param-type">'vertex' | 'fragment' | 'compute' | 'any'</span> )</span><span class="type-signature"> : Object</span> </h3>
  1693. <div class="method">
  1694. <div class="description">
  1695. <p>Gets the current flow data based on a Node.</p>
  1696. </div>
  1697. <table class="params">
  1698. <tbody>
  1699. <tr>
  1700. <td class="name">
  1701. <strong>node</strong>
  1702. </td>
  1703. <td class="description last">
  1704. <p>Node that the flow was started.</p>
  1705. </td>
  1706. </tr>
  1707. <tr>
  1708. <td class="name">
  1709. <strong>shaderStage</strong>
  1710. </td>
  1711. <td class="description last">
  1712. <p>The shader stage.</p>
  1713. </td>
  1714. </tr>
  1715. </tbody>
  1716. </table>
  1717. <dl class="details">
  1718. <dt class="tag-returns"><strong>Returns:</strong> The flow data.</dt>
  1719. </dl>
  1720. </div>
  1721. <h3 class="name name-method" id="getFragCoord" translate="no">.<a href="#getFragCoord">getFragCoord</a><span class="signature">()</span><span class="type-signature"> : string</span> <span class="type-signature">(abstract) </span></h3>
  1722. <div class="method">
  1723. <div class="description">
  1724. <p>Returns the fragCoord input variable as a native shader string.</p>
  1725. </div>
  1726. <dl class="details">
  1727. <dt class="tag-returns"><strong>Returns:</strong> The fragCoord shader string.</dt>
  1728. </dl>
  1729. </div>
  1730. <h3 class="name name-method" id="getFrontFacing" translate="no">.<a href="#getFrontFacing">getFrontFacing</a><span class="signature">()</span><span class="type-signature"> : string</span> <span class="type-signature">(abstract) </span></h3>
  1731. <div class="method">
  1732. <div class="description">
  1733. <p>Returns the frontFacing input variable as a native shader string.</p>
  1734. </div>
  1735. <dl class="details">
  1736. <dt class="tag-returns"><strong>Returns:</strong> The frontFacing shader string.</dt>
  1737. </dl>
  1738. </div>
  1739. <h3 class="name name-method" id="getFunctionOperator" translate="no">.<a href="#getFunctionOperator">getFunctionOperator</a><span class="signature">( op : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> <span class="type-signature">(abstract) </span></h3>
  1740. <div class="method">
  1741. <div class="description">
  1742. <p>Returns the native shader operator name for a given generic name.
  1743. It is a similar type of method like <a href="NodeBuilder.html#getMethod">NodeBuilder#getMethod</a>.</p>
  1744. </div>
  1745. <table class="params">
  1746. <tbody>
  1747. <tr>
  1748. <td class="name">
  1749. <strong>op</strong>
  1750. </td>
  1751. <td class="description last">
  1752. <p>The operator name to resolve.</p>
  1753. </td>
  1754. </tr>
  1755. </tbody>
  1756. </table>
  1757. <dl class="details">
  1758. <dt class="tag-returns"><strong>Returns:</strong> The resolved operator name.</dt>
  1759. </dl>
  1760. </div>
  1761. <h3 class="name name-method" id="getHash" translate="no">.<a href="#getHash">getHash</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
  1762. <div class="method">
  1763. <div class="description">
  1764. <p>Returns the hash of this node builder.</p>
  1765. </div>
  1766. <dl class="details">
  1767. <dt class="tag-returns"><strong>Returns:</strong> The hash.</dt>
  1768. </dl>
  1769. </div>
  1770. <h3 class="name name-method" id="getInstanceIndex" translate="no">.<a href="#getInstanceIndex">getInstanceIndex</a><span class="signature">()</span><span class="type-signature"> : string</span> <span class="type-signature">(abstract) </span></h3>
  1771. <div class="method">
  1772. <div class="description">
  1773. <p>Contextually returns either the vertex stage instance index builtin
  1774. or the linearized index of an compute invocation within a grid of workgroups.</p>
  1775. </div>
  1776. <dl class="details">
  1777. <dt class="tag-returns"><strong>Returns:</strong> The instanceIndex shader string.</dt>
  1778. </dl>
  1779. </div>
  1780. <h3 class="name name-method" id="getIntegerType" translate="no">.<a href="#getIntegerType">getIntegerType</a><span class="signature">( type : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  1781. <div class="method">
  1782. <div class="description">
  1783. <p>Returns the integer type pendant for the given type.</p>
  1784. </div>
  1785. <table class="params">
  1786. <tbody>
  1787. <tr>
  1788. <td class="name">
  1789. <strong>type</strong>
  1790. </td>
  1791. <td class="description last">
  1792. <p>The type.</p>
  1793. </td>
  1794. </tr>
  1795. </tbody>
  1796. </table>
  1797. <dl class="details">
  1798. <dt class="tag-returns"><strong>Returns:</strong> The integer type.</dt>
  1799. </dl>
  1800. </div>
  1801. <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> <span class="type-signature">(abstract) </span></h3>
  1802. <div class="method">
  1803. <div class="description">
  1804. <p>Returns the native shader method name for a given generic name. E.g.
  1805. the method name <code>textureDimensions</code> matches the WGSL name but must be
  1806. resolved to <code>textureSize</code> in GLSL.</p>
  1807. </div>
  1808. <table class="params">
  1809. <tbody>
  1810. <tr>
  1811. <td class="name">
  1812. <strong>method</strong>
  1813. </td>
  1814. <td class="description last">
  1815. <p>The method name to resolve.</p>
  1816. </td>
  1817. </tr>
  1818. </tbody>
  1819. </table>
  1820. <dl class="details">
  1821. <dt class="tag-returns"><strong>Returns:</strong> The resolved method name.</dt>
  1822. </dl>
  1823. </div>
  1824. <h3 class="name name-method" id="getNodeFromHash" translate="no">.<a href="#getNodeFromHash">getNodeFromHash</a><span class="signature">( hash : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  1825. <div class="method">
  1826. <div class="description">
  1827. <p>Returns a node for the given hash, see <a href="NodeBuilder.html#setHashNode">NodeBuilder#setHashNode</a>.</p>
  1828. </div>
  1829. <table class="params">
  1830. <tbody>
  1831. <tr>
  1832. <td class="name">
  1833. <strong>hash</strong>
  1834. </td>
  1835. <td class="description last">
  1836. <p>The hash of the node.</p>
  1837. </td>
  1838. </tr>
  1839. </tbody>
  1840. </table>
  1841. <dl class="details">
  1842. <dt class="tag-returns"><strong>Returns:</strong> The found node.</dt>
  1843. </dl>
  1844. </div>
  1845. <h3 class="name name-method" id="getNodeProperties" translate="no">.<a href="#getNodeProperties">getNodeProperties</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span>, shaderStage : <span class="param-type">'vertex' | 'fragment' | 'compute' | 'any'</span> )</span><span class="type-signature"> : Object</span> </h3>
  1846. <div class="method">
  1847. <div class="description">
  1848. <p>Returns the properties for the given node and shader stage.</p>
  1849. <p>Properties are typically used within a build stage to reference a node's
  1850. child node or nodes manually assigned to the properties in a separate build stage.
  1851. A typical usage pattern for defining nodes manually would be assigning dependency nodes
  1852. to the current node's properties in the setup stage and building those properties in the generate stage.</p>
  1853. </div>
  1854. <table class="params">
  1855. <tbody>
  1856. <tr>
  1857. <td class="name">
  1858. <strong>node</strong>
  1859. </td>
  1860. <td class="description last">
  1861. <p>The node to get the properties for.</p>
  1862. </td>
  1863. </tr>
  1864. <tr>
  1865. <td class="name">
  1866. <strong>shaderStage</strong>
  1867. </td>
  1868. <td class="description last">
  1869. <p>The shader stage.</p>
  1870. <p>Default is <code>'any'</code>.</p>
  1871. </td>
  1872. </tr>
  1873. </tbody>
  1874. </table>
  1875. <dl class="details">
  1876. <dt class="tag-returns"><strong>Returns:</strong> The node properties.</dt>
  1877. </dl>
  1878. </div>
  1879. <h3 class="name name-method" id="getNodeUniform" translate="no">.<a href="#getNodeUniform">getNodeUniform</a><span class="signature">( uniformNode : <span class="param-type"><a href="NodeUniform.html">NodeUniform</a></span>, type : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="Uniform.html">Uniform</a></span> </h3>
  1880. <div class="method">
  1881. <div class="description">
  1882. <p>Returns a uniform representation which is later used for UBO generation and rendering.</p>
  1883. </div>
  1884. <table class="params">
  1885. <tbody>
  1886. <tr>
  1887. <td class="name">
  1888. <strong>uniformNode</strong>
  1889. </td>
  1890. <td class="description last">
  1891. <p>The uniform node.</p>
  1892. </td>
  1893. </tr>
  1894. <tr>
  1895. <td class="name">
  1896. <strong>type</strong>
  1897. </td>
  1898. <td class="description last">
  1899. <p>The requested type.</p>
  1900. </td>
  1901. </tr>
  1902. </tbody>
  1903. </table>
  1904. <dl class="details">
  1905. <dt class="tag-returns"><strong>Returns:</strong> The uniform.</dt>
  1906. </dl>
  1907. </div>
  1908. <h3 class="name name-method" id="getOutputStructName" translate="no">.<a href="#getOutputStructName">getOutputStructName</a><span class="signature">()</span><span class="type-signature"> : string</span> <span class="type-signature">(abstract) </span></h3>
  1909. <div class="method">
  1910. <div class="description">
  1911. <p>Returns the output struct name which is required by
  1912. <a href="OutputStructNode.html">OutputStructNode</a>.</p>
  1913. </div>
  1914. <dl class="details">
  1915. <dt class="tag-returns"><strong>Returns:</strong> The name of the output struct.</dt>
  1916. </dl>
  1917. </div>
  1918. <h3 class="name name-method" id="getOutputStructTypeFromNode" translate="no">.<a href="#getOutputStructTypeFromNode">getOutputStructTypeFromNode</a><span class="signature">( node : <span class="param-type"><a href="OutputStructNode.html">OutputStructNode</a></span>, membersLayout : <span class="param-type">Array.&lt;Object></span> )</span><span class="type-signature"> : StructType</span> </h3>
  1919. <div class="method">
  1920. <div class="description">
  1921. <p>Returns an instance of StructType for the given output struct node.</p>
  1922. </div>
  1923. <table class="params">
  1924. <tbody>
  1925. <tr>
  1926. <td class="name">
  1927. <strong>node</strong>
  1928. </td>
  1929. <td class="description last">
  1930. <p>The output struct node.</p>
  1931. </td>
  1932. </tr>
  1933. <tr>
  1934. <td class="name">
  1935. <strong>membersLayout</strong>
  1936. </td>
  1937. <td class="description last">
  1938. <p>The output struct types.</p>
  1939. </td>
  1940. </tr>
  1941. </tbody>
  1942. </table>
  1943. <dl class="details">
  1944. <dt class="tag-returns"><strong>Returns:</strong> The struct type attribute.</dt>
  1945. </dl>
  1946. </div>
  1947. <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">'vertex' | 'fragment' | 'compute' | 'any'</span> )</span><span class="type-signature"> : string</span> </h3>
  1948. <div class="method">
  1949. <div class="description">
  1950. <p>Returns for the given node and shader stage the property name for the shader.</p>
  1951. </div>
  1952. <table class="params">
  1953. <tbody>
  1954. <tr>
  1955. <td class="name">
  1956. <strong>node</strong>
  1957. </td>
  1958. <td class="description last">
  1959. <p>The node.</p>
  1960. </td>
  1961. </tr>
  1962. <tr>
  1963. <td class="name">
  1964. <strong>shaderStage</strong>
  1965. </td>
  1966. <td class="description last">
  1967. <p>The shader stage.</p>
  1968. </td>
  1969. </tr>
  1970. </tbody>
  1971. </table>
  1972. <dl class="details">
  1973. <dt class="tag-returns"><strong>Returns:</strong> The property name.</dt>
  1974. </dl>
  1975. </div>
  1976. <h3 class="name name-method" id="getShaderStage" translate="no">.<a href="#getShaderStage">getShaderStage</a><span class="signature">()</span><span class="type-signature"> : 'vertex' | 'fragment' | 'compute' | 'any'</span> </h3>
  1977. <div class="method">
  1978. <div class="description">
  1979. <p>Returns the current shader stage.</p>
  1980. </div>
  1981. <dl class="details">
  1982. <dt class="tag-returns"><strong>Returns:</strong> The current shader stage.</dt>
  1983. </dl>
  1984. </div>
  1985. <h3 class="name name-method" id="getSharedContext" translate="no">.<a href="#getSharedContext">getSharedContext</a><span class="signature">()</span><span class="type-signature"> : Object</span> </h3>
  1986. <div class="method">
  1987. <div class="description">
  1988. <p>Gets a context used in shader construction that can be shared across different materials.
  1989. This is necessary since the renderer cache can reuse shaders generated in one material and use them in another.</p>
  1990. </div>
  1991. <dl class="details">
  1992. <dt class="tag-returns"><strong>Returns:</strong> The builder's current context without material.</dt>
  1993. </dl>
  1994. </div>
  1995. <h3 class="name name-method" id="getSharedDataFromNode" translate="no">.<a href="#getSharedDataFromNode">getSharedDataFromNode</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span> )</span><span class="type-signature"> : Object</span> </h3>
  1996. <div class="method">
  1997. <div class="description">
  1998. <p>Returns shared data object for the given node.</p>
  1999. </div>
  2000. <table class="params">
  2001. <tbody>
  2002. <tr>
  2003. <td class="name">
  2004. <strong>node</strong>
  2005. </td>
  2006. <td class="description last">
  2007. <p>The node to get shared data from.</p>
  2008. </td>
  2009. </tr>
  2010. </tbody>
  2011. </table>
  2012. <dl class="details">
  2013. <dt class="tag-returns"><strong>Returns:</strong> The shared data.</dt>
  2014. </dl>
  2015. </div>
  2016. <h3 class="name name-method" id="getSignature" translate="no">.<a href="#getSignature">getSignature</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
  2017. <div class="method">
  2018. <div class="description">
  2019. <p>Returns a signature with the engine's current revision.</p>
  2020. </div>
  2021. <dl class="details">
  2022. <dt class="tag-returns"><strong>Returns:</strong> The signature.</dt>
  2023. </dl>
  2024. </div>
  2025. <h3 class="name name-method" id="getStructTypeFromNode" translate="no">.<a href="#getStructTypeFromNode">getStructTypeFromNode</a><span class="signature">( node : <span class="param-type"><a href="OutputStructNode.html">OutputStructNode</a></span>, membersLayout : <span class="param-type">Array.&lt;Object></span>, name : <span class="param-type">string</span>, shaderStage : <span class="param-type">'vertex' | 'fragment' | 'compute' | 'any'</span> )</span><span class="type-signature"> : StructType</span> </h3>
  2026. <div class="method">
  2027. <div class="description">
  2028. <p>Returns an instance of StructType for the given output struct node.</p>
  2029. </div>
  2030. <table class="params">
  2031. <tbody>
  2032. <tr>
  2033. <td class="name">
  2034. <strong>node</strong>
  2035. </td>
  2036. <td class="description last">
  2037. <p>The output struct node.</p>
  2038. </td>
  2039. </tr>
  2040. <tr>
  2041. <td class="name">
  2042. <strong>membersLayout</strong>
  2043. </td>
  2044. <td class="description last">
  2045. <p>The output struct types.</p>
  2046. </td>
  2047. </tr>
  2048. <tr>
  2049. <td class="name">
  2050. <strong>name</strong>
  2051. </td>
  2052. <td class="description last">
  2053. <p>The name of the struct.</p>
  2054. <p>Default is <code>null</code>.</p>
  2055. </td>
  2056. </tr>
  2057. <tr>
  2058. <td class="name">
  2059. <strong>shaderStage</strong>
  2060. </td>
  2061. <td class="description last">
  2062. <p>The shader stage.</p>
  2063. <p>Default is <code>this.shaderStage</code>.</p>
  2064. </td>
  2065. </tr>
  2066. </tbody>
  2067. </table>
  2068. <dl class="details">
  2069. <dt class="tag-returns"><strong>Returns:</strong> The struct type attribute.</dt>
  2070. </dl>
  2071. </div>
  2072. <h3 class="name name-method" id="getStructTypeNode" translate="no">.<a href="#getStructTypeNode">getStructTypeNode</a><span class="signature">( name : <span class="param-type">string</span>, shaderStage : <span class="param-type">'vertex' | 'fragment' | 'compute' | 'any'</span> )</span><span class="type-signature"> : StructType</span> </h3>
  2073. <div class="method">
  2074. <div class="description">
  2075. <p>Returns an instance of StructType for the given struct name and shader stage
  2076. or null if not found.</p>
  2077. </div>
  2078. <table class="params">
  2079. <tbody>
  2080. <tr>
  2081. <td class="name">
  2082. <strong>name</strong>
  2083. </td>
  2084. <td class="description last">
  2085. <p>The name of the struct.</p>
  2086. </td>
  2087. </tr>
  2088. <tr>
  2089. <td class="name">
  2090. <strong>shaderStage</strong>
  2091. </td>
  2092. <td class="description last">
  2093. <p>The shader stage.</p>
  2094. <p>Default is <code>this.shaderStage</code>.</p>
  2095. </td>
  2096. </tr>
  2097. </tbody>
  2098. </table>
  2099. <dl class="details">
  2100. <dt class="tag-returns"><strong>Returns:</strong> The struct type or null if not found.</dt>
  2101. </dl>
  2102. </div>
  2103. <h3 class="name name-method" id="getSubBuildOutput" translate="no">.<a href="#getSubBuildOutput">getSubBuildOutput</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span> )</span><span class="type-signature"> : string</span> </h3>
  2104. <div class="method">
  2105. <div class="description">
  2106. <p>Returns the output node of a sub-build layer.</p>
  2107. </div>
  2108. <table class="params">
  2109. <tbody>
  2110. <tr>
  2111. <td class="name">
  2112. <strong>node</strong>
  2113. </td>
  2114. <td class="description last">
  2115. <p>The node to get the output from.</p>
  2116. </td>
  2117. </tr>
  2118. </tbody>
  2119. </table>
  2120. <dl class="details">
  2121. <dt class="tag-returns"><strong>Returns:</strong> The output node name.</dt>
  2122. </dl>
  2123. </div>
  2124. <h3 class="name name-method" id="getSubBuildProperty" translate="no">.<a href="#getSubBuildProperty">getSubBuildProperty</a><span class="signature">( property : <span class="param-type">string</span>, node : <span class="param-type"><a href="Node.html">Node</a></span> )</span><span class="type-signature"> : string</span> </h3>
  2125. <div class="method">
  2126. <div class="description">
  2127. <p>Returns the sub-build property name for the given property and node.</p>
  2128. </div>
  2129. <table class="params">
  2130. <tbody>
  2131. <tr>
  2132. <td class="name">
  2133. <strong>property</strong>
  2134. </td>
  2135. <td class="description last">
  2136. <p>The property name.</p>
  2137. <p>Default is <code>''</code>.</p>
  2138. </td>
  2139. </tr>
  2140. <tr>
  2141. <td class="name">
  2142. <strong>node</strong>
  2143. </td>
  2144. <td class="description last">
  2145. <p>The node to get the sub-build from.</p>
  2146. <p>Default is <code>null</code>.</p>
  2147. </td>
  2148. </tr>
  2149. </tbody>
  2150. </table>
  2151. <dl class="details">
  2152. <dt class="tag-returns"><strong>Returns:</strong> The sub-build property name.</dt>
  2153. </dl>
  2154. </div>
  2155. <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> <span class="type-signature">(abstract) </span></h3>
  2156. <div class="method">
  2157. <div class="description">
  2158. <p>Returns the native snippet for a ternary operation. E.g. GLSL would output
  2159. a ternary op as <code>cond ? x : y</code> whereas WGSL would output it as <code>select(y, x, cond)</code></p>
  2160. </div>
  2161. <table class="params">
  2162. <tbody>
  2163. <tr>
  2164. <td class="name">
  2165. <strong>condSnippet</strong>
  2166. </td>
  2167. <td class="description last">
  2168. <p>The condition determining which expression gets resolved.</p>
  2169. </td>
  2170. </tr>
  2171. <tr>
  2172. <td class="name">
  2173. <strong>ifSnippet</strong>
  2174. </td>
  2175. <td class="description last">
  2176. <p>The expression to resolve to if the condition is true.</p>
  2177. </td>
  2178. </tr>
  2179. <tr>
  2180. <td class="name">
  2181. <strong>elseSnippet</strong>
  2182. </td>
  2183. <td class="description last">
  2184. <p>The expression to resolve to if the condition is false.</p>
  2185. </td>
  2186. </tr>
  2187. </tbody>
  2188. </table>
  2189. <dl class="details">
  2190. <dt class="tag-returns"><strong>Returns:</strong> The resolved method name.</dt>
  2191. </dl>
  2192. </div>
  2193. <h3 class="name name-method" id="getType" translate="no">.<a href="#getType">getType</a><span class="signature">( type : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  2194. <div class="method">
  2195. <div class="description">
  2196. <p>It might be necessary to convert certain data types to different ones
  2197. so this method can be used to hide the conversion.</p>
  2198. </div>
  2199. <table class="params">
  2200. <tbody>
  2201. <tr>
  2202. <td class="name">
  2203. <strong>type</strong>
  2204. </td>
  2205. <td class="description last">
  2206. <p>The type.</p>
  2207. </td>
  2208. </tr>
  2209. </tbody>
  2210. </table>
  2211. <dl class="details">
  2212. <dt class="tag-returns"><strong>Returns:</strong> The updated type.</dt>
  2213. </dl>
  2214. </div>
  2215. <h3 class="name name-method" id="getTypeFromArray" translate="no">.<a href="#getTypeFromArray">getTypeFromArray</a><span class="signature">( array : <span class="param-type">TypedArray</span> )</span><span class="type-signature"> : string</span> </h3>
  2216. <div class="method">
  2217. <div class="description">
  2218. <p>Returns the type for a given typed array.</p>
  2219. </div>
  2220. <table class="params">
  2221. <tbody>
  2222. <tr>
  2223. <td class="name">
  2224. <strong>array</strong>
  2225. </td>
  2226. <td class="description last">
  2227. <p>The typed array.</p>
  2228. </td>
  2229. </tr>
  2230. </tbody>
  2231. </table>
  2232. <dl class="details">
  2233. <dt class="tag-returns"><strong>Returns:</strong> The type.</dt>
  2234. </dl>
  2235. </div>
  2236. <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>
  2237. <div class="method">
  2238. <div class="description">
  2239. <p>Returns the type for a given buffer attribute.</p>
  2240. </div>
  2241. <table class="params">
  2242. <tbody>
  2243. <tr>
  2244. <td class="name">
  2245. <strong>attribute</strong>
  2246. </td>
  2247. <td class="description last">
  2248. <p>The buffer attribute.</p>
  2249. </td>
  2250. </tr>
  2251. </tbody>
  2252. </table>
  2253. <dl class="details">
  2254. <dt class="tag-returns"><strong>Returns:</strong> The type.</dt>
  2255. </dl>
  2256. </div>
  2257. <h3 class="name name-method" id="getTypeFromLength" translate="no">.<a href="#getTypeFromLength">getTypeFromLength</a><span class="signature">( length : <span class="param-type">number</span>, componentType : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  2258. <div class="method">
  2259. <div class="description">
  2260. <p>Returns the data type for the given the length and component type.</p>
  2261. </div>
  2262. <table class="params">
  2263. <tbody>
  2264. <tr>
  2265. <td class="name">
  2266. <strong>length</strong>
  2267. </td>
  2268. <td class="description last">
  2269. <p>The length.</p>
  2270. </td>
  2271. </tr>
  2272. <tr>
  2273. <td class="name">
  2274. <strong>componentType</strong>
  2275. </td>
  2276. <td class="description last">
  2277. <p>The component type.</p>
  2278. <p>Default is <code>'float'</code>.</p>
  2279. </td>
  2280. </tr>
  2281. </tbody>
  2282. </table>
  2283. <dl class="details">
  2284. <dt class="tag-returns"><strong>Returns:</strong> The type.</dt>
  2285. </dl>
  2286. </div>
  2287. <h3 class="name name-method" id="getTypeLength" translate="no">.<a href="#getTypeLength">getTypeLength</a><span class="signature">( type : <span class="param-type">string</span> )</span><span class="type-signature"> : number</span> </h3>
  2288. <div class="method">
  2289. <div class="description">
  2290. <p>Returns the length for the given data type.</p>
  2291. </div>
  2292. <table class="params">
  2293. <tbody>
  2294. <tr>
  2295. <td class="name">
  2296. <strong>type</strong>
  2297. </td>
  2298. <td class="description last">
  2299. <p>The data type.</p>
  2300. </td>
  2301. </tr>
  2302. </tbody>
  2303. </table>
  2304. <dl class="details">
  2305. <dt class="tag-returns"><strong>Returns:</strong> The length.</dt>
  2306. </dl>
  2307. </div>
  2308. <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">'vertex' | 'fragment' | 'compute' | 'any'</span>, name : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="NodeUniform.html">NodeUniform</a></span> </h3>
  2309. <div class="method">
  2310. <div class="description">
  2311. <p>Returns an instance of <a href="NodeUniform.html">NodeUniform</a> for the given uniform node.</p>
  2312. </div>
  2313. <table class="params">
  2314. <tbody>
  2315. <tr>
  2316. <td class="name">
  2317. <strong>node</strong>
  2318. </td>
  2319. <td class="description last">
  2320. <p>The uniform node.</p>
  2321. </td>
  2322. </tr>
  2323. <tr>
  2324. <td class="name">
  2325. <strong>type</strong>
  2326. </td>
  2327. <td class="description last">
  2328. <p>The uniform type.</p>
  2329. </td>
  2330. </tr>
  2331. <tr>
  2332. <td class="name">
  2333. <strong>shaderStage</strong>
  2334. </td>
  2335. <td class="description last">
  2336. <p>The shader stage.</p>
  2337. <p>Default is <code>this.shaderStage</code>.</p>
  2338. </td>
  2339. </tr>
  2340. <tr>
  2341. <td class="name">
  2342. <strong>name</strong>
  2343. </td>
  2344. <td class="description last">
  2345. <p>The name of the uniform.</p>
  2346. <p>Default is <code>null</code>.</p>
  2347. </td>
  2348. </tr>
  2349. </tbody>
  2350. </table>
  2351. <dl class="details">
  2352. <dt class="tag-returns"><strong>Returns:</strong> The node uniform.</dt>
  2353. </dl>
  2354. </div>
  2355. <h3 class="name name-method" id="getUniforms" translate="no">.<a href="#getUniforms">getUniforms</a><span class="signature">( shaderStage : <span class="param-type">'vertex' | 'fragment' | 'compute' | 'any'</span> )</span><span class="type-signature"> : string</span> <span class="type-signature">(abstract) </span></h3>
  2356. <div class="method">
  2357. <div class="description">
  2358. <p>Returns the uniform definitions as a shader string for the given shader stage.</p>
  2359. </div>
  2360. <table class="params">
  2361. <tbody>
  2362. <tr>
  2363. <td class="name">
  2364. <strong>shaderStage</strong>
  2365. </td>
  2366. <td class="description last">
  2367. <p>The shader stage.</p>
  2368. </td>
  2369. </tr>
  2370. </tbody>
  2371. </table>
  2372. <dl class="details">
  2373. <dt class="tag-returns"><strong>Returns:</strong> The uniform code section.</dt>
  2374. </dl>
  2375. </div>
  2376. <h3 class="name name-method" id="getVar" translate="no">.<a href="#getVar">getVar</a><span class="signature">( type : <span class="param-type">string</span>, name : <span class="param-type">string</span>, count : <span class="param-type">number</span> )</span><span class="type-signature"> : string</span> </h3>
  2377. <div class="method">
  2378. <div class="description">
  2379. <p>Returns a single variable definition as a shader string for the given variable type and name.</p>
  2380. </div>
  2381. <table class="params">
  2382. <tbody>
  2383. <tr>
  2384. <td class="name">
  2385. <strong>type</strong>
  2386. </td>
  2387. <td class="description last">
  2388. <p>The variable's type.</p>
  2389. </td>
  2390. </tr>
  2391. <tr>
  2392. <td class="name">
  2393. <strong>name</strong>
  2394. </td>
  2395. <td class="description last">
  2396. <p>The variable's name.</p>
  2397. </td>
  2398. </tr>
  2399. <tr>
  2400. <td class="name">
  2401. <strong>count</strong>
  2402. </td>
  2403. <td class="description last">
  2404. <p>The array length.</p>
  2405. <p>Default is <code>null</code>.</p>
  2406. </td>
  2407. </tr>
  2408. </tbody>
  2409. </table>
  2410. <dl class="details">
  2411. <dt class="tag-returns"><strong>Returns:</strong> The shader string.</dt>
  2412. </dl>
  2413. </div>
  2414. <h3 class="name name-method" id="getVarFromNode" translate="no">.<a href="#getVarFromNode">getVarFromNode</a><span class="signature">( node : <span class="param-type"><a href="VarNode.html">VarNode</a></span>, name : <span class="param-type">string</span>, type : <span class="param-type">string</span>, shaderStage : <span class="param-type">'vertex' | 'fragment' | 'compute' | 'any'</span>, readOnly : <span class="param-type">boolean</span> )</span><span class="type-signature"> : <a href="NodeVar.html">NodeVar</a></span> </h3>
  2415. <div class="method">
  2416. <div class="description">
  2417. <p>Returns an instance of <a href="NodeVar.html">NodeVar</a> for the given variable node.</p>
  2418. </div>
  2419. <table class="params">
  2420. <tbody>
  2421. <tr>
  2422. <td class="name">
  2423. <strong>node</strong>
  2424. </td>
  2425. <td class="description last">
  2426. <p>The variable node.</p>
  2427. </td>
  2428. </tr>
  2429. <tr>
  2430. <td class="name">
  2431. <strong>name</strong>
  2432. </td>
  2433. <td class="description last">
  2434. <p>The variable's name.</p>
  2435. <p>Default is <code>null</code>.</p>
  2436. </td>
  2437. </tr>
  2438. <tr>
  2439. <td class="name">
  2440. <strong>type</strong>
  2441. </td>
  2442. <td class="description last">
  2443. <p>The variable's type.</p>
  2444. <p>Default is <code>node.getNodeType( this )</code>.</p>
  2445. </td>
  2446. </tr>
  2447. <tr>
  2448. <td class="name">
  2449. <strong>shaderStage</strong>
  2450. </td>
  2451. <td class="description last">
  2452. <p>The shader stage.</p>
  2453. <p>Default is <code>this.shaderStage</code>.</p>
  2454. </td>
  2455. </tr>
  2456. <tr>
  2457. <td class="name">
  2458. <strong>readOnly</strong>
  2459. </td>
  2460. <td class="description last">
  2461. <p>Whether the variable is read-only or not.</p>
  2462. <p>Default is <code>false</code>.</p>
  2463. </td>
  2464. </tr>
  2465. </tbody>
  2466. </table>
  2467. <dl class="details">
  2468. <dt class="tag-returns"><strong>Returns:</strong> The node variable.</dt>
  2469. </dl>
  2470. </div>
  2471. <h3 class="name name-method" id="getVars" translate="no">.<a href="#getVars">getVars</a><span class="signature">( shaderStage : <span class="param-type">'vertex' | 'fragment' | 'compute' | 'any'</span> )</span><span class="type-signature"> : string</span> </h3>
  2472. <div class="method">
  2473. <div class="description">
  2474. <p>Returns the variable definitions as a shader string for the given shader stage.</p>
  2475. </div>
  2476. <table class="params">
  2477. <tbody>
  2478. <tr>
  2479. <td class="name">
  2480. <strong>shaderStage</strong>
  2481. </td>
  2482. <td class="description last">
  2483. <p>The shader stage.</p>
  2484. </td>
  2485. </tr>
  2486. </tbody>
  2487. </table>
  2488. <dl class="details">
  2489. <dt class="tag-returns"><strong>Returns:</strong> The variable code section.</dt>
  2490. </dl>
  2491. </div>
  2492. <h3 class="name name-method" id="getVaryingFromNode" translate="no">.<a href="#getVaryingFromNode">getVaryingFromNode</a><span class="signature">( node : <span class="param-type"><a href="VaryingNode.html">VaryingNode</a> | <a href="PropertyNode.html">PropertyNode</a></span>, name : <span class="param-type">string</span>, type : <span class="param-type">string</span>, interpolationType : <span class="param-type">string</span>, interpolationSampling : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="NodeVar.html">NodeVar</a></span> </h3>
  2493. <div class="method">
  2494. <div class="description">
  2495. <p>Returns an instance of <a href="NodeVarying.html">NodeVarying</a> for the given varying node.</p>
  2496. </div>
  2497. <table class="params">
  2498. <tbody>
  2499. <tr>
  2500. <td class="name">
  2501. <strong>node</strong>
  2502. </td>
  2503. <td class="description last">
  2504. <p>The varying node.</p>
  2505. </td>
  2506. </tr>
  2507. <tr>
  2508. <td class="name">
  2509. <strong>name</strong>
  2510. </td>
  2511. <td class="description last">
  2512. <p>The varying's name.</p>
  2513. <p>Default is <code>null</code>.</p>
  2514. </td>
  2515. </tr>
  2516. <tr>
  2517. <td class="name">
  2518. <strong>type</strong>
  2519. </td>
  2520. <td class="description last">
  2521. <p>The varying's type.</p>
  2522. <p>Default is <code>node.getNodeType( this )</code>.</p>
  2523. </td>
  2524. </tr>
  2525. <tr>
  2526. <td class="name">
  2527. <strong>interpolationType</strong>
  2528. </td>
  2529. <td class="description last">
  2530. <p>The interpolation type of the varying.</p>
  2531. <p>Default is <code>null</code>.</p>
  2532. </td>
  2533. </tr>
  2534. <tr>
  2535. <td class="name">
  2536. <strong>interpolationSampling</strong>
  2537. </td>
  2538. <td class="description last">
  2539. <p>The interpolation sampling type of the varying.</p>
  2540. <p>Default is <code>null</code>.</p>
  2541. </td>
  2542. </tr>
  2543. </tbody>
  2544. </table>
  2545. <dl class="details">
  2546. <dt class="tag-returns"><strong>Returns:</strong> The node varying.</dt>
  2547. </dl>
  2548. </div>
  2549. <h3 class="name name-method" id="getVaryings" translate="no">.<a href="#getVaryings">getVaryings</a><span class="signature">( shaderStage : <span class="param-type">'vertex' | 'fragment' | 'compute' | 'any'</span> )</span><span class="type-signature"> : string</span> <span class="type-signature">(abstract) </span></h3>
  2550. <div class="method">
  2551. <div class="description">
  2552. <p>Returns the varying definitions as a shader string for the given shader stage.</p>
  2553. </div>
  2554. <table class="params">
  2555. <tbody>
  2556. <tr>
  2557. <td class="name">
  2558. <strong>shaderStage</strong>
  2559. </td>
  2560. <td class="description last">
  2561. <p>The shader stage.</p>
  2562. </td>
  2563. </tr>
  2564. </tbody>
  2565. </table>
  2566. <dl class="details">
  2567. <dt class="tag-returns"><strong>Returns:</strong> The varying code section.</dt>
  2568. </dl>
  2569. </div>
  2570. <h3 class="name name-method" id="getVectorFromMatrix" translate="no">.<a href="#getVectorFromMatrix">getVectorFromMatrix</a><span class="signature">( type : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  2571. <div class="method">
  2572. <div class="description">
  2573. <p>Returns the vector type for a given matrix type.</p>
  2574. </div>
  2575. <table class="params">
  2576. <tbody>
  2577. <tr>
  2578. <td class="name">
  2579. <strong>type</strong>
  2580. </td>
  2581. <td class="description last">
  2582. <p>The matrix type.</p>
  2583. </td>
  2584. </tr>
  2585. </tbody>
  2586. </table>
  2587. <dl class="details">
  2588. <dt class="tag-returns"><strong>Returns:</strong> The vector type.</dt>
  2589. </dl>
  2590. </div>
  2591. <h3 class="name name-method" id="getVectorType" translate="no">.<a href="#getVectorType">getVectorType</a><span class="signature">( type : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  2592. <div class="method">
  2593. <div class="description">
  2594. <p>Returns the vector type for a given type.</p>
  2595. </div>
  2596. <table class="params">
  2597. <tbody>
  2598. <tr>
  2599. <td class="name">
  2600. <strong>type</strong>
  2601. </td>
  2602. <td class="description last">
  2603. <p>The type.</p>
  2604. </td>
  2605. </tr>
  2606. </tbody>
  2607. </table>
  2608. <dl class="details">
  2609. <dt class="tag-returns"><strong>Returns:</strong> The vector type.</dt>
  2610. </dl>
  2611. </div>
  2612. <h3 class="name name-method" id="getVertexIndex" translate="no">.<a href="#getVertexIndex">getVertexIndex</a><span class="signature">()</span><span class="type-signature"> : string</span> <span class="type-signature">(abstract) </span></h3>
  2613. <div class="method">
  2614. <div class="description">
  2615. <p>Returns the vertexIndex input variable as a native shader string.</p>
  2616. </div>
  2617. <dl class="details">
  2618. <dt class="tag-returns"><strong>Returns:</strong> The instanceIndex shader string.</dt>
  2619. </dl>
  2620. </div>
  2621. <h3 class="name name-method" id="hasGeometryAttribute" translate="no">.<a href="#hasGeometryAttribute">hasGeometryAttribute</a><span class="signature">( name : <span class="param-type">string</span> )</span><span class="type-signature"> : boolean</span> </h3>
  2622. <div class="method">
  2623. <div class="description">
  2624. <p>Whether the given attribute name is defined in the geometry or not.</p>
  2625. </div>
  2626. <table class="params">
  2627. <tbody>
  2628. <tr>
  2629. <td class="name">
  2630. <strong>name</strong>
  2631. </td>
  2632. <td class="description last">
  2633. <p>The attribute name.</p>
  2634. </td>
  2635. </tr>
  2636. </tbody>
  2637. </table>
  2638. <dl class="details">
  2639. <dt class="tag-returns"><strong>Returns:</strong> Whether the given attribute name is defined in the geometry.</dt>
  2640. </dl>
  2641. </div>
  2642. <h3 class="name name-method" id="includes" translate="no">.<a href="#includes">includes</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
  2643. <div class="method">
  2644. <div class="description">
  2645. <p>Whether the given node is included in the internal array of nodes or not.</p>
  2646. </div>
  2647. <table class="params">
  2648. <tbody>
  2649. <tr>
  2650. <td class="name">
  2651. <strong>node</strong>
  2652. </td>
  2653. <td class="description last">
  2654. <p>The node to test.</p>
  2655. </td>
  2656. </tr>
  2657. </tbody>
  2658. </table>
  2659. <dl class="details">
  2660. <dt class="tag-returns"><strong>Returns:</strong> Whether the given node is included in the internal array of nodes or not.</dt>
  2661. </dl>
  2662. </div>
  2663. <h3 class="name name-method" id="increaseUsage" translate="no">.<a href="#increaseUsage">increaseUsage</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span> )</span><span class="type-signature"> : number</span> </h3>
  2664. <div class="method">
  2665. <div class="description">
  2666. <p>Calling this method increases the usage count for the given node by one.</p>
  2667. </div>
  2668. <table class="params">
  2669. <tbody>
  2670. <tr>
  2671. <td class="name">
  2672. <strong>node</strong>
  2673. </td>
  2674. <td class="description last">
  2675. <p>The node to increase the usage count for.</p>
  2676. </td>
  2677. </tr>
  2678. </tbody>
  2679. </table>
  2680. <dl class="details">
  2681. <dt class="tag-returns"><strong>Returns:</strong> The updated usage count.</dt>
  2682. </dl>
  2683. </div>
  2684. <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> <span class="type-signature">(abstract) </span></h3>
  2685. <div class="method">
  2686. <div class="description">
  2687. <p>Whether the requested feature is available or not.</p>
  2688. </div>
  2689. <table class="params">
  2690. <tbody>
  2691. <tr>
  2692. <td class="name">
  2693. <strong>name</strong>
  2694. </td>
  2695. <td class="description last">
  2696. <p>The requested feature.</p>
  2697. </td>
  2698. </tr>
  2699. </tbody>
  2700. </table>
  2701. <dl class="details">
  2702. <dt class="tag-returns"><strong>Returns:</strong> Whether the requested feature is supported or not.</dt>
  2703. </dl>
  2704. </div>
  2705. <h3 class="name name-method" id="isDeterministic" translate="no">.<a href="#isDeterministic">isDeterministic</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
  2706. <div class="method">
  2707. <div class="description">
  2708. <p>Returns whether a Node or its flow is deterministic, useful for use in <code>const</code>.</p>
  2709. </div>
  2710. <table class="params">
  2711. <tbody>
  2712. <tr>
  2713. <td class="name">
  2714. <strong>node</strong>
  2715. </td>
  2716. <td class="description last">
  2717. <p>The varying node.</p>
  2718. </td>
  2719. </tr>
  2720. </tbody>
  2721. </table>
  2722. <dl class="details">
  2723. <dt class="tag-returns"><strong>Returns:</strong> Returns true if deterministic.</dt>
  2724. </dl>
  2725. </div>
  2726. <h3 class="name name-method" id="isFilteredTexture" translate="no">.<a href="#isFilteredTexture">isFilteredTexture</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
  2727. <div class="method">
  2728. <div class="description">
  2729. <p>Whether the given texture is filtered or not.</p>
  2730. </div>
  2731. <table class="params">
  2732. <tbody>
  2733. <tr>
  2734. <td class="name">
  2735. <strong>texture</strong>
  2736. </td>
  2737. <td class="description last">
  2738. <p>The texture to check.</p>
  2739. </td>
  2740. </tr>
  2741. </tbody>
  2742. </table>
  2743. <dl class="details">
  2744. <dt class="tag-returns"><strong>Returns:</strong> Whether the given texture is filtered or not.</dt>
  2745. </dl>
  2746. </div>
  2747. <h3 class="name name-method" id="isFlipY" translate="no">.<a href="#isFlipY">isFlipY</a><span class="signature">()</span><span class="type-signature"> : boolean</span> <span class="type-signature">(abstract) </span></h3>
  2748. <div class="method">
  2749. <div class="description">
  2750. <p>Whether to flip texture data along its vertical axis or not. WebGL needs
  2751. this method evaluate to <code>true</code>, WebGPU to <code>false</code>.</p>
  2752. </div>
  2753. <dl class="details">
  2754. <dt class="tag-returns"><strong>Returns:</strong> Whether to flip texture data along its vertical axis or not.</dt>
  2755. </dl>
  2756. </div>
  2757. <h3 class="name name-method" id="isInteger" translate="no">.<a href="#isInteger">isInteger</a><span class="signature">( type : <span class="param-type">string</span> )</span><span class="type-signature"> : boolean</span> </h3>
  2758. <div class="method">
  2759. <div class="description">
  2760. <p>Returns the type is an integer type.</p>
  2761. </div>
  2762. <table class="params">
  2763. <tbody>
  2764. <tr>
  2765. <td class="name">
  2766. <strong>type</strong>
  2767. </td>
  2768. <td class="description last">
  2769. <p>The type.</p>
  2770. </td>
  2771. </tr>
  2772. </tbody>
  2773. </table>
  2774. <dl class="details">
  2775. <dt class="tag-returns"><strong>Returns:</strong> Whether the type is an integer type or not.</dt>
  2776. </dl>
  2777. </div>
  2778. <h3 class="name name-method" id="isMatrix" translate="no">.<a href="#isMatrix">isMatrix</a><span class="signature">( type : <span class="param-type">string</span> )</span><span class="type-signature"> : boolean</span> </h3>
  2779. <div class="method">
  2780. <div class="description">
  2781. <p>Whether the given type is a matrix type or not.</p>
  2782. </div>
  2783. <table class="params">
  2784. <tbody>
  2785. <tr>
  2786. <td class="name">
  2787. <strong>type</strong>
  2788. </td>
  2789. <td class="description last">
  2790. <p>The type to check.</p>
  2791. </td>
  2792. </tr>
  2793. </tbody>
  2794. </table>
  2795. <dl class="details">
  2796. <dt class="tag-returns"><strong>Returns:</strong> Whether the given type is a matrix type or not.</dt>
  2797. </dl>
  2798. </div>
  2799. <h3 class="name name-method" id="isOpaque" translate="no">.<a href="#isOpaque">isOpaque</a><span class="signature">()</span><span class="type-signature"> : boolean</span> </h3>
  2800. <div class="method">
  2801. <div class="description">
  2802. <p>Whether the material is opaque or not.</p>
  2803. </div>
  2804. <dl class="details">
  2805. <dt class="tag-returns"><strong>Returns:</strong> Whether the material is opaque or not.</dt>
  2806. </dl>
  2807. </div>
  2808. <h3 class="name name-method" id="isReference" translate="no">.<a href="#isReference">isReference</a><span class="signature">( type : <span class="param-type">string</span> )</span><span class="type-signature"> : boolean</span> </h3>
  2809. <div class="method">
  2810. <div class="description">
  2811. <p>Whether the given type is a reference type or not.</p>
  2812. </div>
  2813. <table class="params">
  2814. <tbody>
  2815. <tr>
  2816. <td class="name">
  2817. <strong>type</strong>
  2818. </td>
  2819. <td class="description last">
  2820. <p>The type to check.</p>
  2821. </td>
  2822. </tr>
  2823. </tbody>
  2824. </table>
  2825. <dl class="details">
  2826. <dt class="tag-returns"><strong>Returns:</strong> Whether the given type is a reference type or not.</dt>
  2827. </dl>
  2828. </div>
  2829. <h3 class="name name-method" id="isVector" translate="no">.<a href="#isVector">isVector</a><span class="signature">( type : <span class="param-type">string</span> )</span><span class="type-signature"> : boolean</span> </h3>
  2830. <div class="method">
  2831. <div class="description">
  2832. <p>Whether the given type is a vector type or not.</p>
  2833. </div>
  2834. <table class="params">
  2835. <tbody>
  2836. <tr>
  2837. <td class="name">
  2838. <strong>type</strong>
  2839. </td>
  2840. <td class="description last">
  2841. <p>The type to check.</p>
  2842. </td>
  2843. </tr>
  2844. </tbody>
  2845. </table>
  2846. <dl class="details">
  2847. <dt class="tag-returns"><strong>Returns:</strong> Whether the given type is a vector type or not.</dt>
  2848. </dl>
  2849. </div>
  2850. <h3 class="name name-method" id="needsPreviousData" translate="no">.<a href="#needsPreviousData">needsPreviousData</a><span class="signature">()</span><span class="type-signature"> : boolean</span> </h3>
  2851. <div class="method">
  2852. <div class="description">
  2853. <p>Returns <code>true</code> if data from the previous frame are required. Relevant
  2854. when computing motion vectors with <a href="VelocityNode.html">VelocityNode</a>.</p>
  2855. </div>
  2856. <dl class="details">
  2857. <dt class="tag-returns"><strong>Returns:</strong> Whether data from the previous frame are required or not.</dt>
  2858. </dl>
  2859. </div>
  2860. <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> <span class="type-signature">(abstract) </span></h3>
  2861. <div class="method">
  2862. <div class="description">
  2863. <p>Checks if the given texture requires a manual conversion to the working color space.</p>
  2864. </div>
  2865. <table class="params">
  2866. <tbody>
  2867. <tr>
  2868. <td class="name">
  2869. <strong>texture</strong>
  2870. </td>
  2871. <td class="description last">
  2872. <p>The texture to check.</p>
  2873. </td>
  2874. </tr>
  2875. </tbody>
  2876. </table>
  2877. <dl class="details">
  2878. <dt class="tag-returns"><strong>Returns:</strong> Whether the given texture requires a conversion to working color space or not.</dt>
  2879. </dl>
  2880. </div>
  2881. <h3 class="name name-method" id="registerDeclaration" translate="no">.<a href="#registerDeclaration">registerDeclaration</a><span class="signature">( node : <span class="param-type">Object</span> )</span> </h3>
  2882. <div class="method">
  2883. <div class="description">
  2884. <p>Registers a node declaration in the current shader stage.</p>
  2885. </div>
  2886. <table class="params">
  2887. <tbody>
  2888. <tr>
  2889. <td class="name">
  2890. <strong>node</strong>
  2891. </td>
  2892. <td class="description last">
  2893. <p>The node to be registered.</p>
  2894. </td>
  2895. </tr>
  2896. </tbody>
  2897. </table>
  2898. </div>
  2899. <h3 class="name name-method" id="removeActiveStack" translate="no">.<a href="#removeActiveStack">removeActiveStack</a><span class="signature">( stack : <span class="param-type"><a href="StackNode.html">StackNode</a></span> )</span> </h3>
  2900. <div class="method">
  2901. <div class="description">
  2902. <p>Removes the active stack from the internal stack.</p>
  2903. </div>
  2904. <table class="params">
  2905. <tbody>
  2906. <tr>
  2907. <td class="name">
  2908. <strong>stack</strong>
  2909. </td>
  2910. <td class="description last">
  2911. <p>The stack node to remove.</p>
  2912. </td>
  2913. </tr>
  2914. </tbody>
  2915. </table>
  2916. </div>
  2917. <h3 class="name name-method" id="removeChain" translate="no">.<a href="#removeChain">removeChain</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span> )</span> </h3>
  2918. <div class="method">
  2919. <div class="description">
  2920. <p>Removes the given node from the internal node chain.</p>
  2921. </div>
  2922. <table class="params">
  2923. <tbody>
  2924. <tr>
  2925. <td class="name">
  2926. <strong>node</strong>
  2927. </td>
  2928. <td class="description last">
  2929. <p>The node to remove.</p>
  2930. </td>
  2931. </tr>
  2932. </tbody>
  2933. </table>
  2934. </div>
  2935. <h3 class="name name-method" id="removeFlowTab" translate="no">.<a href="#removeFlowTab">removeFlowTab</a><span class="signature">()</span><span class="type-signature"> : <a href="NodeBuilder.html">NodeBuilder</a></span> </h3>
  2936. <div class="method">
  2937. <div class="description">
  2938. <p>Removes a tab.</p>
  2939. </div>
  2940. <dl class="details">
  2941. <dt class="tag-returns"><strong>Returns:</strong> A reference to this node builder.</dt>
  2942. </dl>
  2943. </div>
  2944. <h3 class="name name-method" id="removeStack" translate="no">.<a href="#removeStack">removeStack</a><span class="signature">()</span><span class="type-signature"> : <a href="StackNode.html">StackNode</a></span> </h3>
  2945. <div class="method">
  2946. <div class="description">
  2947. <p>Removes the last stack node from the internal stack.</p>
  2948. </div>
  2949. <dl class="details">
  2950. <dt class="tag-returns"><strong>Returns:</strong> The removed stack node.</dt>
  2951. </dl>
  2952. </div>
  2953. <h3 class="name name-method" id="removeSubBuild" translate="no">.<a href="#removeSubBuild">removeSubBuild</a><span class="signature">()</span><span class="type-signature"> : <a href="SubBuildNode.html">SubBuildNode</a></span> </h3>
  2954. <div class="method">
  2955. <div class="description">
  2956. <p>Removes the last sub-build layer from the node builder.</p>
  2957. </div>
  2958. <dl class="details">
  2959. <dt class="tag-returns"><strong>Returns:</strong> The removed sub-build layer.</dt>
  2960. </dl>
  2961. </div>
  2962. <h3 class="name name-method" id="setActiveStack" translate="no">.<a href="#setActiveStack">setActiveStack</a><span class="signature">( stack : <span class="param-type"><a href="StackNode.html">StackNode</a></span> )</span> </h3>
  2963. <div class="method">
  2964. <div class="description">
  2965. <p>Adds an active stack to the internal stack.</p>
  2966. </div>
  2967. <table class="params">
  2968. <tbody>
  2969. <tr>
  2970. <td class="name">
  2971. <strong>stack</strong>
  2972. </td>
  2973. <td class="description last">
  2974. <p>The stack node to add.</p>
  2975. </td>
  2976. </tr>
  2977. </tbody>
  2978. </table>
  2979. </div>
  2980. <h3 class="name name-method" id="setBuildStage" translate="no">.<a href="#setBuildStage">setBuildStage</a><span class="signature">( buildStage : <span class="param-type">'setup' | 'analyze' | 'generate'</span> )</span> </h3>
  2981. <div class="method">
  2982. <div class="description">
  2983. <p>Sets the current build stage.</p>
  2984. </div>
  2985. <table class="params">
  2986. <tbody>
  2987. <tr>
  2988. <td class="name">
  2989. <strong>buildStage</strong>
  2990. </td>
  2991. <td class="description last">
  2992. <p>The build stage to set.</p>
  2993. </td>
  2994. </tr>
  2995. </tbody>
  2996. </table>
  2997. </div>
  2998. <h3 class="name name-method" id="setCache" translate="no">.<a href="#setCache">setCache</a><span class="signature">( cache : <span class="param-type"><a href="NodeCache.html">NodeCache</a></span> )</span> </h3>
  2999. <div class="method">
  3000. <div class="description">
  3001. <p>Sets builder's cache.</p>
  3002. </div>
  3003. <table class="params">
  3004. <tbody>
  3005. <tr>
  3006. <td class="name">
  3007. <strong>cache</strong>
  3008. </td>
  3009. <td class="description last">
  3010. <p>The cache to set.</p>
  3011. </td>
  3012. </tr>
  3013. </tbody>
  3014. </table>
  3015. </div>
  3016. <h3 class="name name-method" id="setContext" translate="no">.<a href="#setContext">setContext</a><span class="signature">( context : <span class="param-type">Object</span> )</span> </h3>
  3017. <div class="method">
  3018. <div class="description">
  3019. <p>Sets builder's context.</p>
  3020. </div>
  3021. <table class="params">
  3022. <tbody>
  3023. <tr>
  3024. <td class="name">
  3025. <strong>context</strong>
  3026. </td>
  3027. <td class="description last">
  3028. <p>The context to set.</p>
  3029. </td>
  3030. </tr>
  3031. </tbody>
  3032. </table>
  3033. </div>
  3034. <h3 class="name name-method" id="setHashNode" translate="no">.<a href="#setHashNode">setHashNode</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span>, hash : <span class="param-type">number</span> )</span> </h3>
  3035. <div class="method">
  3036. <div class="description">
  3037. <p>The builder maintains each node in a hash-based dictionary.
  3038. This method sets the given node (value) with the given hash (key) into this dictionary.</p>
  3039. </div>
  3040. <table class="params">
  3041. <tbody>
  3042. <tr>
  3043. <td class="name">
  3044. <strong>node</strong>
  3045. </td>
  3046. <td class="description last">
  3047. <p>The node to add.</p>
  3048. </td>
  3049. </tr>
  3050. <tr>
  3051. <td class="name">
  3052. <strong>hash</strong>
  3053. </td>
  3054. <td class="description last">
  3055. <p>The hash of the node.</p>
  3056. </td>
  3057. </tr>
  3058. </tbody>
  3059. </table>
  3060. </div>
  3061. <h3 class="name name-method" id="setShaderStage" translate="no">.<a href="#setShaderStage">setShaderStage</a><span class="signature">( shaderStage : <span class="param-type">'vertex' | 'fragment' | 'compute' | 'any'</span> )</span> </h3>
  3062. <div class="method">
  3063. <div class="description">
  3064. <p>Sets the current shader stage.</p>
  3065. </div>
  3066. <table class="params">
  3067. <tbody>
  3068. <tr>
  3069. <td class="name">
  3070. <strong>shaderStage</strong>
  3071. </td>
  3072. <td class="description last">
  3073. <p>The shader stage to set.</p>
  3074. </td>
  3075. </tr>
  3076. </tbody>
  3077. </table>
  3078. </div>
  3079. <h3 class="name name-method" id="sortBindingGroups" translate="no">.<a href="#sortBindingGroups">sortBindingGroups</a><span class="signature">()</span> </h3>
  3080. <div class="method">
  3081. <div class="description">
  3082. <p>Sorts the bind groups and updates <a href="NodeBuilder.html#bindingsIndexes">NodeBuilder#bindingsIndexes</a>.</p>
  3083. </div>
  3084. </div>
  3085. <h2 class="subsection-title">Source</h2>
  3086. <p>
  3087. <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/core/NodeBuilder.js" translate="no" target="_blank" rel="noopener">src/nodes/core/NodeBuilder.js</a>
  3088. </p>
  3089. </article>
  3090. </section>
  3091. <script src="../scripts/linenumber.js"></script>
  3092. <script src="../scripts/page.js"></script>
  3093. </body>
  3094. </html>
粤ICP备19079148号