本文整理汇总了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;
}