本文整理汇总了C++中XmlTree::find方法的典型用法代码示例。如果您正苦于以下问题:C++ XmlTree::find方法的具体用法?C++ XmlTree::find怎么用?C++ XmlTree::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlTree
的用法示例。
在下文中一共展示了XmlTree::find方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fromXml
void Warp::fromXml( const XmlTree &xml )
{
mControlsX = xml.getAttributeValue<int>( "width", 2 );
mControlsY = xml.getAttributeValue<int>( "height", 2 );
mBrightness = xml.getAttributeValue<float>( "brightness", 1.0f );
// load control points
mPoints.clear();
for( auto child = xml.begin( "controlpoint" ); child != xml.end(); ++child ) {
float x = child->getAttributeValue<float>( "x", 0.0f );
float y = child->getAttributeValue<float>( "y", 0.0f );
mPoints.push_back( vec2( x, y ) );
}
// load blend params
auto blend = xml.find( "blend" );
if( blend != xml.end() ) {
mExponent = blend->getAttributeValue<float>( "exponent", mExponent );
auto edges = blend->find( "edges" );
if( edges != blend->end() ) {
mEdges.x = edges->getAttributeValue<float>( "left", mEdges.x );
mEdges.y = edges->getAttributeValue<float>( "top", mEdges.y );
mEdges.z = edges->getAttributeValue<float>( "right", mEdges.z );
mEdges.w = edges->getAttributeValue<float>( "bottom", mEdges.w );
}
auto gamma = blend->find( "gamma" );
if( gamma != blend->end() ) {
mGamma.x = gamma->getAttributeValue<float>( "red", mGamma.x );
mGamma.y = gamma->getAttributeValue<float>( "green", mGamma.y );
mGamma.z = gamma->getAttributeValue<float>( "blue", mGamma.z );
}
auto luminance = blend->find( "luminance" );
if( luminance != blend->end() ) {
mLuminance.x = luminance->getAttributeValue<float>( "red", mLuminance.x );
mLuminance.y = luminance->getAttributeValue<float>( "green", mLuminance.y );
mLuminance.z = luminance->getAttributeValue<float>( "blue", mLuminance.z );
}
}
// reconstruct warp
mIsDirty = true;
}