Feature: repro wall surrounding the stage
This commit is contained in:
parent
94ae337e96
commit
4feeab53de
@ -11,63 +11,67 @@ export class ReproWall extends SceneFeature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
const boxSize = 1.2;
|
const boxSize = 2.6;
|
||||||
const geometry = new THREE.BoxGeometry(boxSize, boxSize, boxSize);
|
const boxStacks = 3;
|
||||||
|
const startZ = -20;
|
||||||
|
const endZ = -18;
|
||||||
|
const leftX = -8;
|
||||||
|
const rightX = 8;
|
||||||
|
|
||||||
|
const cabinetGeometry = new THREE.BoxGeometry(boxSize, boxSize, boxSize);
|
||||||
|
|
||||||
const cabinetMaterial = new THREE.MeshStandardMaterial({
|
const cabinetMaterial = new THREE.MeshStandardMaterial({
|
||||||
color: 0x333333,
|
color: 0x333333,
|
||||||
roughness: 0.6,
|
roughness: 0.6,
|
||||||
metalness: 0.2,
|
metalness: 0.2,
|
||||||
});
|
});
|
||||||
|
|
||||||
const meshMaterial = new THREE.MeshStandardMaterial({
|
const grilleSize = boxSize * 0.85;
|
||||||
color: 0x050505,
|
const grilleGeometry = new THREE.PlaneGeometry(grilleSize, grilleSize);
|
||||||
|
const grilleMaterial = new THREE.MeshStandardMaterial({
|
||||||
|
color: 0x1a1a1a, // Not completely dark so the mesh is visible
|
||||||
roughness: 0.9,
|
roughness: 0.9,
|
||||||
metalness: 0.1,
|
metalness: 0.1,
|
||||||
});
|
});
|
||||||
|
|
||||||
const materials = [
|
|
||||||
cabinetMaterial, cabinetMaterial, cabinetMaterial,
|
|
||||||
cabinetMaterial, meshMaterial, cabinetMaterial
|
|
||||||
];
|
|
||||||
|
|
||||||
// Helper to create a stack of boxes
|
// Helper to create a stack of boxes
|
||||||
const createStack = (baseX, baseZ) => {
|
const createStack = (baseX, baseZ, rotY) => {
|
||||||
const stackHeight = 3 + Math.floor(Math.random() * 4); // 3 to 6 boxes high
|
const stackHeight = 4// + Math.floor(Math.random() * 2);
|
||||||
for (let i = 0; i < stackHeight; i++) {
|
for (let i = 0; i < stackHeight; i++) {
|
||||||
const box = new THREE.Mesh(geometry, materials);
|
const speakerGroup = new THREE.Group();
|
||||||
|
|
||||||
|
const cabinet = new THREE.Mesh(cabinetGeometry, cabinetMaterial);
|
||||||
|
cabinet.castShadow = true;
|
||||||
|
cabinet.receiveShadow = true;
|
||||||
|
speakerGroup.add(cabinet);
|
||||||
|
|
||||||
|
const grille = new THREE.Mesh(grilleGeometry, grilleMaterial);
|
||||||
|
grille.position.z = (boxSize / 2) + 0.01; // Place on front face, slightly forward
|
||||||
|
grille.receiveShadow = true;
|
||||||
|
speakerGroup.add(grille);
|
||||||
|
|
||||||
// Slight random offset for realism
|
// Slight random offset for realism
|
||||||
const x = baseX + (Math.random() * 0.1 - 0.05);
|
const x = baseX + (Math.random() * 0.1 - 0.05);
|
||||||
const z = baseZ + (Math.random() * 0.1 - 0.05);
|
const z = baseZ + (Math.random() * 0.4 - 0.05);
|
||||||
const y = (i * boxSize) + (boxSize / 2);
|
const y = (i * boxSize) + (boxSize / 2);
|
||||||
|
|
||||||
box.position.set(x, y, z);
|
speakerGroup.position.set(x, y, z);
|
||||||
|
|
||||||
// Slight random rotation
|
// Slight random rotation
|
||||||
box.rotation.y = (Math.random() * 0.1 - 0.05);
|
speakerGroup.rotation.y = rotY + (Math.random() * 0.1 - 0.05);
|
||||||
|
|
||||||
box.castShadow = true;
|
|
||||||
box.receiveShadow = true;
|
|
||||||
|
|
||||||
state.scene.add(box);
|
state.scene.add(speakerGroup);
|
||||||
this.boxes.push({ mesh: box, originalScale: new THREE.Vector3(1, 1, 1) });
|
this.boxes.push({ mesh: speakerGroup, originalScale: new THREE.Vector3(1, 1, 1) });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create walls on both sides of the stage
|
// Create walls on both sides of the stage
|
||||||
const startZ = -20;
|
const z = startZ;
|
||||||
const endZ = -18;
|
for (let x = 0; x <= boxStacks * boxSize; x += boxSize) {
|
||||||
const leftX = -8;
|
// left side
|
||||||
const rightX = 8;
|
createStack(leftX - x, z + x / 2, 0.3);
|
||||||
|
// right side
|
||||||
for (let z = startZ; z <= endZ; z += boxSize) {
|
createStack(rightX + x, z + x / 2, -0.3);
|
||||||
// Left side wall (2 layers deep)
|
|
||||||
createStack(leftX, z);
|
|
||||||
createStack(leftX - boxSize, z);
|
|
||||||
|
|
||||||
// Right side wall (2 layers deep)
|
|
||||||
createStack(rightX, z);
|
|
||||||
createStack(rightX + boxSize, z);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,7 @@ export function createSceneObjects() {
|
|||||||
state.scene.add(floor);
|
state.scene.add(floor);
|
||||||
|
|
||||||
// 3. Lighting (Minimal and focused)
|
// 3. Lighting (Minimal and focused)
|
||||||
const ambientLight = new THREE.AmbientLight(0x606060, 0.2); // Increased ambient light for a larger space
|
const ambientLight = new THREE.AmbientLight(0x606060, 1.0); // Increased ambient light for a larger space
|
||||||
state.scene.add(ambientLight);
|
state.scene.add(ambientLight);
|
||||||
|
|
||||||
// Add a HemisphereLight for more natural, general illumination in a large space.
|
// Add a HemisphereLight for more natural, general illumination in a large space.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user