Skip to content

Commit

Permalink
TSL Transpiler: Support varying. (#30506)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 authored Feb 12, 2025
1 parent c48f842 commit 577ee12
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions examples/jsm/transpiler/TSLEncoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,6 @@ class TSLEncoder {

let code;

/*@TODO: else if ( node.isVarying ) {
code = this.emitVarying( node );
}*/

if ( node.isAccessor ) {

this.addImport( node.property );
Expand Down Expand Up @@ -243,6 +237,10 @@ class TSLEncoder {

code = this.emitUniform( node );

} else if ( node.isVarying ) {

code = this.emitVarying( node );

} else if ( node.isTernary ) {

code = this.emitTernary( node );
Expand Down Expand Up @@ -500,7 +498,16 @@ ${ this.tab }} )`;

}

/*emitVarying( node ) { }*/
emitVarying( node ) {

const { name, type } = node;

this.addImport( 'varying' );
this.addImport( type );

return `const ${ name } = varying( ${ type }(), '${ name }' )`;

}

emitOverloadingFunction( nodes ) {

Expand Down

0 comments on commit 577ee12

Please sign in to comment.