zyy-engine

图形引擎API


平行光源

<h1>平行光源</h1> <h2>方法总览</h2> <ul> <li><code>openDirectionalLight()</code> 打开方向光,引擎默认打开</li> <li><code>closeDirectionalLight()</code> 关闭方向光,引擎默认打开</li> <li><code>setDirectionalLight(color,intensity,position)</code></li> <li><code>getDirectionalLight()</code></li> <li><code>setDirectionalLightIntensity(intensity: number)</code> 设置方向光强度</li> <li><code>getDirectionalLightIntensity()</code> 获取方向光强度</li> <li><code>setDirectionalLightAngle(angle: number)</code> 设置当前方向光角度</li> <li><code>getDirectionalLightAngle()</code> 获取当前方向光角度</li> <li><code>openShadowMap()</code> 开启平行光阴影效果</li> <li><code>closeShadowMap()</code> 关闭平行光阴影效果</li> </ul> <h2>方法示例</h2> <h3>1. 打开方向光</h3> <ul> <li><strong>简要描述</strong>: 打开环境光</li> <li><strong>接口</strong>: <code>openDirectionalLight()</code></li> <li><strong>示例</strong>: <pre><code class="language-javascript">let viewer3DConfig = new BCore.Viewer.Viewer3DConfig(); let viewer3d = new BCore.Viewer.Viewer3D(viewer3DConfig); viewer3d.openDirectionalLight();</code></pre></li> </ul> <p>&lt;br&gt;</p> <h3>2. 关闭方向光</h3> <ul> <li><strong>简要描述</strong>: 关闭环境光</li> <li><strong>接口</strong>: <code>closeDirectionalLight()</code></li> <li><strong>示例</strong>: <pre><code class="language-javascript">let viewer3DConfig = new BCore.Viewer.Viewer3DConfig(); let viewer3d = new BCore.Viewer.Viewer3D(viewer3DConfig); viewer3d.closeDirectionalLight();</code></pre></li> </ul> <p>&lt;br&gt;</p> <h3>3. 设置方向光</h3> <ul> <li><strong>简要描述</strong>: 设置光源颜色、强度、朝向</li> <li><strong>接口</strong>: <code>setDirectionalLight(color, intensity?, position?)</code></li> <li><strong>参数</strong>: <ul> <li><code>color</code> : <code>string</code> (必选) - 光源颜色</li> <li><code>intensity</code> : <code>number</code> (可选) - 光源强度</li> <li><code>position</code> : <code>{x: number, y: number, z: number}</code> (可选) - 光源位置</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.setDirectionalLight('#FFFFFF', 0.5, {x: 0, y: 0, z: 0});</code></pre></li> </ul> <p>&lt;br&gt;</p> <h3>4. 返回方向光配置</h3> <ul> <li><strong>简要描述</strong>: 返回方向光颜色、强度、光源位置</li> <li><strong>接口</strong>: <code>getDirectionalLight()</code></li> <li><strong>示例</strong>: <pre><code class="language-javascript">let viewer3DConfig = new BCore.Viewer.Viewer3DConfig(); let viewer3d = new BCore.Viewer.Viewer3D(viewer3DConfig); viewer3d.getDirectionalLight();</code></pre></li> <li><strong>返回值说明</strong>: <code>DirectionalLight</code> - 方向光配置</li> </ul> <p>&lt;br&gt;</p> <h3>5. 设置方向光强度</h3> <ul> <li><strong>简要描述</strong>: 设置方向光强度</li> <li><strong>接口</strong>: <code>setDirectionalLightIntensity(intensity)</code></li> <li><strong>参数</strong>: <ul> <li><code>intensity</code> : <code>number</code> (必选) - 光源强度</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.setDirectionalLightIntensity(0.5);</code></pre></li> <li><strong>返回值说明</strong>: 无</li> </ul> <hr /> <h3>6. 返回方向光强度</h3> <ul> <li><strong>简要描述</strong>: 返回方向光强度</li> <li><strong>接口</strong>: <code>getDirectionalLightIntensity()</code></li> <li><strong>示例</strong>: <pre><code class="language-javascript">let viewer3DConfig = new BCore.Viewer.Viewer3DConfig(); let viewer3d = new BCore.Viewer.Viewer3D(viewer3DConfig); viewer3d.getDirectionalLightIntensity();</code></pre></li> <li><strong>返回值说明</strong>: <code>number</code> - 光源强度</li> </ul> <p>&lt;br&gt;</p> <h3>7. 设置当前方向光角度</h3> <ul> <li><strong>简要描述</strong>: 设置当前方向光角度</li> <li><strong>接口</strong>: <code>setDirectionalLightAngle(angle: number)</code></li> <li><strong>参数</strong>: <ul> <li><code>angle</code> : <code>number</code> (必选) - 光源角度</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.setDirectionalLightAngle(0.5);</code></pre></li> </ul> <p>&lt;br&gt;</p> <h3>8. 返回方向光角度</h3> <ul> <li><strong>简要描述</strong>: 返回方向光角度</li> <li><strong>接口</strong>: <code>getDirectionalLightAngle()</code></li> <li><strong>示例</strong>: <pre><code class="language-javascript">let viewer3DConfig = new BCore.Viewer.Viewer3DConfig(); let viewer3d = new BCore.Viewer.Viewer3D(viewer3DConfig); viewer3d.getDirectionalLightAngle();</code></pre></li> <li><strong>返回值说明</strong>: <code>number</code> - 光源角度</li> </ul> <p>&lt;br&gt;</p> <h3>9. 开启平行光阴影效果</h3> <ul> <li><strong>简要描述</strong>: 开启平行光阴影效果</li> <li><strong>接口</strong>: <code>openShadowMap()</code></li> <li><strong>示例</strong>: <pre><code class="language-javascript">let viewer3DConfig = new BCore.Viewer.Viewer3DConfig(); let viewer3d = new BCore.Viewer.Viewer3D(viewer3DConfig); viewer3d.openShadowMap();</code></pre></li> </ul> <p>&lt;br&gt;</p> <h3>10. 关闭平行光阴影效果</h3> <ul> <li><strong>简要描述</strong>: 关闭平行光阴影效果</li> <li><strong>接口</strong>: <code>closeShadowMap()</code></li> <li><strong>示例</strong>: <pre><code class="language-javascript">let viewer3DConfig = new BCore.Viewer.Viewer3DConfig(); let viewer3d = new BCore.Viewer.Viewer3D(viewer3DConfig); viewer3d.closeShadowMap();</code></pre></li> </ul> <hr /> <p>以上是 <code>平行光源</code> 的相关API说明,可以根据需要进行操作和调用。</p>

页面列表

ITEM_HTML