Compare commits

...

2 Commits

Author SHA1 Message Date
adrien 21585bad7a tweaks & dont speak clear lines 2026-03-24 01:50:44 +01:00
adrien 53b2361e2b merge space and retro themes 2026-03-24 01:29:44 +01:00
5 changed files with 36 additions and 42 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ export class Menu extends GUI {
this.settings = this.addFolder("Options") this.settings = this.addFolder("Options")
this.settings.add(settings, "startLevel").name("Niveau initial").min(1).max(15).step(1) this.settings.add(settings, "startLevel").name("Niveau initial").min(1).max(15).step(1)
this.settings.add(settings, "theme", ["Plasma", "Space", "Retro"]).name("Thème").onChange(theme => { this.settings.add(settings, "theme", ["Plasma", "Space"]).name("Thème").onChange(theme => {
scene.theme = theme scene.theme = theme
if (dev) changeMaterial() if (dev) changeMaterial()
}) })
+2 -2
View File
@@ -181,10 +181,10 @@ class Stats {
this.b2b = -1 this.b2b = -1
} }
if (this.speechSynthesisAvailable && this.settings.sfxVolume) { /*if (this.speechSynthesisAvailable && this.settings.sfxVolume) {
if (tSpin) this.speak(tSpin, this.settings.sfxVolume); if (tSpin) this.speak(tSpin, this.settings.sfxVolume);
if (nbClearedLines > 1) this.speak(CLEARED_LINES_NAMES[nbClearedLines], this.settings.sfxVolume); if (nbClearedLines > 1) this.speak(CLEARED_LINES_NAMES[nbClearedLines], this.settings.sfxVolume);
} }*/
this.goal -= awardedLineClears this.goal -= awardedLineClears
if (this.goal <= 0) return this.level++ if (this.goal <= 0) return this.level++
+4 -14
View File
@@ -71,8 +71,8 @@ export class TetraScene extends THREE.Scene {
set theme(theme) { set theme(theme) {
switch (theme) { switch (theme) {
case "Plasma": case "Plasma":
this.ambientLight.intensity = 0 this.ambientLight.intensity = 1
this.directionalLight.intensity = 3 this.directionalLight.intensity = 1
this.directionalLight.position.set(5, -20, 20) this.directionalLight.position.set(5, -20, 20)
this.music.src = "audio/Moon-Over-Moscow-DJ-ResiDance-Mix-2022.mp3" this.music.src = "audio/Moon-Over-Moscow-DJ-ResiDance-Mix-2022.mp3"
this.background = new THREE.Color(0xffffff) this.background = new THREE.Color(0xffffff)
@@ -81,22 +81,12 @@ export class TetraScene extends THREE.Scene {
this.playfield.retroEdge.visible = false this.playfield.retroEdge.visible = false
break break
case "Space": case "Space":
this.ambientLight.intensity = 5 this.ambientLight.intensity = 3
this.directionalLight.intensity = 10 this.directionalLight.intensity = 1
this.directionalLight.position.set(2, 15, 20) this.directionalLight.position.set(2, 15, 20)
this.music.src = "audio/benevolence.m4a" this.music.src = "audio/benevolence.m4a"
this.background = new THREE.Color(0x000000) this.background = new THREE.Color(0x000000)
this.fog.color.set(0x000000) this.fog.color.set(0x000000)
this.playfield.edge.visible = true
this.playfield.retroEdge.visible = false
break
case "Retro":
this.ambientLight.intensity = 1
this.directionalLight.intensity = 10
this.directionalLight.position.set(19, 120, 200)
this.music.src = "audio/Tetris_MkVaffQuasi_Ultimix_OC_ReMix.mp3"
this.background = new THREE.Color(0x000000)
this.fog.color.set(0x000000)
this.playfield.edge.visible = false this.playfield.edge.visible = false
this.playfield.retroEdge.visible = true this.playfield.retroEdge.visible = true
break break
+21 -11
View File
@@ -79,7 +79,7 @@ export class InstancedMino extends THREE.InstancedMesh {
} }
set theme(theme) { set theme(theme) {
if (theme == "Retro") { if (theme == "Space") {
this.resetColor() this.resetColor()
this.update = this.updateOffset this.update = this.updateOffset
if (this.materials["Retro"]) { if (this.materials["Retro"]) {
@@ -94,8 +94,10 @@ export class InstancedMino extends THREE.InstancedMesh {
map: texture, map: texture,
bumpMap: texture, bumpMap: texture,
bumpScale: 1.5, bumpScale: 1.5,
roughness: 0.25, envMap: environment,
metalness: 0.9, envMapIntensity: 5,
roughness: 0.07,
metalness: 1,
transparent: true, transparent: true,
}, 8, 8) }, 8, 8)
}) })
@@ -108,8 +110,10 @@ export class InstancedMino extends THREE.InstancedMesh {
map: texture, map: texture,
bumpMap: texture, bumpMap: texture,
bumpScale: 1.5, bumpScale: 1.5,
roughness: 0.25, envMap: environment,
metalness: 0.9, envMapIntensity: 5,
roughness: 0.07,
metalness: 1,
transparent: true, transparent: true,
}, 1, 1) }, 1, 1)
}) })
@@ -165,8 +169,8 @@ InstancedMino.prototype.materials = {
side: THREE.DoubleSide, side: THREE.DoubleSide,
transparent: true, transparent: true,
opacity: 0.55, opacity: 0.55,
roughness: 0.5, roughness: 0.1,
metalness: 0.9, metalness: 0.95,
}), }),
Space: new THREE.MeshStandardMaterial({ Space: new THREE.MeshStandardMaterial({
envMap: environment, envMap: environment,
@@ -483,8 +487,8 @@ class Playfield extends THREE.Group {
.lineTo(COLUMNS, 0) .lineTo(COLUMNS, 0)
.lineTo(COLUMNS, SKYLINE) .lineTo(COLUMNS, SKYLINE)
.lineTo(COLUMNS + 1, SKYLINE) .lineTo(COLUMNS + 1, SKYLINE)
.lineTo(COLUMNS + 1, -1/3) .lineTo(COLUMNS + 1, -1)
.lineTo(-1, -1/3) .lineTo(-1, -1)
.moveTo(-1, SKYLINE) .moveTo(-1, SKYLINE)
const retroEdgeTexture = new THREE.TextureLoader(loadingManager).load("images/edge.png", (texture) => { const retroEdgeTexture = new THREE.TextureLoader(loadingManager).load("images/edge.png", (texture) => {
texture.wrapS = THREE.RepeatWrapping texture.wrapS = THREE.RepeatWrapping
@@ -494,9 +498,11 @@ class Playfield extends THREE.Group {
color: COLORS.RETRO, color: COLORS.RETRO,
map: retroEdgeTexture, map: retroEdgeTexture,
bumpMap: retroEdgeTexture, bumpMap: retroEdgeTexture,
envMap: environment,
envMapIntensity: 5,
bumpScale: 1.5, bumpScale: 1.5,
roughness: 0.25, roughness: 0.07,
metalness: 0.8, metalness: 1
}) })
this.retroEdge = new THREE.Mesh( this.retroEdge = new THREE.Mesh(
new THREE.ExtrudeGeometry(retroEdgeShape, { new THREE.ExtrudeGeometry(retroEdgeShape, {
@@ -509,8 +515,12 @@ class Playfield extends THREE.Group {
new THREE.PlaneGeometry(COLUMNS, SKYLINE), new THREE.PlaneGeometry(COLUMNS, SKYLINE),
new THREE.MeshStandardMaterial({ new THREE.MeshStandardMaterial({
color: 0xc5d0a1, color: 0xc5d0a1,
envMap: environment,
envMapIntensity: 5,
roughness: 0.1, roughness: 0.1,
metalness: 0.9, metalness: 0.9,
opacity: 0.1,
transparent: true
}) })
) )
back.position.set(COLUMNS/2, SKYLINE/2) back.position.set(COLUMNS/2, SKYLINE/2)
+3 -9
View File
@@ -17,7 +17,7 @@ export class Vortex extends THREE.Group {
this.opaqueCylinder = new THREE.Mesh( this.opaqueCylinder = new THREE.Mesh(
new THREE.CylinderGeometry(40, 40, 1000, 12, 1, true), new THREE.CylinderGeometry(40, 40, 1000, 12, 1, true),
new THREE.MeshBasicMaterial({ new THREE.MeshLambertMaterial({
side: THREE.BackSide, side: THREE.BackSide,
blending: THREE.MultiplyBlending blending: THREE.MultiplyBlending
}) })
@@ -44,7 +44,7 @@ export class Vortex extends THREE.Group {
texture.wrapT = THREE.MirroredRepeatWrapping texture.wrapT = THREE.MirroredRepeatWrapping
texture.repeat.set(1, 2) texture.repeat.set(1, 2)
this.transparentCylinder.material.map = texture this.transparentCylinder.material.map = texture
this.transparentCylinder.material.opacity = 0.15 this.transparentCylinder.material.opacity = 0.3
this.add(this.transparentCylinder) this.add(this.transparentCylinder)
}) })
@@ -78,7 +78,7 @@ export class Vortex extends THREE.Group {
loader.load("./images/stars_space.jpg", texture => { loader.load("./images/stars_space.jpg", texture => {
texture.wrapS = THREE.RepeatWrapping texture.wrapS = THREE.RepeatWrapping
texture.wrapT = THREE.RepeatWrapping texture.wrapT = THREE.MirroredRepeatWrapping
texture.repeat.set(3, 6) texture.repeat.set(3, 6)
this.opaqueCylinder.material.map = texture this.opaqueCylinder.material.map = texture
this.opaqueCylinder.material.blending = THREE.AdditiveBlending this.opaqueCylinder.material.blending = THREE.AdditiveBlending
@@ -93,12 +93,6 @@ export class Vortex extends THREE.Group {
this.visible = true this.visible = true
break break
case "Retro":
this.remove(this.transparentCylinder)
this.remove(this.opaqueCylinder)
this.visible = false
break
} }
} }