fix favicon and click

This commit is contained in:
Adrien MALINGREY 2023-10-15 09:50:36 +02:00
parent 738e92c16b
commit 6e51b2f115

24
main.js
View File

@ -49,6 +49,12 @@ loadMngr.onLoad = function (url, itemsLoaded, itemsTotal) {
message.className = "" message.className = ""
renderer.setAnimationLoop(animate) 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); 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 // Ground
@ -279,8 +279,8 @@ const oceanOctree = new Octree().fromGraphNode(ocean);
const sun = new THREE.Vector3(); const sun = new THREE.Vector3();
//const ambientLight = new THREE.AmbientLight(0x404040, 7); const ambientLight = new THREE.AmbientLight(0x404040, 7);
//scene.add(ambientLight); scene.add(ambientLight);
const sunLight = new THREE.DirectionalLight(0xffffff, 1); const sunLight = new THREE.DirectionalLight(0xffffff, 1);
sunLight.castShadow = true; sunLight.castShadow = true;
@ -551,9 +551,9 @@ pointerLockControls.addEventListener('lock', function () {
ambiance.play(); 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(); ambiance.pause();
container.removeEventListener('mousedown', onMouseChange) document.removeEventListener('mousedown', onMouseChange)
container.removeEventListener('mouseup', onMouseChange) document.removeEventListener('mouseup', onMouseChange)
}); });