-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
31 lines (21 loc) · 810 Bytes
/
app.js
File metadata and controls
31 lines (21 loc) · 810 Bytes
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
import Renderer from './renderer/DeferredRenderer.js';
(async function () {
const stats = new Stats();
stats.showPanel( 0 ); // 0: fps, 1: ms, 2: mb, 3+: custom
document.body.appendChild( stats.dom );
const gui = new dat.GUI();
const canvas = document.querySelector('canvas');
// canvas.width = window.innerWidth;
// canvas.height = window.innerHeight;
const renderer = new Renderer(canvas);
await renderer.init();
gui.add(renderer, 'debugViewOffset', 0.0, 5.0);
gui.add(renderer, 'renderMode', renderer.renderModeLists).onChange(renderer.onChangeRenderMode.bind(renderer));
function frame() {
stats.begin();
renderer.frame();
stats.end();
requestAnimationFrame(frame);
}
requestAnimationFrame(frame);
})();