Skip to content

Commit 499d8ea

Browse files
committed
updated processing version and tried to fix the problem
1 parent 5e08a10 commit 499d8ea

File tree

7 files changed

+95
-24
lines changed

7 files changed

+95
-24
lines changed

lib/processing/core/library/core.jar

65.9 KB
Binary file not shown.

lib/processing/core/library/export.txt

100755100644
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ application.windows32=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-wind
88
application.windows64=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-windows-amd64.jar,gluegen-rt-natives-windows-amd64.jar
99
application.linux32=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-i586.jar,gluegen-rt-natives-linux-i586.jar
1010
application.linux64=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-amd64.jar,gluegen-rt-natives-linux-amd64.jar
11-
application.linux-armv6hf=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-armv6hf.jar,gluegen-rt-natives-linux-armv6hf.jar
11+
application.linux-armv6hf=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-armv6hf.jar,gluegen-rt-natives-linux-armv6hf.jar
12+
application.linux-arm64=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-aarch64.jar,gluegen-rt-natives-linux-aarch64.jar
Binary file not shown.
Binary file not shown.
-1.39 KB
Binary file not shown.

src/main/java/ch/bildspur/postfx/PostFXSupervisor.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ public void setResolution(int width, int height) {
7373
passBuffers = new PGraphics[PASS_NUMBER];
7474
for (int i = 0; i < passBuffers.length; i++) {
7575
passBuffers[i] = sketch.createGraphics(width, height, PApplet.P2D);
76-
passBuffers[i].noSmooth();
7776
}
7877

7978
resolution = new int[]{width * sketch.pixelDensity, height * sketch.pixelDensity};
@@ -110,9 +109,11 @@ public void render(PImage graphics) {
110109
clearPass(pass);
111110

112111
pass.beginDraw();
112+
/*
113113
pass.image(graphics, 0, 0, width, height,
114114
0, (int) (height * -1f), width * graphics.pixelDensity, (int) (0.5f * height * graphics.pixelDensity));
115-
//pass.image(graphics, 0, 0, width, height);
115+
*/
116+
pass.image(graphics, 0, 0, width, height);
116117
pass.endDraw();
117118

118119
increasePass();
Lines changed: 90 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
package ch.bildspur.postfx;
22

33
import ch.bildspur.postfx.builder.PostFX;
4+
import ch.bildspur.postfx.builder.PostFXBuilder;
45
import processing.core.PApplet;
6+
import processing.core.PGraphics;
7+
8+
import java.lang.reflect.Field;
9+
import java.util.Arrays;
10+
import java.util.Collection;
11+
import java.util.Comparator;
12+
import java.util.TreeSet;
513

614
/**
715
* Created by cansik on 21.03.17.
816
*/
917
public class SimpleSketch extends PApplet {
1018
PostFX fx;
19+
PGraphics canvas;
20+
21+
boolean renderOnCanvas = false;
1122

1223
public static void main(String... args) {
1324
SimpleSketch sketch = new SimpleSketch();
@@ -16,43 +27,101 @@ public static void main(String... args) {
1627

1728
public void settings() {
1829
size(720, 720, P3D);
19-
pixelDensity(2);
30+
pixelDensity(1);
2031
}
2132

2233
public void setup() {
2334
fx = new PostFX(this);
35+
36+
canvas = createGraphics(width, height, P3D);
2437
}
2538

2639
public void draw() {
27-
// clear screen
2840
background(0);
2941

30-
fill(255);
31-
ellipse(width / 2, height / 2, width * 0.75f, height * 0.75f);
42+
if (renderOnCanvas) {
43+
canvas.beginDraw();
44+
renderExample(canvas);
45+
canvas.endDraw();
46+
} else {
47+
renderExample(g);
48+
}
49+
50+
// add effect
51+
PostFXBuilder fxb;
52+
53+
if (renderOnCanvas) {
54+
fxb = fx.render(this.canvas);
55+
} else {
56+
fxb = fx.render();
57+
}
58+
59+
fxb = fxb.bloom(0.8f, 30, 50);
60+
61+
background(0);
62+
if (renderOnCanvas) {
63+
fxb.compose(canvas);
64+
image(canvas, 0, 0);
65+
} else {
66+
fxb.compose();
67+
}
68+
69+
fill(0, 255, 0);
70+
text("FPS: " + frameRate, 20, 20);
71+
text("Rendering: " + ((renderOnCanvas) ? "Canvas" : "Screen"), 20, 50);
72+
}
73+
74+
void renderExample(PGraphics graphics) {
75+
// clear screen
76+
graphics.background(0);
77+
78+
graphics.fill(255);
79+
graphics.ellipse(width / 2, height / 2, width * 0.75f, height * 0.75f);
3280

3381
// render simple cube
34-
pushMatrix();
82+
graphics.pushMatrix();
3583

36-
translate(width / 2f, height / 2f);
37-
rotateX(radians(frameCount % 360));
38-
rotateZ(radians(frameCount % 360));
84+
graphics.translate(width / 2f, height / 2f);
85+
graphics.rotateX(radians(frameCount % 360));
86+
graphics.rotateZ(radians(frameCount % 360));
3987

40-
noStroke();
41-
fill(20, 20, 20);
42-
box(100);
88+
graphics.noStroke();
89+
graphics.fill(20, 20, 20);
90+
graphics.box(100);
4391

44-
fill(150, 255, 255);
45-
sphere(60);
92+
graphics.fill(150, 255, 255);
93+
graphics.sphere(60);
4694

47-
popMatrix();
95+
graphics.popMatrix();
96+
}
4897

49-
// add effect
50-
fx.render()
51-
.bloom(0.8f, 30, 50)
52-
.toneMapping(1.2f)
53-
.compose();
98+
@Override
99+
public void keyPressed() {
100+
super.keyPressed();
54101

55-
fill(0, 255, 0);
56-
text("FPS: " + frameRate, 20, 20);
102+
renderOnCanvas = !renderOnCanvas;
103+
}
104+
105+
public static Collection<Field> getAllFields(Class<?> type) {
106+
TreeSet<Field> fields = new TreeSet<Field>(
107+
Comparator.comparing(Field::getName).thenComparing(o -> o.getDeclaringClass().getSimpleName()).thenComparing(o -> o.getDeclaringClass().getName()));
108+
for (Class<?> c = type; c != null; c = c.getSuperclass()) {
109+
fields.addAll(Arrays.asList(c.getDeclaredFields()));
110+
}
111+
return fields;
112+
}
113+
114+
public static void printAllFields(Object obj) {
115+
for (Field field : getAllFields(obj.getClass())) {
116+
field.setAccessible(true);
117+
String name = field.getName();
118+
Object value = null;
119+
try {
120+
value = field.get(obj);
121+
} catch (IllegalArgumentException | IllegalAccessException e) {
122+
e.printStackTrace();
123+
}
124+
System.out.printf("%s %s.%s = %s;\n", value == null ? " " : "*", field.getDeclaringClass().getSimpleName(), name, value);
125+
}
57126
}
58127
}

0 commit comments

Comments
 (0)