素材
商品説明
このコンポーネントは、ジオメトリを持つエンティティにマテリアルを作成します。
プロパティ一覧
Property | Type | 初期値 | 商品説明 |
---|---|---|---|
r | 番号 | 0 | 素材の赤チャンネルの値 [0...255] |
g | 番号 | 0 | 素材のグリーン・チャンネル値 [0...255] |
b | 番号 | 0 | 素材の青チャンネル値 [0...255] |
テクスチャー | ストリング | "" | カラーマップソース、色で変調(設定されている場合) |
凹凸 | 番号 | 0 | 素材がどの程度粗く見えるか [0...1] |
粗さマップ | ストリング | "" | このテクスチャマップの緑チャンネルは、粗さに粗さ番号を掛けたものをリソースとする。 |
きんぞくせい | 番号 | 0 | 素材の金属的な見え方 [0...1] |
メタルネス・マップ | ストリング | "" | このテクスチャリソースのブ ルーチャンネルは、素材の金属の見え方に影響します。 |
ノーマルスケール | 番号 | 0 | 法線マップ(設定されている場合)がマテリアルに与える影響度 [0...1] |
ノーマルマップ | ストリング | "" | テクスチャの法線マップソース。 |
不透明性 | 番号 | 0 | 素材の全体的なアルファ値/透明度 [0...1] |
不透明度マップ | ストリング | "" | テクスチャリソースを介してマッピングされたアルファ/透明度。 |
発光強度 | 番号 | 0 | 発光マップの全体強度 [0...1] |
エミッシブマップ | ストリング | "" | テクスチャリソースとしてマッピングされた放射強度。 発光色と発光強度によって変調される。 |
エミッシブR | 番号 | 0 | 素材の赤チャンネルの発光色 [0...255] |
エミッシブG | 番号 | 0 | 素材の緑チャンネルの発光色 [0...255] |
エミッシブB | 番号 | 0 | 素材の青チャンネルの発光色 [0...255] |
サイド | ストリング | "" | 面のどの面をレンダリングするか。 フロント、バック、ダブルからお選びください。 |
折衷 | ストリング | "" | このマテリアルでオブジェクトを表示するときに使用するブレンド。 無、普通、加算、減算、乗算から選択。 |
リピートエックス | 番号 | 0 | テクスチャがX軸のマテリアル上で何回繰り返されるか。 |
リピートY | 番号 | 0 | テクスチャがY軸のマテ リアル上で何回繰り返されるか。 |
offsetX | 番号 | 0 | テクスチャがX軸上でマテリアル全体にどれだけオフセットされるか。 |
offsetY | 番号 | 0 | テクスチャがY軸上でマテリアル全体にどれだけオフセットされるか。 |
デプス試験 | ブーリアン | true | この素材をレンダリングする際に深さをテストするかどうか |
デプスライト | ブーリアン | true | この素材のレンダリングが深度バッファに影響を与えるかどうか |
ワイヤフレーム | ブーリアン | false | ジオメトリをワイヤフレームとしてレンダリングする。 |
関数一覧
Get
Returns a read-only reference.
Example
ecs.Material.get(world, component.eid)
Set
Ensures the component exists on the entity, then assigns the (optional) data to the component.
Example
ecs.Material.set(world, component.eid, {
r: 255,
g: 0,
b: 0
})
Mutate
Perform an update to the component within a callback function. Return true
to indicate no changes made.
Example
ecs.Material.mutate(world, component.eid, (cursor) => {
cursor.roughness = 0.8;
cursor.wireframe = true;
return false;
})
Remove
Removes the component from the entity.
Example
ecs.Material.remove(world, component.eid)
Has
Returns true
if the component is present on the entity.
Example
ecs.Material.has(world, component.eid)
Reset
Adds, or resets the component to its default state.
Example
ecs.Material.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.Material.cursor(world, component.eid)
Acquire
Same behavior as cursor, but commit must be called after the cursor is done being used.
Example
ecs.Material.acquire(world, component.eid)
Commit
Called after acquire. An optional third argument determines whether the cursor was mutated or not.
Example
ecs.Material.commit(world, component.eid)
ecs.Material.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.Material.dirty(world, component.eid)