-
Notifications
You must be signed in to change notification settings - Fork 13
/
AdvancedEffect.pde
54 lines (41 loc) · 1.07 KB
/
AdvancedEffect.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import ch.bildspur.postfx.builder.*;
import ch.bildspur.postfx.pass.*;
import ch.bildspur.postfx.*;
PostFXSupervisor supervisor;
BrightPass brightPass;
SobelPass sobelPass;
PGraphics canvas;
void setup()
{
size(500, 500, P2D);
// create supervisor and load shaders
supervisor = new PostFXSupervisor(this);
brightPass = new BrightPass(this, 0.3f);
sobelPass = new SobelPass(this);
canvas = createGraphics(width, height, P3D);
}
void draw()
{
// draw a simple rotating cube around a sphere
canvas.beginDraw();
canvas.background(55);
canvas.pushMatrix();
canvas.translate(width / 2, height / 2);
canvas.rotateX(radians(frameCount % 360));
canvas.rotateZ(radians(frameCount % 360));
canvas.noStroke();
canvas.fill(20, 20, 20);
canvas.box(100);
canvas.fill(150, 255, 255);
canvas.sphere(60);
canvas.popMatrix();
canvas.endDraw();
blendMode(BLEND);
image(canvas, 0, 0);
// add white ring around sphere
blendMode(SCREEN);
supervisor.render(canvas);
supervisor.pass(brightPass);
supervisor.pass(sobelPass);
supervisor.compose();
}