本文整理汇总了C++中MaterialInfo::getGradientColors方法的典型用法代码示例。如果您正苦于以下问题:C++ MaterialInfo::getGradientColors方法的具体用法?C++ MaterialInfo::getGradientColors怎么用?C++ MaterialInfo::getGradientColors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MaterialInfo
的用法示例。
在下文中一共展示了MaterialInfo::getGradientColors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fillInstanceData
void MeshRenderSystem::fillInstanceData(InstanceData* p_data, Entity* p_entity,
RenderInfo* p_renderInfo, int p_boneCount){
MaterialInfo matInfo;
p_data->setNumberOfActiveBones(p_boneCount);
// Try and get the gradient component
auto gradient = static_cast<GradientComponent*>(p_entity->getComponent(
ComponentType::Gradient));
if(gradient != NULL){
// Set all the values needed
matInfo = m_gfxBackend->getGfxWrapper()->getMaterialInfoFromMeshID(
p_renderInfo->m_meshId);
matInfo.setGradientLayer(1,gradient->m_color.layerOne);
matInfo.setGradientLayer(2,gradient->m_color.layerTwo);
p_data->setNumberOfActiveGradientLayers( matInfo.numberOfLayers );
}
// If none was found check why
else{
// Assume its a valid Ship Module
ShipModule* shipModule = static_cast<ShipModule*>(m_world->
getComponentManager()->getComponent(p_entity,ComponentType::ShipModule));
if(shipModule != NULL && shipModule->m_parentEntity > -1){
Entity* parentShip = m_world->getEntity(shipModule->m_parentEntity);
ModuleHelper::FindParentShip(m_world,&parentShip, shipModule);
if(parentShip != NULL){
RenderInfo* parentShipRenderInfo = getRenderInfo(parentShip);
matInfo = m_gfxBackend->getGfxWrapper()->getMaterialInfoFromMeshID(
parentShipRenderInfo->m_meshId);
auto gradient = static_cast<GradientComponent*>(parentShip->getComponent(
ComponentType::Gradient));
matInfo.setGradientLayer(1,gradient->m_color.layerOne);
matInfo.setGradientLayer(2,gradient->m_color.layerTwo);
p_data->setNumberOfActiveGradientLayers( matInfo.numberOfLayers );
}
}
// If not a Ship Module set values to default
else{
matInfo.setGradientLayer(1, AglVector4(1,1,1,1));
matInfo.setGradientLayer(2, AglVector4(1,1,1,1));
p_data->setNumberOfActiveGradientLayers( 1 );
}
}
auto colorTone = static_cast<ColorTone*>(p_entity->getComponent(ComponentType::ColorTone));
if (colorTone && colorTone->toneEnabled)
p_data->setColorTone(colorTone->color);
auto glowAnimation = static_cast<GlowAnimation*>(p_entity->getComponent(
ComponentType::GlowAnimation));
if(glowAnimation && glowAnimation->enabled)
{
p_data->setColorTone(glowAnimation->color);
}
//neg-x creates additive blending
//neg-y replaces color entirely
if (p_entity->getComponent(ComponentType::SelectionMarker))
p_data->setColorTone(AglVector4(-0.6f, 0.8f, 0.2f, 1)); ///< neg-sign on y for total color replacement
else if (p_entity->getComponent(ComponentType::TAG_Highlight))
p_data->setColorTone(AglVector4(0.5f, 1, 1, 1));
ShipHighlight* highlight = static_cast<ShipHighlight*>(p_entity->getComponent(ComponentType::ShipHighlight));
if (highlight && highlight->active)
p_data->setColorTone(highlight->color);
ShineSpawn* shineSpawn = static_cast<ShineSpawn*>(p_entity->getComponent(ComponentType::ShineSpawn));
if (shineSpawn)
{
float age = m_world->getElapsedTime()-shineSpawn->m_createdAt;
if (age < shineSpawn->m_lifetime)
p_data->setColorTone(AglVector4(-1, 1, 1, 1) * ((shineSpawn->m_lifetime-age) / shineSpawn->m_lifetime));
}
p_data->setGradientColor( matInfo.getGradientColors() );
}