Repository navigation
Expand file tree
/
Copy pathsidebar.js
More file actions
105 lines (99 loc) · 3.63 KB
/
Copy pathsidebar.js
File metadata and controls
105 lines (99 loc) · 3.63 KB
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
/*global sidebarStupidFirefox postProcessOutline*/
var rigging = false;
var dots = false;
var shadowOnlyDots = false;
var dotsFXAA = false;
var colorFXAA = true;
var rotAroundCam = true;
function initSidebar() {
var options = sidebarStupidFirefox.getElementsByTagName("button");
for (var i = 0; i < options.length; i++) {
if (options[i].id == "toggle") {
options[i].addEventListener("click", toggleSidebar);
} else {
options[i].addEventListener("click", optionClick);
}
}
}
function toggleSidebar() {
if (sidebarStupidFirefox.style.transform != "translateX(0%)") {
sidebarStupidFirefox.style.transform = "translateX(0%)";
} else {
sidebarStupidFirefox.style.transform = "translateX(-100%)";
}
}
function optionClick(event) {
switch (this.innerHTML.toLowerCase()) {
case "": //Special case
//Harharhar, a nested switch statement!
switch (this.className) {
case "back":
break;
}
break;
case "rig":
rigging = !rigging;
this.classList.toggle("enabled");
break;
case "dots":
dots = !dots;
this.classList.toggle("enabled");
if (dots) {
postProcessOutline.shader.fShaderHeader["DOTS"] = true;
postProcessOutline.shader.fShaderHeader["SHADOW_ONLY_DOTS"] = false;
postProcessOutline.shader.recompileF();
} else {
postProcessOutline.shader.fShaderHeader["DOTS"] = false;
postProcessOutline.shader.recompileF();
}
break;
case "dots2":
shadowOnlyDots = !shadowOnlyDots;
this.classList.toggle("enabled");
if (shadowOnlyDots) {
postProcessOutline.shader.fShaderHeader["SHADOW_ONLY_DOTS"] = true;
postProcessOutline.shader.fShaderHeader["DOTS"] = true;
postProcessOutline.shader.recompileF();
} else {
postProcessOutline.shader.fShaderHeader["SHADOW_ONLY_DOTS"] = false;
postProcessOutline.shader.fShaderHeader["DOTS"] = false;
postProcessOutline.shader.recompileF();
}
break;
case "fxaa for dots":
dotsFXAA = !dotsFXAA;
this.classList.toggle("enabled");
if (dotsFXAA) {
postProcessOutline.shader.fShaderHeader["DOTSFXAA"] = true;
postProcessOutline.shader.recompileF();
} else {
postProcessOutline.shader.fShaderHeader["DOTSFXAA"] = false;
postProcessOutline.shader.recompileF();
}
break;
case "fxaa for color":
colorFXAA = !colorFXAA;
this.classList.toggle("enabled");
if (colorFXAA) {
postProcessOutline.shader.fShaderHeader["COLORFXAA"] = true;
postProcessOutline.shader.recompileF();
} else {
postProcessOutline.shader.fShaderHeader["COLORFXAA"] = false;
postProcessOutline.shader.recompileF();
}
break;
case "set light":
lightRot = [-Math.sin(yawRad) * Math.cos(pitchRad),
Math.sin(pitchRad), -Math.cos(yawRad) * Math.cos(pitchRad)
];
break;
case "rotate around cam":
this.classList.toggle("enabled");
rotAroundCam = !rotAroundCam;
break;
case "lock mouse":
glcanvas.requestPointerLock();
toggleSidebar();
break;
}
}