NodeBuilder.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984
  1. import {
  2. CubeReflectionMapping,
  3. CubeRefractionMapping,
  4. CubeUVReflectionMapping,
  5. CubeUVRefractionMapping,
  6. LinearEncoding,
  7. GammaEncoding
  8. } from '../../../../build/three.module.js';
  9. import { NodeUniform } from './NodeUniform.js';
  10. import { NodeUtils } from './NodeUtils.js';
  11. import { NodeLib } from './NodeLib.js';
  12. import { FunctionNode } from './FunctionNode.js';
  13. import { ConstNode } from './ConstNode.js';
  14. import { StructNode } from './StructNode.js';
  15. import { Vector2Node } from '../inputs/Vector2Node.js';
  16. import { Vector3Node } from '../inputs/Vector3Node.js';
  17. import { Vector4Node } from '../inputs/Vector4Node.js';
  18. import { TextureNode } from '../inputs/TextureNode.js';
  19. import { CubeTextureNode } from '../inputs/CubeTextureNode.js';
  20. import { TextureCubeNode } from '../misc/TextureCubeNode.js';
  21. var elements = NodeUtils.elements,
  22. constructors = [ 'float', 'vec2', 'vec3', 'vec4' ],
  23. convertFormatToType = {
  24. float: 'f',
  25. vec2: 'v2',
  26. vec3: 'v3',
  27. vec4: 'v4',
  28. mat4: 'v4',
  29. int: 'i',
  30. bool: 'b'
  31. },
  32. convertTypeToFormat = {
  33. t: 'sampler2D',
  34. tc: 'samplerCube',
  35. b: 'bool',
  36. i: 'int',
  37. f: 'float',
  38. c: 'vec3',
  39. v2: 'vec2',
  40. v3: 'vec3',
  41. v4: 'vec4',
  42. m3: 'mat3',
  43. m4: 'mat4'
  44. };
  45. function NodeBuilder() {
  46. this.slots = [];
  47. this.caches = [];
  48. this.contexts = [];
  49. this.keywords = {};
  50. this.nodeData = {};
  51. this.requires = {
  52. uv: [],
  53. color: [],
  54. lights: false,
  55. fog: false,
  56. transparent: false,
  57. irradiance: false
  58. };
  59. this.includes = {
  60. consts: [],
  61. functions: [],
  62. structs: []
  63. };
  64. this.attributes = {};
  65. this.prefixCode = [
  66. '#ifdef TEXTURE_LOD_EXT',
  67. ' #define texCube(a, b) textureCube(a, b)',
  68. ' #define texCubeBias(a, b, c) textureCubeLodEXT(a, b, c)',
  69. ' #define tex2D(a, b) texture2D(a, b)',
  70. ' #define tex2DBias(a, b, c) texture2DLodEXT(a, b, c)',
  71. '#else',
  72. ' #define texCube(a, b) textureCube(a, b)',
  73. ' #define texCubeBias(a, b, c) textureCube(a, b, c)',
  74. ' #define tex2D(a, b) texture2D(a, b)',
  75. ' #define tex2DBias(a, b, c) texture2D(a, b, c)',
  76. '#endif',
  77. '#include <packing>',
  78. '#include <common>'
  79. ].join( '\n' );
  80. this.parsCode = {
  81. vertex: '',
  82. fragment: ''
  83. };
  84. this.code = {
  85. vertex: '',
  86. fragment: ''
  87. };
  88. this.nodeCode = {
  89. vertex: '',
  90. fragment: ''
  91. };
  92. this.resultCode = {
  93. vertex: '',
  94. fragment: ''
  95. };
  96. this.finalCode = {
  97. vertex: '',
  98. fragment: ''
  99. };
  100. this.inputs = {
  101. uniforms: {
  102. list: [],
  103. vertex: [],
  104. fragment: []
  105. },
  106. vars: {
  107. varying: [],
  108. vertex: [],
  109. fragment: []
  110. }
  111. };
  112. // send to material
  113. this.defines = {};
  114. this.uniforms = {};
  115. this.extensions = {};
  116. this.updaters = [];
  117. this.nodes = [];
  118. // --
  119. this.analyzing = false;
  120. }
  121. NodeBuilder.prototype = {
  122. constructor: NodeBuilder,
  123. build: function ( vertex, fragment ) {
  124. this.buildShader( 'vertex', vertex );
  125. this.buildShader( 'fragment', fragment );
  126. for ( var i = 0; i < this.requires.uv.length; i ++ ) {
  127. if ( this.requires.uv[ i ] ) {
  128. var uvIndex = i > 0 ? i + 1 : '';
  129. this.addVaryCode( 'varying vec2 vUv' + uvIndex + ';' );
  130. if ( i > 0 ) {
  131. this.addVertexParsCode( 'attribute vec2 uv' + uvIndex + ';' );
  132. }
  133. this.addVertexFinalCode( 'vUv' + uvIndex + ' = uv' + uvIndex + ';' );
  134. }
  135. }
  136. if ( this.requires.color[ 0 ] ) {
  137. this.addVaryCode( 'varying vec4 vColor;' );
  138. this.addVertexParsCode( 'attribute vec4 color;' );
  139. this.addVertexFinalCode( 'vColor = color;' );
  140. }
  141. if ( this.requires.color[ 1 ] ) {
  142. this.addVaryCode( 'varying vec4 vColor2;' );
  143. this.addVertexParsCode( 'attribute vec4 color2;' );
  144. this.addVertexFinalCode( 'vColor2 = color2;' );
  145. }
  146. if ( this.requires.position ) {
  147. this.addVaryCode( 'varying vec3 vPosition;' );
  148. this.addVertexFinalCode( 'vPosition = transformed;' );
  149. }
  150. if ( this.requires.worldPosition ) {
  151. this.addVaryCode( 'varying vec3 vWPosition;' );
  152. this.addVertexFinalCode( 'vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;' );
  153. }
  154. if ( this.requires.normal ) {
  155. this.addVaryCode( 'varying vec3 vObjectNormal;' );
  156. this.addVertexFinalCode( 'vObjectNormal = normal;' );
  157. }
  158. if ( this.requires.worldNormal ) {
  159. this.addVaryCode( 'varying vec3 vWNormal;' );
  160. this.addVertexFinalCode( 'vWNormal = inverseTransformDirection( transformedNormal, viewMatrix ).xyz;' );
  161. }
  162. return this;
  163. },
  164. buildShader: function ( shader, node ) {
  165. this.resultCode[ shader ] = node.build( this.setShader( shader ), 'v4' );
  166. },
  167. setMaterial: function ( material, renderer ) {
  168. this.material = material;
  169. this.renderer = renderer;
  170. this.requires.lights = material.lights;
  171. this.requires.fog = material.fog;
  172. this.mergeDefines( material.defines );
  173. return this;
  174. },
  175. addFlow: function ( slot, cache, context ) {
  176. return this.addSlot( slot ).addCache( cache ).addContext( context );
  177. },
  178. removeFlow: function () {
  179. return this.removeSlot().removeCache().removeContext();
  180. },
  181. addCache: function ( name ) {
  182. this.cache = name || '';
  183. this.caches.push( this.cache );
  184. return this;
  185. },
  186. removeCache: function () {
  187. this.caches.pop();
  188. this.cache = this.caches[ this.caches.length - 1 ] || '';
  189. return this;
  190. },
  191. addContext: function ( context ) {
  192. this.context = Object.assign( {}, this.context, context );
  193. this.context.extra = this.context.extra || {};
  194. this.contexts.push( this.context );
  195. return this;
  196. },
  197. removeContext: function () {
  198. this.contexts.pop();
  199. this.context = this.contexts[ this.contexts.length - 1 ] || {};
  200. return this;
  201. },
  202. addSlot: function ( name ) {
  203. this.slot = name || '';
  204. this.slots.push( this.slot );
  205. return this;
  206. },
  207. removeSlot: function () {
  208. this.slots.pop();
  209. this.slot = this.slots[ this.slots.length - 1 ] || '';
  210. return this;
  211. },
  212. addVertexCode: function ( code ) {
  213. this.addCode( code, 'vertex' );
  214. },
  215. addFragmentCode: function ( code ) {
  216. this.addCode( code, 'fragment' );
  217. },
  218. addCode: function ( code, shader ) {
  219. this.code[ shader || this.shader ] += code + '\n';
  220. },
  221. addVertexNodeCode: function ( code ) {
  222. this.addNodeCode( code, 'vertex' );
  223. },
  224. addFragmentNodeCode: function ( code ) {
  225. this.addNodeCode( code, 'fragment' );
  226. },
  227. addNodeCode: function ( code, shader ) {
  228. this.nodeCode[ shader || this.shader ] += code + '\n';
  229. },
  230. clearNodeCode: function ( shader ) {
  231. shader = shader || this.shader;
  232. var code = this.nodeCode[ shader ];
  233. this.nodeCode[ shader ] = '';
  234. return code;
  235. },
  236. clearVertexNodeCode: function ( ) {
  237. return this.clearNodeCode( 'vertex' );
  238. },
  239. clearFragmentNodeCode: function ( ) {
  240. return this.clearNodeCode( 'fragment' );
  241. },
  242. addVertexFinalCode: function ( code ) {
  243. this.addFinalCode( code, 'vertex' );
  244. },
  245. addFragmentFinalCode: function ( code ) {
  246. this.addFinalCode( code, 'fragment' );
  247. },
  248. addFinalCode: function ( code, shader ) {
  249. this.finalCode[ shader || this.shader ] += code + '\n';
  250. },
  251. addVertexParsCode: function ( code ) {
  252. this.addParsCode( code, 'vertex' );
  253. },
  254. addFragmentParsCode: function ( code ) {
  255. this.addParsCode( code, 'fragment' );
  256. },
  257. addParsCode: function ( code, shader ) {
  258. this.parsCode[ shader || this.shader ] += code + '\n';
  259. },
  260. addVaryCode: function ( code ) {
  261. this.addVertexParsCode( code );
  262. this.addFragmentParsCode( code );
  263. },
  264. isCache: function ( name ) {
  265. return this.caches.indexOf( name ) !== - 1;
  266. },
  267. isSlot: function ( name ) {
  268. return this.slots.indexOf( name ) !== - 1;
  269. },
  270. define: function ( name, value ) {
  271. this.defines[ name ] = value === undefined ? 1 : value;
  272. },
  273. require: function ( name ) {
  274. this.requires[ name ] = true;
  275. },
  276. isDefined: function ( name ) {
  277. return this.defines[ name ] !== undefined;
  278. },
  279. getVar: function ( uuid, type, ns, shader = 'varying', prefix = 'V', label = '' ) {
  280. var vars = this.getVars( shader ),
  281. data = vars[ uuid ];
  282. if ( ! data ) {
  283. var index = vars.length,
  284. name = ns ? ns : 'node' + prefix + index + ( label ? '_' + label : '' );
  285. data = { name: name, type: type };
  286. vars.push( data );
  287. vars[ uuid ] = data;
  288. }
  289. return data;
  290. },
  291. getTempVar: function ( uuid, type, ns, label ) {
  292. return this.getVar( uuid, type, ns, this.shader, 'T', label );
  293. },
  294. getAttribute: function ( name, type ) {
  295. if ( ! this.attributes[ name ] ) {
  296. var varying = this.getVar( name, type );
  297. this.addVertexParsCode( 'attribute ' + type + ' ' + name + ';' );
  298. this.addVertexFinalCode( varying.name + ' = ' + name + ';' );
  299. this.attributes[ name ] = { varying: varying, name: name, type: type };
  300. }
  301. return this.attributes[ name ];
  302. },
  303. getCode: function ( shader ) {
  304. return [
  305. this.prefixCode,
  306. this.parsCode[ shader ],
  307. this.getVarListCode( this.getVars( 'varying' ), 'varying' ),
  308. this.getVarListCode( this.inputs.uniforms[ shader ], 'uniform' ),
  309. this.getIncludesCode( 'consts', shader ),
  310. this.getIncludesCode( 'structs', shader ),
  311. this.getIncludesCode( 'functions', shader ),
  312. 'void main() {',
  313. this.getVarListCode( this.getVars( shader ) ),
  314. this.code[ shader ],
  315. this.resultCode[ shader ],
  316. this.finalCode[ shader ],
  317. '}'
  318. ].join( '\n' );
  319. },
  320. getVarListCode: function ( vars, prefix ) {
  321. prefix = prefix || '';
  322. var code = '';
  323. for ( var i = 0, l = vars.length; i < l; ++ i ) {
  324. var nVar = vars[ i ],
  325. type = nVar.type,
  326. name = nVar.name;
  327. var formatType = this.getFormatByType( type );
  328. if ( formatType === undefined ) {
  329. throw new Error( 'Node pars ' + formatType + ' not found.' );
  330. }
  331. code += prefix + ' ' + formatType + ' ' + name + ';\n';
  332. }
  333. return code;
  334. },
  335. getVars: function ( shader ) {
  336. return this.inputs.vars[ shader || this.shader ];
  337. },
  338. getNodeData: function ( node ) {
  339. var uuid = node.isNode ? node.uuid : node;
  340. return this.nodeData[ uuid ] = this.nodeData[ uuid ] || {};
  341. },
  342. createUniform: function ( shader, type, node, ns, needsUpdate, label ) {
  343. var uniforms = this.inputs.uniforms,
  344. index = uniforms.list.length;
  345. var uniform = new NodeUniform( {
  346. type: type,
  347. name: ns ? ns : 'nodeU' + index + ( label ? '_' + label : '' ),
  348. node: node,
  349. needsUpdate: needsUpdate
  350. } );
  351. uniforms.list.push( uniform );
  352. uniforms[ shader ].push( uniform );
  353. uniforms[ shader ][ uniform.name ] = uniform;
  354. this.uniforms[ uniform.name ] = uniform;
  355. return uniform;
  356. },
  357. createVertexUniform: function ( type, node, ns, needsUpdate, label ) {
  358. return this.createUniform( 'vertex', type, node, ns, needsUpdate, label );
  359. },
  360. createFragmentUniform: function ( type, node, ns, needsUpdate, label ) {
  361. return this.createUniform( 'fragment', type, node, ns, needsUpdate, label );
  362. },
  363. include: function ( node, parent, source ) {
  364. var includesStruct;
  365. node = typeof node === 'string' ? NodeLib.get( node ) : node;
  366. if ( this.context.include === false ) {
  367. return node.name;
  368. }
  369. if ( node instanceof FunctionNode ) {
  370. includesStruct = this.includes.functions;
  371. } else if ( node instanceof ConstNode ) {
  372. includesStruct = this.includes.consts;
  373. } else if ( node instanceof StructNode ) {
  374. includesStruct = this.includes.structs;
  375. }
  376. var includes = includesStruct[ this.shader ] = includesStruct[ this.shader ] || [];
  377. if ( node ) {
  378. var included = includes[ node.name ];
  379. if ( ! included ) {
  380. included = includes[ node.name ] = {
  381. node: node,
  382. deps: []
  383. };
  384. includes.push( included );
  385. included.src = node.build( this, 'source' );
  386. }
  387. if ( node instanceof FunctionNode && parent && includes[ parent.name ] && includes[ parent.name ].deps.indexOf( node ) == - 1 ) {
  388. includes[ parent.name ].deps.push( node );
  389. if ( node.includes && node.includes.length ) {
  390. var i = 0;
  391. do {
  392. this.include( node.includes[ i ++ ], parent );
  393. } while ( i < node.includes.length );
  394. }
  395. }
  396. if ( source ) {
  397. included.src = source;
  398. }
  399. return node.name;
  400. } else {
  401. throw new Error( 'Include not found.' );
  402. }
  403. },
  404. colorToVectorProperties: function ( color ) {
  405. return color.replace( 'r', 'x' ).replace( 'g', 'y' ).replace( 'b', 'z' ).replace( 'a', 'w' );
  406. },
  407. colorToVector: function ( color ) {
  408. return color.replace( /c/g, 'v3' );
  409. },
  410. getIncludes: function ( type, shader ) {
  411. return this.includes[ type ][ shader || this.shader ];
  412. },
  413. getIncludesCode: function () {
  414. function sortByPosition( a, b ) {
  415. return a.deps.length - b.deps.length;
  416. }
  417. return function getIncludesCode( type, shader ) {
  418. var includes = this.getIncludes( type, shader );
  419. if ( ! includes ) return '';
  420. var code = '',
  421. includes = includes.sort( sortByPosition );
  422. for ( var i = 0; i < includes.length; i ++ ) {
  423. if ( includes[ i ].src ) code += includes[ i ].src + '\n';
  424. }
  425. return code;
  426. };
  427. }(),
  428. getConstructorFromLength: function ( len ) {
  429. return constructors[ len - 1 ];
  430. },
  431. isTypeMatrix: function ( format ) {
  432. return /^m/.test( format );
  433. },
  434. getTypeLength: function ( type ) {
  435. if ( type === 'f' ) return 1;
  436. return parseInt( this.colorToVector( type ).substr( 1 ) );
  437. },
  438. getTypeFromLength: function ( len ) {
  439. if ( len === 1 ) return 'f';
  440. return 'v' + len;
  441. },
  442. findNode: function () {
  443. for ( var i = 0; i < arguments.length; i ++ ) {
  444. var nodeCandidate = arguments[ i ];
  445. if ( nodeCandidate !== undefined && nodeCandidate.isNode ) {
  446. return nodeCandidate;
  447. }
  448. }
  449. },
  450. resolve: function () {
  451. for ( var i = 0; i < arguments.length; i ++ ) {
  452. var nodeCandidate = arguments[ i ];
  453. if ( nodeCandidate !== undefined ) {
  454. if ( nodeCandidate.isNode ) {
  455. return nodeCandidate;
  456. } else if ( nodeCandidate.isTexture ) {
  457. switch ( nodeCandidate.mapping ) {
  458. case CubeReflectionMapping:
  459. case CubeRefractionMapping:
  460. return new CubeTextureNode( nodeCandidate );
  461. break;
  462. case CubeUVReflectionMapping:
  463. case CubeUVRefractionMapping:
  464. return new TextureCubeNode( new TextureNode( nodeCandidate ) );
  465. break;
  466. default:
  467. return new TextureNode( nodeCandidate );
  468. }
  469. } else if ( nodeCandidate.isVector2 ) {
  470. return new Vector2Node( nodeCandidate );
  471. } else if ( nodeCandidate.isVector3 ) {
  472. return new Vector3Node( nodeCandidate );
  473. } else if ( nodeCandidate.isVector4 ) {
  474. return new Vector4Node( nodeCandidate );
  475. }
  476. }
  477. }
  478. },
  479. format: function ( code, from, to ) {
  480. var typeToType = this.colorToVector( to + ' <- ' + from );
  481. switch ( typeToType ) {
  482. case 'f <- v2' : return code + '.x';
  483. case 'f <- v3' : return code + '.x';
  484. case 'f <- v4' : return code + '.x';
  485. case 'f <- i' :
  486. case 'f <- b' : return 'float( ' + code + ' )';
  487. case 'v2 <- f' : return 'vec2( ' + code + ' )';
  488. case 'v2 <- v3': return code + '.xy';
  489. case 'v2 <- v4': return code + '.xy';
  490. case 'v2 <- i' :
  491. case 'v2 <- b' : return 'vec2( float( ' + code + ' ) )';
  492. case 'v3 <- f' : return 'vec3( ' + code + ' )';
  493. case 'v3 <- v2': return 'vec3( ' + code + ', 0.0 )';
  494. case 'v3 <- v4': return code + '.xyz';
  495. case 'v3 <- i' :
  496. case 'v3 <- b' : return 'vec2( float( ' + code + ' ) )';
  497. case 'v4 <- f' : return 'vec4( ' + code + ' )';
  498. case 'v4 <- v2': return 'vec4( ' + code + ', 0.0, 1.0 )';
  499. case 'v4 <- v3': return 'vec4( ' + code + ', 1.0 )';
  500. case 'v4 <- i' :
  501. case 'v4 <- b' : return 'vec4( float( ' + code + ' ) )';
  502. case 'i <- f' :
  503. case 'i <- b' : return 'int( ' + code + ' )';
  504. case 'i <- v2' : return 'int( ' + code + '.x )';
  505. case 'i <- v3' : return 'int( ' + code + '.x )';
  506. case 'i <- v4' : return 'int( ' + code + '.x )';
  507. case 'b <- f' : return '( ' + code + ' != 0.0 )';
  508. case 'b <- v2' : return '( ' + code + ' != vec2( 0.0 ) )';
  509. case 'b <- v3' : return '( ' + code + ' != vec3( 0.0 ) )';
  510. case 'b <- v4' : return '( ' + code + ' != vec4( 0.0 ) )';
  511. case 'b <- i' : return '( ' + code + ' != 0 )';
  512. }
  513. return code;
  514. },
  515. getTypeByFormat: function ( format ) {
  516. return convertFormatToType[ format ] || format;
  517. },
  518. getFormatByType: function ( type ) {
  519. return convertTypeToFormat[ type ] || type;
  520. },
  521. getUuid: function ( uuid, useCache ) {
  522. useCache = useCache !== undefined ? useCache : true;
  523. if ( useCache && this.cache ) uuid = this.cache + '-' + uuid;
  524. return uuid;
  525. },
  526. getElementByIndex: function ( index ) {
  527. return elements[ index ];
  528. },
  529. getIndexByElement: function ( elm ) {
  530. return elements.indexOf( elm );
  531. },
  532. isShader: function ( shader ) {
  533. return this.shader === shader;
  534. },
  535. setShader: function ( shader ) {
  536. this.shader = shader;
  537. return this;
  538. },
  539. mergeDefines: function ( defines ) {
  540. for ( var name in defines ) {
  541. this.defines[ name ] = defines[ name ];
  542. }
  543. return this.defines;
  544. },
  545. mergeUniform: function ( uniforms ) {
  546. for ( var name in uniforms ) {
  547. this.uniforms[ name ] = uniforms[ name ];
  548. }
  549. return this.uniforms;
  550. },
  551. getTextureEncodingFromMap: function ( map ) {
  552. var encoding;
  553. if ( ! map ) {
  554. encoding = LinearEncoding;
  555. } else if ( map.isTexture ) {
  556. encoding = map.encoding;
  557. } else if ( map.isWebGLRenderTarget ) {
  558. console.warn( 'THREE.WebGLPrograms.getTextureEncodingFromMap: don\'t use render targets as textures. Use their .texture property instead.' );
  559. encoding = map.texture.encoding;
  560. }
  561. if ( encoding === LinearEncoding && this.context.gamma ) {
  562. encoding = GammaEncoding;
  563. }
  564. return encoding;
  565. }
  566. };
  567. export { NodeBuilder };