-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
200 lines (184 loc) · 4.97 KB
/
index.html
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/comet.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ricochet • Ray Tracer</title>
</head>
<body>
<div id="app">
<div class="perfBox" id="perf-box">
<p id="fps">test</p>
<p id="rendertime">testy</p>
<p id="accumulations">testz</p>
</div>
<div class="infoBox" oncontextmenu="return false">
<div id="controls">
<p>
Hold right click to move camera: (translate with [W/A/S/D/Q/E])
(rotate with mouse).
</p>
<p>[p] to pause.</p>
<div class="scene-props">
<div>
<div>
<label for="sun-intensity">Sun Intensity</label>
<p id="sunIntensityValue">-</p>
</div>
<input
id="sunIntensity"
type="range"
min="0"
max="100"
/>
</div>
<div>
<div style="min-width: 150px;">
<label for="lights-intensity">Lights Intensity</label>
<p id="lightsIntensityValue">-</p>
</div>
<input
id="lightsIntensity"
type="range"
min="0"
max="100"
/>
</div>
<div>
<div>
<label for="spheres">Spheres</label>
<p id="spheresValue">-</p>
</div>
<input id="spheres" type="range" min="2" max="300" />
</div>
<div>
<div>
<label for="ray-bounces">Ray Bounces</label>
<p id="rayBouncesValue">-</p>
</div>
<input
id="rayBounces"
type="range"
min="0"
max="10"
/>
</div>
<div>
<div style="min-width: 180px;">
<label for="ray-offset">Ray Random Offset</label>
<p id="rayOffsetValue">-</p>
</div>
<input
id="rayOffset"
type="range"
min="0"
max="1"
step="0.01"
/>
</div>
</div>
</div>
<div style="display: inline-flex; justify-content: space-between">
<button id="show-fps-button">hide fps</button>
<p>•</p>
<button id="show-controls-button">hide controls</button>
<p>•</p>
<a target="_blank" href="https://github.com/typio/ricochet">code</a>
<p>•</p>
<a target="_blank" href="https://tohuber.com">Thomas Huber</a>
</div>
</div>
</div>
<script type="module" src="/src/main.ts"></script>
</body>
<script>
let showControls = true;
let showFPS = true;
const fpsButton = document.getElementById("show-fps-button");
const controlsButton = document.getElementById("show-controls-button");
const perfBox = document.getElementById("perf-box");
const controls = document.getElementById("controls");
fpsButton.addEventListener("click", () => {
showFPS = !showFPS;
if (showFPS) {
fpsButton.innerText = "hide fps";
perfBox.style.display = "";
} else {
fpsButton.innerText = "show fps";
perfBox.style.display = "none";
}
});
controlsButton.addEventListener("click", () => {
showControls = !showControls;
if (showControls) {
controlsButton.innerText = "hide controls";
controls.style.display = "inline";
} else {
controlsButton.innerText = "show controls";
controls.style.display = "none";
}
});
</script>
<style>
html,
body {
margin: 0;
overflow: hidden;
}
canvas {
position: absolute;
}
.infoBox,
.perfBox {
position: absolute;
text-align: right;
z-index: 10;
bottom: 6px;
right: 6px;
background: #001484;
border: 3px solid white;
padding: 2px 6px;
}
.perfBox {
top: 6px;
height: fit-content;
min-width: 140px;
}
.scene-props {
display: flex;
flex-direction: row;
}
.scene-props div {
display: flex;
flex-direction: column;
}
.scene-props div div {
display: flex;
flex-direction: row;
justify-content: space-between;
}
p,
a,
button,
label {
padding: 0px 5px;
font-family:
system-ui,
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
"Open Sans",
"Helvetica Neue",
sans-serif;
background: none;
border: none;
user-select: none;
color: #fff;
margin: 0;
font-size: 0.9rem;
line-height: 1.5rem;
}
</style>
</html>