File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2116,7 +2116,7 @@ function material(p5, fn){
21162116 *
21172117 * function draw() {
21182118 * background(255);
2119- * shader (myShader);
2119+ * strokeShader (myShader);
21202120 * strokeWeight(10);
21212121 * beginShape();
21222122 * for (let i = 0; i <= 50; i++) {
Original file line number Diff line number Diff line change @@ -316,22 +316,23 @@ class Shader {
316316 * createCanvas(200, 200, WEBGL);
317317 * myShader = baseMaterialShader().modify({
318318 * uniforms: {
319- * 'float time': () => millis()
319+ * 'float time': () => millis() // Uniform for time
320320 * },
321- * 'vec3 getWorldPosition': `(vec3 pos) {
322- * pos.y += 20. * sin(time * 0.001 + pos.x * 0.05);
323- * return pos;
321+ * 'Vertex getWorldInputs': `(Vertex inputs) {
322+ * inputs.position.y +=
323+ * 20. * sin(time * 0.001 + inputs.position.x * 0.05);
324+ * return inputs;
324325 * }`
325326 * });
326327 * }
327328 *
328329 * function draw() {
329330 * background(255);
330- * shader(myShader);
331- * lights();
332- * noStroke();
333- * fill('red');
334- * sphere(50);
331+ * shader(myShader); // Apply the custom shader
332+ * lights(); // Enable lighting
333+ * noStroke(); // Disable stroke
334+ * fill('red'); // Set fill color to red
335+ * sphere(50); // Draw a sphere with the shader applied
335336 * }
336337 * </code>
337338 * </div>
@@ -346,9 +347,10 @@ class Shader {
346347 * myShader = baseMaterialShader().modify({
347348 * // Manually specifying a uniform
348349 * declarations: 'uniform float time;',
349- * 'vec3 getWorldPosition': `(vec3 pos) {
350- * pos.y += 20. * sin(time * 0.001 + pos.x * 0.05);
351- * return pos;
350+ * 'Vertex getWorldInputs': `(Vertex inputs) {
351+ * inputs.position.y +=
352+ * 20. * sin(time * 0.001 + inputs.position.x * 0.05);
353+ * return inputs;
352354 * }`
353355 * });
354356 * }
You can’t perform that action at this time.
0 commit comments