From 6e51b2f115db13fa72d9e96b9c5b9a9cc377455a Mon Sep 17 00:00:00 2001 From: adrien Date: Sun, 15 Oct 2023 09:50:36 +0200 Subject: [PATCH] fix favicon and click --- main.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/main.js b/main.js index 386f86e..d1f1af9 100644 --- a/main.js +++ b/main.js @@ -49,6 +49,12 @@ loadMngr.onLoad = function (url, itemsLoaded, itemsTotal) { message.className = "" renderer.setAnimationLoop(animate) + + setInterval(() => { + let x = Math.floor(8 + camera.position.x * 16 / mazeWidth) + let y = Math.floor(8 + camera.position.z * 16 / mazeWidth) + favicon.href = `favicon.php?x=${x}&y=${y}` + }, 1000); }; // @@ -122,12 +128,6 @@ if (!dev) { mazeCollisionner.add(clone); } - setInterval(() => { - let x = Math.floor(8 + camera.position.x * 16 / mazeWidth) - let y = Math.floor(8 + camera.position.z * 16 / mazeWidth) - favicon.href = `favicon.php?x=${x}&y=${y}` - }, 1000); - } // Ground @@ -279,8 +279,8 @@ const oceanOctree = new Octree().fromGraphNode(ocean); const sun = new THREE.Vector3(); -//const ambientLight = new THREE.AmbientLight(0x404040, 7); -//scene.add(ambientLight); +const ambientLight = new THREE.AmbientLight(0x404040, 7); +scene.add(ambientLight); const sunLight = new THREE.DirectionalLight(0xffffff, 1); sunLight.castShadow = true; @@ -551,9 +551,9 @@ pointerLockControls.addEventListener('lock', function () { ambiance.play(); - container.addEventListener('mousedown', onMouseChange) + document.addEventListener('mousedown', onMouseChange) - container.addEventListener('mouseup', onMouseChange) + document.addEventListener('mouseup', onMouseChange) }); @@ -561,9 +561,9 @@ pointerLockControls.addEventListener('unlock', function () { ambiance.pause(); - container.removeEventListener('mousedown', onMouseChange) + document.removeEventListener('mousedown', onMouseChange) - container.removeEventListener('mouseup', onMouseChange) + document.removeEventListener('mouseup', onMouseChange) });