AmbientLightDesc
AmbientLightDescクラスは、シーン全体に均一に光を当てる環境光Descriptorを表します。AmbientLightはすべてのオブジェクトを均等に照らし、影を作りません。
Common Properties
Section titled “Common Properties”visible
Section titled “visible”Type: boolean | undefined
Description: オブジェクトの表示/非表示を制御します。
Default: true
Example:
{ visible: false, ambient: { ... }}Ambient Properties
Section titled “Ambient Properties”ambient
Section titled “ambient”Type: object | undefined
Description: 環境光の設定オプション。
Type: Color | undefined
Description: 環境光の色をColorオブジェクトで指定します。
Default: new Color().setHex(0xffffff)
Example:
import { Color } from "@navaramap/three";
{ ambient: { color: new Color().setHex(0xffffff), }}intensity
Section titled “intensity”Type: number | undefined
Description: 環境光の強度を指定します。数値が大きいほど明るくなります。
Default: 1
Example:
{ ambient: { intensity: 1.0, }}基本的な使用例
Section titled “基本的な使用例”import ThreeView, { Color } from "@navaramap/three";import { AmbientLightDesc } from "@navaramap/three-default-descs";
const view = new ThreeView();await view.init();
// 環境光オブジェクトを追加const ambientLight = view.addLight<AmbientLightDesc>({ ambient: { color: new Color().setHex(0xffffff), intensity: 1.0 }});環境光の更新
Section titled “環境光の更新”// 環境光の色と強度を更新ambientLight.update({ ambient: { color: new Color().setHex(0xaabbcc), intensity: 0.5 }});シンプルな環境光
Section titled “シンプルな環境光”// デフォルト設定で環境光を追加view.addLight<AmbientLightDesc>({ ambient: {}});初期非表示で追加
Section titled “初期非表示で追加”// 非表示状態で環境光を追加し、後から表示切り替えconst ambientLightDesc = view.addLight<AmbientLightDesc>({ visible: false, ambient: { intensity: 1, color: new Color().setHex(0xffffff), },});
// 表示/非表示を切り替えambientLightDesc.visible = true;- 環境光は影を作りません。
- 環境光は全方向から均等にオブジェクトを照らします。
- 他のライトタイプ(SunLightDesc、SkyLightProbeDescなど)と組み合わせて使用することができます。
- 環境光の強度が高すぎると、シーンが平坦に見える可能性があります。