本文整理汇总了C++中ogre::MaterialPtr::removeAllTechniques方法的典型用法代码示例。如果您正苦于以下问题:C++ MaterialPtr::removeAllTechniques方法的具体用法?C++ MaterialPtr::removeAllTechniques怎么用?C++ MaterialPtr::removeAllTechniques使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::MaterialPtr
的用法示例。
在下文中一共展示了MaterialPtr::removeAllTechniques方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compileMaterial
bool Simple::compileMaterial(Ogre::MaterialPtr material, std::set<std::string>& managedTextures) const
{
material->removeAllTechniques();
Ogre::Technique* technique = material->createTechnique();
if (!mTerrainPageSurfaces.empty()) {
//First add a base pass
auto surfaceLayer = mTerrainPageSurfaces.begin()->second;
Ogre::Pass* pass = technique->createPass();
pass->setLightingEnabled(false);
Ogre::TextureUnitState * textureUnitState = pass->createTextureUnitState();
textureUnitState->setTextureScale(1.0f / surfaceLayer->getScale(), 1.0f / surfaceLayer->getScale());
textureUnitState->setTextureName(surfaceLayer->getDiffuseTextureName());
textureUnitState->setTextureCoordSet(0);
for (auto& layer : mLayers) {
addPassToTechnique(*mGeometry, technique, layer, managedTextures);
}
}
if (mTerrainPageShadow) {
addShadow(technique, mTerrainPageShadow, material, managedTextures);
}
// addLightingPass(technique, managedTextures);
material->load();
if (material->getNumSupportedTechniques() == 0) {
S_LOG_WARNING("The material '" << material->getName() << "' has no supported techniques. The reason for this is: \n" << material->getUnsupportedTechniquesExplanation());
return false;
}
return true;
}
示例2: compileMaterial
bool Simple::compileMaterial(Ogre::MaterialPtr material)
{
material->removeAllTechniques();
Ogre::Technique* technique = material->createTechnique();
for (SurfaceLayerStore::const_iterator I = mTerrainPageSurfaces.begin(); I != mTerrainPageSurfaces.end(); ++I) {
const TerrainPageSurfaceLayer* surfaceLayer = I->second;
if (I == mTerrainPageSurfaces.begin()) {
Ogre::Pass* pass = technique->createPass();
pass->setLightingEnabled(false);
//add the first layer of the terrain, no alpha or anything
Ogre::TextureUnitState * textureUnitState = pass->createTextureUnitState();
textureUnitState->setTextureScale(1.0f / surfaceLayer->getScale(), 1.0f / surfaceLayer->getScale());
textureUnitState->setTextureName(surfaceLayer->getDiffuseTextureName());
textureUnitState->setTextureCoordSet(0);
} else {
if (surfaceLayer->intersects(*mGeometry)) {
addPassToTechnique(*mGeometry, technique, surfaceLayer);
}
}
}
if (mTerrainPageShadow) {
addShadow(technique, mTerrainPageShadow, material);
}
material->load();
if (material->getNumSupportedTechniques() == 0) {
S_LOG_WARNING("The material '" << material->getName() << "' has no supported techniques. The reason for this is: \n" << material->getUnsupportedTechniquesExplanation());
return false;
}
return true;
}
示例3: createActions
//.........这里部分代码省略.........
mNodeEditor->addNode(mMaterialNode);
}
}
//****************************************************************************/
void EditorDockWidget::doTechniqueHToolbarAction(void)
{
// Add a technique node
Magus::QtNodeTechnique* techniqueNode = new Magus::QtNodeTechnique(NODE_TITLE_TECHNIQUE);
mNodeEditor->addNode(techniqueNode);
}
//****************************************************************************/
void EditorDockWidget::doPassHToolbarAction(void)
{
// Add a pass node
Magus::QtNodePass* passNode = new Magus::QtNodePass(NODE_TITLE_PASS);
mNodeEditor->addNode(passNode);
}
//****************************************************************************/
void EditorDockWidget::doTextureHToolbarAction(void)
{
// Add a texture unit node
Magus::QtNodeTextureUnit* textureUnitNode = new Magus::QtNodeTextureUnit(NODE_TITLE_TEXTURE_UNIT);
mNodeEditor->addNode(textureUnitNode);
}
//****************************************************************************/
void EditorDockWidget::doCogHToolbarAction(void)
{
if (!mMaterialNode)
return;
if (mMaterialNode->getMaterialName().isEmpty())
return;
// ---------------------------------------- Create a material ----------------------------------------
Ogre::LogManager* logManager = Ogre::LogManager::getSingletonPtr();
Ogre::MaterialManager* materialManager = Ogre::MaterialManager::getSingletonPtr();
Ogre::String materialName = mMaterialNode->getMaterialName().toStdString(); // Convert to std format
logManager->logMessage("SME: create Ogre material: " + materialName);
Ogre::MaterialPtr material = materialManager->create(materialName, "General");
// Remark: Sceneblending is done for each pass individually, although it is defined on material level
// ---------------------------------------- Add the technique ----------------------------------------
Magus::QtNode* node = mMaterialNode->getNodeConnectedToPort(PORT_TECHNIQUE_OUT);
if (!node)
{
logManager->logMessage("SME: No technique node available");
return;
}
Magus::QtNodeTechnique* techniqueNode = static_cast<Magus::QtNodeTechnique*>(node);
material->removeAllTechniques();
Ogre::Technique* technique = material->createTechnique();
technique->removeAllPasses();
logManager->logMessage("SME: Technique created" + Ogre::StringConverter::toString(material->getNumTechniques()));
// ---------------------------------------- Add the passes ----------------------------------------
Magus::QtNodePass* passNode;
Magus::QtNodeTextureUnit* textureUnitNode;
Ogre::Pass* pass;
Ogre::TextureUnitState* textureUnit;
for (unsigned int i = 1; i < 5; ++i)
{
node = techniqueNode->getNodeConnectedToPort(PORT_PASS_OUT, i); // node with the same name
if (node)
{
passNode = static_cast<Magus::QtNodePass*>(node);
pass = technique->createPass();
pass->removeAllTextureUnitStates();
logManager->logMessage("SME: Pass on port nr. " + Ogre::StringConverter::toString(i) + " created");
propagatePassNodeData(passNode, pass);
// ---------------------------------------- Add the texture units ----------------------------------------
for (unsigned int j = 1; j < 9; ++j)
{
node = passNode->getNodeConnectedToPort(PORT_TEXTURE_OUT, j);
if (node)
{
logManager->logMessage("SME: Texture unit on port nr. " +
Ogre::StringConverter::toString(j) +
" of Pass port nr. " +
Ogre::StringConverter::toString(i) +
" created");
textureUnitNode = static_cast<Magus::QtNodeTextureUnit*>(node);
textureUnit = pass->createTextureUnitState();
propagateTextureUnitNodeData(textureUnitNode, textureUnit);
}
}
}
}
// Assign the material to the ogrehead
material->compile();
material->load();
mParent->getOgreManager()->getOgreWidget(1)->mEntity->setMaterial(material);
}