本文整理汇总了C++中osgdb::Input::advanceOverCurrentFieldOrBlock方法的典型用法代码示例。如果您正苦于以下问题:C++ Input::advanceOverCurrentFieldOrBlock方法的具体用法?C++ Input::advanceOverCurrentFieldOrBlock怎么用?C++ Input::advanceOverCurrentFieldOrBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osgdb::Input
的用法示例。
在下文中一共展示了Input::advanceOverCurrentFieldOrBlock方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readMatrix
bool readMatrix(osg::Matrix& matrix, osgDB::Input& fr, const char* keyword)
{
bool iteratorAdvanced = false;
if (fr[0].matchWord(keyword) && fr[1].isOpenBracket())
{
int entry = fr[0].getNoNestedBrackets();
fr += 2;
int row=0;
int col=0;
double v;
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
{
if (fr[0].getFloat(v))
{
matrix(row,col)=v;
++col;
if (col>=4)
{
col = 0;
++row;
}
++fr;
}
else fr.advanceOverCurrentFieldOrBlock();
}
iteratorAdvanced = true;
}
return iteratorAdvanced;
}
示例2: Locator_readLocalData
bool Locator_readLocalData(osg::Object& obj, osgDB::Input &fr)
{
osgVolume::Locator& locator = static_cast<osgVolume::Locator&>(obj);
bool itrAdvanced = false;
if (fr.matchSequence("Transform {"))
{
int tansform_entry = fr[0].getNoNestedBrackets();
fr += 2;
int row=0;
int col=0;
double v;
osg::Matrixd matrix;
while (!fr.eof() && fr[0].getNoNestedBrackets()>tansform_entry)
{
if (fr[0].getFloat(v))
{
matrix(row,col)=v;
++col;
if (col>=4)
{
col = 0;
++row;
}
++fr;
}
else fr.advanceOverCurrentFieldOrBlock();
}
locator.setTransform(matrix);
++fr;
itrAdvanced = true;
}
return itrAdvanced;
}
示例3: AnimationPath_readLocalData
bool AnimationPath_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
osg::AnimationPath *ap = dynamic_cast<osg::AnimationPath*>(&obj);
if (!ap) return false;
bool itAdvanced = false;
if (fr[0].matchWord("LoopMode"))
{
if (fr[1].matchWord("SWING"))
{
ap->setLoopMode(AnimationPath::SWING);
fr += 2;
itAdvanced = true;
}
else if (fr[1].matchWord("LOOP"))
{
ap->setLoopMode(AnimationPath::LOOP);
fr += 2;
itAdvanced = true;
}
else if (fr[1].matchWord("NO_LOOPING"))
{
ap->setLoopMode(AnimationPath::NO_LOOPING);
fr += 2;
itAdvanced = true;
}
}
if (fr.matchSequence("ControlPoints {"))
{
int entry = fr[0].getNoNestedBrackets();
fr += 2;
double time;
Vec3d position,scale;
Quat rotation;
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
{
if (fr[0].getFloat(time) &&
fr[1].getFloat(position[0]) &&
fr[2].getFloat(position[1]) &&
fr[3].getFloat(position[2]) &&
fr[4].getFloat(rotation[0]) &&
fr[5].getFloat(rotation[1]) &&
fr[6].getFloat(rotation[2]) &&
fr[7].getFloat(rotation[3]) &&
fr[8].getFloat(scale[0]) &&
fr[9].getFloat(scale[1]) &&
fr[10].getFloat(scale[2]))
{
osg::AnimationPath::ControlPoint ctrlPoint(position,rotation,scale);
ap->insert(time, ctrlPoint);
fr+=11;
}
else fr.advanceOverCurrentFieldOrBlock();
}
itAdvanced = true;
}
return itAdvanced;
}
示例4: buildHierarchy
void buildHierarchy( osgDB::Input& fr, int level, osgAnimation::Bone* parent )
{
bool isRecognized = false;
if ( !parent ) return;
if ( fr.matchSequence("OFFSET %f %f %f") )
{
isRecognized = true;
++fr;
osg::Vec3 offset;
if ( fr.readSequence(offset) )
{
// Process OFFSET section
parent->setBindMatrixInBoneSpace( osg::Matrix::translate(offset) );
if ( _drawingFlag && parent->getNumParents() && level>0 )
parent->getParent(0)->addChild( createRefGeometry(offset, 0.5).get() );
}
}
if ( fr.matchSequence("CHANNELS %i") )
{
isRecognized = true;
// Process CHANNELS section
int noChannels;
fr[1].getInt( noChannels );
fr += 2;
for ( int i=0; i<noChannels; ++i )
{
// Process each channel
std::string channelName;
fr.readSequence( channelName );
alterChannel( channelName, _joints.back().second );
}
}
if ( fr.matchSequence("End Site {") )
{
isRecognized = true;
fr += 3;
if ( fr.matchSequence("OFFSET %f %f %f") )
{
++fr;
osg::Vec3 offsetEndSite;
if ( fr.readSequence(offsetEndSite) )
{
// Process End Site section
osg::ref_ptr<osgAnimation::Bone> bone = new osgAnimation::Bone( parent->getName()+"End" );
bone->setBindMatrixInBoneSpace( osg::Matrix::translate(offsetEndSite) );
bone->setDataVariance( osg::Object::DYNAMIC );
parent->addChild( bone.get() );
if ( _drawingFlag )
parent->addChild( createRefGeometry(offsetEndSite, 0.5).get() );
}
}
fr.advanceOverCurrentFieldOrBlock();
}
if ( fr.matchSequence("ROOT %w {") || fr.matchSequence("JOINT %w {") )
{
isRecognized = true;
// Process JOINT section
osg::ref_ptr<osgAnimation::Bone> bone = new osgAnimation::Bone( fr[1].getStr() );
bone->setDefaultUpdateCallback();
bone->setDataVariance( osg::Object::DYNAMIC );
parent->addChild( bone.get() );
_joints.push_back( JointNode(bone, 0) );
int entry = fr[1].getNoNestedBrackets();
fr += 3;
while ( !fr.eof() && fr[0].getNoNestedBrackets()>entry )
buildHierarchy( fr, entry, bone.get() );
fr.advanceOverCurrentFieldOrBlock();
}
if ( !isRecognized )
{
osg::notify(osg::WARN) << "BVH Reader: Unrecognized symbol " << fr[0].getStr()
<< ". Ignore current field or block." << std::endl;
fr.advanceOverCurrentFieldOrBlock();
}
}