@@ -1374,14 +1374,12 @@ function material(p5, fn){
1374
1374
* function setup() {
1375
1375
* createCanvas(200, 200, WEBGL);
1376
1376
* myShader = baseMaterialShader().modify({
1377
- * uniforms: {
1378
- * 'float time': () => millis()
1379
- * },
1380
- * 'Vertex getWorldInputs': `(Vertex inputs) {
1377
+ * let time = uniformFloat(() => millis());
1378
+ * getWorldInputs((inputs) => {
1381
1379
* inputs.position.y +=
1382
- * 20.0 * sin(time * 0.001 + inputs.position.x * 0.05);
1380
+ * 20 * sin(time * 0.001 + inputs.position.x * 0.05);
1383
1381
* return inputs;
1384
- * }`
1382
+ * });
1385
1383
* });
1386
1384
* }
1387
1385
*
@@ -1403,19 +1401,19 @@ function material(p5, fn){
1403
1401
*
1404
1402
* function setup() {
1405
1403
* createCanvas(200, 200, WEBGL);
1406
- * myShader = baseMaterialShader().modify({
1407
- * declarations: 'vec3 myNormal;',
1408
- * 'Inputs getPixelInputs': `(Inputs inputs) {
1404
+ * myShader = baseMaterialShader().modify(() => {
1405
+ * let myNormal = varyingVec3();
1406
+ * getPixelInputs(( inputs) => {
1409
1407
* myNormal = inputs.normal;
1410
1408
* return inputs;
1411
- * }`,
1412
- * 'vec4 getFinalColor': `(vec4 color) {
1409
+ * });
1410
+ * getFinalColor(( color) => {
1413
1411
* return mix(
1414
- * vec4(1.0 , 1.0 , 1.0 , 1.0 ),
1412
+ * vec4(1, 1, 1, 1),
1415
1413
* color,
1416
1414
* abs(dot(myNormal, vec3(0.0, 0.0, 1.0)))
1417
1415
* );
1418
- * }`
1416
+ * });
1419
1417
* });
1420
1418
* }
1421
1419
*
@@ -1477,10 +1475,10 @@ function material(p5, fn){
1477
1475
* myShader = baseMaterialShader().modify(() => {
1478
1476
* getPixelInputs((inputs) => {
1479
1477
* inputs.normal.x += 0.2 * sin(
1480
- * sin(inputs.texCoord.yx * TWO_PI * [ 10, 25] )
1478
+ * sin(TWO_PI * dot( inputs.texCoord.yx, vec2( 10, 25)) )
1481
1479
* );
1482
1480
* inputs.normal.y += 0.2 * sin(
1483
- * sin(inputs.texCoord * TWO_PI * [ 10, 25] )
1481
+ * sin(TWO_PI * dot(inputs.texCoord, vec2( 10, 25)) )
1484
1482
* );
1485
1483
* inputs.normal = normalize(inputs.normal);
1486
1484
* return inputs;
0 commit comments