[HOME] GLB без земли (камера не уезжает), карта v10: габариты по дому, двусторонние материалы, баланс света
lint / hygiene (push) Successful in 20s

This commit is contained in:
root committed 2026-10-31 01:40:20 +03:00
1 parent 67e2150b20
commit 433acfc30f
3 files changed
+29 -12

No files matched your search

+29 -12
View File
@@ -89,15 +89,21 @@ class House3dCard extends HTMLElement {
this._renderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5));
this._renderer.setSize(W, H);
this._renderer.outputEncoding = T.sRGBEncoding;
this._renderer.toneMapping = T.ACESFilmicToneMapping;
this._renderer.toneMappingExposure = 1.05;
this._wrap.appendChild(this._renderer.domElement);
this._scene.add(new T.HemisphereLight(0x8fb4d8, 0x0a0f14, 0.55));
const dir = new T.DirectionalLight(0xfff0d8, 1.5);
dir.position.set(-30, 45, -25);
this._scene.add(new T.AmbientLight(0xffffff, 0.40));
this._scene.add(new T.HemisphereLight(0xbcd6ee, 0x1a2028, 0.9));
const dir = new T.DirectionalLight(0xfff4e2, 2.0);
dir.position.set(-24, 38, -18);
this._scene.add(dir);
const fill = new T.DirectionalLight(0x6fa8d8, 0.5);
fill.position.set(30, 20, 30);
const fill = new T.DirectionalLight(0x9cc4e8, 1.1);
fill.position.set(26, 16, 26);
this._scene.add(fill);
const fill2 = new T.DirectionalLight(0xcfe0f0, 0.7);
fill2.position.set(-10, 8, 30);
this._scene.add(fill2);
// земля + сетка
const ground = new T.Mesh(
@@ -137,16 +143,27 @@ class House3dCard extends HTMLElement {
o.material.metalness = 0.2;
}
});
model.traverse((o) => { if (o.isMesh && o.material) o.material.side = T.DoubleSide; });
this._pivot.add(model);
this._model = model;
const box = new T.Box3().setFromObject(model);
const size = box.getSize(new T.Vector3());
const center = box.getCenter(new T.Vector3());
this._pivot.position.set(-center.x, -box.min.y, -center.z);
const dist = Math.max(size.x, size.z) * 1.25;
this._cam.position.set(dist * 0.85, size.y * 0.95 + 4, dist * 0.95);
this._cam.lookAt(0, size.y * 0.35, 0);
// считаем габариты только по «домовым» мешам (без крупных плоскостей)
model.updateWorldMatrix(true, true);
const bb = new T.Box3();
model.traverse((o) => {
if (!o.isMesh) return;
const b = new T.Box3().setFromObject(o);
const sz = b.getSize(new T.Vector3());
if (sz.x * sz.z > 400) return;
bb.union(b);
});
if (bb.isEmpty()) bb.setFromObject(model);
const size = bb.getSize(new T.Vector3());
const center = bb.getCenter(new T.Vector3());
this._pivot.position.set(-center.x, -bb.min.y, -center.z);
const dist = Math.max(size.x, size.z) * 1.05;
this._cam.position.set(dist * 0.9, size.y * 0.85 + 3.5, dist * 1.0);
this._cam.lookAt(0, size.y * 0.33, 0);
this._radius = dist;
this._load.style.display = "none";
this._ready = true;
Binary file not shown.

After

Width:  |  Height:  |  Size: 927 KiB

Binary file not shown.