forked from amandaghassaei/OrigamiSimulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobals.js
executable file
·131 lines (106 loc) · 3.38 KB
/
globals.js
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/**
* Created by ghassaei on 10/7/16.
*/
function initGlobals(){
var _globals = {
navMode: "simulation",
scale: 1,
//view
colorMode: "color",
calcFaceStrain: false,
color1: "ec008b",
color2: "dddddd",
edgesVisible: true,
mtnsVisible: true,
valleysVisible: true,
panelsVisible: false,
passiveEdgesVisible: false,
boundaryEdgesVisible: true,
meshVisible: true,
ambientOcclusion: false,
//flags
simulationRunning: true,
fixedHasChanged: false,
forceHasChanged: false,
materialHasChanged: false,
creaseMaterialHasChanged: false,
shouldResetDynamicSim: false,//not used
shouldChangeCreasePercent: false,
nodePositionHasChanged: false,
shouldZeroDynamicVelocity: false,
shouldCenterGeo: false,
needsSync: false,
simNeedsSync: false,
menusVisible: true,
url: null,
//3d vis
simType: "dynamic",
//compliant sim settings
creasePercent: 0.6,
axialStiffness: 20,
creaseStiffness: 0.7,
panelStiffness: 0.7,
faceStiffness: 0.2,
//dynamic sim settings
percentDamping: 0.45,//damping ratio
density: 1,
integrationType: "euler",
strainClip: 5.0,//for strain visualization, % strain that is drawn red
//import pattern settings
vertTol: 3,//vertex merge tolerance
foldUseAngles: true,//import current angles from fold format as target angles
//save stl settings
filename: null,
extension: null,
doublesidedSTL: false,
doublesidedOBJ: false,
exportScale: 1,
thickenModel: true,
thickenOffset: 5,
polyFacesOBJ: true,
//save fold settings
foldUnits: "unit",
triangulateFOLDexport: false,
exportFoldAngle: true,
pausedForPatternView: false,
userInteractionEnabled: false,
vrEnabled: false,
numSteps: 100,
rotateModel: null,
rotationSpeed: 0.01,
backgroundColor:"ffffff",
capturer: null,
capturerQuality: 63,
capturerFPS: 60,
gifFPS: 20,
currentFPS: null,
capturerScale: 1,
capturerFrames: 0,
shouldScaleCanvas: false,
isGif: false,
shouldAnimateFoldPercent: false
};
function setCreasePercent(percent){
_globals.creasePercent = percent;
percent *= 100;
$("#creasePercent>div").slider({value:percent});
$("#creasePercent>input").val(percent.toFixed(0));
$("#creasePercentNav>div").slider({value:percent});
$("#creasePercentBottom>div").slider({value:percent});
}
_globals.setCreasePercent = setCreasePercent;
function warn(msg){
if (($("#warningMessage").html()) != "") $("#warningMessage").append("<br/><hr>" + msg);
else $("#warningMessage").html(msg);
if (!$('#warningModal').hasClass('show')) $("#warningModal").modal("show");
}
$('#warningModal').on('hidden.bs.modal', function () {
$("#warningMessage").html("");
});
_globals.warn = warn;
function noCreasePatternAvailable(){
return _globals.extension == "fold";
}
_globals.noCreasePatternAvailable = noCreasePatternAvailable;
return _globals;
}