From aedfd6a2172e656de9cd054797fa0ce51e6e7bab Mon Sep 17 00:00:00 2001 From: Oleg Tolchin Date: Thu, 8 Jan 2026 19:59:09 +0300 Subject: [PATCH] Initial commit --- js/lights.js | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/js/lights.js b/js/lights.js index 8d12758..d95f733 100644 --- a/js/lights.js +++ b/js/lights.js @@ -4,7 +4,7 @@ import * as THREE from 'three'; * Базовый свет сцены (Ambient + Directional) */ export function setupLights(scene) { - const ambient = new THREE.AmbientLight(0xffffff, 1.3); + const ambient = new THREE.AmbientLight(0xffffff, 1.4); scene.add(ambient); const key = new THREE.DirectionalLight(0xffffff, 0.8); @@ -33,25 +33,40 @@ export function setupRoomLights(room) { } // === СПОТ-СВЕТ === - const spotLight = new THREE.SpotLight(0xffffff, 5, 80, Math.PI/4, 0.5, 1); + const spotLight = new THREE.SpotLight( + 0xffffff, + 5, // intensity + 80, // distance + Math.PI / 4, // angle + 0.5, // penumbra + 2 // decay (физически корректный) + ); + spotObject.add(spotLight); spotLight.position.set(0, 0, 0); - // === Target по -Z (вниз) === + // === Target (локально по -Z) === spotObject.add(spotLight.target); spotLight.target.position.set(0, 0, -1); spotLight.target.updateMatrixWorld(true); - // === ВИЗУАЛЬНАЯ ТОЧКА ИСТОЧНИКА (сфера) === + // === ВИЗУАЛЬНЫЙ СВЕТЯЩИЙСЯ КРУГ (LED-линза) === const bulb = new THREE.Mesh( - new THREE.SphereGeometry(0.02, 12, 12), + new THREE.CircleGeometry(0.01, 24), new THREE.MeshStandardMaterial({ color: 0xffffff, emissive: 0xffffff, - emissiveIntensity: 2 + emissiveIntensity: 2.5, + roughness: 0.2, + metalness: 0.0, + side: THREE.DoubleSide }) ); - bulb.position.set(0, 0, 0); + + // CircleGeometry смотрит по +Z → поворачиваем вниз + bulb.rotation.x = -Math.PI; + bulb.position.set(0, 0, -0.005); + spotObject.add(bulb); console.log(`Спот корректно создан: ${spotName}`);