> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ILampArray::GetIndicesForPurposes

> ILampArray::GetIndicesForPurposes

# ILampArray::GetIndicesForPurposes

指定された LampPurposes のセットをサポートする Lamp インデックスのバッファーを設定します。このメソッドを呼び出す前に、[ILampArray::GetIndicesCountForPurposes](/reference/lighting/lamparray/interfaces/ilamparray/methods/ilamparray_getindicescountforpurposes) を呼び出して最大のバッファー サイズを取得してください。

## 構文

```cpp theme={null}
void GetIndicesForPurposes(
    LampPurposes lampPurposes,
    uint32_t lampIndicesCount,
    uint32_t * lampIndices)
```

### パラメーター

*lampPurposes*
Type: [LampPurposes](/reference/lighting/lamparray/enums/lamppurposes)

望ましい LampPurposes のセットです。

*lampIndicesCount*\
Type: uint32\_t

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

*lampIndices*  \_Out\_writes\_(lampIndicesCount)
Type: uint32\_t\*

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

### 戻り値

Type: void

## 解説

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

```cpp theme={null}
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 の概要](/build/core-features/common/lighting/gc-lighting-toc)\
[ILampArray::GetIndicesCountForPurposes](/reference/lighting/lamparray/interfaces/ilamparray/methods/ilamparray_getindicescountforpurposes)\
[ILampArray::SetColorsForIndices](/reference/lighting/lamparray/interfaces/ilamparray/methods/ilamparray_setcolorsforindices)\
[ILampArray](/reference/lighting/lamparray/interfaces/ilamparray/ilamparray)


## Related topics

- [ILampArray::GetIndicesCountForPurposes](/ja-jp/reference/lighting/lamparray/interfaces/ilamparray/methods/ilamparray_getindicescountforpurposes.md)
- [LampPurposes 列挙型](/ja-jp/reference/lighting/lamparray/enums/lamppurposes.md)
- [ILampArray::SetColorsForIndices](/ja-jp/reference/lighting/lamparray/interfaces/ilamparray/methods/ilamparray_setcolorsforindices.md)
- [ILampArray::GetLampArrayKind](/ja-jp/reference/lighting/lamparray/interfaces/ilamparray/methods/ilamparray_getlamparraykind.md)
- [ILampArray::GetLampCount](/ja-jp/reference/lighting/lamparray/interfaces/ilamparray/methods/ilamparray_getlampcount.md)
