three.js dev template - module
HTML
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three/build/three.webgpu.js",
"three/webgpu": "https://unpkg.com/three/build/three.webgpu.js",
"three/tsl": "https://unpkg.com/three/build/three.tsl.js",
"three/addons/": "https://unpkg.com/three/examples/jsm/"
}
}
</script>
CSS
body {
margin: 0px;
}
JavaScript
import { struct } from 'three/tsl';
const a = struct( { count: 'int' } );
const b = struct( { count: 'i32' } );
const c = struct( { count: 'vec4<i32>' } );
console.log( a.getLength() ); // 1
console.log( b.getLength() ); // "TSL: Unsupported type: i32", NaN
console.log( c.getLength() ); // 4, passes by regex accident, breaks later in the builder