This feature requires the p5.webgpu.js addon.
此 API 是实验性的
其行为可能在 p5.js 的未来版本中发生变化。
Declares a storage buffer uniform inside a modify() callback, making a createStorage() buffer accessible in the shader.
Pass a p5.StorageBuffer (or a function returning one) as the second argument to set it as the default value, applied automatically each frame. Pass a plain object with the same field layout as the buffer's struct elements to declare the schema without binding a specific buffer.
When called without a name, p5.strands automatically uses the name of the variable it is assigned to as the uniform name.
Note: uniformStorage is only available when using p5.strands.
示例
语法
uniformStorage(name, [bufferOrSchema])
uniformStorage([bufferOrSchema])
参数
name
String: The name of the storage buffer uniform in the shader.
bufferOrSchema
p5.StorageBuffer|Function|Object: A storage buffer to bind, a function returning a storage buffer (called each frame), or a plain object describing the struct field layout.
返回值
A strands node representing the storage buffer.
Notice any errors or typos? Please let us know. Please feel free to edit src/strands/p5.strands.js and open a pull request!