当前位置: 首页>>代码示例>>C++>>正文


C++ TreeNode::GetChildren方法代码示例

本文整理汇总了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 );
		}
		
	}
	
}
开发者ID:whwayne,项目名称:otokowantmiku,代码行数:33,代码来源:CullSystem.cpp

示例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]);
			}
		}
	}
}
开发者ID:whwayne,项目名称:otokowantmiku,代码行数:14,代码来源:CullSystem.cpp

示例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]);
		
	}
}
开发者ID:whwayne,项目名称:otokowantmiku,代码行数:58,代码来源:CullSystem.cpp

示例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 );
}
开发者ID:ablab,项目名称:external-tools,代码行数:39,代码来源:Tree.cpp


注:本文中的TreeNode::GetChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。