本文整理汇总了C++中BVHNode::addChild方法的典型用法代码示例。如果您正苦于以下问题:C++ BVHNode::addChild方法的具体用法?C++ BVHNode::addChild怎么用?C++ BVHNode::addChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BVHNode
的用法示例。
在下文中一共展示了BVHNode::addChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
BVHNode *BVHParser::parseNode( Buffer & buf, BVHNode * parent )
{
BVHNode * node = new BVHNode();
node->parent = parent;
_linearNodes.push_back(node);
buf.getToken(node->name);
std::string str;
buf.getToken(str);
if( str != "{" )
{
debugPrint("Error didnt find opening bracket\n");
delete node;
return 0;
}
// parse offset
buf.getToken(str);
if(str!="OFFSET")
{
debugPrint("Error didnt find OFFSET\n");
delete node;
return 0;
}
buf.readLine(str);
sscanf(str.c_str(),"%f %f %f",&node->offset.x,&node->offset.y,&node->offset.z);
//buf.getToken(str);
if(!buf.testToken("CHANNELS"))//, <#bool caseSensitive#>)str!="CHANNELS")
{
debugPrint("Error didnt find CHANNELS\n");
delete node;
return 0;
}
// parse channels
int nChannels = 0;
buf.readInt(&nChannels);
for( int i = 0; i < nChannels; i++ )
{
buf.getToken(str);
BVH_CHANNEL chan = parseChannel(str);
if(chan == CHANNEL_UNKNOWN)
{
debugPrint("Error undefined channel %s\n",str.c_str());
delete node;
return 0;
}
node->channels.push_back(chan);
}
buf.getToken(str);
// parse children ( if any... )
while( str!="}" )
{
if( str=="JOINT" )
{
BVHNode * child = parseNode(buf,node);
if(child==0)
{
debugPrint("Could not add child\n");
delete node;
return 0;
}
node->addChild(child);
//buf.getToken(str);
}
else if( str=="End" )
{
buf.getToken(str); // skip site
BVHNode * child = parseEndSite(buf,node);
if(child==0)
{
debugPrint("Could not add child\n");
delete node;
return 0;
}
node->addChild(child);
}
buf.getToken(str);
}
// Hacky compute bone length...
if( node->children.size() )
{
BVHNode * child = node->children[0];
}
//.........这里部分代码省略.........