merge space and retro themes
This commit is contained in:
@@ -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()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -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 = 2
|
||||||
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
|
||||||
|
|||||||
@@ -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)
|
||||||
})
|
})
|
||||||
@@ -164,9 +168,9 @@ InstancedMino.prototype.materials = {
|
|||||||
envMap: environment,
|
envMap: environment,
|
||||||
side: THREE.DoubleSide,
|
side: THREE.DoubleSide,
|
||||||
transparent: true,
|
transparent: true,
|
||||||
opacity: 0.55,
|
opacity: 0.6,
|
||||||
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)
|
||||||
|
|||||||
@@ -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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user