Skip to content

Commit b751657

Browse files
committed
Merge branch 'shadergen' of https://github.com/lukeplowden/p5.js into shadergen
2 parents b8072f9 + a0199d0 commit b751657

File tree

1 file changed

+12
-31
lines changed

1 file changed

+12
-31
lines changed

preview/global/sketch.js

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
let myShader;
2-
let myShader2;
32

3+
let myShader2;
44
p5.disableFriendlyErrors = true;
55
function windowResized() {
66
resizeCanvas(windowWidth, windowHeight);
@@ -18,15 +18,15 @@ function setup(){
1818
createCanvas(windowWidth, windowHeight, WEBGL);
1919

2020
myShader = baseMaterialShader().modify(() => {
21-
const uCol = uniformVector4(1,0, 0,1);
22-
const time = uniformFloat(() => millis());
23-
getFinalColor((color) => {
24-
color = uCol;
25-
color.y = 1;
26-
let x = createVector4(time);
27-
x.x += createFloat(2);
28-
color += x;
29-
return color;
21+
22+
const offset = uniformFloat(1);
23+
24+
getFinalColor((col) => {
25+
let a = createVector4(1, 2, 3, 4);
26+
let b = createVector4(3, 4, 5, 6);
27+
a = (a * b + offset) / 10;
28+
col += a;
29+
return col;
3030
});
3131
// getWorldInputs((Inputs) => {
3232
// console.log(Inputs)
@@ -35,25 +35,6 @@ function setup(){
3535
}
3636

3737
function draw(){
38-
background(0);
39-
shader(myShader);
40-
fill(0,0,0)
41-
sphere(100);
38+
// Set the styles
39+
background(0)
4240
}
43-
44-
`(vec4 color) {
45-
// From at <computed> [as uniformVector4] (http://localhost:5173/p5.js:86002:25)
46-
vec4 temp_0 = uCol;
47-
temp_0 = vec4(temp_0.x, 1.0000, temp_0.z, temp_0.w);
48-
vec4 finalReturnValue = temp_0;
49-
return finalReturnValue;
50-
}`
51-
`
52-
(vec4 color) {
53-
54-
// From at <computed> [as uniformVector4] (http://localhost:5173/p5.js:86002:25)
55-
vec4 temp_0 = uCol;
56-
temp_0 = vec4(temp_0.x, 1.0000, temp_0.z, temp_0.w);
57-
vec4 finalReturnValue = temp_0 + vec4(0.0000 + 2.0000, 0.0000, 0.0000, 0.0000);
58-
return finalReturnValue;
59-
}`

0 commit comments

Comments
 (0)