Buckets:

imerfanrajabee's picture
download
raw
1.18 kB
/**
* A class that transpiles shader code from one language into another.
*
* `Transpiler` can only be used to convert GLSL into TSL right now. It is intended
* to support developers when they want to migrate their custom materials from the
* current to the new node-based material system.
*
* @three_import import Transpiler from 'three/addons/transpiler/Transpiler.js';
*/
class Transpiler {
/**
* Constructs a new transpiler.
*
* @param {GLSLDecoder} decoder - The GLSL decoder.
* @param {TSLEncoder} encoder - The TSL encoder.
*/
constructor( decoder, encoder ) {
/**
* The GLSL decoder. This component parse GLSL and produces
* a language-independent AST for further processing.
*
* @type {GLSLDecoder}
*/
this.decoder = decoder;
/**
* The TSL encoder. It takes the AST and emits TSL code.
*
* @type {TSLEncoder}
*/
this.encoder = encoder;
}
/**
* Parses the given GLSL source and returns TSL syntax.
*
* @param {string} source - The GLSL source.
* @return {string} The TSL code.
*/
parse( source ) {
return this.encoder.emit( this.decoder.parse( source ) );
}
}
export default Transpiler;

Xet Storage Details

Size:
1.18 kB
·
Xet hash:
cb61482bca60873f4d980f96cfdee5f6e63224d6f24655955637522d1c7440fb

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.