本文整理汇总了C++中TreeNode::GetChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ TreeNode::GetChildren方法的具体用法?C++ TreeNode::GetChildren怎么用?C++ TreeNode::GetChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeNode
的用法示例。
在下文中一共展示了TreeNode::GetChildren方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Cull
void CullSystem::Cull( Frustum& frus, TreeNode<VisCell>& node, std::vector<std::list<Ptr<Renderable>>>& outRenderables)
{
InterSectResult result = frus.InterSect(node.GetContent().GetAABB());
if ( !result==INTERSECTOUT )
{
std::list<Ptr<Renderable>>::iterator iter = node.GetContent().GetRenderables().begin();
if (result== INTERSECTIN)
{
for (;iter!=node.GetContent().GetRenderables().end();iter++)
{
RenderType rType = (*iter)->GetRenderType();
outRenderables[rType].push_back((*iter));
}
}
else
{
for (;iter!=node.GetContent().GetRenderables().end();iter++)
{
if ( frus.InterSect((*iter)->GetSubMesh()->GetVertexBuffer()->GetBBox())!= INTERSECTOUT)
{
RenderType rType = (*iter)->GetRenderType();
outRenderables[rType].push_back((*iter));
}
}
}
for (int i = 0 ;i<(int)node.GetChildren().size();i++)
{
Cull( frus,*node.GetChildren()[i],outRenderables );
}
}
}
示例2: DestoryOctTree
void CullSystem::DestoryOctTree( TreeNode<VisCell>& node )
{
if (node.GetChildren().size()==8)
{
for( int i = 0 ;i<8; i++ )
{
if ( node.GetChildren()[i] )
{
DestoryOctTree(*node.GetChildren()[i]);
o_delete(node.GetChildren()[i]);
}
}
}
}
示例3: BuildOctTree
void CullSystem::BuildOctTree( TreeNode<VisCell>& node )
{
if (node.GetDepth() == m_Depth )
{
return;
}
node.GetChildren().resize(8);
for( int i = 0 ;i<8; i++ )
{
node.GetChildren()[i] = o_new( TreeNode<VisCell> );
node.GetChildren()[i]->SetParent( &node );
node.GetChildren()[i]->SetDepth( node.GetDepth()+1 );
node.GetChildren()[i]->SetIndex(i);
VisCell& parentCell = node.GetContent();
aabbox& box = parentCell.GetAABB();
aabbox baseBox;
point middle = (box.GetMax()+box.GetMin())*0.5f;
float xHalf = box.GetMax().X() - middle.X();
float yHalf = box.GetMax().Y() - middle.Y();
float zHalf = box.GetMax().Z() - middle.Z();
baseBox.SetMax( box.GetMax() );
baseBox.SetMin( middle );
point& pMax = baseBox.GetMax();
point& pMin = baseBox.GetMin();
if ( i%2==1 )
{
pMax.X()-=xHalf;
pMin.X()-=xHalf;
}
if ( i>=4 )
{
pMax.Y()-=yHalf;
pMin.Y()-=yHalf;
if (i>=6)
{
pMax.Z()-=zHalf;
pMin.Z()-=zHalf;
}
}
else if( i>=2 )
{
pMax.Z()-=zHalf;
pMin.Z()-=zHalf;
}
VisCell& childCell = node.GetChildren()[i]->GetContent();
childCell.SetAABB(baseBox);
BuildOctTree( *node.GetChildren()[i]);
}
}
示例4: Clear
// clear the tree
void Tree::Clear(){
m_totalNum = 0;
// clear active region
list<ARTreeNode*> *tempARList = new list<ARTreeNode*>;
tempARList->push_back( arHead );
while( !tempARList->empty() ){
ARTreeNode *arNode = tempARList->front();
tempARList->pop_front();
// save the children
list<ARTreeNode*> *children = arNode->GetChildren();
tempARList->insert( tempARList->end(), children->begin(), children->end() );
delete children;
delete arNode;
}
delete tempARList;
// clear dangling edge
list<TreeNode*> *tempDEList = new list<TreeNode*>;
tempDEList->push_back( deHead );
while( !tempDEList->empty() ){
TreeNode *deNode = tempDEList->front();
tempDEList->pop_front();
// save the children
list<TreeNode*> *children = deNode->GetChildren();
tempDEList->insert( tempDEList->end(), children->begin(), children->end() );
delete children;
delete deNode;
}
delete tempDEList;
// creat new heads
arHead = new ARTreeNode( -1 );
deHead = new TreeNode( -1 );
}