本文整理汇总了C++中CColor::Modulate方法的典型用法代码示例。如果您正苦于以下问题:C++ CColor::Modulate方法的具体用法?C++ CColor::Modulate怎么用?C++ CColor::Modulate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CColor
的用法示例。
在下文中一共展示了CColor::Modulate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdatePlayerMaterial
void CToolMainPlayer::UpdatePlayerMaterial(const int gridIndex)
{
//////////////////////////////////////////////////////////////////////////
if( CSceneEnvMgr::GetInst()->ShadowedColorIsEmpty() )
{
CTerrainMesh *pTerrainMesh = CMapEditApp::GetInst()->GetEditingMesh();
// grid color
int width = pTerrainMesh->GetWidth();
vector<DWORD> vecGridIndices;
DWORD index = gridIndex - width;
vecGridIndices.push_back(index - 1);
vecGridIndices.push_back(index);
vecGridIndices.push_back(index + 1);
vecGridIndices.push_back(gridIndex - 1);
vecGridIndices.push_back(gridIndex);
vecGridIndices.push_back(gridIndex + 1);
index = gridIndex + width;
vecGridIndices.push_back(index - 1);
vecGridIndices.push_back(index);
vecGridIndices.push_back(index + 1);
DWORD Red = 0;
DWORD Green = 0;
DWORD Blue = 0;
size_t vecSize = vecGridIndices.size();
for ( size_t i = 0; i < vecSize; ++i )
{
if( !pTerrainMesh->IsValid(vecGridIndices[i]) )
continue;
SGrid &Grid = pTerrainMesh->GetGrid(vecGridIndices[i]);
for ( int k = 0; k < 4; ++k )
{
SVertex & vertex = pTerrainMesh->GetVertex(Grid.dwVertexIndex[k]);
Red += VERTEX_COLOR;
Green += VERTEX_COLOR;
Blue += VERTEX_COLOR;
}
}
m_fRed = Red/(4*vecSize*255.0f);
m_fGreen = Green/(4*vecSize*255.0f);
m_fBlue = Blue/(4*vecSize*255.0f);
}
else
{
int nX = int(m_vPos.x / GRID_SPACE);
int nZ = int(m_vPos.z / GRID_SPACE);
CColor shadow = CSceneEnvMgr::GetInst()->GetShadowedColor(nX, nZ);
CColor diffuse = shadow.Modulate(0xff808080);///应该是Modulate格子顶点材质色
m_fRed = diffuse.R * colorFloat;
m_fGreen = diffuse.G * colorFloat;
m_fBlue = diffuse.B * colorFloat;
}
//////////////////////////////////////////////////////////////////////////
}