// --- Room Walls Function --- function createRoomWalls() { const wallTexture = loader.load('./textures/wall.jpg'); wallTexture.wrapS = THREE.RepeatWrapping; wallTexture.wrapT = THREE.RepeatWrapping; // USING MeshPhongMaterial for specular highlights on walls const wallMaterial = new THREE.MeshPhongMaterial({ map: wallTexture, side: THREE.FrontSide, shininess: 5, specular: 0x111111 // Subtle reflection }); // 1. Back Wall (behind the TV) const backWall = new THREE.Mesh(new THREE.PlaneGeometry(roomSize, roomHeight), wallMaterial); backWall.position.set(0, roomHeight / 2, -roomSize / 2); backWall.receiveShadow = true; scene.add(backWall); // 2. Front Wall (behind the camera) const frontWall = new THREE.Mesh(new THREE.PlaneGeometry(roomSize, roomHeight), wallMaterial); frontWall.position.set(0, roomHeight / 2, roomSize / 2); frontWall.rotation.y = Math.PI; frontWall.receiveShadow = true; scene.add(frontWall); // 3. Left Wall const leftWall = new THREE.Mesh(new THREE.PlaneGeometry(roomSize, roomHeight), wallMaterial); leftWall.rotation.y = Math.PI / 2; leftWall.position.set(-roomSize / 2, roomHeight / 2, 0); leftWall.receiveShadow = true; scene.add(leftWall); // 4. Right Wall const rightWall = new THREE.Mesh(new THREE.PlaneGeometry(roomSize, roomHeight), wallMaterial); rightWall.rotation.y = -Math.PI / 2; rightWall.position.set(roomSize / 2, roomHeight / 2, 0); rightWall.receiveShadow = true; scene.add(rightWall); // 5. Ceiling const ceilingGeometry = new THREE.PlaneGeometry(roomSize, roomSize); const ceilingTexture = wallTexture; ceilingTexture.repeat.set(4, 4); // USING MeshPhongMaterial const ceilingMaterial = new THREE.MeshPhongMaterial({ map: ceilingTexture, side: THREE.FrontSide, shininess: 5, specular: 0x111111 }); const ceiling = new THREE.Mesh(ceilingGeometry, ceilingMaterial); ceiling.rotation.x = Math.PI / 2; ceiling.position.set(0, roomHeight, 0); ceiling.receiveShadow = true; scene.add(ceiling); // --- 6. Add a Window to the Back Wall --- const windowWidth = 1.5; const windowHeight = 1.2; const windowGeometry = new THREE.PlaneGeometry(windowWidth, windowHeight); const nightSkyMaterial = new THREE.MeshBasicMaterial({ color: 0x0a1a3a, emissive: 0x0a1a3a, emissiveIntensity: 0.5, side: THREE.FrontSide }); const windowPane = new THREE.Mesh(windowGeometry, nightSkyMaterial); const windowZ = -roomSize / 2 + 0.001; windowPane.position.set(-3.5, roomHeight * 0.5 + 1.5, windowZ); scene.add(windowPane); }