zyy-engine

图形引擎API


环境光源

<h1>环境光源</h1> <h2>方法总览</h2> <ul> <li><code>openAmbientLight()</code> 打开环境光,引擎默认打开</li> <li><code>closeAmbientLight()</code> 关闭环境光,引擎默认打开</li> <li><code>setAmbientLight(color,intensity)</code> 设置环境光</li> <li><code>getAmbientLight()</code> 返回环境光配置</li> </ul> <h3>1 <strong>打开环境光</strong></h3> <ul> <li><strong>简要描述</strong>:打开环境光,默认情况下环境光是打开的。</li> <li><strong>接口</strong>:<code>openAmbientLight()</code></li> <li><strong>示例</strong>: <pre><code class="language-javascript">let viewer3DConfig = new BCore.Viewer.Viewer3DConfig(); let viewer3d = new BCore.Viewer.Viewer3D(viewer3DConfig); viewer3d.openAmbientLight();</code></pre></li> </ul> <p>&lt;br&gt;</p> <h3>2. <strong>关闭环境光</strong></h3> <ul> <li><strong>简要描述</strong>:关闭环境光。</li> <li><strong>接口</strong>:<code>closeAmbientLight()</code></li> <li><strong>示例</strong>: <pre><code class="language-javascript">let viewer3DConfig = new BCore.Viewer.Viewer3DConfig(); let viewer3d = new BCore.Viewer.Viewer3D(viewer3DConfig); viewer3d.closeAmbientLight();</code></pre></li> </ul> <p>&lt;br&gt;</p> <h3>3. <strong>设置环境光</strong></h3> <ul> <li><strong>简要描述</strong>:设置环境光的颜色和强度。</li> <li><strong>接口</strong>:<code>setAmbientLight(color, ?intensity)</code></li> <li><strong>参数</strong>: <ul> <li><code>color</code>: <code>string</code> - 光源颜色,必选。</li> <li><code>intensity</code>: <code>number</code> - 光源强度,默认为1,可选。</li> </ul></li> <li><strong>示例</strong>: <pre><code class="language-javascript"> let viewer3DConfig = new BCore.Viewer.Viewer3DConfig(); let viewer3d = new BCore.Viewer.Viewer3D(viewer3DConfig); viewer3d.setAmbientLight('#FFFFFF', 0.5);</code></pre></li> </ul> <p>&lt;br&gt;</p> <h3>4. <strong>返回环境光配置</strong></h3> <ul> <li><strong>简要描述</strong>:返回当前环境光的颜色和强度。</li> <li><strong>接口</strong>:<code>getAmbientLight()</code></li> <li><strong>示例</strong>: <pre><code class="language-javascript"> let viewer3DConfig = new BCore.Viewer.Viewer3DConfig(); let viewer3d = new BCore.Viewer.Viewer3D(viewer3DConfig); let ambientLightConfig = viewer3d.getAmbientLight();</code></pre></li> <li><strong>返回值</strong>: <ul> <li><code>AmbientLight</code>: 返回当前的环境光颜色和强度。</li> </ul></li> </ul>

页面列表

ITEM_HTML