merge space and retro themes

This commit is contained in:
2026-03-24 01:29:44 +01:00
parent 8509608ba9
commit 53b2361e2b
4 changed files with 30 additions and 36 deletions

View File

@@ -26,7 +26,7 @@ export class Menu extends GUI {
this.settings = this.addFolder("Options")
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
if (dev) changeMaterial()
})

View File

@@ -81,22 +81,12 @@ export class TetraScene extends THREE.Scene {
this.playfield.retroEdge.visible = false
break
case "Space":
this.ambientLight.intensity = 5
this.directionalLight.intensity = 10
this.ambientLight.intensity = 2
this.directionalLight.intensity = 1
this.directionalLight.position.set(2, 15, 20)
this.music.src = "audio/benevolence.m4a"
this.background = new THREE.Color(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.retroEdge.visible = true
break

View File

@@ -79,7 +79,7 @@ export class InstancedMino extends THREE.InstancedMesh {
}
set theme(theme) {
if (theme == "Retro") {
if (theme == "Space") {
this.resetColor()
this.update = this.updateOffset
if (this.materials["Retro"]) {
@@ -94,8 +94,10 @@ export class InstancedMino extends THREE.InstancedMesh {
map: texture,
bumpMap: texture,
bumpScale: 1.5,
roughness: 0.25,
metalness: 0.9,
envMap: environment,
envMapIntensity: 5,
roughness: 0.07,
metalness: 1,
transparent: true,
}, 8, 8)
})
@@ -108,8 +110,10 @@ export class InstancedMino extends THREE.InstancedMesh {
map: texture,
bumpMap: texture,
bumpScale: 1.5,
roughness: 0.25,
metalness: 0.9,
envMap: environment,
envMapIntensity: 5,
roughness: 0.07,
metalness: 1,
transparent: true,
}, 1, 1)
})
@@ -164,9 +168,9 @@ InstancedMino.prototype.materials = {
envMap: environment,
side: THREE.DoubleSide,
transparent: true,
opacity: 0.55,
roughness: 0.5,
metalness: 0.9,
opacity: 0.6,
roughness: 0.1,
metalness: 0.95,
}),
Space: new THREE.MeshStandardMaterial({
envMap: environment,
@@ -483,8 +487,8 @@ class Playfield extends THREE.Group {
.lineTo(COLUMNS, 0)
.lineTo(COLUMNS, SKYLINE)
.lineTo(COLUMNS + 1, SKYLINE)
.lineTo(COLUMNS + 1, -1/3)
.lineTo(-1, -1/3)
.lineTo(COLUMNS + 1, -1)
.lineTo(-1, -1)
.moveTo(-1, SKYLINE)
const retroEdgeTexture = new THREE.TextureLoader(loadingManager).load("images/edge.png", (texture) => {
texture.wrapS = THREE.RepeatWrapping
@@ -494,9 +498,11 @@ class Playfield extends THREE.Group {
color: COLORS.RETRO,
map: retroEdgeTexture,
bumpMap: retroEdgeTexture,
envMap: environment,
envMapIntensity: 5,
bumpScale: 1.5,
roughness: 0.25,
metalness: 0.8,
roughness: 0.07,
metalness: 1
})
this.retroEdge = new THREE.Mesh(
new THREE.ExtrudeGeometry(retroEdgeShape, {
@@ -506,11 +512,15 @@ class Playfield extends THREE.Group {
[retroEdgeMaterial, sideMaterial, sideMaterial, sideMaterial, sideMaterial, sideMaterial],
)
const back = new THREE.Mesh(
new THREE.PlaneGeometry(COLUMNS, SKYLINE),
new THREE.MeshStandardMaterial({
color: 0xc5d0a1,
roughness: 0.1,
metalness: 0.9,
new THREE.PlaneGeometry(COLUMNS, SKYLINE),
new THREE.MeshStandardMaterial({
color: 0xc5d0a1,
envMap: environment,
envMapIntensity: 5,
roughness: 0.1,
metalness: 0.9,
opacity: 0.1,
transparent: true
})
)
back.position.set(COLUMNS/2, SKYLINE/2)

View File

@@ -93,12 +93,6 @@ export class Vortex extends THREE.Group {
this.visible = true
break
case "Retro":
this.remove(this.transparentCylinder)
this.remove(this.opaqueCylinder)
this.visible = false
break
}
}