You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm doing lots of WebGPU and I'm finding it difficult to use tweakpane because tweakpane seems to want things in JavaScript objects but I need them in typedarrays.
One example: Color, In WebGPU I have color = new Float32Array(4)
I can work around this issue by making proxy objects that convert to/from one to the other but it would be really great if I could use the typed arrays directly with tweakpane.
Have you given any thought to supporting this use case or accepting a PR for this use case?
What I'm hoping for is something
constwgslCode=` struct Uniforms { color: vec3f, lightDirection: vec3f, color: f32, } ...`;// Make an ArrayBuffer to contain the uniform valuesconstuniformValues=newArrayBuffer(8*4);// Make PARAMS that are views into the ArrayBufferconstPARAMS={color: newFloat32Array(uniformValues,0,3),lightDirection: newFloat32Array(uniformValues,16,3),mix: newFloat32Array(uniformValues,28,1),};constpane=newPane();pane.addBinding(PARAMS,'color',{color: {type: 'float'}});pane.addBinding(PARAMS,'lightDirection');pane.addBinding(PARAMS,'mix',{min: 0,max: 1});
Right now, those first 2 are problematic. Since color and lightDirection are typed arrays, tweakpane will just error internally. Fixing them outside tweakpane with proxies isn't a huge ton of code but it sure would be nice if tweakpane could somehow handle this because it seems like it would get more and more common
which is probably fine but if we're dreaming then the first way would be supported. Tweakpane could see the min/max or see it's an array with 1 value and make a Number controller.
wdyt?
The text was updated successfully, but these errors were encountered:
I'm doing lots of WebGPU and I'm finding it difficult to use tweakpane because tweakpane seems to want things in JavaScript objects but I need them in typedarrays.
One example: Color, In WebGPU I have
color = new Float32Array(4)
AFAICT, tweakpane wants
{r: number, b: number, g: number, a: number}
I can work around this issue by making proxy objects that convert to/from one to the other but it would be really great if I could use the typed arrays directly with tweakpane.
Have you given any thought to supporting this use case or accepting a PR for this use case?
What I'm hoping for is something
Right now, those first 2 are problematic. Since
color
andlightDirection
are typed arrays, tweakpane will just error internally. Fixing them outside tweakpane with proxies isn't a huge ton of code but it sure would be nice if tweakpane could somehow handle this because it seems like it would get more and more commonThe last one can be changed to
which is probably fine but if we're dreaming then the first way would be supported. Tweakpane could see the min/max or see it's an array with 1 value and make a Number controller.
wdyt?
The text was updated successfully, but these errors were encountered: