-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExportFunction.pde
58 lines (48 loc) · 1.75 KB
/
ExportFunction.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
/*--------------------------------------------------------------------------------
***ALL EXPORT FUNCTION ARE HERE***
---------------------------------------------------------------------------------*/
void ExportFunction(){
//export springs in OBJ (Thanks Co-de-iT)////////////////////////////////
if (exportSprings==true) {
exportAsOBJ("HA_exported_Springs");
exportSprings=false;
}
//Export OBJ////////////////////////////////////////
if (endSimulation==true) {
println("END SIMULATION!!!!!");
saveFrame("FINALSTATE/HA_100_#####.tiff");
exportAsOBJ("100_100");
endSimulation=false;
}
}
void exportAsOBJ(String fileName){
String dir = "export_data/"+fileName+ "springs.obj";
// export springs
PrintWriter output = createWriter(dir);
println("creating", "springs.obj file");
output.println("# exported from Processing");
output.println("# based on code (c) Co-de-iT 2014");
output.println("o Curve_0");
for (int i = 0; i < physics.springs.size(); ++i) {
VerletSpring sp = (VerletSpring) physics.springs.get(i);
output.println("v " + sp.a.x + " " + sp.a.z + " " + -sp.a.y);
output.println("v " + sp.b.x + " " + sp.b.z + " " + -sp.b.y);
output.println("l "+ (-2)+ " " + (-1));
}
output.flush();
output.close();
println(dir + " created.");
}
void RecordingFunction(){
//recordingVideo//////////////////////////////////////
if (recording) {
println("Video Recording");
saveFrame("outputVid/HA_video_#####.tiff");
}
//Take a picture/////////////////////////////////////
if (screenshot) {
println("screenshot");
saveFrame("outputPNG/HA_#####.tiff");
screenshot=false;
}
}