外部模型
<h1>外部模型</h1>
<p><strong>描述:</strong></p>
<ul>
<li>提供管理外部模型的功能,包括添加和删除模型。</li>
</ul>
<h2>接口:</h2>
<ul>
<li>
<p><strong><code>addToScene(name: string, obj: Object3D)</code></strong>
向场景中添加外部模型。</p>
</li>
<li><strong><code>removeFromScene(name: string)</code></strong>
从场景中移除外部模型。</li>
</ul>
<h3>成员参数说明:</h3>
<table>
<thead>
<tr>
<th>参数名</th>
<th>必选</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td>是</td>
<td>string</td>
<td>外部模型名称</td>
</tr>
<tr>
<td>obj</td>
<td>是</td>
<td>Object3D</td>
<td>模型对象</td>
</tr>
</tbody>
</table>
<h3>示例代码:</h3>
<pre><code class="language-javascript">let viewer2DConfig = new BCore.Viewer.Viewer2DConfig();
mViewer2D = new BCore.Viewer.Viewer2D('bcorecontainer-2d', viewer2DConfig);
// 创建几何体和材质
const geometry = new THREE.BufferGeometry();
geometry.setAttribute('position', new THREE.Float32BufferAttribute([0, 0, 0], 3));
const material = new THREE.PointsMaterial({ color: 0x00ff00, sizeAttenuation: false, size: 8 });
// 创建点云并添加到场景
const Points = new THREE.Points(geometry, material);
mViewer2D.addToScene('Points', Points);
// 从场景中移除点云
mViewer2D.removeFromScene('Points');</code></pre>
<h3>返回值说明:</h3>
<table>
<thead>
<tr>
<th>参数名</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>mindistanceLine</td>
<td>number[]</td>
<td>距事件点最近的线点坐标数组(每三个数表示一个坐标)</td>
</tr>
<tr>
<td>mousepoint</td>
<td>number[]</td>
<td>事件点吸附的点,未吸附时返回鼠标点</td>
</tr>
</tbody>
</table>
<hr />