本文整理汇总了C++中Input::advanceOverCurrentFieldOrBlock方法的典型用法代码示例。如果您正苦于以下问题:C++ Input::advanceOverCurrentFieldOrBlock方法的具体用法?C++ Input::advanceOverCurrentFieldOrBlock怎么用?C++ Input::advanceOverCurrentFieldOrBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Input
的用法示例。
在下文中一共展示了Input::advanceOverCurrentFieldOrBlock方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readObject
virtual ReadResult readObject(std::istream& fin, const Options* options) const
{
loadWrappers();
fin.imbue(std::locale::classic());
Input fr;
fr.attach(&fin);
fr.setOptions(options);
typedef std::vector<osg::Object*> ObjectList;
ObjectList objectList;
// load all nodes in file, placing them in a group.
while(!fr.eof())
{
Object *object = fr.readObject();
if (object) objectList.push_back(object);
else fr.advanceOverCurrentFieldOrBlock();
}
if (objectList.empty())
{
return ReadResult("No data loaded");
}
else if (objectList.size()==1)
{
return objectList.front();
}
else
{
return objectList.front();
}
}
示例2: readNode
virtual ReadResult readNode(std::istream& fin, const Options* options) const
{
loadWrappers();
fin.imbue(std::locale::classic());
Input fr;
fr.attach(&fin);
fr.setOptions(options);
typedef std::vector<osg::Node*> NodeList;
NodeList nodeList;
// load all nodes in file, placing them in a group.
while(!fr.eof())
{
Node *node = fr.readNode();
if (node) nodeList.push_back(node);
else fr.advanceOverCurrentFieldOrBlock();
}
if (nodeList.empty())
{
return ReadResult("No data loaded");
}
else if (nodeList.size()==1)
{
return nodeList.front();
}
else
{
Group* group = new Group;
group->setName("import group");
for(NodeList::iterator itr=nodeList.begin();
itr!=nodeList.end();
++itr)
{
group->addChild(*itr);
}
return group;
}
}
示例3: Geometry_readLocalData
bool Geometry_readLocalData(Object& obj, Input& fr)
{
bool iteratorAdvanced = false;
deprecated_osg::Geometry& geom = static_cast<deprecated_osg::Geometry&>(obj);
if (fr.matchSequence("Primitives %i {") || fr.matchSequence("PrimitiveSets %i {") )
{
int entry = fr[1].getNoNestedBrackets();
int capacity;
fr[1].getInt(capacity);
Geometry::PrimitiveSetList& primitives = geom.getPrimitiveSetList();
if (capacity>0) primitives.reserve(capacity);
fr += 3;
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
{
if (!Primitive_readLocalData(fr,geom)) fr.advanceOverCurrentFieldOrBlock();
}
++fr;
iteratorAdvanced = true;
}
if (fr[0].matchWord("VertexArray"))
{
if (fr.matchSequence("VertexArray %i {"))
{
int entry = fr[0].getNoNestedBrackets();
int capacity;
fr[1].getInt(capacity);
Vec3Array* vertices = new Vec3Array;
vertices->reserve(capacity);
fr += 3;
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
{
Vec3 v;
if (fr[0].getFloat(v.x()) && fr[1].getFloat(v.y()) && fr[2].getFloat(v.z()))
{
fr += 3;
vertices->push_back(v);
}
else
{
++fr;
}
}
geom.setVertexArray(vertices);
iteratorAdvanced = true;
++fr;
}
else
{
// post 0.9.3 releases.
++fr;
Array* vertices = Array_readLocalData(fr);
if (vertices)
{
geom.setVertexArray(vertices);
}
iteratorAdvanced = true;
}
}
if (fr[0].matchWord("VertexIndices"))
{
++fr;
IndexArray* indices = dynamic_cast<IndexArray*>(Array_readLocalData(fr));
if (indices)
{
geom.setVertexIndices(indices);
}
iteratorAdvanced = true;
}
deprecated_osg::Geometry::AttributeBinding normalBinding = deprecated_osg::Geometry::BIND_OFF;
if (fr[0].matchWord("NormalBinding") && Geometry_matchBindingTypeStr(fr[1].getStr(),normalBinding))
{
fr+=2;
iteratorAdvanced = true;
}
//.........这里部分代码省略.........
示例4: StateSet_readLocalData
//.........这里部分代码省略.........
readingMode=true;
}
}
}
}
// new code using osg::Registry's list of prototypes to loaded attributes.
Uniform* uniform = NULL;
while((uniform=fr.readUniform())!=NULL)
{
stateset.addUniform(uniform);
iteratorAdvanced = true;
}
// new code using osg::Registry's list of prototypes to loaded attributes.
StateAttribute* attribute = NULL;
while((attribute=fr.readStateAttribute())!=NULL)
{
if (attribute->isTextureAttribute())
{
// remap to be a texture attribute
stateset.setTextureAttribute(0,attribute);
}
else
{
stateset.setAttribute(attribute);
}
iteratorAdvanced = true;
}
while(fr.matchSequence("textureUnit %i {"))
{
int entry = fr[0].getNoNestedBrackets();
unsigned int unit=0;
fr[1].getUInt(unit);
fr+=3;
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
{
bool localIteratorAdvanced = false;
bool readingMode = true;
StateAttribute::GLModeValue value;
while (readingMode)
{
readingMode=false;
if (fr[0].isInt())
{
if (StateSet_matchModeStr(fr[1].getStr(),value))
{
int mode;
fr[0].getInt(mode);
stateset.setTextureMode(unit,(StateAttribute::GLMode)mode,value);
fr+=2;
localIteratorAdvanced = true;
readingMode=true;
}
}
else
if (fr[0].getStr())
{
if (StateSet_matchModeStr(fr[1].getStr(),value))
{
StateAttribute::GLMode mode;
if (s_ModesAndNames.getGLModeForName(fr[0].getStr(), mode))
{
stateset.setTextureMode(unit,mode,value);
fr+=2;
localIteratorAdvanced = true;
readingMode=true;
}
}
}
}
StateAttribute* attribute = NULL;
while((attribute=fr.readStateAttribute())!=NULL)
{
stateset.setTextureAttribute(unit,attribute);
localIteratorAdvanced = true;
}
if (!localIteratorAdvanced)
fr.advanceOverCurrentFieldOrBlock();
}
// skip over trailing '}'
++fr;
iteratorAdvanced = true;
}
return iteratorAdvanced;
}