zyy-engine

图形引擎API


环境贴图

<h1>环境贴图</h1> <h2>一、BCore.Extension.IBLManagerConfig</h2> <h3>构造函数</h3> <pre><code class="language-javascript">new BCore.Extension.IBLManagerConfig(viewer)</code></pre> <h3>成员变量</h3> <table> <thead> <tr> <th>成员变量</th> <th>类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td>viewer</td> <td>BCore.Viewer.Viewer3D</td> <td>视图对象</td> </tr> </tbody> </table> <hr /> <h2>二、BCore.Extension.IBLManager</h2> <h3>构造函数</h3> <pre><code class="language-javascript">new BCore.Extension.IBLManager(config)</code></pre> <h3>参数</h3> <table> <thead> <tr> <th>参数名</th> <th>类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td>config</td> <td>BCore.Extension.IBLManagerConfig</td> <td>环境贴图配置对象</td> </tr> </tbody> </table> <h3>方法</h3> <ul> <li> <p><strong>openIBL()</strong></p> <ul> <li><strong>简要描述</strong>:开启环境贴图</li> <li><strong>返回值说明</strong>:无返回值</li> </ul> </li> <li> <p><strong>closeIBL()</strong></p> <ul> <li><strong>简要描述</strong>:关闭环境贴图</li> <li><strong>返回值说明</strong>:无返回值</li> </ul> </li> <li> <p><strong>setIBLImages(url): Promise</strong></p> <ul> <li><strong>简要描述</strong>:设置环境贴图图片</li> <li><strong>参数</strong>:</li> <li><strong>url</strong>:必选,类型为 <code>string</code> 或 <code>string[]</code>,可传入一张或六张贴图。</li> <li><strong>返回值说明</strong>:</li> <li><code>Promise</code>:resolve(boolean), reject(error: ErrorEvent)</li> </ul> </li> <li> <p><strong>updateIBL()</strong></p> <ul> <li><strong>简要描述</strong>:更新环境贴图</li> <li><strong>返回值说明</strong>:无返回值</li> </ul> </li> <li> <p><strong>getEnvMapIntensity() : number</strong></p> <ul> <li><strong>简要描述</strong>:获取环境贴图强度</li> <li><strong>返回值说明</strong>:返回环境贴图强度(number)。</li> </ul> </li> <li><strong>setEnvMapIntensity(intensity)</strong> <ul> <li><strong>简要描述</strong>:设置环境贴图强度</li> <li><strong>参数</strong>:</li> <li><strong>intensity</strong>:必选,类型为 <code>number</code>,代表环境贴图强度。</li> <li><strong>返回值说明</strong>:无返回值</li> </ul></li> </ul> <hr /> <h2>使用示例</h2> <h3>1.开启环境贴图</h3> <pre><code class="language-javascript">var mIBLManagerConfig = new BCore.Extension.IBLManagerConfig(viewer3D); var mIBLManager = new BCore.Extension.IBLManager(mIBLManagerConfig); mIBLManager.openIBL();</code></pre> <h3>2.关闭环境贴图</h3> <pre><code class="language-javascript">var mIBLManagerConfig = new BCore.Extension.IBLManagerConfig(viewer3D); var mIBLManager = new BCore.Extension.IBLManager(mIBLManagerConfig); mIBLManager.openIBL(); mIBLManager.closeIBL();</code></pre> <h3>3.设置环境贴图图片</h3> <pre><code class="language-javascript">var mIBLManagerConfig = new BCore.Extension.IBLManagerConfig(viewer3D); var mIBLManager = new BCore.Extension.IBLManager(mIBLManagerConfig); mIBLManager.openIBL(); //使用时替换成您所访问的域名地址 const domain = &amp;#039;https://ib.bimernet.com&amp;#039; mIBLManager.setIBLImages([ `${domain}/static/assets/bimengine/3d/textures/cube/pisa/nx.png`, `${domain}/static/assets/bimengine/3d/textures/cube/pisa/ny.png`, `${domain}/static/assets/bimengine/3d/textures/cube/pisa/nz.png`, `${domain}/static/assets/bimengine/3d/textures/cube/pisa/px.png`, `${domain}/static/assets/bimengine/3d/textures/cube/pisa/py.png`, `${domain}/static/assets/bimengine/3d/textures/cube/pisa/pz.png`, ]).then(() =&amp;gt; { mIBLManager.updateIBL(); });</code></pre> <h3>4.获取环境贴图强度</h3> <pre><code class="language-javascript">var mIBLManagerConfig = new BCore.Extension.IBLManagerConfig(viewer3D); var mIBLManager = new BCore.Extension.IBLManager(mIBLManagerConfig); mIBLManager.openIBL(); let envMapIntensity = mIBLManager.getEnvMapIntensity();</code></pre> <h3>设置环境贴图强度</h3> <pre><code class="language-javascript">var mIBLManagerConfig = new BCore.Extension.IBLManagerConfig(viewer3D); var mIBLManager = new BCore.Extension.IBLManager(mIBLManagerConfig); mIBLManager.openIBL(); mIBLManager.setEnvMapIntensity(4);</code></pre> <hr />

页面列表

ITEM_HTML