@@ -53,6 +53,8 @@ function rendererWebGPU(p5, fn) {
5353 * <a href="#/p5/uniformStorage">uniformStorage()</a> to bind it to a shader.
5454 *
5555 * @class p5.StorageBuffer
56+ * @module 3D
57+ * @submodule p5.strands
5658 * @beta
5759 * @webgpu
5860 */
@@ -3652,6 +3654,8 @@ ${hookUniformFields}}
36523654 * @method createStorage
36533655 * @beta
36543656 * @webgpu
3657+ * @module 3D
3658+ * @submodule p5.strands
36553659 * @param {Number|Array|Float32Array|Object[] } dataOrCount Either a number specifying the count of floats,
36563660 * an array/Float32Array of floats, or an array of objects describing struct elements.
36573661 * @returns {p5.StorageBuffer } A storage buffer.
@@ -3667,6 +3671,7 @@ ${hookUniformFields}}
36673671 * calling `baseComputeShader().modify(shaderFunction)`.
36683672 *
36693673 * @method baseComputeShader
3674+ * @module 3D
36703675 * @submodule p5.strands
36713676 * @beta
36723677 * @webgpu
@@ -3715,14 +3720,8 @@ ${hookUniformFields}}
37153720 * }
37163721 * particles = createStorage(data);
37173722 *
3718- * computeShader = buildComputeShader(
3719- * simulate,
3720- * { particles }
3721- * );
3722- * displayShader = buildMaterialShader(
3723- * display,
3724- * { particles }
3725- * );
3723+ * computeShader = buildComputeShader(simulate);
3724+ * displayShader = buildMaterialShader(display);
37263725 * instance = buildGeometry(drawParticle);
37273726 * }
37283727 *
@@ -3732,10 +3731,10 @@ ${hookUniformFields}}
37323731 *
37333732 * function simulate() {
37343733 * let r = 3;
3735- * let particleData = uniformStorage(particles);
3734+ * let data = uniformStorage(particles);
37363735 * let idx = iteration.index.x;
3737- * let pos = particleData [idx].position;
3738- * let vel = particleData [idx].velocity;
3736+ * let pos = data [idx].position;
3737+ * let vel = data [idx].velocity;
37393738 * pos = pos + vel;
37403739 * if (pos.x > width/2 - r || pos.x < -height/2 + r) {
37413740 * vel.x = -vel.x;
@@ -3745,14 +3744,14 @@ ${hookUniformFields}}
37453744 * vel.y = -vel.y;
37463745 * pos.y = clamp(pos.y, -height/2 + r, height/2 - r);
37473746 * }
3748- * particleData [idx].position = pos;
3749- * particleData [idx].velocity = vel;
3747+ * data [idx].position = pos;
3748+ * data [idx].velocity = vel;
37503749 * }
37513750 *
37523751 * function display() {
3753- * let particleData = uniformStorage(particles);
3752+ * let data = uniformStorage(particles);
37543753 * worldInputs.begin();
3755- * let pos = particleData [instanceID()].position;
3754+ * let pos = data [instanceID()].position;
37563755 * worldInputs.position.xy += pos;
37573756 * worldInputs.end();
37583757 * }
@@ -3764,11 +3763,12 @@ ${hookUniformFields}}
37643763 * fill(255);
37653764 * lights();
37663765 * shader(displayShader);
3767- * model(geo , numParticles);
3766+ * model(instance , numParticles);
37683767 * }
37693768 * ```
37703769 *
37713770 * @method buildComputeShader
3771+ * @module 3D
37723772 * @submodule p5.strands
37733773 * @beta
37743774 * @webgpu
@@ -3783,6 +3783,7 @@ ${hookUniformFields}}
37833783 * Dispatches a compute shader to run on the GPU.
37843784 *
37853785 * @method compute
3786+ * @module 3D
37863787 * @submodule p5.strands
37873788 * @beta
37883789 * @webgpu
@@ -3816,6 +3817,8 @@ ${hookUniformFields}}
38163817 * @property {Object } iteration
38173818 * @beta
38183819 * @webgpu
3820+ * @module 3D
3821+ * @submodule p5.strands
38193822 */
38203823}
38213824
0 commit comments