Use only one implementation of lineIndicesFromQuadVertexArray (#7980)

* Use only one implementation of lineIndicesFromQuadVertexArray
This commit is contained in:
jonjenssen
2021-09-10 06:19:44 +00:00
committed by GitHub
parent a5b80c649b
commit 0c69cdf203
11 changed files with 25 additions and 150 deletions
@@ -56,7 +56,7 @@ cvf::ref<cvf::Part> RivBoxGeometryGenerator::createBoxFromVertices( const std::v
geo->setVertexArray( cvfVertices.p() );
cvf::ref<cvf::UIntArray> indices = lineIndicesFromQuadVertexArray( cvfVertices.p() );
cvf::ref<cvf::UIntArray> indices = cvf::StructGridGeometryGenerator::lineIndicesFromQuadVertexArray( cvfVertices.p() );
cvf::ref<cvf::PrimitiveSetIndexedUInt> prim = new cvf::PrimitiveSetIndexedUInt( cvf::PT_LINES );
prim->setIndices( indices.p() );
@@ -75,33 +75,3 @@ cvf::ref<cvf::Part> RivBoxGeometryGenerator::createBoxFromVertices( const std::v
return part;
}
cvf::ref<cvf::UIntArray> RivBoxGeometryGenerator::lineIndicesFromQuadVertexArray( const cvf::Vec3fArray* vertexArray )
{
// TODO - see issue #7890
CVF_ASSERT( vertexArray );
size_t numVertices = vertexArray->size();
int numQuads = static_cast<int>( numVertices / 4 );
CVF_ASSERT( numVertices % 4 == 0 );
cvf::ref<cvf::UIntArray> indices = new cvf::UIntArray;
indices->resize( numQuads * 8 );
#pragma omp parallel for
for ( int i = 0; i < numQuads; i++ )
{
int idx = 8 * i;
indices->set( idx + 0, i * 4 + 0 );
indices->set( idx + 1, i * 4 + 1 );
indices->set( idx + 2, i * 4 + 1 );
indices->set( idx + 3, i * 4 + 2 );
indices->set( idx + 4, i * 4 + 2 );
indices->set( idx + 5, i * 4 + 3 );
indices->set( idx + 6, i * 4 + 3 );
indices->set( idx + 7, i * 4 + 0 );
}
return indices;
}