Web template: adopt session-evolved features + render-on-demand everywhere

Ported from the test3d-5 session build: in-page variant switching, share
link (full state in URL hash), auto tour, toast, building-grouped floor
toggles, per-(floor,category) geometry merge (draw calls), progressive
overview->standard loading. Hardened during the port: {{BUILD}} placeholder
restored (Date.now() defeated caching), single-GLB deployments skip the
phantom overview.glb phase, building-group fallback now derives from
floor-key prefixes (assemble_campus convention) instead of a hardcoded "A"
test, bookmarks completed (list + restore + remove + hash persistence).

Render-on-demand lands in BOTH the template and the offline viewer: static
scenes rendered at 60fps pegged the GPU/fans for identical frames —
invalidate()-driven rendering + shadowMap.autoUpdate=false (bake per
change). 27号 measured: template web 0 frames over 3s idle, offline viewer
25 frames total through load; features browser-verified (tour, bookmarks,
hash restore), zero console errors. window.__renders is the diagnostic
counter — idle growth must be 0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-04 12:55:03 +08:00
parent eb7eea2861
commit 23cf3af678
6 changed files with 757 additions and 114 deletions

View File

@@ -85,7 +85,7 @@ p {
.stats-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 8px;
margin: 14px 0 0;
}
@@ -100,13 +100,13 @@ p {
.stats-grid dt {
color: var(--muted);
font-size: 11px;
font-size: 10px;
}
.stats-grid dd {
margin: 3px 0 0;
color: var(--ink);
font-size: 14px;
font-size: 13px;
font-weight: 700;
white-space: nowrap;
overflow: hidden;
@@ -117,9 +117,19 @@ p {
left: 20px;
bottom: 20px;
width: min(384px, calc(100vw - 40px));
max-height: calc(100vh - 280px);
overflow-y: auto;
padding: 14px;
}
.controls-panel::-webkit-scrollbar {
width: 6px;
}
.controls-panel::-webkit-scrollbar-thumb {
background: rgba(0,0,0,0.18);
border-radius: 3px;
}
.control-group + .control-group {
margin-top: 13px;
padding-top: 13px;
@@ -140,9 +150,48 @@ p {
margin-bottom: 8px;
}
.segmented,
.toggle-grid,
.download-list {
/* ── Building-grouped floor controls ── */
.building-group {
margin-bottom: 10px;
}
.building-group:last-child {
margin-bottom: 0;
}
.building-header {
display: flex;
align-items: center;
gap: 7px;
padding: 5px 8px;
border-radius: 6px;
background: rgba(47, 125, 112, 0.1);
color: var(--accent);
font-size: 12px;
font-weight: 800;
cursor: pointer;
user-select: none;
margin-bottom: 5px;
}
.building-header input {
width: 13px;
height: 13px;
accent-color: var(--accent);
}
.building-label {
flex: 1;
}
.floor-list {
display: flex;
flex-wrap: wrap;
gap: 6px;
padding-left: 4px;
}
.toggle-grid {
display: flex;
flex-wrap: wrap;
gap: 6px;
@@ -177,6 +226,36 @@ p {
border: 1px solid rgba(0, 0, 0, 0.2);
}
/* ── Variant controls ── */
.variant-list {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.variant-btn {
min-height: 32px;
padding: 6px 12px;
border: 1px solid var(--line);
border-radius: 6px;
background: rgba(255, 255, 255, 0.58);
color: var(--ink);
font-size: 12px;
font-weight: 700;
cursor: pointer;
transition: background 0.15s;
}
.variant-btn:hover {
background: rgba(47, 125, 112, 0.12);
}
.variant-btn.active {
background: var(--accent);
color: #fff;
border-color: var(--accent);
}
.download-link {
min-height: 32px;
display: inline-flex;
@@ -205,12 +284,14 @@ input[type="range"] {
right: 20px;
top: 20px;
display: flex;
flex-wrap: wrap;
gap: 8px;
padding: 8px;
border-radius: 8px;
background: rgba(32, 35, 38, 0.86);
box-shadow: var(--shadow);
backdrop-filter: blur(16px);
max-width: 200px;
}
.tool-button {
@@ -284,6 +365,31 @@ input[type="range"] {
width: 12%;
height: 100%;
background: #d1a445;
transition: width 0.3s;
}
/* ── Toast ── */
.toast {
position: fixed;
bottom: 80px;
left: 50%;
transform: translateX(-50%) translateY(20px);
padding: 10px 20px;
border-radius: 8px;
background: rgba(32, 35, 38, 0.95);
color: #f6f4ec;
font-size: 13px;
font-weight: 600;
box-shadow: var(--shadow);
opacity: 0;
pointer-events: none;
transition: opacity 0.25s, transform 0.25s;
z-index: 9999;
}
.toast.show {
opacity: 1;
transform: translateX(-50%) translateY(0);
}
@media (max-width: 760px) {
@@ -297,6 +403,7 @@ input[type="range"] {
top: auto;
right: 10px;
bottom: 10px;
max-width: 152px;
}
.controls-panel {
@@ -310,4 +417,42 @@ input[type="range"] {
.inspect-panel {
display: none;
}
.stats-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
/* ── Camera bookmarks ─────────────────────────────── */
.bookmark-list {
display: flex;
flex-wrap: wrap;
gap: 6px;
max-width: 220px;
}
.bookmark-item {
display: inline-flex;
align-items: stretch;
border: 1px solid var(--line);
border-radius: 6px;
overflow: hidden;
background: rgba(255, 255, 255, 0.58);
}
.bookmark-item button {
border: 0;
background: transparent;
color: var(--ink);
font-size: 12px;
font-weight: 700;
padding: 4px 8px;
cursor: pointer;
}
.bookmark-item button:hover {
background: rgba(47, 125, 112, 0.12);
}
.bookmark-item .bookmark-remove {
padding: 4px 6px;
font-weight: 400;
opacity: 0.55;
border-left: 1px solid var(--line);
}