メインコンテンツへスキップ

ライト

商品説明

このコンポーネントは、実体を発光させる。

プロパティ一覧

PropertyType初期値商品説明
タイプ (必須)ストリング方向性サポートされているタイプは以下の通り: ディレクショナル」、「ポイント」、「アンビエント
キャストシャドウブーリアンtrue光源が影を落とす場合。
強度番号0.5放出強度。
r番号(0~255)255光が発する赤の量。
g番号(0~255)255光が発する緑の量。
b番号(0~255)255光が発する青の量。
シャドウバイアス番号-0.005サーフェスが影になっているかどうかを判断するときに、正規化された深度からどれだけ足したり引いたりするか。
シャドウ・ノーマルバイアス番号0シャドウマップのクエリに使用される位置が、オブジェクトの法線に沿ってどれだけオフセットされるか。
シャドウ半径番号1影の半径
シャドウ自動更新ブーリアンtrueシャドーは自動的に計算され、更新されるべきか
シャドウブラーサンプル番号8仮想シャドウマップを計算する際に使用するサンプル量。
shadowMapSizeHeight番号1024シャドウマップの高さ。 (値は**2の累乗でなければならない)
シャドウマップサイズ幅番号1024シャドウマップの幅。 (値は**2の累乗でなければならない)
シャドウカメラニア番号0.5影を計算するためのカメラニアペイン
シャドウカメラファー番号200影を計算するためのカメラ・フラストゥム・ファーペイン
シャドウカメラ左番号-50影を計算するためのカメラ挫折左ペイン
シャドウカメラ右番号50影を計算するためのカメラの挫折の右ペイン
シャドーカメラ下部番号-50影を計算するためのカメラ・フラストゥム・ボトムペイン
シャドウカメラトップ番号50影を計算するためのカメラ・フラストゥルム・トップペイン
ターゲットエックス番号0ライトのターゲットX座標(指向性のみ)
ターゲットY番号0ライトのターゲットY座標(指向性のみ)
ターゲットZ番号0光のターゲットZ座標(指向性のみ)

関数一覧

Get

Returns a read-only reference.

Example

ecs.Light.get(world, component.eid)

Set

Ensures the component exists on the entity, then assigns the (optional) data to the component.

Example

ecs.Light.set(world, component.eid, {
type: 'directional',
castShadow: true,
intensity: 0.5,
r: 255,
g: 255,
b: 255,
shadowBias: -0.005,
shadowNormalBias: 0,
shadowRadius: 1,
shadowAutoUpdate: true,
shadowBlurSamples: 8,
shadowMapSizeHeight: 1024,
shadowMapSizeWidth: 1024,
shadowCameraNear: 0.5,
shadowCameraFar: 200,
shadowCameraLeft: -50,
shadowCameraRight: 50,
shadowCameraBottom: -50,
shadowCameraTop: 50,
targetX: 0,
targetY: 0,
targetZ: 0
})

Mutate

Perform an update to the component within a callback function. Return true to indicate no changes made.

Example

ecs.Light.mutate(world, component.eid, (cursor) => {
cursor.intensity = 1.0;
cursor.castShadow = false;
return false;
})

Remove

Removes the component from the entity.

Example

ecs.Light.remove(world, component.eid)

Has

Returns true if the component is present on the entity.

Example

ecs.Light.has(world, component.eid)

Reset

Adds, or resets the component to its default state.

Example

ecs.Light.reset(world, component.eid)

Advanced Functions

Cursor

Returns a mutable reference. Cursors are reused so only one cursor for each component can exist at a time.

Example
ecs.Light.cursor(world, component.eid)

Acquire

Same behavior as cursor, but commit must be called after the cursor is done being used.

Example
ecs.Light.acquire(world, component.eid)

Commit

Called after acquire. An optional third argument determines whether the cursor was mutated or not.

Example
ecs.Light.commit(world, component.eid)
ecs.Light.commit(world, component.eid, false)

Dirty

Mark the entity as having been mutated. Only needed in a specific case where systems are mutating data.

Example
ecs.Light.dirty(world, component.eid)