本文整理汇总了C++中TextureUnitState::getParent方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureUnitState::getParent方法的具体用法?C++ TextureUnitState::getParent怎么用?C++ TextureUnitState::getParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextureUnitState
的用法示例。
在下文中一共展示了TextureUnitState::getParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: translateTextureUnit
/*
note: we can know the texture unit index by getting parent then finding it in the list of children
*/
void SGScriptTranslator::translateTextureUnit(ScriptCompiler* compiler, const AbstractNodePtr &node)
{
ObjectAbstractNode *obj = static_cast<ObjectAbstractNode*>(node.get());
TextureUnitState* texState = any_cast<TextureUnitState*>(obj->parent->context);
Pass* pass = texState->getParent();
Technique* technique = pass->getParent();
Material* material = technique->getParent();
ShaderGenerator* shaderGenerator = ShaderGenerator::getSingletonPtr();
String dstTechniqueSchemeName = obj->name;
bool techniqueCreated;
// Make sure the scheme name is valid - use default if none exists.
if (dstTechniqueSchemeName.empty())
dstTechniqueSchemeName = ShaderGenerator::DEFAULT_SCHEME_NAME;
//check if technique already created
techniqueCreated = shaderGenerator->hasShaderBasedTechnique(material->getName(),
material->getGroup(),
technique->getSchemeName(),
dstTechniqueSchemeName);
if (techniqueCreated == false)
{
// Create the shader based technique.
techniqueCreated = shaderGenerator->createShaderBasedTechnique(material->getName(),
material->getGroup(),
technique->getSchemeName(),
dstTechniqueSchemeName,
shaderGenerator->getCreateShaderOverProgrammablePass());
}
// Case technique successfully created.
if (techniqueCreated)
{
//Attempt to get the render state which might have been created by the pass parsing
mGeneratedRenderState = shaderGenerator->getRenderState(dstTechniqueSchemeName,
material->getName(), material->getGroup(), pass->getIndex());
// Go over all the render state properties.
for(AbstractNodeList::iterator i = obj->children.begin(); i != obj->children.end(); ++i)
{
if((*i)->type == ANT_PROPERTY)
{
PropertyAbstractNode *prop = static_cast<PropertyAbstractNode*>((*i).get());
SubRenderState* subRenderState = ShaderGenerator::getSingleton().createSubRenderState(compiler, prop, texState, this);
if (subRenderState)
{
addSubRenderState(subRenderState, dstTechniqueSchemeName, material->getName(),
material->getGroup(), pass->getIndex());
}
}
else
{
processNode(compiler, *i);
}
}
mGeneratedRenderState = NULL;
}
}