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


C++ Partition::CheckAddTriangle方法代码示例

本文整理汇总了C++中Partition::CheckAddTriangle方法的典型用法代码示例。如果您正苦于以下问题:C++ Partition::CheckAddTriangle方法的具体用法?C++ Partition::CheckAddTriangle怎么用?C++ Partition::CheckAddTriangle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Partition的用法示例。


在下文中一共展示了Partition::CheckAddTriangle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Partition

/**
Does the actual partitioning. For each triangle:

- add it to an existing partition object if it has enough space in
its joint palette
- otherwise add it to a new empty partition
- update the triangle group id in the mesh to account for the
additional partitions
- a group id mapping array will be created which maps new
group ids to old group ids

@param  srcMesh                 the source mesh to partition
@param  dstMesh                 the destination mesh
@param  maxJointPaletteSize     max number of joints in a joint palette
*/
bool U2SkinPartition::Execute(U2MeshBuilder& srcMeshBlder, U2MeshBuilder& dstMeshBlder, 
							  int maxBonePaletteSize)
{
	for(uint32 i=0; i < m_partitions.FilledSize(); ++i)
	{
		U2_DELETE m_partitions[i];
	}
	
	m_partitions.RemoveAll();

	int triIdx;
	int numTris = srcMeshBlder.GetNumTriangles();
	for(triIdx=0; triIdx < numTris; ++triIdx)
	{
		const U2MeshBuilder::Triangle& tri = srcMeshBlder.GetTriangleAt(triIdx);

		// try to add the triangle to an existing partition
		bool bTriAdded = false;
		uint32 numPartitions = m_partitions.FilledSize();
		uint32 partitionIdx;
		for(partitionIdx=0; partitionIdx < numPartitions; ++partitionIdx)
		{
			if(m_partitions[partitionIdx]->GetGroupId() == tri.GetGroupId())
			{
				if(m_partitions[partitionIdx]->CheckAddTriangle(triIdx))
				{
					bTriAdded = true;
					break;
				}
			}
		}
		if(!bTriAdded)
		{
			// triangle didn't fit into any existing partition, create a new partition
			Partition *pNewPartition = U2_NEW Partition(&srcMeshBlder, maxBonePaletteSize,tri.GetGroupId());
			bTriAdded = pNewPartition->CheckAddTriangle(triIdx);
			U2ASSERT(bTriAdded);
			m_partitions.AddElem(pNewPartition);
		}
	}

	// update the triangle group ids
	BuildResultMesh(srcMeshBlder, dstMeshBlder);

	return true;
}
开发者ID:DanielNeander,项目名称:my-3d-engine,代码行数:61,代码来源:U2SkinPartition.cpp


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