本文整理汇总了C++中SparseArray::set方法的典型用法代码示例。如果您正苦于以下问题:C++ SparseArray::set方法的具体用法?C++ SparseArray::set怎么用?C++ SparseArray::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SparseArray
的用法示例。
在下文中一共展示了SparseArray::set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetVertexFaceUVs
void ExpMapGenerator::GetVertexFaceUVs( std::vector<unsigned int> & vIDs, std::vector<float> & vU, std::vector<float> & vV, std::vector<unsigned int> & vFaces, rms::VFTriangleMesh * pMesh )
{
SparseArray<IMesh::TriangleID> vTris;
vTris.resize(pMesh->GetMaxTriangleID());
// mark triangles that have at least one vertex UV set
size_t nLastCount = m_vLastParticles.size();
for ( unsigned int k = 0; k < nLastCount; ++k ) {
ExpMapParticle * pParticle = m_vLastParticles[k];
if ( pParticle->VertexID() == IMesh::InvalidID || pParticle->SurfaceDistance() == std::numeric_limits<float>::max() )
continue;
IMesh::VtxNbrItr itr(pParticle->VertexID());
pMesh->BeginVtxTriangles(itr);
IMesh::TriangleID tID = pMesh->GetNextVtxTriangle(itr);
while ( tID != IMesh::InvalidID ) {
vTris.set(tID, tID);
tID = pMesh->GetNextVtxTriangle(itr);
}
}
// generate list of triangles with all vertex UVs set, and mark vertices
SparseArray<IMesh::VertexID> vVerts;
vVerts.resize(pMesh->GetMaxVertexID());
SparseArray<IMesh::TriangleID>::iterator curf(vTris.begin()), endf(vTris.end());
while ( curf != endf ) {
IMesh::TriangleID tID = curf.index(); curf++;
IMesh::VertexID nTri[3];
pMesh->GetTriangle(tID, nTri);
bool b1 = m_vParticles[ m_vVtxToParticleMap[nTri[0]] ]->SurfaceDistance() != std::numeric_limits<float>::max();
bool b2 = m_vParticles[ m_vVtxToParticleMap[nTri[1]] ]->SurfaceDistance() != std::numeric_limits<float>::max();
bool b3 = m_vParticles[ m_vVtxToParticleMap[nTri[2]] ]->SurfaceDistance() != std::numeric_limits<float>::max();
if ( b1 && b2 && b3 ) {
vVerts.set(nTri[0], nTri[0]);
vVerts.set(nTri[2], nTri[1]);
vVerts.set(nTri[1], nTri[2]);
vFaces.push_back(tID);
}
}
// generate list of vertices and UVs who are contained in at least one triangle
SparseArray<IMesh::VertexID>::iterator curv(vVerts.begin()), endv(vVerts.end());
while ( curv != endv ) {
IMesh::VertexID vID = curv.index(); ++curv;
int nIndex = m_vVtxToParticleMap[vID];
vIDs.push_back(vID);
vU.push_back( m_vParticles[nIndex]->SurfaceVector().X() );
vV.push_back( m_vParticles[nIndex]->SurfaceVector().Y() );
}
}