feat
Define program using class extension
import { d, Lil, uniform } from "https://esm.sh/gh/gnlow/lilgpu/browser.ts"
class MyProgram extends Lil {
vertShader = `... GLSL code ...`
fragShader = `... GLSL code ...`
@uniform(d.struct({
x: d.u32,
y: d.u32,
}))
accessor span = { x: 10, y: 20 }
@uniform(d.f32)
accessor blue = 0.5
}
const app = new MyProgram()
const g = await app.init(document.querySelector("canvas")!)
g.draw(4 /* The number of vertices */)
const tick = () => new Promise(requestAnimationFrame)
while (true) {
await tick()
basic.blue = Math.sin(Date.now()/1000)/2+0.5
g.draw(4)
}
dependency
- Update
typegpu@0.3.2 -> 0.5.3
0.5.4-0.5.7 occurs runtime error