填充支持给定 LampPurpose 集的灯索引缓冲区。 调用此方法之前,应通过调用 ILampArray::GetIndicesCountForPurposes 来获取最大缓冲区大小。
语法
void GetIndicesForPurposes(
LampPurposes lampPurposes,
uint32_t lampIndicesCount,
uint32_t * lampIndices)
参数
lampPurposes 类型: LampPurposes
所需的 LampPurposes 集。
lampIndicesCount
类型:uint32_t
要填充的缓冲区的大小。
lampIndices _Out_writes_(lampIndicesCount) 类型: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 主机
另请参阅
照明 API 概述
ILampArray::GetIndicesCountForPurposes
ILampArray::SetColorsForIndices
ILampArray