move sounds
This commit is contained in:
@@ -47,17 +47,37 @@ export class TetraScene extends THREE.Scene {
|
||||
this.lineClearSound = new THREE.Audio(listener)
|
||||
audioLoader.load('audio/line-clear.ogg', function( buffer ) {
|
||||
this.lineClearSound.setBuffer(buffer)
|
||||
this.lineClearSound.setVolume(settings.sfxVolume/100)
|
||||
}.bind(this))
|
||||
this.tetrisSound = new THREE.Audio(listener)
|
||||
audioLoader.load('audio/tetris.ogg', function( buffer ) {
|
||||
this.tetrisSound.setBuffer(buffer)
|
||||
this.lineClearSound.setVolume(settings.sfxVolume/100)
|
||||
this.tetrisSound.setVolume(settings.sfxVolume/100)
|
||||
this.hardDropSound.setVolume(settings.sfxVolume/100)
|
||||
}.bind(this))
|
||||
this.hardDropSound = new THREE.Audio(listener)
|
||||
audioLoader.load('audio/hard-drop.wav', function( buffer ) {
|
||||
this.hardDropSound.setBuffer(buffer)
|
||||
this.hardDropSound.setVolume(settings.sfxVolume/100)
|
||||
}.bind(this))
|
||||
this.hitSound = new THREE.Audio(listener)
|
||||
audioLoader.load('audio/hit.mp3', function( buffer ) {
|
||||
this.hitSound.setBuffer(buffer)
|
||||
this.hitSound.setVolume(settings.sfxVolume/100)
|
||||
}.bind(this))
|
||||
this.floorSound = new THREE.Audio(listener)
|
||||
audioLoader.load('audio/floor.ogg', function( buffer ) {
|
||||
this.floorSoung.setBuffer(buffer)
|
||||
this.floorSoung.setVolume(settings.sfxVolume/100)
|
||||
}.bind(this))
|
||||
this.moveSound = new THREE.Audio(listener)
|
||||
audioLoader.load('audio/move.ogg', function( buffer ) {
|
||||
this.moveSound.setBuffer(buffer)
|
||||
this.moveSound.setVolume(settings.sfxVolume/100)
|
||||
}.bind(this))
|
||||
this.rotateSound = new THREE.Audio(listener)
|
||||
audioLoader.load('audio/rotate.ogg', function( buffer ) {
|
||||
this.rotateSound.setBuffer(buffer)
|
||||
this.rotateSound.setVolume(settings.sfxVolume/100)
|
||||
}.bind(this))
|
||||
|
||||
this.playfield = new Playfield(loadingManager)
|
||||
@@ -72,8 +92,8 @@ export class TetraScene extends THREE.Scene {
|
||||
switch (theme) {
|
||||
case "Plasma":
|
||||
this.ambientLight.intensity = 1
|
||||
this.directionalLight.intensity = 1
|
||||
this.directionalLight.position.set(5, -20, 20)
|
||||
this.directionalLight.intensity = 3
|
||||
this.directionalLight.position.set(5, -20, -10)
|
||||
this.music.src = "audio/Moon-Over-Moscow-DJ-ResiDance-Mix-2022.mp3"
|
||||
this.background = new THREE.Color(0xffffff)
|
||||
this.fog.color.set(0xffffff)
|
||||
|
||||
@@ -96,7 +96,7 @@ export class InstancedMino extends THREE.InstancedMesh {
|
||||
bumpScale: 1.5,
|
||||
envMap: environment,
|
||||
envMapIntensity: 5,
|
||||
roughness: 0.07,
|
||||
roughness: 0.03,
|
||||
metalness: 1,
|
||||
transparent: true,
|
||||
}, 8, 8)
|
||||
@@ -112,7 +112,7 @@ export class InstancedMino extends THREE.InstancedMesh {
|
||||
bumpScale: 1.5,
|
||||
envMap: environment,
|
||||
envMapIntensity: 5,
|
||||
roughness: 0.07,
|
||||
roughness: 0.03,
|
||||
metalness: 1,
|
||||
transparent: true,
|
||||
}, 1, 1)
|
||||
@@ -168,35 +168,27 @@ InstancedMino.prototype.materials = {
|
||||
envMap: environment,
|
||||
side: THREE.DoubleSide,
|
||||
transparent: true,
|
||||
opacity: 0.55,
|
||||
opacity: 0.66,
|
||||
roughness: 0.1,
|
||||
metalness: 0.95,
|
||||
}),
|
||||
Space: new THREE.MeshStandardMaterial({
|
||||
envMap: environment,
|
||||
side: THREE.DoubleSide,
|
||||
transparent: true,
|
||||
opacity: 0.66,
|
||||
roughness: 0.01,
|
||||
metalness: 0.99,
|
||||
onBeforeCompile: shader => {
|
||||
shader.vertexShader = `
|
||||
varying vec3 vPos;
|
||||
${shader.vertexShader}
|
||||
`.replace(
|
||||
'#include <begin_vertex>',
|
||||
`
|
||||
#include <begin_vertex>
|
||||
vPos = position;
|
||||
|
||||
// Bruit basé sur la position du sommet pour irrégularité
|
||||
float n = sin(position.x*3.1 + position.y*5.2 + position.z*7.3) * 0.03;
|
||||
transformed += normal * n;
|
||||
`
|
||||
);
|
||||
}
|
||||
})
|
||||
}
|
||||
InstancedMino.prototype.materials['Plasma'].onBeforeCompile = shader => {
|
||||
shader.vertexShader = `
|
||||
varying vec3 vPos;
|
||||
${shader.vertexShader}
|
||||
`.replace(
|
||||
'#include <begin_vertex>',
|
||||
`
|
||||
#include <begin_vertex>
|
||||
vPos = position;
|
||||
|
||||
// Bruit basé sur la position du sommet pour irrégularité
|
||||
float n = sin(position.x*3.1 + position.y*5.2 + position.z*7.3) * 0.03;
|
||||
transformed += normal * n;
|
||||
`
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
class Mino extends THREE.Object3D {
|
||||
@@ -498,10 +490,10 @@ class Playfield extends THREE.Group {
|
||||
color: COLORS.RETRO,
|
||||
map: retroEdgeTexture,
|
||||
bumpMap: retroEdgeTexture,
|
||||
bumpScale: 1.5,
|
||||
envMap: environment,
|
||||
envMapIntensity: 5,
|
||||
bumpScale: 1.5,
|
||||
roughness: 0.07,
|
||||
roughness: 0.03,
|
||||
metalness: 1
|
||||
})
|
||||
this.retroEdge = new THREE.Mesh(
|
||||
|
||||
Reference in New Issue
Block a user