本文整理汇总了C++中ogre::MaterialPtr::getPointer方法的典型用法代码示例。如果您正苦于以下问题:C++ MaterialPtr::getPointer方法的具体用法?C++ MaterialPtr::getPointer怎么用?C++ MaterialPtr::getPointer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::MaterialPtr
的用法示例。
在下文中一共展示了MaterialPtr::getPointer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: populateWorkSpaceTree
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());
}
}
}
}
}
示例2: cloneMe
Material Material::cloneMe()
{
String name = mMaterial->getName();
unsigned int i = 0;
Ogre::MaterialPtr ptr = Ogre::MaterialManager::getSingletonPtr()->getByName(name+StringUtils::toString(i));
while(ptr.getPointer())
{
++i;// keep going until we get a unique name
ptr = Ogre::MaterialManager::getSingletonPtr()->getByName(name+StringUtils::toString(i));
}
Ogre::MaterialPtr newptr = mMaterial->clone(name+StringUtils::toString(i));
return Material(newptr.getPointer());
}
示例3:
Material::Material(String name)
{
Ogre::MaterialPtr ptr = Ogre::MaterialManager::getSingletonPtr()->getByName(name);
mMaterial = ptr.getPointer();
}
示例4: _createSoftMaterial
//-----------------------------------------------------------------------
void ParticleRenderer::_createSoftMaterial(void)
{
Ogre::String newMaterialName = SOFT_PREFIX + mParentTechnique->getMaterialName();
if (!Ogre::MaterialManager::getSingletonPtr()->getByName(newMaterialName).isNull())
{
mParentTechnique->setMaterialName(newMaterialName);
return;
}
// Create a new material for soft particles
if (mUseSoftParticles && mNotifiedDepthMap)
{
// Create Vertex program
Ogre::String softVertexName = "ParticleUniverse_SoftVP"; // Use ParticleUniverse_ to avoid name conflicts.
Ogre::HighLevelGpuProgramPtr vertexProgram = Ogre::HighLevelGpuProgramManager::getSingleton().createProgram(
softVertexName,
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
"hlsl",
Ogre::GPT_VERTEX_PROGRAM);
vertexProgram->setSourceFile("pu_soft_sm20.hlsl");
vertexProgram->setParameter("target", "vs_2_0");
vertexProgram->setParameter("entry_point", "mainVP"); // Must be same name as in pu_soft_sm20.hlsl
vertexProgram->load();
Ogre::String softFragmentName = "ParticleUniverse_SoftFP"; // Use ParticleUniverse_ to avoid name conflicts.
Ogre::HighLevelGpuProgramPtr fragmentProgram = Ogre::HighLevelGpuProgramManager::getSingleton().createProgram(
softFragmentName,
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
"hlsl",
Ogre::GPT_FRAGMENT_PROGRAM);
fragmentProgram->setSourceFile("pu_soft_sm20.hlsl");
fragmentProgram->setParameter("target", "ps_2_0");
fragmentProgram->setParameter("entry_point", "mainFP"); // Must be same name as in pu_soft_sm20.hlsl
fragmentProgram->load();
Ogre::String resourceGroupName = mParentTechnique->getParentSystem() ?
mParentTechnique->getParentSystem()->getResourceGroupName() :
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME;
// Create material with depth texture
Ogre::MaterialPtr newMaterial = Ogre::MaterialManager::getSingleton().getByName(newMaterialName);
if (!newMaterial.getPointer())
{
newMaterial = Ogre::MaterialManager::getSingleton().create(newMaterialName, resourceGroupName);
Ogre::Pass* newPass = newMaterial->getTechnique(0)->getPass(0);
newPass->setDepthCheckEnabled(true);
newPass->setDepthWriteEnabled(false);
newPass->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
newPass->createTextureUnitState(ParticleSystemManager::getSingleton().getDepthTextureName());
// Get the first texture from the old material (assume it has at least 1 technique and one pass)
Ogre::Pass* oldPass = mParentTechnique->getMaterial()->getBestTechnique()->getPass(0);
newPass->setLightingEnabled(oldPass->getLightingEnabled());
if (oldPass->getNumTextureUnitStates() > 0)
{
Ogre::TextureUnitState* oldTextureUnitState = oldPass->getTextureUnitState(0);
newPass->createTextureUnitState(oldTextureUnitState->getTextureName());
}
// Set the vertex and fragment parameters
newPass->setVertexProgram(softVertexName);
newPass->setFragmentProgram(softFragmentName);
Ogre::GpuProgramParametersSharedPtr vertexParams = newPass->getVertexProgramParameters();
vertexParams->setNamedAutoConstant("worldViewProj", Ogre::GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX);
vertexParams->setNamedAutoConstant("depthRange", Ogre::GpuProgramParameters::ACT_SCENE_DEPTH_RANGE);
// Depth scale must be the same as used in creation of the depth map
vertexParams->setNamedConstant("depthScale", ParticleSystemManager::getSingleton().getDepthScale());
Ogre::GpuProgramParametersSharedPtr fragmentParams = newPass->getFragmentProgramParameters();
fragmentParams->setNamedConstant("contrastPower", mSoftParticlesContrastPower);
fragmentParams->setNamedConstant("scale", mSoftParticlesScale);
fragmentParams->setNamedConstant("delta", mSoftParticlesDelta);
}
// Set the new material
mParentTechnique->setMaterialName(newMaterialName);
}
}