Compare commits

...

2 Commits

Author SHA1 Message Date
a0893fd881 tweaking again 2024-02-27 21:53:12 +01:00
1a026db655 fix audio stop 2024-02-27 21:52:57 +01:00
4 changed files with 21 additions and 19 deletions

4
app.js
View File

@ -36,6 +36,8 @@ let game = {
holdQueue.clear() holdQueue.clear()
playfield.init() playfield.init()
scene.music.currentTime = 0
this.playing = true this.playing = true
stats.clock.start() stats.clock.start()
@ -133,7 +135,7 @@ let game = {
renderer.domElement.onfocus = null renderer.domElement.onfocus = null
gui.settings.domElement.onfocus = null gui.settings.domElement.onfocus = null
game.playing = false game.playing = false
scene.music.stop() scene.music.pause()
stats.clock.stop() stats.clock.stop()
messagesSpan.addNewChild("div", { className: "show-level-animation", innerHTML: `<h1>GAME<br/>OVER</h1>` }) messagesSpan.addNewChild("div", { className: "show-level-animation", innerHTML: `<h1>GAME<br/>OVER</h1>` })

View File

@ -54,12 +54,12 @@ 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 = 1
scene.directionalLight.intensity = 2 scene.directionalLight.intensity = 1.8
Mino.mesh.material.opacity = 0.6 Mino.mesh.material.opacity = 0.7
Mino.mesh.material.roughness = 0.4 Mino.mesh.material.roughness = 0.48
Mino.mesh.material.metalness = 0.95 Mino.mesh.material.metalness = 0.9
} }
break break
case "Espace": case "Espace":
@ -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()
@ -170,9 +170,9 @@ export class TetraGUI extends GUI {
envMap: environnement, envMap: environnement,
side: THREE.DoubleSide, side: THREE.DoubleSide,
transparent: true, transparent: true,
opacity: 0.8, opacity: 0.7,
roughness: 0.2, roughness: 0.48,
metalness: 0.9, metalness: 0.67,
}) })
break break
case "MeshPhysicalMaterial": case "MeshPhysicalMaterial":
@ -182,7 +182,7 @@ export class TetraGUI extends GUI {
transparent: true, transparent: true,
opacity: 0.6, opacity: 0.6,
roughness: 0.5, roughness: 0.5,
metalness: 0.9, metalness: 0.67,
attenuationDistance: 0.5, attenuationDistance: 0.5,
ior: 2, ior: 2,
sheen: 0, sheen: 0,

View File

@ -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, 2) this.directionalLight = new THREE.DirectionalLight(0xffffff, 1.8)
this.directionalLight.position.set(5, -20, 20) this.directionalLight.position.set(5, -20, 20)
this.add(this.directionalLight) this.add(this.directionalLight)

View File

@ -120,9 +120,9 @@ class Mino extends THREE.Object3D {
envMap: environnement, envMap: environnement,
side: THREE.DoubleSide, side: THREE.DoubleSide,
transparent: true, transparent: true,
opacity: 0.8, opacity: 0.7,
roughness: 0.2, roughness: 0.48,
metalness: 0.9, metalness: 0.67,
}) })
this.mesh = new InstancedMino(minoGeometry, minoMaterial, 2*ROWS*COLUMNS) this.mesh = new InstancedMino(minoGeometry, minoMaterial, 2*ROWS*COLUMNS)
} }
@ -353,7 +353,7 @@ Z.prototype.freeColor = new THREE.Color(COLORS.Z)
class Playfield extends THREE.Group { class Playfield extends THREE.Group {
constructor() { constructor() {
super() super()
this.visible = false //this.visible = false
const edgeMaterial = new THREE.MeshStandardMaterial({ const edgeMaterial = new THREE.MeshStandardMaterial({
color: COLORS.EDGE, color: COLORS.EDGE,
@ -361,7 +361,7 @@ class Playfield extends THREE.Group {
transparent: true, transparent: true,
opacity: 0.2, opacity: 0.2,
roughness: 0.1, roughness: 0.1,
metalness: 0.9, metalness: 0.67,
}) })
const edgeShape = new THREE.Shape() const edgeShape = new THREE.Shape()
.moveTo(-.3, SKYLINE) .moveTo(-.3, SKYLINE)