removed useless selection count call in append

This commit is contained in:
Paolo Cignoni 2021-10-28 21:21:15 +02:00
parent 7cce9f185f
commit 448c340d3a
1 changed files with 11 additions and 6 deletions

View File

@ -299,9 +299,10 @@ static void MeshAppendConst(
// vertex // vertex
remap.vert.resize(mr.vert.size(), Remap::InvalidIndex()); remap.vert.resize(mr.vert.size(), Remap::InvalidIndex());
VertexIteratorLeft vp; VertexIteratorLeft vp;
size_t svn = UpdateSelection<ConstMeshRight>::VertexCount(mr); if(selected){
if(selected) size_t svn = UpdateSelection<ConstMeshRight>::VertexCount(mr);
vp=Allocator<MeshLeft>::AddVertices(ml,int(svn)); vp=Allocator<MeshLeft>::AddVertices(ml,int(svn));
}
else else
vp=Allocator<MeshLeft>::AddVertices(ml,mr.vn); vp=Allocator<MeshLeft>::AddVertices(ml,mr.vn);
@ -317,8 +318,10 @@ static void MeshAppendConst(
// edge // edge
remap.edge.resize(mr.edge.size(), Remap::InvalidIndex()); remap.edge.resize(mr.edge.size(), Remap::InvalidIndex());
EdgeIteratorLeft ep; EdgeIteratorLeft ep;
size_t sen = UpdateSelection<ConstMeshRight>::EdgeCount(mr); if(selected) {
if(selected) ep=Allocator<MeshLeft>::AddEdges(ml,sen); size_t sen = UpdateSelection<ConstMeshRight>::EdgeCount(mr);
ep=Allocator<MeshLeft>::AddEdges(ml,sen);
}
else ep=Allocator<MeshLeft>::AddEdges(ml,mr.en); else ep=Allocator<MeshLeft>::AddEdges(ml,mr.en);
ForEachEdge(mr, [&](const EdgeRight& e) ForEachEdge(mr, [&](const EdgeRight& e)
@ -333,8 +336,10 @@ static void MeshAppendConst(
// face // face
remap.face.resize(mr.face.size(), Remap::InvalidIndex()); remap.face.resize(mr.face.size(), Remap::InvalidIndex());
FaceIteratorLeft fp; FaceIteratorLeft fp;
size_t sfn = UpdateSelection<ConstMeshRight>::FaceCount(mr); if(selected) {
if(selected) fp=Allocator<MeshLeft>::AddFaces(ml,sfn); size_t sfn = UpdateSelection<ConstMeshRight>::FaceCount(mr);
fp=Allocator<MeshLeft>::AddFaces(ml,sfn);
}
else fp=Allocator<MeshLeft>::AddFaces(ml,mr.fn); else fp=Allocator<MeshLeft>::AddFaces(ml,mr.fn);
ForEachFace(mr, [&](const FaceRight& f) ForEachFace(mr, [&](const FaceRight& f)