Beispiel #1
0
void MainWindow::populateWorkSpaceTree(const QStringList &itemNames)
{
    for(int count = 0; count < itemNames.size(); ++count)
    {
        QTreeWidgetItem *matItem = new QTreeWidgetItem(ui->workspaceTree);
        QString parentName = itemNames.at(count);
        matItem->setText(0, parentName);
        matItem->setText(1, "material");
        Ogre::MaterialPtr parMat = Ogre::MaterialManager::getSingleton().getByName(parentName.toStdString());

        unsigned short numTech = parMat.getPointer()->getNumTechniques();

        for (int countTech = 0; countTech < numTech; ++countTech)
        {
            Ogre::Technique *parTech = parMat.getPointer()->getTechnique(countTech);
            int numPass = parTech->getNumPasses();
            QTreeWidgetItem *techItem = new QTreeWidgetItem(matItem);
            techItem->setText(0, QString("technique(")+QString(Ogre::String(parTech->getName()).c_str())+QString(")"));

            for (int countPass = 0; countPass < numPass; ++countPass)
            {
                QTreeWidgetItem *passItem = new QTreeWidgetItem(techItem);
                Ogre::Pass* pass = parTech->getPass(countPass);
                passItem->setText(0, QString("pass(")+QString(Ogre::String(pass->getName()).c_str())+QString(")"));
                passItem->setText(1, QString("pass"));

                if(pass->hasVertexProgram())
                {
                    QTreeWidgetItem *vpItem = new QTreeWidgetItem(passItem);
                    vpItem->setText(0,Ogre::String(pass->getVertexProgramName()).c_str());
                    vpItem->setText(1,QString("VertexProgram"));
                    vpItem->setText(2,QString(parentName));
                    vpItem->setText(3,QString(countTech));
                    vpItem->setText(4,QString(countPass));
                }
                if(pass->hasFragmentProgram())
                {
                    QTreeWidgetItem *fpItem = new QTreeWidgetItem(passItem);
                    fpItem->setText(0,Ogre::String(pass->getFragmentProgramName()).c_str());
                    fpItem->setText(1,QString("FragmentProgram"));
                    fpItem->setText(2,QString(parentName));
                    fpItem->setText(3,QString(countTech));
                    fpItem->setText(4,QString(countPass));
                }
                if(pass->hasGeometryProgram())
                {
                    QTreeWidgetItem *gpItem = new QTreeWidgetItem(passItem);
                    gpItem->setText(0,Ogre::String(pass->getGeometryProgramName()).c_str());
                }
            }
        }
    }
}
Beispiel #2
0
bool FoliageLayer::isTangentsEnabled() const
{
	Ogre::Technique* tech = material->getBestTechnique();
	if (tech) {
		const std::string& name = tech->getName();
		if (Ogre::StringUtil::endsWith(name, "High", false)) {
			return true;
		} else if (Ogre::StringUtil::endsWith(name, "Medium", false)) {
			return true;
		} else {
			return false;
		}
	}
	return false;
}