94 lines
20 KiB
HTML
94 lines
20 KiB
HTML
<!doctype html>
|
||
<html lang="zh-CN">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
<link rel="icon" href="data:," />
|
||
<title>生产线 · 27 个模型 / 88 个部件重建结果</title>
|
||
<style>
|
||
html, body { margin: 0; height: 100%; background: #0d1318; color: #dbe6ee; font: 14px/1.5 system-ui, "Noto Sans SC", sans-serif; overflow: hidden; }
|
||
header { position: fixed; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; gap: 14px; padding: 10px 16px; background: #0b1116e6; border-bottom: 1px solid #2a3a45; flex-wrap: wrap; }
|
||
header h1 { margin: 0; font-size: 16px; }
|
||
header select { background: #0b1014; color: #dbe6ee; border: 1px solid #3f3f3f; border-radius: 4px; padding: 3px 6px; }
|
||
header .stats { color: #93a6b3; font-size: 12px; }
|
||
#view { position: fixed; inset: 48px 0 0 0; }
|
||
#hint { position: fixed; left: 16px; bottom: 12px; color: #6f8390; font-size: 12px; z-index: 2; }
|
||
</style>
|
||
<script type="importmap">{ "imports": { "three": "./vendor/three.module.js" } }</script>
|
||
</head>
|
||
<body>
|
||
<header>
|
||
<h1>生产线重建结果</h1>
|
||
<select id="model" aria-label="Filter model"><option value="">全部 27 个模型</option></select>
|
||
<span class="stats" id="stats">加载中…</span>
|
||
</header>
|
||
<div id="view"></div>
|
||
<p id="hint">左键旋转 · 滚轮缩放 · 右键平移</p>
|
||
<script type="module">
|
||
import * as THREE from "three";
|
||
import { OrbitControls } from "./vendor/OrbitControls.js";
|
||
import { STLLoader } from "./vendor/STLLoader.js";
|
||
|
||
const PARTS = [{"partName":"ABB_IRB_120_P01","model":"ABB_IRB_120","modelLabel":"ABB IRB 120 机器人","color":[0.0667,0.0667,0.0667],"worldBBox":[-963.333,33.697,774,-748.444,251.009,951]},{"partName":"ABB_IRB_120_P02","model":"ABB_IRB_120","modelLabel":"ABB IRB 120 机器人","color":[0.4744,0.4744,0.4744],"worldBBox":[-917.373,251.009,778.001,-794.373,352.209,923.001]},{"partName":"ABB_IRB_120_P03","model":"ABB_IRB_120","modelLabel":"ABB IRB 120 机器人","color":[0.8,0.8,0.8],"worldBBox":[-965.303,33.549,951,-745.943,248.469,1382.168]},{"partName":"ABB_IRB_120_P04","model":"ABB_IRB_120","modelLabel":"ABB IRB 120 机器人","color":[0.8,0.8,0.8],"worldBBox":[-921.373,-3.591,1285.473,-805.873,230.422,1473.587]},{"partName":"ABB_IRB_120_P05","model":"ABB_IRB_120","modelLabel":"ABB IRB 120 机器人","color":[0.8,0.8,0.8],"worldBBox":[-886.873,-205.491,1363,-824.873,-94.991,1445]},{"partName":"ABB_IRB_120_P06","model":"ABB_IRB_120","modelLabel":"ABB IRB 120 机器人","color":[0.8,0.8,0.8],"worldBBox":[-919.81,-201.071,1358.045,-792.867,-7.591,1451]},{"partName":"ABB_IRB_120_P07","model":"ABB_IRB_120","modelLabel":"ABB IRB 120 机器人","color":[0.0667,0.0667,0.0667],"worldBBox":[-913.373,-8.591,1356.021,-817.457,-3.591,1451.979]},{"partName":"ABB_IRB_120_P08","model":"ABB_IRB_120","modelLabel":"ABB IRB 120 机器人","color":[0.0667,0.0667,0.0667],"worldBBox":[-890.857,-232.991,1369,-820.873,-205.491,1439]},{"partName":"ABB_IRB_120_P09","model":"ABB_IRB_120","modelLabel":"ABB IRB 120 机器人","color":[0.8633,0.9046,0.9386],"worldBBox":[-903,-271.031,1367.344,-808.742,-232.991,1440.656]},{"partName":"ABB_IRB_120_P10","model":"ABB_IRB_120","modelLabel":"ABB IRB 120 机器人","color":[0.7146,0.7145,0.7145],"worldBBox":[-888.057,-335.358,1385.037,-834.985,-265.331,1425.037]},{"partName":"ABB_IRB_120_P11","model":"ABB_IRB_120","modelLabel":"ABB IRB 120 机器人","color":[0.7146,0.7145,0.7145],"worldBBox":[-853.297,-319.231,1387.817,-823.423,-265.331,1421.95]},{"partName":"ToolFrame_P01","model":"ToolFrame","modelLabel":"工具坐标系","color":[1,0,0],"worldBBox":[0,-4.515,-4.515,67.729,4.515,4.515]},{"partName":"ToolFrame_P02","model":"ToolFrame","modelLabel":"工具坐标系","color":[0,1,0],"worldBBox":[-4.515,0,-4.515,4.515,67.729,4.515]},{"partName":"ToolFrame_P03","model":"ToolFrame","modelLabel":"工具坐标系","color":[0,0,1],"worldBBox":[-4.515,-4.515,0,4.515,4.515,67.729]},{"partName":"CabinetA_P01","model":"CabinetA","modelLabel":"主控制柜","color":[0,0,0],"worldBBox":[15.003,-214.285,154,455.003,-80.001,751]},{"partName":"CabinetA_P02","model":"CabinetA","modelLabel":"主控制柜","color":[0.6352,0.6509,0.6786],"worldBBox":[-34.991,-214.285,0,1464.941,529.94,754]},{"partName":"CabinetA_P03","model":"CabinetA","modelLabel":"主控制柜","color":[0,0,0],"worldBBox":[975.003,-214.285,154,1415.003,-80.001,751]},{"partName":"CabinetA_P04","model":"CabinetA","modelLabel":"主控制柜","color":[0.7725,0.7725,0.7725],"worldBBox":[1425.003,-80.001,154,1455.003,479.999,714]},{"partName":"CabinetA_P05","model":"CabinetA","modelLabel":"主控制柜","color":[0.6352,0.6509,0.6786],"worldBBox":[-24.997,-80.001,114,15.003,479.999,154]},{"partName":"CabinetA_P06","model":"CabinetA","modelLabel":"主控制柜","color":[0.898,0.9137,0.9255],"worldBBox":[935.003,-80.001,714,975.003,479.999,754]},{"partName":"CabinetA_P07","model":"CabinetA","modelLabel":"主控制柜","color":[0.7725,0.7725,0.7725],"worldBBox":[15.003,489.999,154,455.003,519.999,714]},{"partName":"CabinetA_P08","model":"CabinetA","modelLabel":"主控制柜","color":[0.7725,0.7725,0.7725],"worldBBox":[975.003,489.999,154,1415.003,519.999,714]},{"partName":"CabinetB_P01","model":"CabinetB","modelLabel":"长控制柜","color":[0,0,0],"worldBBox":[-1464.914,-214.241,154,-1024.914,-79.958,751]},{"partName":"CabinetB_P02","model":"CabinetB","modelLabel":"长控制柜","color":[0.6352,0.6509,0.6786],"worldBBox":[-1514.908,-214.241,0,-14.976,529.983,754]},{"partName":"CabinetB_P03","model":"CabinetB","modelLabel":"长控制柜","color":[0,0,0],"worldBBox":[-504.914,-214.241,154,-64.914,-79.958,751]},{"partName":"CabinetB_P04","model":"CabinetB","modelLabel":"长控制柜","color":[0.5445,0.5445,0.5445],"worldBBox":[-1504.914,-120.015,753.656,1455.086,520.042,774.001]},{"partName":"CabinetB_P05","model":"CabinetB","modelLabel":"长控制柜","color":[0.6013,0.6027,0.6031],"worldBBox":[-564.914,-79.958,114,-24.914,560.042,714]},{"partName":"CabinetB_P06","model":"CabinetB","modelLabel":"长控制柜","color":[0.898,0.9137,0.9255],"worldBBox":[-544.914,-79.958,714,-504.914,480.042,754]},{"partName":"CabinetB_P07","model":"CabinetB","modelLabel":"长控制柜","color":[0.898,0.9137,0.9255],"worldBBox":[-1024.914,-79.958,714,-984.914,480.042,754]},{"partName":"CabinetB_P08","model":"CabinetB","modelLabel":"长控制柜","color":[0.7725,0.7725,0.7725],"worldBBox":[-1464.914,490.042,154,-1024.914,520.043,714]},{"partName":"StackLight_P01","model":"StackLight","modelLabel":"三色警示灯","color":[0.6352,0.6509,0.6786],"worldBBox":[-1506.999,420.001,726,-1456.999,460.001,954]},{"partName":"StackLight_P02","model":"StackLight","modelLabel":"三色警示灯","color":[0.1137,0.2196,0.1098],"worldBBox":[-1496.999,420.006,954,-1456.999,459.995,1194]},{"partName":"Loader_P01","model":"Loader","modelLabel":"上料机构","color":[0.6352,0.6509,0.6786],"worldBBox":[-1204.5,67,774,-1039.5,207,986]},{"partName":"Loader_P02","model":"Loader","modelLabel":"上料机构","color":[0.6013,0.6027,0.6031],"worldBBox":[-1414.432,117,946,-1094.568,157,976]},{"partName":"ConveyorFeeder_P01","model":"ConveyorFeeder","modelLabel":"传送带送料装置","color":[0.6013,0.6027,0.6031],"worldBBox":[370.068,100,906,878.432,200,974.879]},{"partName":"ConveyorFeeder_P02","model":"ConveyorFeeder","modelLabel":"传送带送料装置","color":[0,0,0],"worldBBox":[805,168.542,943,849.5,321.043,977]},{"partName":"ConveyorFeeder_P03","model":"ConveyorFeeder","modelLabel":"传送带送料装置","color":[0.6352,0.6509,0.6786],"worldBBox":[368.033,51,774,865,221,948]},{"partName":"ConveyorFeeder_P04","model":"ConveyorFeeder","modelLabel":"传送带送料装置","color":[0.8389,0.8664,0.8978],"worldBBox":[587,106,774,982,271,978.607]},{"partName":"ConveyorFeeder_P05","model":"ConveyorFeeder","modelLabel":"传送带送料装置","color":[0.7444,0.7565,0.7586],"worldBBox":[845,105.434,941,965,194.565,962.5]},{"partName":"ConveyorFeeder_P06","model":"ConveyorFeeder","modelLabel":"传送带送料装置","color":[0.7614,0.734,0.6948],"worldBBox":[807,244,941,982,253,947.5]},{"partName":"RawFeeder_P01","model":"RawFeeder","modelLabel":"原料上料装置","color":[0.7614,0.734,0.6948],"worldBBox":[-644.514,236.943,777,-559.696,292.943,966.727]},{"partName":"RawFeeder_P02","model":"RawFeeder","modelLabel":"原料上料装置","color":[0,0.1274,0],"worldBBox":[-688.014,247.324,791,-610.839,274.676,807]},{"partName":"RawFeeder_P03","model":"RawFeeder","modelLabel":"原料上料装置","color":[0.7614,0.734,0.6948],"worldBBox":[-602.514,219.383,781,-552.514,302.617,978.1]},{"partName":"RawFeeder_P04","model":"RawFeeder","modelLabel":"原料上料装置","color":[0.6352,0.6509,0.6786],"worldBBox":[-730.014,196,774,-520.014,404,960]},{"partName":"RawFeeder_P05","model":"RawFeeder","modelLabel":"原料上料装置","color":[0,0,0],"worldBBox":[-716.214,232.8,789,-647.814,289.2,889]},{"partName":"RawAssembly_P01","model":"RawAssembly","modelLabel":"原料装配平台","color":[0.6352,0.6509,0.6786],"worldBBox":[-872.299,303,786.001,-373.999,395,1124.126]},{"partName":"RawAssembly_P02","model":"RawAssembly","modelLabel":"原料装配平台","color":[0.5445,0.5445,0.5445],"worldBBox":[-608.07,250.071,991.563,-537.471,328.6,1120.048]},{"partName":"RawAssembly_P03","model":"RawAssembly","modelLabel":"原料装配平台","color":[0.7614,0.734,0.6948],"worldBBox":[-780.978,312,1050.588,-588.433,316.999,1055.587]},{"partName":"OriginMarker_P01","model":"OriginMarker","modelLabel":"原点标记","color":[1,0,0],"worldBBox":[0,-8.855,-8.855,132.827,8.855,8.855]},{"partName":"OriginMarker_P02","model":"OriginMarker","modelLabel":"原点标记","color":[0,1,0],"worldBBox":[-8.855,0,-8.855,8.855,132.827,8.855]},{"partName":"OriginMarker_P03","model":"OriginMarker","modelLabel":"原点标记","color":[0,0,1],"worldBBox":[-8.855,-8.855,0,8.855,8.855,132.827]},{"partName":"GroundPlane_P01","model":"GroundPlane","modelLabel":"地面与地线","color":[0.3801,0.3753,0.3698],"worldBBox":[-2153.148,-2032.821,-1039.203,2714.334,1640.409,-729.142]},{"partName":"GroundPlane_P02","model":"GroundPlane","modelLabel":"地面与地线","color":[0.7137,0.6392,0.2431],"worldBBox":[-2140.94,-2032.819,-739.025,2714.315,-923.485,-738.903]},{"partName":"PickFeeder_P01","model":"PickFeeder","modelLabel":"夹取送料装置","color":[0,0,0],"worldBBox":[600,199.5,1144.8,748.5,259.5,1204.8]},{"partName":"PickFeeder_P02","model":"PickFeeder","modelLabel":"夹取送料装置","color":[0.6146,0.6349,0.6463],"worldBBox":[-30,200,774,390,400,1215.8]},{"partName":"PickFeeder_P03","model":"PickFeeder","modelLabel":"夹取送料装置","color":[0.6146,0.6349,0.6463],"worldBBox":[-180,198,1133.8,630,270,1215.8]},{"partName":"PickFeeder_P04","model":"PickFeeder","modelLabel":"夹取送料装置","color":[0.3725,0.3725,0.3725],"worldBBox":[-277.5,125.943,1109.818,-34.583,269.143,1229.018]},{"partName":"PickFeeder_P05","model":"PickFeeder","modelLabel":"夹取送料装置","color":[0,0,0],"worldBBox":[-227.746,122.743,972.659,-157.746,182.018,1114.128]},{"partName":"Plane001_P01","model":"Plane001","modelLabel":"地面平面 001","color":[0.3801,0.3753,0.3698],"worldBBox":[-2153.148,-2032.821,-1039.203,2714.334,1640.409,-729.142]},{"partName":"Plane001_P02","model":"Plane001","modelLabel":"地面平面 001","color":[0.7137,0.6392,0.2431],"worldBBox":[-2140.94,-2032.819,-739.025,2714.315,-923.485,-738.903]},{"partName":"Plane_P01","model":"Plane","modelLabel":"地面平面","color":[0.3801,0.3753,0.3698],"worldBBox":[-2439.842,-1829.019,-300,2427.64,1844.211,10.061]},{"partName":"Plane_P02","model":"Plane","modelLabel":"地面平面","color":[0.7137,0.6392,0.2431],"worldBBox":[-2427.634,-1829.017,0.178,2427.621,-719.683,0.3]},{"partName":"Pusher_P01","model":"Pusher","modelLabel":"推料装置","color":[0.7144,0.7301,0.734],"worldBBox":[955,-35,774,1445,195,859]},{"partName":"Pusher_P02","model":"Pusher","modelLabel":"推料装置","color":[0.6352,0.6509,0.6786],"worldBBox":[965.008,-138.7,829.2,1114.648,197.3,1361.8]},{"partName":"Hopper_P01","model":"Hopper","modelLabel":"料仓","color":[0.5445,0.5445,0.5445],"worldBBox":[-1480.282,119.617,774,-1289.719,310.384,839]},{"partName":"Hopper_P02","model":"Hopper","modelLabel":"料仓","color":[0.7725,0.7725,0.7725],"worldBBox":[-1485,90,774,-1205,340,974]},{"partName":"SensorBlock_P01","model":"SensorBlock","modelLabel":"新版检测块","color":[0.6013,0.6027,0.6031],"worldBBox":[277.521,-80.054,43.684,299.513,-58.087,50.684]},{"partName":"RotaryTransfer_P01","model":"RotaryTransfer","modelLabel":"旋转运送装置","color":[0.0667,0.0667,0.0667],"worldBBox":[-473,-20,774,-133,245,939]},{"partName":"RotaryTransfer_P02","model":"RotaryTransfer","modelLabel":"旋转运送装置","color":[0.6352,0.6509,0.6786],"worldBBox":[-611.434,-131.634,929,-74.565,404.634,976]},{"partName":"DisplayA_P01","model":"DisplayA","modelLabel":"显示屏 A","color":[0.7725,0.7725,0.7725],"worldBBox":[-1472.405,-127.694,774,-1223.405,33.506,1086]},{"partName":"DisplayA_P02","model":"DisplayA","modelLabel":"显示屏 A","color":[0.4604,0.4727,0.4823],"worldBBox":[-1451.405,-120.077,923.324,-1247.405,-4.401,1071.756]},{"partName":"DisplayB_P01","model":"DisplayB","modelLabel":"显示屏 B","color":[0.7725,0.7725,0.7725],"worldBBox":[-1194.5,-325,40,-945.5,-163.8,352]},{"partName":"DisplayB_P02","model":"DisplayB","modelLabel":"显示屏 B","color":[0.4604,0.4727,0.4823],"worldBBox":[-1173.5,-317.383,189.324,-969.5,-201.707,337.756]},{"partName":"CabinetDoor_P01","model":"CabinetDoor","modelLabel":"柜门","color":[0.7725,0.7725,0.7725],"worldBBox":[-1505,-80,155,-1475,480,715]},{"partName":"InspectionTable_P01","model":"InspectionTable","modelLabel":"检测台","color":[0.7444,0.7565,0.7586],"worldBBox":[837.73,-2.484,774,912.73,146.002,1099]},{"partName":"MaterialStore_P01","model":"MaterialStore","modelLabel":"物料存储区","color":[0.6013,0.6027,0.6031],"worldBBox":[1065.108,221.846,1104.741,1104.972,261.846,1134.741]},{"partName":"MaterialStore_P02","model":"MaterialStore","modelLabel":"物料存储区","color":[0.7725,0.7725,0.7725],"worldBBox":[1038.935,199.25,774,1390.75,282.229,1186.75]},{"partName":"MaterialStore_P03","model":"MaterialStore","modelLabel":"物料存储区","color":[0.6013,0.6027,0.6031],"worldBBox":[1328.422,221.846,1104.741,1368.286,261.846,1134.741]},{"partName":"MaterialStore_P04","model":"MaterialStore","modelLabel":"物料存储区","color":[0.6013,0.6027,0.6031],"worldBBox":[1065.108,221.846,860.235,1104.972,261.846,890.235]},{"partName":"MaterialStore_P05","model":"MaterialStore","modelLabel":"物料存储区","color":[0.6013,0.6027,0.6031],"worldBBox":[1329.24,221.846,858.6,1369.103,261.846,888.6]},{"partName":"WeighPlatform_P01","model":"WeighPlatform","modelLabel":"称重平台","color":[0.8633,0.9046,0.9386],"worldBBox":[65.002,50.341,774,265.002,249.657,944]},{"partName":"WeighPlatform_P02","model":"WeighPlatform","modelLabel":"称重平台","color":[0.8633,0.9046,0.9386],"worldBBox":[90.17,75.008,944,239.835,224.99,949]},{"partName":"AuxGripper_P01","model":"AuxGripper","modelLabel":"辅助夹爪","color":[0.8389,0.8664,0.8978],"worldBBox":[-530.519,80.32,1010.301,-457.207,174.592,1048.378]},{"partName":"AuxGripper_P02","model":"AuxGripper","modelLabel":"辅助夹爪","color":[0.8389,0.8664,0.8978],"worldBBox":[-512.825,95.245,945.984,-472.825,148.322,1016.032]},{"partName":"AuxGripper_P03","model":"AuxGripper","modelLabel":"辅助夹爪","color":[0.8389,0.8664,0.8978],"worldBBox":[-510.046,130.005,962.107,-475.912,159.899,1016.019]},{"partName":"TransportBracket_P01","model":"TransportBracket","modelLabel":"运送支架","color":[0.7444,0.7565,0.7586],"worldBBox":[-280,-100,774,-220,13.5,1084]},{"partName":"TransportInspector_P01","model":"TransportInspector","modelLabel":"运送检测装置","color":[0.7444,0.7565,0.7586],"worldBBox":[-312.488,253.99,774,-237.488,402.476,1099]},{"partName":"TransportInspector_P02","model":"TransportInspector","modelLabel":"运送检测装置","color":[0.5946,0.0016,0.0016],"worldBBox":[-289.988,254.976,968.182,-259.988,284.976,1028.182]}];
|
||
const MODELS = [{"name":"ABB_IRB_120","label":"ABB IRB 120 机器人"},{"name":"ToolFrame","label":"工具坐标系"},{"name":"CabinetA","label":"主控制柜"},{"name":"CabinetB","label":"长控制柜"},{"name":"StackLight","label":"三色警示灯"},{"name":"Loader","label":"上料机构"},{"name":"ConveyorFeeder","label":"传送带送料装置"},{"name":"RawFeeder","label":"原料上料装置"},{"name":"RawAssembly","label":"原料装配平台"},{"name":"OriginMarker","label":"原点标记"},{"name":"GroundPlane","label":"地面与地线"},{"name":"PickFeeder","label":"夹取送料装置"},{"name":"Plane001","label":"地面平面 001"},{"name":"Plane","label":"地面平面"},{"name":"Pusher","label":"推料装置"},{"name":"Hopper","label":"料仓"},{"name":"SensorBlock","label":"新版检测块"},{"name":"RotaryTransfer","label":"旋转运送装置"},{"name":"DisplayA","label":"显示屏 A"},{"name":"DisplayB","label":"显示屏 B"},{"name":"CabinetDoor","label":"柜门"},{"name":"InspectionTable","label":"检测台"},{"name":"MaterialStore","label":"物料存储区"},{"name":"WeighPlatform","label":"称重平台"},{"name":"AuxGripper","label":"辅助夹爪"},{"name":"TransportBracket","label":"运送支架"},{"name":"TransportInspector","label":"运送检测装置"}];
|
||
const host = document.getElementById("view");
|
||
const select = document.getElementById("model");
|
||
for (const model of MODELS) {
|
||
const option = document.createElement("option");
|
||
option.value = model.name; option.textContent = model.label;
|
||
select.appendChild(option);
|
||
}
|
||
const scene = new THREE.Scene();
|
||
scene.background = new THREE.Color(0x0d1318);
|
||
const camera = new THREE.PerspectiveCamera(42, host.clientWidth / host.clientHeight, 1, 20000);
|
||
camera.up.set(0, 0, 1);
|
||
const renderer = new THREE.WebGLRenderer({ antialias: true });
|
||
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
|
||
renderer.setSize(host.clientWidth, host.clientHeight);
|
||
host.appendChild(renderer.domElement);
|
||
scene.add(new THREE.HemisphereLight(0xffffff, 0x334455, 2.4));
|
||
const key = new THREE.DirectionalLight(0xffffff, 2.2); key.position.set(400, 700, 500); scene.add(key);
|
||
const fill = new THREE.DirectionalLight(0xffffff, 0.8); fill.position.set(-600, 200, -400); scene.add(fill);
|
||
|
||
const root = new THREE.Group();
|
||
scene.add(root);
|
||
const byModel = new Map();
|
||
const loader = new STLLoader();
|
||
let loaded = 0;
|
||
for (const part of PARTS) {
|
||
try {
|
||
const buffer = await (await fetch("./line-parts/" + encodeURIComponent(part.partName) + ".stl")).arrayBuffer();
|
||
const geometry = loader.parse(buffer);
|
||
const color = new THREE.Color().setRGB(part.color[0], part.color[1], part.color[2], THREE.SRGBColorSpace);
|
||
const mesh = new THREE.Mesh(geometry, new THREE.MeshStandardMaterial({ color, metalness: 0.3, roughness: 0.6 }));
|
||
mesh.userData = { partName: part.partName, model: part.model };
|
||
if (!byModel.has(part.model)) { const group = new THREE.Group(); group.name = part.model; byModel.set(part.model, group); root.add(group); }
|
||
byModel.get(part.model).add(mesh);
|
||
loaded++;
|
||
} catch (error) { console.warn("part", part.partName, error); }
|
||
}
|
||
const [xmin, ymin, zmin, xmax, ymax, zmax] = [-1514.908,-335.358,-8.855,1464.941,560.042,1473.587];
|
||
const size = new THREE.Vector3(xmax - xmin, ymax - ymin, zmax - zmin);
|
||
const center = new THREE.Vector3((xmin + xmax) / 2, (ymin + ymax) / 2, (zmin + zmax) / 2);
|
||
const maxSize = Math.max(size.x, size.y, size.z);
|
||
camera.position.set(center.x + maxSize * 1.05, center.y - maxSize * 1.35, center.z + maxSize * 0.75);
|
||
camera.lookAt(center);
|
||
const controls = new OrbitControls(camera, renderer.domElement);
|
||
controls.target.copy(center); controls.enableDamping = true; controls.dampingFactor = 0.08; controls.update();
|
||
document.getElementById("stats").textContent =
|
||
loaded + " / 88 个部件 · 27 个模型 · 场景 " + (size.x / 1000).toFixed(2) + " × " + (size.y / 1000).toFixed(2) + " × " + (size.z / 1000).toFixed(2) + " m";
|
||
select.addEventListener("change", () => {
|
||
for (const [model, group] of byModel) group.visible = !select.value || select.value === model;
|
||
});
|
||
addEventListener("resize", () => {
|
||
camera.aspect = host.clientWidth / host.clientHeight; camera.updateProjectionMatrix();
|
||
renderer.setSize(host.clientWidth, host.clientHeight);
|
||
});
|
||
const animate = () => { requestAnimationFrame(animate); controls.update(); renderer.render(scene, camera); };
|
||
animate();
|
||
window.__lineAssemblyStats = { loaded, models: byModel.size };
|
||
window.__lineAssemblyReady = true;
|
||
</script>
|
||
</body>
|
||
</html>
|