Initial commit
This commit is contained in:
29
js/lights.js
29
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}`);
|
||||
|
||||
Reference in New Issue
Block a user