Viewer3DConfig
<h3>BCore.Viewer.Viewer3DConfig</h3>
<h4>构造函数</h4>
<pre><code class="language-javascript">new BCore.Viewer.Viewer3DConfig();</code></pre>
<h4>成员变量</h4>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>rendererOptions</code></td>
<td>Object</td>
<td>渲染器选项</td>
</tr>
<tr>
<td><code>backgroundColor</code></td>
<td>Object</td>
<td>背景颜色</td>
</tr>
<tr>
<td><code>ambientLight</code></td>
<td>Object</td>
<td>环境光</td>
</tr>
<tr>
<td><code>directionalLight</code></td>
<td>Object</td>
<td>平行光</td>
</tr>
<tr>
<td><code>selectStyle</code></td>
<td>Object</td>
<td>构件选中样式</td>
</tr>
<tr>
<td><code>postilConfig</code></td>
<td>Object</td>
<td>批注功能配置</td>
</tr>
<tr>
<td><code>cameraConfig</code></td>
<td>Object</td>
<td>相机配置</td>
</tr>
<tr>
<td><code>cameraControl</code></td>
<td>Object</td>
<td>相机控制器设置</td>
</tr>
<tr>
<td><code>modelConfig</code></td>
<td>Object</td>
<td>模型相关配置</td>
</tr>
<tr>
<td><code>wireframeLineConfig</code></td>
<td>Object</td>
<td>轮廓线配置</td>
</tr>
<tr>
<td><code>technologyOptions</code></td>
<td>Object</td>
<td>科技效果配置(v2.5)</td>
</tr>
<tr>
<td><code>sketchyOptions</code></td>
<td>Object</td>
<td>草图效果配置(v2.5)</td>
</tr>
<tr>
<td><code>viewControlConfig</code></td>
<td>Object</td>
<td>视图控制器配置(v2.5)</td>
</tr>
<tr>
<td><code>requestRandomUrls</code></td>
<td>string[]</td>
<td>加载gltf多域名配置(按一定规律随机请求)</td>
</tr>
</tbody>
</table>
<h4>使用示例</h4>
<pre><code class="language-javascript">let mApplication3D = new BCore.Application.Application3D(new BCore.Application.Application3DConfig());
let mViewer3Dconfig = new BCore.Viewer.Viewer3DConfig();
mViewer3Dconfig.ambientLight.color = &quot;#fff333&quot;; //成员变量任一项可配置
let mViewer3D = new BCore.Viewer.Viewer3D('bcorecontanier', mViewer3Dconfig);
mViewer3D.initViewer3D(&quot;4ccb5c29d860f69acbd909dcc509fa&quot;);
mViewer3D.addEventListener('ViewAdded', () =&gt; { console.log('loading'); });
mApplication3D.addViewer3D(mViewer3D); </code></pre>
<p><br></p>
<h3>成员变量可配置参数</h3>
<h4>1. rendererOptions</h4>
<table>
<thead>
<tr>
<th>参数名</th>
<th>类型</th>
<th>默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>alpha</code></td>
<td>boolean</td>
<td>true</td>
<td>渲染容器是否背景透明</td>
</tr>
<tr>
<td><code>antialias</code></td>
<td>boolean</td>
<td>false</td>
<td>开启MSAA抗锯齿方式</td>
</tr>
<tr>
<td><code>ambientOcclusion</code></td>
<td>boolean</td>
<td>false</td>
<td>环境光遮蔽</td>
</tr>
<tr>
<td><code>logarithmicDepthBuffer</code></td>
<td>boolean</td>
<td>false</td>
<td>优化构件渲染闪烁问题,但会消耗性能</td>
</tr>
<tr>
<td><code>devicePixelRatio</code></td>
<td>number</td>
<td>window.devicePixelRatio</td>
<td>dpr</td>
</tr>
</tbody>
</table>
<h4>2. backgroundColor</h4>
<table>
<thead>
<tr>
<th>参数名</th>
<th>类型</th>
<th>默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>color1</code></td>
<td>string</td>
<td>"#e2f7fe"</td>
<td>纯色(color1 !== color2)</td>
</tr>
<tr>
<td><code>color2</code></td>
<td>string</td>
<td>"#faf8ef"</td>
<td>渐变(color1 !== color2)</td>
</tr>
</tbody>
</table>
<h4>3. ambientLight</h4>
<table>
<thead>
<tr>
<th>参数名</th>
<th>类型</th>
<th>默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>color</code></td>
<td>string</td>
<td>"#ffffff"</td>
<td>颜色</td>
</tr>
<tr>
<td><code>intensity</code></td>
<td>number</td>
<td>0.85</td>
<td>强度</td>
</tr>
<tr>
<td><code>enable</code></td>
<td>boolean</td>
<td>true</td>
<td>开启环境光</td>
</tr>
</tbody>
</table>
<h4>4. directionalLight</h4>
<table>
<thead>
<tr>
<th>参数名</th>
<th>类型</th>
<th>默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>color</code></td>
<td>number</td>
<td>0xffffff</td>
<td>颜色</td>
</tr>
<tr>
<td><code>position</code></td>
<td>{x,y,z}</td>
<td>{ x: 100, y: 100, z: 100 }</td>
<td>方向</td>
</tr>
<tr>
<td><code>intensity</code></td>
<td>number</td>
<td>0.6</td>
<td>强度</td>
</tr>
<tr>
<td><code>enable</code></td>
<td>boolean</td>
<td>true</td>
<td>是否启用</td>
</tr>
</tbody>
</table>
<h4>5. selectStyle</h4>
<table>
<thead>
<tr>
<th>参数名</th>
<th>类型</th>
<th>默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>color</code></td>
<td>string</td>
<td>'#66CDAA'</td>
<td>颜色</td>
</tr>
<tr>
<td><code>depthTest</code></td>
<td>boolean</td>
<td>false</td>
<td>取消遮挡</td>
</tr>
<tr>
<td><code>transparent</code></td>
<td>boolean</td>
<td>true</td>
<td>是否允许透明</td>
</tr>
<tr>
<td><code>opacity</code></td>
<td>number</td>
<td>0.5</td>
<td>透明度</td>
</tr>
<tr>
<td><code>enable</code></td>
<td>boolean</td>
<td>true</td>
<td>是否启用</td>
</tr>
<tr>
<td><code>enableBorder</code></td>
<td>boolean</td>
<td>true</td>
<td>是否显示线框</td>
</tr>
<tr>
<td><code>borderColor</code></td>
<td>string</td>
<td>'#000000'</td>
<td>线框颜色</td>
</tr>
<tr>
<td><code>borderDepthTest</code></td>
<td>boolean</td>
<td>false</td>
<td>取消线框遮挡</td>
</tr>
<tr>
<td><code>borderOpacity</code></td>
<td>number</td>
<td>0.8</td>
<td>线框透明度</td>
</tr>
<tr>
<td><code>borderLimitCount</code></td>
<td>number</td>
<td>40000</td>
<td>显示线框面数限制</td>
</tr>
<tr>
<td><code>pressLimitTime</code></td>
<td>number</td>
<td>600</td>
<td>移动端长按右键菜单时间</td>
</tr>
<tr>
<td><code>doubleTapLimitCount</code></td>
<td>number</td>
<td>2</td>
<td>双击判定次数</td>
</tr>
<tr>
<td><code>isTransparentObjectSelectable</code></td>
<td>boolean</td>
<td>false</td>
<td>透明构件是否可以交互</td>
</tr>
</tbody>
</table>
<h4>6. postilConfig</h4>
<table>
<thead>
<tr>
<th>参数名</th>
<th>类型</th>
<th>默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>isAutoSavePostilScreenShot</code></td>
<td>boolean</td>
<td>true</td>
<td>是否允许保存批注截图</td>
</tr>
<tr>
<td><code>isShowMessage</code></td>
<td>boolean</td>
<td>true</td>
<td>是否提示批注状态</td>
</tr>
</tbody>
</table>
<p>(后面成员变量的具体说明可按需求继续补充)</p>
<p>以上为 <code>BCore.Viewer.Viewer3DConfig</code> 的基本配置文档,若有更细节需求,请联系我们~</p>