-
-
Notifications
You must be signed in to change notification settings - Fork 35.7k
tsl transpiler not supporting "switch" #30900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You are right, there is no You can represent a switch statement always as an if/else statement so we could basically updated the transpiler to do that. However, given that GLSL and WGSL support switch statements, adding a switch/case syntax could be a worthwhile addition. Maybe like so? import { Switch, vec2 } from 'three/tsl';
const result = vec2();
Switch( id ).Case( 0, () => {
result.assign( 1 );
} ).Case( 1, () => {
result.assign( 2 );
} ).Case( 2, () => {
result.assign( 3 );
} ).Case( 3, () => {
result.assign( 4 );
} ).Default( () => {
result.assign( 0 );
} ); |
@Mugen87 I'm closing this issue, thanks for the fast support on it ! |
The transpiler does not support the new switch/case syntax though. It might be good for tracking to keep this issue open. |
@Mugen87 oh right my bad ! thanks ! |
Description
currently the transpiler seems not understanding the switch :
transpile to :
Edit : actually i'm not even sure
switch
is supported by tsl cause it's not in the doc :https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language
Live example
https://threejs.org/examples/webgpu_tsl_transpiler.html
Version
r175
The text was updated successfully, but these errors were encountered: