本文整理汇总了C++中TIntermSymbol::traverse方法的典型用法代码示例。如果您正苦于以下问题:C++ TIntermSymbol::traverse方法的具体用法?C++ TIntermSymbol::traverse怎么用?C++ TIntermSymbol::traverse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TIntermSymbol
的用法示例。
在下文中一共展示了TIntermSymbol::traverse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: traverseDeclaration
bool TGlslOutputTraverser::traverseDeclaration(bool preVisit, TIntermDeclaration* decl, TIntermTraverser* it) {
TGlslOutputTraverser* goit = static_cast<TGlslOutputTraverser*>(it);
GlslFunction *current = goit->current;
std::stringstream& out = current->getActiveOutput();
EGlslSymbolType symbol_type = translateType(decl->getTypePointer());
TType& type = *decl->getTypePointer();
bool emit_osx10_6_arrays = goit->m_EmitSnowLeopardCompatibleArrayInitializers
&& decl->containsArrayInitialization();
if (emit_osx10_6_arrays) {
assert(decl->isSingleInitialization() && "Emission of multiple in-line array declarations isn't supported when running in OS X 10.6 compatible mode.");
current->indent(out);
out << "#if defined(OSX_SNOW_LEOPARD)" << std::endl;
current->increaseDepth();
TQualifier q = type.getQualifier();
if (q == EvqConst)
q = EvqTemporary;
current->beginStatement();
if (q != EvqTemporary && q != EvqGlobal)
out << type.getQualifierString() << " ";
TIntermBinary* assign = decl->getDeclaration()->getAsBinaryNode();
TIntermSymbol* sym = assign->getLeft()->getAsSymbolNode();
TIntermSequence& init = assign->getRight()->getAsAggregate()->getSequence();
writeType(out, symbol_type, NULL, goit->m_UsePrecision ? decl->getPrecision() : EbpUndefined);
out << "[" << type.getArraySize() << "] " << sym->getSymbol();
current->endStatement();
unsigned n_vals = init.size();
for (unsigned i = 0; i != n_vals; ++i) {
current->beginStatement();
sym->traverse(goit);
out << "[" << i << "]" << " = ";
init[i]->traverse(goit);
current->endStatement();
}
current->decreaseDepth();
current->indent(out);
out << "#else" << std::endl;
current->increaseDepth();
}
current->beginStatement();
if (type.getQualifier() != EvqTemporary && type.getQualifier() != EvqGlobal)
out << type.getQualifierString() << " ";
if (type.getBasicType() == EbtStruct)
out << type.getTypeName();
else
writeType(out, symbol_type, NULL, goit->m_UsePrecision ? decl->getPrecision() : EbpUndefined);
if (type.isArray())
out << "[" << type.getArraySize() << "]";
out << " ";
decl->getDeclaration()->traverse(goit);
current->endStatement();
if (emit_osx10_6_arrays) {
current->decreaseDepth();
current->indent(out);
out << "#endif" << std::endl;
}
return false;
}