forked from struct78/hemeshgui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThreadRenderer.pde
67 lines (57 loc) · 2.08 KB
/
ThreadRenderer.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
55
56
57
58
59
60
61
62
63
64
65
66
67
class ThreadRenderer implements Runnable {
Thread thread;
ThreadRenderer() {
}
public void start () {
if (thread == null) {
thread = new Thread (this);
thread.start();
}
}
public void run() {
SunflowAPIAPI sunflow = new SunflowAPIAPI();
sunflow.setWidth(int(sceneWidth * sunflowMultiply));
sunflow.setHeight(int(sceneHeight * sunflowMultiply));
if (savePreview) {
sunflow.setAaMin(-2);
sunflow.setAaMax(0);
samples = 16;
} else {
if (saveContinuous) {
sunflow.setAaMin(0);
sunflow.setAaMax(2);
samples = 16;
} else {
sunflow.setAaMin(1);
sunflow.setAaMax(2);
samples = 24;
}
}
sunflow.setThinlensCamera("thinLensCamera", 40f, (float)sceneWidth/sceneHeight);
sunflow.setCameraPosition(0, 0, (sceneHeight/2.0) / tan(PI*30.0 / 180.0));
selectedShader.create(sunflow);
sunflow.drawPlane("plane", new Point3(0, -sceneHeight/3, 0), new Vector3(0,1,0));
sunflow.drawMesh("hemesh", verticesHemeshOneDim, facesHemeshOneDim, actualZoom, radians(-rotationX), radians(rotationY), radians(rotationZ));
String path = "/renders/screenshots/";
if (saveContinuous) path = "/renders/sequence/" + timestamp + "/";
if (saveContinuous) {
if (saveMask) {
sunflow.render(sketchPath() + path + "mask-" + nf(frameCount,4) + ".png");
}
if (saveSunflow) {
sunflowLights(sunflow);
sunflow.setAmbientOcclusionEngine(new Color(255), new Color(0), samples, 7.5);
sunflow.render(sketchPath() + path + "sunflow-" + nf(frameCount,4) + ".png");
}
} else {
if (saveMask) {
sunflow.render(sketchPath() + path + timestamp + "-sunflow-mask.png");
}
if (saveSunflow) {
sunflowLights(sunflow);
sunflow.setAmbientOcclusionEngine(new Color(255), new Color(0), samples, 7.5);
sunflow.render(sketchPath() + path + timestamp + "-sunflow.png");
}
}
}
}