diff --git a/ops/home/house3d-card.js b/ops/home/house3d-card.js index 0f5dbc3..b5c472d 100644 --- a/ops/home/house3d-card.js +++ b/ops/home/house3d-card.js @@ -302,6 +302,7 @@ class House3dCard extends HTMLElement { this._dirty = true; }, undefined, (e) => { console.warn("interior", e); }); + this._buildFromPlan(); this._ready = true; this._syncState(true); this._dirty = true; @@ -385,6 +386,66 @@ class House3dCard extends HTMLElement { } + + // комнаты из зон, отредактированных на плане (localStorage) + _buildFromPlan() { + let saved = null; + try { saved = JSON.parse(localStorage.getItem("house3d_room_px_v2") || "null"); } catch (e) { return false; } + if (!saved || typeof saved !== "object" || !Object.keys(saved).length) return false; + + const X0 = 180, Y0 = 173, SX = 42.0, SY = 41.4, TER = 2.45, LY = 8.60; + const COLORS = { + terrasa: 0xb08a5e, kitchen: 0xb08a5e, spalnia: 0x8a7a68, danina_komnata: 0xb08a5e, + kabinet: 0xb08a5e, sanuzel: 0x3a3d40, tualet: 0x3a3d40, garderob: 0xb08a5e, + kladovaia: 0x3a3d40, koridor: 0x4a4a48, prihozhaya: 0x4a4a48, tambur: 0x3a3d40, + postirochnaia: 0x3a3d40, kryltso: 0xb08a5e, + }; + const group = new T.Group(); + group.name = "plan_rooms"; + // hide baked: спрятать зоны из модели, чтобы не двоились + for (const id of Object.keys(this._zones || {})) { + const m = this._zones[id]; + if (m) m.visible = false; + } + this._zones = {}; + + for (const id of Object.keys(saved)) { + const px = saved[id]; + if (!Array.isArray(px) || px.length < 3) continue; + const pts = px.map(([x, y]) => new T.Vector2((x - X0) / SX - TER, LY - (y - Y0) / SY)); + // пол + const shape = new T.Shape(pts); + const fg = new T.ExtrudeGeometry(shape, { depth: 0.05, bevelEnabled: false }); + fg.rotateX(-Math.PI / 2); + const fm = new T.Mesh(fg, new T.MeshStandardMaterial({ + color: COLORS[id] || 0xb08a5e, roughness: 0.65, metalness: 0.0, + transparent: true, opacity: 0.85, side: T.DoubleSide, + })); + fm.name = "zone_" + id; + fm.position.y = 0.78; + group.add(fm); + this._zones[id] = fm; + + // стены по рёбрам + for (let i = 0; i < pts.length; i++) { + const a = pts[i], b = pts[(i + 1) % pts.length]; + const len = a.distanceTo(b); + if (len < 0.2) continue; + const wg = new T.BoxGeometry(len + 0.06, 2.5, 0.06); + const wm = new T.Mesh(wg, new T.MeshStandardMaterial({ + color: id === "spalnia" ? 0x5c6657 : id === "kabinet" ? 0x3e4a56 : 0xd8d2c4, + roughness: 0.9, metalness: 0.0, side: T.DoubleSide, + })); + wm.position.set((a.x + b.x) / 2, 0.78 + 1.25, (a.y + b.y) / 2); + wm.rotation.y = -Math.atan2(b.y - a.y, b.x - a.x); + group.add(wm); + } + } + this._pivot.add(group); + this._planRooms = group; + return true; + } + _highlightZone(zone) { const zones = this._zones || {}; for (const id of Object.keys(zones)) { diff --git a/ops/home/plans/bath-inside.png b/ops/home/plans/bath-inside.png new file mode 100644 index 0000000..c156c58 Binary files /dev/null and b/ops/home/plans/bath-inside.png differ diff --git a/ops/home/plans/bath-top.png b/ops/home/plans/bath-top.png new file mode 100644 index 0000000..289b9ac Binary files /dev/null and b/ops/home/plans/bath-top.png differ diff --git a/ops/home/plans/house-web-v60.glb b/ops/home/plans/house-web-v60.glb new file mode 100644 index 0000000..6926969 Binary files /dev/null and b/ops/home/plans/house-web-v60.glb differ diff --git a/ops/home/plans/house.glb b/ops/home/plans/house.glb index 8f00109..6926969 100644 Binary files a/ops/home/plans/house.glb and b/ops/home/plans/house.glb differ diff --git a/ops/home/plans/house_full.py b/ops/home/plans/house_full.py index 92b0de6..2d53bdb 100644 --- a/ops/home/plans/house_full.py +++ b/ops/home/plans/house_full.py @@ -727,9 +727,75 @@ def main(): box("ipart_%s_%d" % (_rid, _i), _mx - 0.05, _mx + 0.05, min(_ay, _by), max(_ay, _by), ZI, ZI + WHI, I_WALL.get(_rid, _wlight)) + + # ================= ВАННАЯ (по фото) ================= + _bw = mat_tex("B_Wood", os.path.join(TDIR, "tex_bath_wood.png"), 0.35) + _bd = mat_tex("B_Dark", os.path.join(TDIR, "tex_bath_dark.png"), 0.4) + _white2 = mat("B_White", "F4F4F0", 0.25) + _chrome = mat("B_Chrome", "B9C0C6", 0.25, 0.9) + _blackm = mat("B_Black", "16181A", 0.35, 0.6) + _bwood = mat("B_WoodCab", "8B5E3C", 0.45) + _stone = mat("B_Stone", "6E7679", 0.4) + + # границы санузла + _bp = ROOMS_M["sanuzel"] + _bx0 = min(q[0] for q in _bp); _bx1 = max(q[0] for q in _bp) + _by0 = min(q[1] for q in _bp); _by1 = max(q[1] for q in _bp) + + # пол: тёмная плитка (перекрываем базовый светлый) + _floor_poly("bath_floor", _bp, ZI - 0.015, 0.03, _bd) + + # стены: северная и восточная — «дерево», остальные тёмные + box("bath_w_n", _bx0, _bx1, _by1 - 0.03, _by1, ZI, ZI + WHI, _bw) + box("bath_w_e", _bx1 - 0.03, _bx1, _by0, _by1, ZI, ZI + WHI, _bw) + box("bath_w_w", _bx0, _bx0 + 0.03, _by0, _by1, ZI, ZI + WHI, _bd) + box("bath_w_s", _bx0, _bx1, _by0, _by0 + 0.03, ZI, ZI + WHI, _bd) + + # ванна вдоль северной стены + _tx0, _tx1 = _bx1 - 1.75, _bx1 - 0.08 + _ty0, _ty1 = _by1 - 0.82, _by1 - 0.06 + box("bath_tub_b", _tx0, _tx1, _ty0, _ty1, ZI + 0.02, ZI + 0.58, _white2) + box("bath_tub_in", _tx0 + 0.07, _tx1 - 0.07, _ty0 + 0.07, _ty1 - 0.07, + ZI + 0.3, ZI + 0.62, _bd) + box("bath_tub_panel", _tx0 - 0.06, _tx0, _ty0, _ty1, ZI + 0.02, ZI + 0.6, _bwood) + # стеклянный экран у изножья + box("bath_glass", _tx0 - 0.02, _tx0 + 0.01, _ty0, _ty1 - 0.15, + ZI + 0.6, ZI + 1.75, _chrome) + # душевая стойка с «дождём» + box("bath_shaft", _tx0 + 0.02, _tx0 + 0.06, _ty1 - 0.2, _ty1 - 0.16, ZI + 0.6, ZI + 2.15, _blackm) + box("bath_rain", _tx0 + 0.0, _tx0 + 0.5, _ty1 - 0.22, _ty1 - 0.14, ZI + 2.05, ZI + 2.09, _blackm) + + # унитаз у окна (северо-восток) + box("bath_wc", _bx1 - 0.72, _bx1 - 0.28, _by1 - 1.35, _by1 - 0.95, ZI, ZI + 0.42, _white2) + box("bath_wc_t", _bx1 - 0.7, _bx1 - 0.3, _by1 - 1.33, _by1 - 0.97, ZI + 0.42, ZI + 0.46, _white2) + box("bath_wc_b", _bx1 - 0.05, _bx1 - 0.02, _by1 - 1.4, _by1 - 1.0, ZI + 0.35, ZI + 0.75, _bwood) + + # тумба с раковиной у западной стены + _vx0, _vx1 = _bx0 + 0.05, _bx0 + 0.72 + _vy0, _vy1 = _by0 + 0.45, _by0 + 1.55 + box("bath_van", _vx0, _vx1, _vy0, _vy1, ZI + 0.35, ZI + 0.82, _bwood) + box("bath_vtop", _vx0 - 0.02, _vx1 + 0.02, _vy0 - 0.02, _vy1 + 0.02, ZI + 0.82, ZI + 0.86, _stone) + box("bath_sink", _vx0 + 0.08, _vx1 - 0.08, _vy0 + 0.18, _vy1 - 0.18, ZI + 0.86, ZI + 1.0, _white2) + # зеркало с подсветкой + box("bath_mirror", _bx0 + 0.04, _bx0 + 0.06, _vy0, _vy1, ZI + 1.15, ZI + 2.0, _chrome) + box("bath_mirror_l", _bx0 + 0.02, _bx0 + 0.05, _vy0, _vy1, ZI + 1.13, ZI + 1.16, _lamp) + + # деревянные полки с полотенцами + box("bath_shelf", _bx0 + 0.05, _bx0 + 0.35, _by1 - 1.6, _by1 - 1.1, ZI + 1.0, ZI + 1.04, _bwood) + box("bath_towel1", _bx0 + 0.08, _bx0 + 0.32, _by1 - 1.58, _by1 - 1.12, ZI + 1.04, ZI + 1.18, _blackm) + box("bath_towel2", _bx0 + 0.08, _bx0 + 0.32, _by1 - 1.58, _by1 - 1.12, ZI + 1.18, ZI + 1.3, _bd) + + # коврик и подсветка + box("bath_mat", _vx1 + 0.15, _vx1 + 0.9, _by0 + 0.5, _by0 + 1.2, ZI + 0.005, ZI + 0.02, mat("B_Mat", "C8B49A", 0.9)) + box("bath_light", _bx0 + 0.6, _bx0 + 1.4, (_by0 + _by1) / 2 - 0.04, (_by0 + _by1) / 2 + 0.04, + ZI + WHI - 0.05, ZI + WHI - 0.01, _lamp) + print("ванная собрана", flush=True) + # ================= /ВАННАЯ ================= + # UV для текстур интерьера _uv = {"I_FloorWood": 1.2, "I_FloorTile": 1.0, "I_WallLight": 1.5, - "I_WallGreen": 0.9, "I_TileDark": 0.8, "I_WallBlue": 0.9, "I_FloorStone": 1.0} + "I_WallGreen": 0.9, "I_TileDark": 0.8, "I_WallBlue": 0.9, "I_FloorStone": 1.0, + "B_Wood": 0.9, "B_Dark": 0.9} bpy.ops.object.select_all(action="DESELECT") for _o in bpy.data.objects: if _o.type != "MESH" or not _o.data.materials: diff --git a/ops/home/plans/render-front.png b/ops/home/plans/render-front.png index ebd728a..667b7f5 100644 Binary files a/ops/home/plans/render-front.png and b/ops/home/plans/render-front.png differ diff --git a/ops/home/plans/render-side.png b/ops/home/plans/render-side.png index 9279707..12ecd3b 100644 Binary files a/ops/home/plans/render-side.png and b/ops/home/plans/render-side.png differ diff --git a/ops/home/plans/render-terrace.png b/ops/home/plans/render-terrace.png index dfc5e48..b40552c 100644 Binary files a/ops/home/plans/render-terrace.png and b/ops/home/plans/render-terrace.png differ diff --git a/ops/home/plans/render-west-ortho.png b/ops/home/plans/render-west-ortho.png index c988a5e..35fb878 100644 Binary files a/ops/home/plans/render-west-ortho.png and b/ops/home/plans/render-west-ortho.png differ diff --git a/ops/home/plans/tex_bath_dark.png b/ops/home/plans/tex_bath_dark.png new file mode 100644 index 0000000..5154c97 Binary files /dev/null and b/ops/home/plans/tex_bath_dark.png differ diff --git a/ops/home/plans/tex_bath_wood.png b/ops/home/plans/tex_bath_wood.png new file mode 100644 index 0000000..68930f6 Binary files /dev/null and b/ops/home/plans/tex_bath_wood.png differ