Tweak room lighting. Add floor texture.
This commit is contained in:
parent
6a505f0af1
commit
a7cd8f5546
@ -82,7 +82,7 @@
|
|||||||
const nextTapeButton = document.getElementById('nextTapeButton');
|
const nextTapeButton = document.getElementById('nextTapeButton');
|
||||||
const loader = new THREE.TextureLoader();
|
const loader = new THREE.TextureLoader();
|
||||||
|
|
||||||
const debugLight = true;
|
const debugLight = false;
|
||||||
|
|
||||||
// --- Utility: Random Color (seeded) ---
|
// --- Utility: Random Color (seeded) ---
|
||||||
function getRandomColor() {
|
function getRandomColor() {
|
||||||
@ -108,7 +108,7 @@
|
|||||||
scene.background = new THREE.Color(0x000000);
|
scene.background = new THREE.Color(0x000000);
|
||||||
|
|
||||||
// 2. Camera Setup
|
// 2. Camera Setup
|
||||||
const FOV = 65;
|
const FOV = 55;
|
||||||
camera = new THREE.PerspectiveCamera(FOV, window.innerWidth / window.innerHeight, 0.1, 1000);
|
camera = new THREE.PerspectiveCamera(FOV, window.innerWidth / window.innerHeight, 0.1, 1000);
|
||||||
camera.position.set(0, 1.5, 4);
|
camera.position.set(0, 1.5, 4);
|
||||||
|
|
||||||
@ -126,6 +126,10 @@
|
|||||||
const ambientLight = new THREE.AmbientLight(0x111111);
|
const ambientLight = new THREE.AmbientLight(0x111111);
|
||||||
scene.add(ambientLight);
|
scene.add(ambientLight);
|
||||||
|
|
||||||
|
const roomLight = new THREE.PointLight(0xffaa55, 0.2, roomSize);
|
||||||
|
roomLight.position.set(0, 1.8, 0);
|
||||||
|
scene.add(roomLight);
|
||||||
|
|
||||||
// 5. Build the entire scene with TV and surrounding objects
|
// 5. Build the entire scene with TV and surrounding objects
|
||||||
createSceneObjects();
|
createSceneObjects();
|
||||||
|
|
||||||
@ -333,9 +337,10 @@
|
|||||||
const shelfSurfaceY = currentShelfY + woodThickness / 2;
|
const shelfSurfaceY = currentShelfY + woodThickness / 2;
|
||||||
|
|
||||||
while (currentBookX < internalWidth / 2 - 0.05) {
|
while (currentBookX < internalWidth / 2 - 0.05) {
|
||||||
const bookWidth = 0.02 + seededRandom() * 0.05; // 2cm to 7cm wide
|
// sizes vary
|
||||||
const bookHeight = (shelfSpacing * 0.6) + seededRandom() * (shelfSpacing * 0.3); // Vary height within shelf limits
|
const bookWidth = 0.02 + seededRandom() * 0.05;
|
||||||
const bookDepth = 0.15 + seededRandom() * 0.1; // Vary depth
|
const bookHeight = (shelfSpacing * 0.6) + seededRandom() * (shelfSpacing * 0.1);
|
||||||
|
const bookDepth = 0.15 + seededRandom() * 0.03;
|
||||||
|
|
||||||
if (currentBookX + bookWidth > internalWidth / 2) break;
|
if (currentBookX + bookWidth > internalWidth / 2) break;
|
||||||
|
|
||||||
@ -357,6 +362,10 @@
|
|||||||
shelfGroup.add(book);
|
shelfGroup.add(book);
|
||||||
|
|
||||||
currentBookX += bookWidth + 0.002; // Tiny gap between books
|
currentBookX += bookWidth + 0.002; // Tiny gap between books
|
||||||
|
|
||||||
|
if (seededRandom() > 0.92) {
|
||||||
|
currentBookX += bookWidth * 3; // random bigger gaps
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,7 +419,7 @@
|
|||||||
shininess: 80,
|
shininess: 80,
|
||||||
specular: 0x888888
|
specular: 0x888888
|
||||||
});
|
});
|
||||||
const tvPlastic = new THREE.MeshPhongMaterial({ color: 0x2d251e, shininess: 10 });
|
const tvPlastic = new THREE.MeshPhongMaterial({ color: 0x4d4d4d, shininess: 30 });
|
||||||
|
|
||||||
const tvGroup = new THREE.Group();
|
const tvGroup = new THREE.Group();
|
||||||
|
|
||||||
@ -431,7 +440,7 @@
|
|||||||
tvGroup.add(cabinet);
|
tvGroup.add(cabinet);
|
||||||
|
|
||||||
// --- 3. Screen Frame ---
|
// --- 3. Screen Frame ---
|
||||||
const frameGeometry = new THREE.BoxGeometry(1.5, 1.3, 0.2);
|
const frameGeometry = new THREE.BoxGeometry(1.5, 1.3, 0.1);
|
||||||
const frameMaterial = new THREE.MeshPhongMaterial({ color: 0x111111, shininess: 20 });
|
const frameMaterial = new THREE.MeshPhongMaterial({ color: 0x111111, shininess: 20 });
|
||||||
const frame = new THREE.Mesh(frameGeometry, frameMaterial);
|
const frame = new THREE.Mesh(frameGeometry, frameMaterial);
|
||||||
frame.position.set(0, 1.5, 0.68);
|
frame.position.set(0, 1.5, 0.68);
|
||||||
@ -466,7 +475,7 @@
|
|||||||
tvScreen = new THREE.Mesh(screenGeometry, screenMaterial);
|
tvScreen = new THREE.Mesh(screenGeometry, screenMaterial);
|
||||||
|
|
||||||
// Position the curved screen
|
// Position the curved screen
|
||||||
tvScreen.position.set(0, 1.5, -2);
|
tvScreen.position.set(0.0, 1.5, -2.1);
|
||||||
tvGroup.add(tvScreen);
|
tvGroup.add(tvScreen);
|
||||||
|
|
||||||
tvGroup.position.set(x, 0, z);
|
tvGroup.position.set(x, 0, z);
|
||||||
@ -499,7 +508,11 @@
|
|||||||
|
|
||||||
// --- 1. Floor ---
|
// --- 1. Floor ---
|
||||||
const floorGeometry = new THREE.PlaneGeometry(20, 20);
|
const floorGeometry = new THREE.PlaneGeometry(20, 20);
|
||||||
const floorMaterial = new THREE.MeshPhongMaterial({ color: 0x1a1a1a, shininess: 5 });
|
const floorTexture = loader.load('./textures/floor.jpg');
|
||||||
|
floorTexture.wrapS = THREE.RepeatWrapping;
|
||||||
|
floorTexture.wrapT = THREE.RepeatWrapping;
|
||||||
|
floorTexture.repeat.set(roomSize, roomSize);
|
||||||
|
const floorMaterial = new THREE.MeshPhongMaterial({ map: floorTexture, color: 0x555555, shininess: 5 });
|
||||||
const floor = new THREE.Mesh(floorGeometry, floorMaterial);
|
const floor = new THREE.Mesh(floorGeometry, floorMaterial);
|
||||||
floor.rotation.x = -Math.PI / 2;
|
floor.rotation.x = -Math.PI / 2;
|
||||||
floor.position.y = 0;
|
floor.position.y = 0;
|
||||||
@ -585,6 +598,7 @@
|
|||||||
scene.add(pizzaBox);
|
scene.add(pizzaBox);
|
||||||
|
|
||||||
createDoor(roomSize/2, -roomSize/2 * 0.5, -Math.PI/2);
|
createDoor(roomSize/2, -roomSize/2 * 0.5, -Math.PI/2);
|
||||||
|
createBookshelf(-roomSize/2 + 0.2, roomSize/2*0.2, Math.PI/2, 0);
|
||||||
createBookshelf(-roomSize/2 + 0.2, roomSize/2*0.7, Math.PI/2, 0);
|
createBookshelf(-roomSize/2 + 0.2, roomSize/2*0.7, Math.PI/2, 0);
|
||||||
createBookshelf(roomSize/2 * 0.7, -roomSize/2+0.3, 0, 1);
|
createBookshelf(roomSize/2 * 0.7, -roomSize/2+0.3, 0, 1);
|
||||||
}
|
}
|
||||||
@ -865,4 +879,5 @@
|
|||||||
window.onload = init;
|
window.onload = init;
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
<!-- textures sourced from https://animalia-life.club/ -->
|
||||||
BIN
tv-player/textures/floor.jpg
Normal file
BIN
tv-player/textures/floor.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.0 MiB |
Loading…
Reference in New Issue
Block a user