Files
cad-building-showcase/assets/web-showcase-template/index.html
zhengwr 23cf3af678 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>
2026-07-04 12:55:03 +08:00

120 lines
4.4 KiB
HTML

<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{{TITLE}}</title>
<link rel="icon" href="data:," />
<link rel="stylesheet" href="./styles.css" />
<script type="importmap">
{
"imports": {
"three": "./node_modules/three/build/three.module.js",
"three/addons/": "./node_modules/three/examples/jsm/"
}
}
</script>
</head>
<body>
<main id="app-shell">
<canvas id="scene"></canvas>
<section class="panel project-panel" aria-label="项目">
<div class="project-title">
<span class="mark"></span>
<div>
<h1 id="project-name">CAD 建筑模型</h1>
<p id="project-description">Web 展示模型</p>
</div>
</div>
<dl class="stats-grid" id="stats"></dl>
</section>
<section class="panel controls-panel" aria-label="控制">
<div class="control-group">
<div class="group-label">楼层</div>
<div id="floor-controls"></div>
</div>
<div class="control-group">
<div class="group-label">构件</div>
<div class="toggle-grid" id="category-controls"></div>
</div>
<div class="control-group">
<div class="group-label">模型变体</div>
<div class="variant-list" id="variant-controls"></div>
</div>
<div class="control-group">
<div class="group-label">下载</div>
<div class="download-list" id="download-controls"></div>
</div>
<div class="control-group">
<label class="range-row">
<span>楼层展开</span>
<output id="explode-value">0m</output>
</label>
<input id="explode" type="range" min="0" max="16" value="0" step="0.5" />
</div>
<div class="control-group">
<label class="range-row">
<span>剖切高度</span>
<output id="section-value">关闭</output>
</label>
<input id="section" type="range" min="0" max="24" value="24" step="0.25" />
</div>
</section>
<nav class="toolbar" aria-label="视图工具">
<button class="tool-button" data-preset="overview" title="总览" aria-label="总览">
<i data-lucide="home"></i>
</button>
<button class="tool-button" data-preset="top" title="顶视" aria-label="顶视">
<i data-lucide="scan"></i>
</button>
<button class="tool-button" data-preset="side" title="侧视" aria-label="侧视">
<i data-lucide="panel-top"></i>
</button>
<button class="tool-button" id="auto-rotate" title="自动旋转" aria-label="自动旋转">
<i data-lucide="rotate-3d"></i>
</button>
<button class="tool-button" id="auto-tour" title="自动巡航" aria-label="自动巡航">
<i data-lucide="plane"></i>
</button>
<button class="tool-button" id="bookmark" title="保存视角" aria-label="保存视角">
<i data-lucide="bookmark"></i>
</button>
<button class="tool-button" id="share-link" title="复制分享链接" aria-label="复制分享链接">
<i data-lucide="share-2"></i>
</button>
<div id="bookmark-list" class="bookmark-list"></div>
<button class="tool-button" id="reset-view" title="重置视角" aria-label="重置视角">
<i data-lucide="rotate-ccw"></i>
</button>
<button class="tool-button" id="snapshot" title="截图" aria-label="截图">
<i data-lucide="camera"></i>
</button>
<a class="tool-button" href="./model.glb" download title="下载 GLB" aria-label="下载 GLB">
<i data-lucide="download"></i>
</a>
</nav>
<section class="panel inspect-panel" id="inspect" aria-label="选择">
<div class="inspect-title">未选择</div>
<div class="inspect-body">点击模型中的楼层或构件类型</div>
</section>
<div class="loading" id="loading">
<div class="loading-bar"><span id="loading-fill"></span></div>
<div id="loading-text">加载模型</div>
</div>
</main>
<script src="./node_modules/lucide/dist/umd/lucide.js"></script>
<script type="module" src="./app.js?v={{BUILD}}"></script>
</body>
</html>