本文整理汇总了C++中ogre::GpuProgramParametersSharedPtr::getAutoConstantIterator方法的典型用法代码示例。如果您正苦于以下问题:C++ GpuProgramParametersSharedPtr::getAutoConstantIterator方法的具体用法?C++ GpuProgramParametersSharedPtr::getAutoConstantIterator怎么用?C++ GpuProgramParametersSharedPtr::getAutoConstantIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::GpuProgramParametersSharedPtr
的用法示例。
在下文中一共展示了GpuProgramParametersSharedPtr::getAutoConstantIterator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateProperties
bool OgreMaterialProperties::CreateProperties()
{
Ogre::MaterialPtr matPtr = material_->GetMaterial();
if (matPtr.isNull())
return false;
// Material
Ogre::Material::TechniqueIterator tIter = matPtr->getTechniqueIterator();
while(tIter.hasMoreElements())
{
// Technique
Ogre::Technique *tech = tIter.getNext();
Ogre::Technique::PassIterator pIter = tech->getPassIterator();
while(pIter.hasMoreElements())
{
// Pass
Ogre::Pass *pass = pIter.getNext();
if (!pass)
continue;
if(pass->hasVertexProgram())
{
// Vertex program
const Ogre::GpuProgramPtr &verProg = pass->getVertexProgram();
if (!verProg.isNull())
{
Ogre::GpuProgramParametersSharedPtr verPtr = pass->getVertexProgramParameters();
if (verPtr->hasNamedParameters())
{
// Named parameters (constants)
Ogre::GpuConstantDefinitionIterator mapIter = verPtr->getConstantDefinitionIterator();
while(mapIter.hasMoreElements())
{
QString paramName = mapIter.peekNextKey().c_str();
const Ogre::GpuConstantDefinition ¶mDef = mapIter.getNext();
// Filter names that end with '[0]'
int found = paramName.indexOf("[0]");
if (found != -1)
continue;
// Ignore auto parameters
bool is_auto_param = false;
Ogre::GpuProgramParameters::AutoConstantIterator autoConstIter = verPtr->getAutoConstantIterator();
while(autoConstIter.hasMoreElements())
{
Ogre::GpuProgramParameters::AutoConstantEntry autoConstEnt = autoConstIter.getNext();
if (autoConstEnt.physicalIndex == paramDef.physicalIndex)
{
is_auto_param = true;
break;
}
}
if (is_auto_param)
continue;
if (!paramDef.isFloat())
continue;
size_t count = paramDef.elementSize * paramDef.arraySize;
QVector<float> paramValue;
QVector<float>::iterator iter;
paramValue.resize(count);
verPtr->_readRawConstants(paramDef.physicalIndex, count, &*paramValue.begin());
QTextStream vector_string;
QString string;
vector_string.setString(&string, QIODevice::WriteOnly);
for(iter = paramValue.begin(); iter != paramValue.end(); ++iter)
vector_string << *iter << " ";
// Add QPROPERTY. Add to "VP" to the end of the parameter name in order to identify VP parameters.
QMap<QString, QVariant> typeValuePair;
typeValuePair[GpuConstantTypeToString(paramDef.constType)] = *vector_string.string();
setProperty(paramName.append(" VP").toLatin1(), QVariant(typeValuePair));
}
}
}
}
if(pass->hasFragmentProgram())
{
// Fragment program
const Ogre::GpuProgramPtr fragProg = pass->getFragmentProgram();
if (!fragProg.isNull())
{
Ogre::GpuProgramParametersSharedPtr fragPtr = pass->getFragmentProgramParameters();
if (!fragPtr.isNull())
{
if (fragPtr->hasNamedParameters())
{
// Named parameters (constants)
Ogre::GpuConstantDefinitionIterator mapIter = fragPtr->getConstantDefinitionIterator();
while(mapIter.hasMoreElements())
{
QString paramName = mapIter.peekNextKey().c_str();
const Ogre::GpuConstantDefinition ¶mDef = mapIter.getNext();
//.........这里部分代码省略.........