@@ -41,7 +41,6 @@ function strands(p5, fn) {
4141 ctx . vertexDeclarations = new Set ( ) ;
4242 ctx . fragmentDeclarations = new Set ( ) ;
4343 ctx . hooks = [ ] ;
44- ctx . globalAssignments = [ ] ;
4544 ctx . backend = backend ;
4645 ctx . active = active ;
4746 ctx . renderer = renderer ;
@@ -63,7 +62,6 @@ function strands(p5, fn) {
6362 ctx . vertexDeclarations = new Set ( ) ;
6463 ctx . fragmentDeclarations = new Set ( ) ;
6564 ctx . hooks = [ ] ;
66- ctx . globalAssignments = [ ] ;
6765 ctx . active = false ;
6866 p5 . disableFriendlyErrors = ctx . previousFES ;
6967 for ( const key in ctx . windowOverrides ) {
@@ -212,7 +210,7 @@ if (typeof p5 !== "undefined") {
212210 * }
213211 *
214212 * function material() {
215- * let t = uniformFloat ();
213+ * let t = millis ();
216214 * worldInputs.begin();
217215 * // Move the vertex up and down in a wave in world space
218216 * // In world space, moving the object (e.g., with translate()) will affect these coordinates
@@ -224,7 +222,6 @@ if (typeof p5 !== "undefined") {
224222 * function draw() {
225223 * background(255);
226224 * shader(myShader);
227- * myShader.setUniform('t', millis());
228225 * lights();
229226 * noStroke();
230227 * fill('red');
@@ -313,9 +310,7 @@ if (typeof p5 !== "undefined") {
313310 * A value between `0.0` and `1.0`
314311 *
315312 * @example
316- * <div modernizr="webgl">
317- * <code>
318- * // Example 1: A soft vertical fade using smoothstep (no uniforms)
313+ * // Example 1: A soft vertical fade using smoothstep
319314 *
320315 * let fadeShader;
321316 *
@@ -334,31 +329,25 @@ if (typeof p5 !== "undefined") {
334329 *
335330 * function setup() {
336331 * createCanvas(300, 200, WEBGL);
337- * fadeShader = baseFilterShader().modify (fadeCallback);
332+ * fadeShader = buildFilterShader (fadeCallback);
338333 * }
339334 *
340335 * function draw() {
341336 * background(0);
342337 * filter(fadeShader);
343338 * }
344- * </code>
345- * </div>
346339 *
347340 * @example
348- * <div modernizr="webgl">
349- * <code>
350- * // Example 2: Animate the smooth transition using a uniform
341+ * // Example 2: Animate the smooth transition over time
351342 *
352343 * let animatedShader;
353344 *
354345 * function animatedFadeCallback() {
355- * const time = uniformFloat(() => millis() * 0.001);
356- *
357346 * getColor((inputs) => {
358347 * let x = inputs.texCoord.x;
359348 *
360349 * // Move the smoothstep band back and forth over time
361- * let center = 0.5 + 0.25 * sin(time );
350+ * let center = 0.5 + 0.25 * sin(millis() * 0.001 );
362351 * let t = smoothstep(center - 0.05, center + 0.05, x);
363352 *
364353 * return [t, t, t, 1];
@@ -367,15 +356,13 @@ if (typeof p5 !== "undefined") {
367356 *
368357 * function setup() {
369358 * createCanvas(300, 200, WEBGL);
370- * animatedShader = baseFilterShader().modify (animatedFadeCallback);
359+ * animatedShader = buildFilterShader (animatedFadeCallback);
371360 * }
372361 *
373362 * function draw() {
374363 * background(0);
375364 * filter(animatedShader);
376365 * }
377- * </code>
378- * </div>
379366 */
380367
381368/**
@@ -492,7 +479,7 @@ if (typeof p5 !== "undefined") {
492479 * }
493480 *
494481 * function material() {
495- * let t = uniformFloat ();
482+ * let t = millis ();
496483 * pixelInputs.begin();
497484 * // Animate alpha (transparency) based on x position
498485 * pixelInputs.color.a = 0.5 + 0.5 *
@@ -503,7 +490,6 @@ if (typeof p5 !== "undefined") {
503490 * function draw() {
504491 * background(240);
505492 * shader(myShader);
506- * myShader.setUniform('t', millis());
507493 * lights();
508494 * noStroke();
509495 * fill('purple');
@@ -694,7 +680,7 @@ if (typeof p5 !== "undefined") {
694680 * }
695681 *
696682 * function material() {
697- * let t = uniformFloat ();
683+ * let t = millis ();
698684 * objectInputs.begin();
699685 * // Create a sine wave along the object
700686 * objectInputs.position.y += sin(t * 0.001 + objectInputs.position.x);
@@ -704,7 +690,6 @@ if (typeof p5 !== "undefined") {
704690 * function draw() {
705691 * background(220);
706692 * shader(myShader);
707- * myShader.setUniform('t', millis());
708693 * noStroke();
709694 * fill('orange');
710695 * sphere(50);
@@ -736,7 +721,7 @@ if (typeof p5 !== "undefined") {
736721 * }
737722 *
738723 * function material() {
739- * let t = uniformFloat ();
724+ * let t = millis ();
740725 * cameraInputs.begin();
741726 * // Move vertices in camera space based on their x position
742727 * cameraInputs.position.y += 30 * sin(cameraInputs.position.x * 0.05 + t * 0.001);
@@ -748,7 +733,6 @@ if (typeof p5 !== "undefined") {
748733 * function draw() {
749734 * background(200);
750735 * shader(myShader);
751- * myShader.setUniform('t', millis());
752736 * noStroke();
753737 * fill('red');
754738 * sphere(50);
@@ -795,8 +779,6 @@ if (typeof p5 !== "undefined") {
795779 * will behave as a vec4 holding components r, g, b, and a (alpha), with each component being in the range 0.0 to 1.0.
796780 *
797781 * @example
798- * <div modernizr='webgl'>
799- * <code>
800782 * // A filter shader (using p5.strands) which will
801783 * // sample and invert the color of each pixel
802784 * // from the canvas.
@@ -829,12 +811,8 @@ if (typeof p5 !== "undefined") {
829811 *
830812 * filterColor.end();
831813 * }
832- * </code>
833- *
834814 *
835815 * @example
836- * <div modernizr='webgl'>
837- * <code>
838816 * // This primitive edge-detection filter samples
839817 * // and compares the colors of the current pixel
840818 * // on the canvas, and a little to the right.
@@ -891,8 +869,6 @@ if (typeof p5 !== "undefined") {
891869 * rotate(frameCount / 300);
892870 * square(0, 0, 30);
893871 * }
894- * </code>
895- * </div>
896872 */
897873
898874/**
0 commit comments