MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / rrBuildSkullFlagMaterial

Method rrBuildSkullFlagMaterial

source/render/RenderManager.cpp:1538–1574  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1536}
1537
1538std::string RenderManager::rrBuildSkullFlagMaterial(const std::string& materialNameBase,
1539 const Ogre::ColourValue& color)
1540{
1541 std::string materialNameToUse = materialNameBase + "_" + Helper::toString(color);
1542
1543 Ogre::MaterialPtr requestedMaterial = Ogre::MaterialPtr(Ogre::MaterialManager::getSingleton().getByName(materialNameToUse));
1544
1545 // If this texture has been copied and colourized, we can return
1546 if (!requestedMaterial.isNull())
1547 return materialNameToUse;
1548
1549 Ogre::MaterialPtr oldMaterial = Ogre::MaterialManager::getSingleton().getByName(materialNameBase);
1550
1551 Ogre::MaterialPtr newMaterial = oldMaterial->clone(materialNameToUse);
1552 if(!mShaderGenerator->cloneShaderBasedTechniques(oldMaterial->getName(), oldMaterial->getGroup(),
1553 newMaterial->getName(), newMaterial->getGroup()))
1554 {
1555 OD_LOG_ERR("Failed to clone rtss for material: " + materialNameBase);
1556 }
1557
1558 for (unsigned int j = 0; j < newMaterial->getNumTechniques(); ++j)
1559 {
1560 Ogre::Technique* technique = newMaterial->getTechnique(j);
1561 if (technique->getNumPasses() == 0)
1562 continue;
1563
1564 for (uint16_t i = 0; i < technique->getNumPasses(); ++i)
1565 {
1566 Ogre::Pass* pass = technique->getPass(i);
1567 pass->getTextureUnitState(0)->setColourOperationEx(Ogre::LayerBlendOperationEx::LBX_MODULATE,
1568 Ogre::LayerBlendSource::LBS_TEXTURE, Ogre::LayerBlendSource::LBS_MANUAL, Ogre::ColourValue(),
1569 color);
1570 }
1571 }
1572
1573 return materialNameToUse;
1574}
1575
1576void RenderManager::rrMinimapRendering(bool postRender)
1577{

Callers 1

updateHealthMethod · 0.80

Calls 3

toStringFunction · 0.50
ColourValueClass · 0.50
cloneMethod · 0.45

Tested by

no test coverage detected