-
-
Notifications
You must be signed in to change notification settings - Fork 36k
Closed
Labels
TSLThree.js Shading LanguageThree.js Shading Language
Milestone
Description
Description
It transpile for
as While
but it seems While was replaced by Loop
, in my opinion it's good to have while & a For loop, as i dont immediatly understand it when i see the generic terms Loop
but it might be only me, anyway the transpiler have a little problem here.
Reproduction steps
https://threejs.org/examples/webgpu_tsl_transpiler.html
Code
float test(){
int i=0;
for(float i=0.; i<1.; i+=1.){
i++;
}
return i;
}
->
// Three.js Transpiler r175
import { int, float, While, Fn } from 'three/tsl';
export const test = /*#__PURE__*/ Fn( () => {
const i = int( int( 0 ) ).toVar();
{
const i = float( 0. ).toVar();
While( i.lessThan( 1. ), () => {
i.increment();
i.addAssign( 1. );
} )
}
return i;
} ).setLayout( {
name: 'test',
type: 'float',
inputs: []
} );
Live example
X
Screenshots
X
Version
r175
Device
No response
Browser
No response
OS
No response
Metadata
Metadata
Assignees
Labels
TSLThree.js Shading LanguageThree.js Shading Language