serviceWorker in html

This commit is contained in:
Adrien MALINGREY 2024-05-12 11:20:05 +02:00
parent a0893fd881
commit aa2475dc3a
4 changed files with 12 additions and 15 deletions

4
app.js

@ -343,7 +343,3 @@ window.onbeforeunload = function (event) {
localStorage["teTraHighScore"] = stats.highScore localStorage["teTraHighScore"] = stats.highScore
return !game.playing return !game.playing
} }
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('./jsm/service-worker.js');
}

@ -35,5 +35,6 @@
<audio id="music" src="audio/benevolence.m4a" loop></audio> <audio id="music" src="audio/benevolence.m4a" loop></audio>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script>
<script type="module" src="app.js"></script> <script type="module" src="app.js"></script>
<script>navigator?.serviceWorker.register('./jsm/service-worker.js')</script>
</body> </body>
</html> </html>

@ -54,8 +54,8 @@ export class TetraGUI extends GUI {
scene.vortex.colorFullTextureRotation = 0.006 scene.vortex.colorFullTextureRotation = 0.006
scene.vortex.colorFullMoveForward = 0.025 scene.vortex.colorFullMoveForward = 0.025
//scene.ambientLight.intensity = 1 scene.ambientLight.intensity = 0.6
scene.directionalLight.intensity = 1.8 scene.directionalLight.intensity = 5
Mino.mesh.material.opacity = 0.7 Mino.mesh.material.opacity = 0.7
Mino.mesh.material.roughness = 0.48 Mino.mesh.material.roughness = 0.48
@ -81,16 +81,16 @@ export class TetraGUI extends GUI {
scene.vortex.globalRotation = 0.028 scene.vortex.globalRotation = 0.028
scene.vortex.darkTextureRotation = 0.006 scene.vortex.darkTextureRotation = 0.006
scene.vortex.darkMoveForward = 0.02 scene.vortex.darkMoveForward = 0.03
scene.vortex.colorFullTextureRotation = 0.006 scene.vortex.colorFullTextureRotation = 0.006
scene.vortex.colorFullMoveForward = 0.007 scene.vortex.colorFullMoveForward = 0.012
scene.ambientLight.intensity = 20 scene.ambientLight.intensity = 20
scene.directionalLight.intensity = 10 scene.directionalLight.intensity = 10
Mino.mesh.material.opacity = 0.6 //Mino.mesh.material.opacity = 0.6
Mino.mesh.material.roughness = 0.08 //Mino.mesh.material.roughness = 0.08
Mino.mesh.material.metalness = 0.98 //Mino.mesh.material.metalness = 0.98
} }
break break
} }
@ -138,7 +138,7 @@ export class TetraGUI extends GUI {
cameraPosition.add(scene.camera, "fov", 0, 200).onChange(() => scene.camera.updateProjectionMatrix()) cameraPosition.add(scene.camera, "fov", 0, 200).onChange(() => scene.camera.updateProjectionMatrix())
let light = dev.addFolder("lights intensity").close() let light = dev.addFolder("lights intensity").close()
//light.add(scene.ambientLight, "intensity").name("ambient").min(0).max(20) light.add(scene.ambientLight, "intensity").name("ambient").min(0).max(20)
light.add(scene.directionalLight, "intensity").name("directional").min(0).max(20) light.add(scene.directionalLight, "intensity").name("directional").min(0).max(20)
let directionalLightPosition = dev.addFolder("directionalLight.position").close() let directionalLightPosition = dev.addFolder("directionalLight.position").close()

@ -12,10 +12,10 @@ export class TetraScene extends THREE.Scene {
this.vortex = new Vortex(loadingManager) this.vortex = new Vortex(loadingManager)
this.add(this.vortex) this.add(this.vortex)
/*this.ambientLight = new THREE.AmbientLight(0xffffff, 1) this.ambientLight = new THREE.AmbientLight(0xffffff, 1)
this.add(this.ambientLight)*/ this.add(this.ambientLight)
this.directionalLight = new THREE.DirectionalLight(0xffffff, 1.8) this.directionalLight = new THREE.DirectionalLight(0xffffff, 5)
this.directionalLight.position.set(5, -20, 20) this.directionalLight.position.set(5, -20, 20)
this.add(this.directionalLight) this.add(this.directionalLight)