次の方法で共有


ILampArray::GetIndicesForPurposes

特定の LampPurposes セットをサポートする Lamp インデックスのバッファーを設定します。 このメソッドを呼び出す前に、ILampArray::GetIndicesCountForPurposes を呼び出して最大バッファー サイズを取得する必要があります。

構文

void GetIndicesForPurposes(
    LampPurposes lampPurposes,
    uint32_t lampIndicesCount,
    uint32_t * lampIndices)

パラメーター

lampPurposes 型: LampPurposes

目的の LampPurposes のセット。

lampIndicesCount
型: uint32_t

設定するバッファーのサイズ。

lampIndices _Out_writes_(lampIndicesCount) Type: uint32_t*

Lamp インデックス バッファー。 バッファーに書き込まれるインデックスは、lampPurposes のすべてのフラグに一致するランプ用です。

戻り値

型: void

解説

次のコードは、ILampArray 上のすべてのブランド ランプの色を設定する方法を示しています。

void UpdateBrandingLamps(ILampArray* lampArray)
{
    // Get the number of Branding lamps
    LampPurposes purposes = LampPurposes::Branding;
    uint32_t indicesCount = lampArray->GetIndicesCountForPurposes(purposes);

    // Allocate and populate a buffer with the indices of those Lamps
    std::vector<uint32_t> indicesBuffer(indicesCount);
    lampArray->GetIndicesForPurposes(purposes, indicesCount, indicesBuffer.data());

    // Set color for all Branding Lamps to red.
    std::vector<LampArrayColor> colorsBuffer(indicesCount);
    for (uint32_t i = 0; i < indicesCount; i++)
    {
        colorsBuffer[i] = { 0xFF /* r */, 0x0 /* g */, 0x0 /* b */, 0xFF /* a */ };
    }

    lampArray->SetColorsForIndices(indicesCount, indicesBuffer.data(), colorsBuffer.data());
}

要件

ヘッダー: LampArray.h

ライブラリ: xgameplatform.lib

サポートされているプラットフォーム: Xbox One ファミリー本体、Xbox Series 本体

関連項目

Lighting API の概要
ILampArray::GetIndicesCountForPurposes
ILampArray::SetColorsForIndices
ILampArray