本文整理汇总了C++中NvFaceInfoVec::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ NvFaceInfoVec::clear方法的具体用法?C++ NvFaceInfoVec::clear怎么用?C++ NvFaceInfoVec::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NvFaceInfoVec
的用法示例。
在下文中一共展示了NvFaceInfoVec::clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveSmallStrips
////////////////////////////////////////////////////////////////////////////////////////
// RemoveSmallStrips()
//
// allStrips is the whole strip _vector_...all small strips will be deleted from this list, to avoid leaking mem
// allBigStrips is an out parameter which will contain all strips above minStripLength
// faceList is an out parameter which will contain all faces which were removed from the striplist
//
void NvStripifier::RemoveSmallStrips(NvStripInfoVec& allStrips, NvStripInfoVec& allBigStrips, NvFaceInfoVec& faceList)
{
faceList.clear();
allBigStrips.clear(); //make sure these are empty
NvFaceInfoVec tempFaceList;
for(int i = 0; i < allStrips.size(); i++)
{
if(allStrips[i]->m_faces.size() < minStripLength)
{
//strip is too small, add faces to faceList
for(int j = 0; j < allStrips[i]->m_faces.size(); j++)
tempFaceList.push_back(allStrips[i]->m_faces[j]);
//and xr_free memory
xr_delete(allStrips[i]);
}
else
{
allBigStrips.push_back(allStrips[i]);
}
}
bool *bVisitedList = xr_alloc<bool> (tempFaceList.size());
ZeroMemory (bVisitedList, tempFaceList.size()*sizeof(bool));
VertexCache* vcache = xr_new<VertexCache> (cacheSize);
int bestNumHits = -1;
int numHits = 0;
int bestIndex = 0;
while(1)
{
bestNumHits = -1;
//find best face to add next, given the current cache
for(int i = 0; i < tempFaceList.size(); i++)
{
if(bVisitedList[i])
continue;
numHits = CalcNumHitsFace(vcache, tempFaceList[i]);
if(numHits > bestNumHits)
{
bestNumHits = numHits;
bestIndex = i;
}
}
if(bestNumHits == -1.0f)
break;
bVisitedList[bestIndex] = true;
UpdateCacheFace(vcache, tempFaceList[bestIndex]);
faceList.push_back(tempFaceList[bestIndex]);
}
xr_delete (vcache);
xr_free (bVisitedList);
}
示例2: RemoveSmallStrips
////////////////////////////////////////////////////////////////////////////////////////
// RemoveSmallStrips()
//
// allStrips is the whole strip vector...all small strips will be deleted from this list, to avoid leaking mem
// allBigStrips is an out parameter which will contain all strips above minStripLength
// faceList is an out parameter which will contain all faces which were removed from the striplist
//
void NvStripifier::RemoveSmallStrips(NvStripInfoVec& allStrips, NvStripInfoVec& allBigStrips, NvFaceInfoVec& faceList)
{
faceList.clear();
allBigStrips.clear(); //make sure these are empty
NvFaceInfoVec tempFaceList;
for(size_t i = 0; i < allStrips.size(); i++)
{
if(allStrips[i]->m_faces.size() < (size_t)minStripLength)
{
//strip is too small, add faces to faceList
for(size_t j = 0; j < allStrips[i]->m_faces.size(); j++)
tempFaceList.push_back(allStrips[i]->m_faces[j]);
//and free memory
delete allStrips[i];
}
else
{
allBigStrips.push_back(allStrips[i]);
}
}
if(tempFaceList.size())
{
bool *bVisitedList = new bool[tempFaceList.size()];
memset(bVisitedList, 0, tempFaceList.size()*sizeof(bool));
VertexCache* vcache = new VertexCache(cacheSize);
int bestNumHits = -1;
int numHits;
int bestIndex;
while(1)
{
bestNumHits = -1;
//find best face to add next, given the current cache
for(size_t i = 0; i < tempFaceList.size(); i++)
{
if(bVisitedList[i])
continue;
numHits = CalcNumHitsFace(vcache, tempFaceList[i]);
if(numHits > bestNumHits)
{
bestNumHits = numHits;
bestIndex = i;
}
}
if(bestNumHits == -1.0f)
break;
bVisitedList[bestIndex] = true;
UpdateCacheFace(vcache, tempFaceList[bestIndex]);
faceList.push_back(tempFaceList[bestIndex]);
}
delete vcache;
delete[] bVisitedList;
}
}