mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Use only one implementation of lineIndicesFromQuadVertexArray (#7980)
* Use only one implementation of lineIndicesFromQuadVertexArray
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -36,8 +36,6 @@ class RivBoxGeometryGenerator
|
||||
public:
|
||||
static cvf::ref<cvf::Part> createBoxFromVertices( const std::vector<cvf::Vec3f>& vertices, const cvf::Color3f color );
|
||||
|
||||
static cvf::ref<cvf::UIntArray> lineIndicesFromQuadVertexArray( const cvf::Vec3fArray* vertexArray );
|
||||
|
||||
private:
|
||||
RivBoxGeometryGenerator(){};
|
||||
};
|
||||
|
@@ -79,8 +79,9 @@ cvf::ref<cvf::DrawableGeo> RivFaultGeometryGenerator::createMeshDrawable()
|
||||
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
|
||||
geo->setVertexArray( m_vertices.p() );
|
||||
|
||||
cvf::ref<cvf::UIntArray> indices = lineIndicesFromQuadVertexArray( m_vertices.p() );
|
||||
cvf::ref<cvf::PrimitiveSetIndexedUInt> prim = new cvf::PrimitiveSetIndexedUInt( cvf::PT_LINES );
|
||||
cvf::ref<cvf::UIntArray> indices = cvf::StructGridGeometryGenerator::lineIndicesFromQuadVertexArray( m_vertices.p() );
|
||||
|
||||
cvf::ref<cvf::PrimitiveSetIndexedUInt> prim = new cvf::PrimitiveSetIndexedUInt( cvf::PT_LINES );
|
||||
prim->setIndices( indices.p() );
|
||||
|
||||
geo->addPrimitiveSet( prim.p() );
|
||||
@@ -96,7 +97,7 @@ cvf::ref<cvf::DrawableGeo> RivFaultGeometryGenerator::createOutlineMeshDrawable(
|
||||
|
||||
cvf::OutlineEdgeExtractor ee( creaseAngle, *m_vertices );
|
||||
|
||||
cvf::ref<cvf::UIntArray> indices = lineIndicesFromQuadVertexArray( m_vertices.p() );
|
||||
cvf::ref<cvf::UIntArray> indices = cvf::StructGridGeometryGenerator::lineIndicesFromQuadVertexArray( m_vertices.p() );
|
||||
ee.addPrimitives( 4, *indices );
|
||||
|
||||
cvf::ref<cvf::UIntArray> lineIndices = ee.lineIndices();
|
||||
@@ -115,37 +116,6 @@ cvf::ref<cvf::DrawableGeo> RivFaultGeometryGenerator::createOutlineMeshDrawable(
|
||||
return geo;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::UIntArray> RivFaultGeometryGenerator::lineIndicesFromQuadVertexArray( const cvf::Vec3fArray* vertexArray )
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -57,8 +57,6 @@ public:
|
||||
cvf::ref<cvf::DrawableGeo> createMeshDrawable();
|
||||
cvf::ref<cvf::DrawableGeo> createOutlineMeshDrawable( double creaseAngle );
|
||||
|
||||
static cvf::ref<cvf::UIntArray> lineIndicesFromQuadVertexArray( const cvf::Vec3fArray* vertexArray );
|
||||
|
||||
private:
|
||||
void computeArrays();
|
||||
|
||||
|
@@ -60,6 +60,7 @@
|
||||
#include "cvfPrimitiveSetIndexedUInt.h"
|
||||
#include "cvfRenderStateDepth.h"
|
||||
#include "cvfScalarMapperContinuousLinear.h"
|
||||
#include "cvfStructGridGeometryGenerator.h"
|
||||
#include "cvfTransform.h"
|
||||
|
||||
#include <cmath>
|
||||
@@ -1077,7 +1078,8 @@ cvf::ref<cvf::DrawableGeo>
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> stimPlanMeshGeo = new cvf::DrawableGeo;
|
||||
stimPlanMeshGeo->setVertexArray( stimPlanMeshVertexList );
|
||||
cvf::ref<cvf::UIntArray> indices = RivFaultGeometryGenerator::lineIndicesFromQuadVertexArray( stimPlanMeshVertexList );
|
||||
cvf::ref<cvf::UIntArray> indices =
|
||||
cvf::StructGridGeometryGenerator::lineIndicesFromQuadVertexArray( stimPlanMeshVertexList );
|
||||
cvf::ref<cvf::PrimitiveSetIndexedUInt> prim = new cvf::PrimitiveSetIndexedUInt( cvf::PT_LINES );
|
||||
prim->setIndices( indices.p() );
|
||||
|
||||
|
Reference in New Issue
Block a user