Spaces:
Running
Running
update comments
Browse files
index.js
CHANGED
@@ -78,7 +78,7 @@ async function main() {
|
|
78 |
let lastTime = performance.now();
|
79 |
function update() {
|
80 |
const currentTime = performance.now();
|
81 |
-
const deltaTime = (currentTime - lastTime) / 1000; //
|
82 |
state.time += deltaTime;
|
83 |
const fov = 60 * Math.PI / 180;
|
84 |
const aspect = canvas.clientWidth / canvas.clientHeight;
|
@@ -100,7 +100,7 @@ async function main() {
|
|
100 |
state.device.queue.submit([encoder.finish()]);
|
101 |
|
102 |
lastTime = currentTime;
|
103 |
-
setTimeout(update, 16); //
|
104 |
}
|
105 |
|
106 |
update();
|
|
|
78 |
let lastTime = performance.now();
|
79 |
function update() {
|
80 |
const currentTime = performance.now();
|
81 |
+
const deltaTime = (currentTime - lastTime) / 1000; //seconds
|
82 |
state.time += deltaTime;
|
83 |
const fov = 60 * Math.PI / 180;
|
84 |
const aspect = canvas.clientWidth / canvas.clientHeight;
|
|
|
100 |
state.device.queue.submit([encoder.finish()]);
|
101 |
|
102 |
lastTime = currentTime;
|
103 |
+
setTimeout(update, 16); //60fps
|
104 |
}
|
105 |
|
106 |
update();
|