[HOME] 3D: детали интерьеров по фото, слайдер времени суток, подсветка комнаты в 3D, синхронизация план↔3D
lint / hygiene (push) Failing after 23s

This commit is contained in:
root committed 2026-11-01 23:54:05 +03:00
1 parent 18fa48afad
commit 74673c644e
11 files changed
+116 -1

No files matched your search

+35
View File
@@ -59,3 +59,38 @@
`plans/house_interior.py`, `plans/house-interior.glb`, `plans/room-zones.json`,
`ops/home/house3d-card.js`, `ops/home/rooms-card.js`,
рендеры `plans/int-*.png`.
# Ночной спринт: раунд 2 (02.11.2026)
## Добавлено к раунду 1
### Интерьеры — детали по фото
* спальня: два бра на акцентной стене, ТВ на стене;
* санузел: стеклянная душевая перегородка, лейка;
* кабинет: два монитора, клавиатура;
* холл: зеркало;
* кухня: три подвеса над островом;
* потолочные светильники во всех комнатах.
Проверка GLB: **603 меша**, **14 зон**, **19 светильников**.
### Время суток вместо кнопки «ночь»
Слайдер 0…24 ч в 3D-карте: день (6–20) — солнце 2.0, ночь — 0.3 и подсветка
светильников (эмиссия 2.6), фон затемняется.
### Подсветка комнаты в 3D
* материалы зон клонируются при загрузке (не влияют друг на друга);
* выбранная комната подсвечивается синим (`emissive 0x2f7fe0`);
* клик в 3D → событие `house3d-room` → план открывает карточку;
* клик на плане → событие `house3d-select` → 3D подсвечивает комнату и пишет имя в HUD.
## Проверено командами
* GLB импортируется, 603 меша, 14 `zone_*`;
* оба файла карт отвечают 200 (house3d-card-v45.js, rooms-card.js?v=16);
* синтаксис карт проверен `node --check`.
## Дальше
1. Позы мебели и сантехника — по фото, после замечаний владельца.
2. Панель климата/медиа поверх комнат.
3. Привязка оставшихся сенсоров.
+58 -1
View File
@@ -20,6 +20,15 @@ class House3dCard extends HTMLElement {
config || {},
);
this._root = this.attachShadow({ mode: "open" });
this._onSelect = (ev) => {
const room = ev && ev.detail ? ev.detail.room : null;
this._room = room;
if (this._roomNameEl) {
this._roomNameEl.textContent = room ? (ROOM_NAMES[room] || room.replace("zone_", "")) : "обзор";
}
this._highlightZone(room);
};
document.addEventListener("house3d-select", this._onSelect);
this._root.innerHTML = `
<style>
:host { display:block; }
@@ -32,6 +41,10 @@ class House3dCard extends HTMLElement {
text-shadow:0 1px 10px rgba(0,0,0,.9); }
.room { display:block; font-weight:400; font-size:12px; color:#7f93a8; margin-top:3px;
letter-spacing:.12em; text-transform:none; }
.timeslider { position:absolute; right:16px; bottom:14px; display:flex; align-items:center; gap:8px;
padding:6px 10px; border-radius:999px; background:rgba(18,28,38,.8);
border:1px solid rgba(90,160,200,.3); font:500 12px/1 'Segoe UI',sans-serif; color:#cfe1f2; }
.timeslider input { width:110px; accent-color:#4aa3ff; }
.nightbtn { position:absolute; right:16px; bottom:14px; padding:6px 12px; border-radius:999px;
font:500 12px/1 'Segoe UI',sans-serif; color:#cfe1f2; cursor:pointer;
background:rgba(18,28,38,.8); border:1px solid rgba(90,160,200,.3); }
@@ -55,7 +68,8 @@ class House3dCard extends HTMLElement {
<div class="wrap">
<div class="hud">${this._config.title}<span class="room"><span class="roomname">обзор</span></span></div>
<div class="chip"><span class="dot"></span><span class="txt">—</span></div>
<div class="nightbtn" title="день / ночь">ночь</div>
<div class="timeslider"><span class="hr">12:00</span><input type="range" min="0" max="24" step="0.5" value="12"/></div>
<div class="nightbtn" title="день / ночь" style="display:none">ночь</div>
<div class="hint">клик по дому — вкл/выкл · тянуть — поворот · колесо — зум</div>
<div class="load">загрузка модели…</div>
</div>`;
@@ -66,6 +80,44 @@ class House3dCard extends HTMLElement {
this._roomNameEl = this._root.querySelector(".roomname");
this._night = false;
this._nightBtn = this._root.querySelector(".nightbtn");
this._hour = 12;
this._zones = {};
this._selZone = null;
const sl = this._root.querySelector(".timeslider input");
const hr = this._root.querySelector(".timeslider .hr");
if (sl) {
const upd = () => {
this._hour = parseFloat(sl.value);
if (hr) hr.textContent = String(Math.floor(this._hour)).padStart(2, "0") + ":00";
this._setHour(this._hour);
};
sl.addEventListener("input", upd);
this._setHour = (h) => {
const day = h >= 6 && h <= 20;
const k = day ? 1 : 0.15;
if (this._sun) this._sun.intensity = 2.0 * k;
if (this._amb) this._amb.intensity = 0.40 * (day ? 1 : 0.35);
if (this._hemi) this._hemi.intensity = 0.9 * (day ? 1 : 0.3);
const wrap = this._root.querySelector(".wrap");
if (wrap) wrap.classList.toggle("night", !day);
if (this._model) {
this._model.traverse((o) => {
if (!o.isMesh || !o.material) return;
const mats = Array.isArray(o.material) ? o.material : [o.material];
for (const m of mats) {
const n = (m.name || "").toLowerCase();
if (n.indexOf("lamp") >= 0) {
if (!m.emissive) continue;
m.emissive.setHex(0xffd9a0);
m.emissiveIntensity = day ? 0.0 : 2.6;
m.needsUpdate = true;
}
}
});
}
};
setTimeout(() => upd(), 1200);
}
if (this._nightBtn) this._nightBtn.addEventListener("click", () => this._toggleNight());
this._load = this._root.querySelector(".load");
}
@@ -158,6 +210,11 @@ class House3dCard extends HTMLElement {
});
drop.forEach((o) => o.parent && o.parent.remove(o));
model.traverse((o) => {
if (o.isMesh && o.name && o.name.indexOf("zone_") === 0) {
const id = o.name.split(".")[0];
o.material = Array.isArray(o.material) ? o.material.map((m) => m.clone()) : o.material.clone();
this._zones[id] = o;
}
if (o.isMesh && o.material && /glass/i.test(o.material.name || "")) {
o.material.transparent = true;
o.material.opacity = 0.45;
Binary file not shown.
Binary file not shown.
+23
View File
@@ -203,6 +203,29 @@ def main():
x0, x1, y0, y1 = bbox("terrasa")
box("ter_table", x0 + 0.4, x0 + 1.3, y0 + 4.4, y0 + 5.3, Z0 + 0.72, Z0 + 0.76, wood_f, groups["terrasa"])
# --- детали по фото ---
x0, x1, y0, y1 = bbox("spalnia")
for i, xx in enumerate((x0 + 0.6, x0 + 2.0)):
box("s_sconce_%d" % i, xx - 0.04, xx + 0.04, y0 + 3.34, y0 + 3.40,
Z0 + 1.25, Z0 + 1.75, lamp, groups["spalnia"])
box("s_tv", x1 - 0.28, x1 - 0.22, y0 + 1.6, y0 + 2.6, Z0 + 1.1, Z0 + 1.75, black, groups["spalnia"])
x0, x1, y0, y1 = bbox("sanuzel")
box("b_shower_glass", x0 + 1.1, x0 + 1.15, y0 + 2.5, y1 - 0.2, Z0, Z0 + 2.0, steel, groups["sanuzel"])
box("b_shower_head", x0 + 0.3, x0 + 0.5, y0 + 2.6, y0 + 2.8, Z0 + 2.02, Z0 + 2.08, steel, groups["sanuzel"])
x0, x1, y0, y1 = bbox("kabinet")
box("o_mon1", x0 + 0.9, x0 + 1.7, y0 + 0.60, y0 + 0.66, Z0 + 1.0, Z0 + 1.45, black, groups["kabinet"])
box("o_mon2", x0 + 1.8, x0 + 2.4, y0 + 0.60, y0 + 0.66, Z0 + 1.0, Z0 + 1.40, black, groups["kabinet"])
box("o_kbd", x0 + 1.1, x0 + 2.2, y0 + 0.75, y0 + 0.95, Z0 + 0.74, Z0 + 0.76, grey_soft, groups["kabinet"])
x0, x1, y0, y1 = bbox("koridor")
box("h_mirror", x0 + 1.6, x0 + 2.4, y0 + 0.22, y0 + 0.25, Z0 + 1.1, Z0 + 2.0, steel, groups["koridor"])
x0, x1, y0, y1 = bbox("kitchen")
for i, yy in enumerate((y0 + 1.0, y0 + 1.6, y0 + 2.2)):
box("k_pend_%d" % i, x0 + 3.05, x0 + 3.35, yy - 0.05, yy + 0.05,
Z0 + WH - 0.45, Z0 + WH - 0.15, lamp, groups["kitchen"])
# ---------- перегородки ----------
for rid, poly in ROOMS_PX.items():
n = len(poly)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB