ContourMap: Add texture-based rendering as default rendering mode

Extract and clean up prototype from contour-map-01 branch:
- RivContourMapProjectionPartMgr: add appendProjectionAsTexturedQuad(),
  createSingleTexturedQuadPart(), createXYPlaneQuadGeoWithTexCoords(),
  and createTexture() — renders the map as a single GPU-textured quad
  with transparency (alpha=0) for undefined/infinity cells
- RimContourMapProjection: add m_showTextureImage (default true) and
  m_showTrianglesWithColor (default false) PDM fields; guard triangle
  mesh generation when showTrianglesWithColor() is false
- RimEclipseContourMapView, RimGeoMechContourMapView: branch
  appendContourMapProjectionToModel() to use texture or triangle path
  based on the new flags; Statistics view inherits Eclipse path

Prototype dead code (debug file save, SurfaceEffectGenerator fallback,
redundant createImage()) not carried forward.
This commit is contained in:
Magne Sjaastad committed 2026-03-12 14:40:26 +01:00
1 parent 5ea450494a
commit 87ef7a01b9
6 files changed
+250 -19

No files matched your search

@@ -109,6 +109,8 @@ RimContourMapProjection::RimContourMapProjection()
CAF_PDM_InitField( &m_showContourLines, "ContourLines", true, "Show Contour Lines" );
CAF_PDM_InitField( &m_showContourLabels, "ContourLabels", true, "Show Contour Labels" );
CAF_PDM_InitField( &m_smoothContourLines, "SmoothContourLines", true, "Smooth Contour Lines" );
CAF_PDM_InitField( &m_showTextureImage, "ShowImage", true, "Show Texture Image" );
CAF_PDM_InitField( &m_showTrianglesWithColor, "ShowTrianglesWithColor", false, "Show Triangles with Color" );
auto defaultValue = caf::AppEnum<RimIntersectionFilterEnum>( RimIntersectionFilterEnum::INTERSECT_FILTER_NONE );
CAF_PDM_InitField( &m_valueFilterType, "ValueFilterType", defaultValue, "Value Filter" );
@@ -208,13 +210,16 @@ void RimContourMapProjection::generateGeometryIfNecessary()
}
}
m_trianglesWithVertexValues = RigContourMapTrianglesGenerator::generateTrianglesWithVertexValues( *m_contourMapGrid,
*m_contourMapProjection,
m_contourPolygons,
contourLevels,
m_contourLevelCumulativeAreas,
discrete,
sampleSpacing() );
if ( showTrianglesWithColor() )
{
m_trianglesWithVertexValues = RigContourMapTrianglesGenerator::generateTrianglesWithVertexValues( *m_contourMapGrid,
*m_contourMapProjection,
m_contourPolygons,
contourLevels,
m_contourLevelCumulativeAreas,
discrete,
sampleSpacing() );
}
}
progress.setProgress( 100 );
}
@@ -268,6 +273,22 @@ bool RimContourMapProjection::showContourLabels() const
return m_showContourLabels();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimContourMapProjection::showImage() const
{
return m_showTextureImage();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimContourMapProjection::showTrianglesWithColor() const
{
return m_showTrianglesWithColor();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -615,6 +636,8 @@ void RimContourMapProjection::defineUiOrdering( QString uiConfigName, caf::PdmUi
legendConfig()->uiOrdering( "NumLevelsOnly", *mainGroup );
mainGroup->add( &m_resolution );
mainGroup->add( &m_showTextureImage );
mainGroup->add( &m_showTrianglesWithColor );
mainGroup->add( &m_showContourLines );
mainGroup->add( &m_showContourLabels );
m_showContourLabels.uiCapability()->setUiReadOnly( !m_showContourLines() );
@@ -68,6 +68,8 @@ public:
bool showContourLines() const;
bool showContourLabels() const;
bool showImage() const;
bool showTrianglesWithColor() const;
// k layer filter, only consider kLayers in the given set (0-based index)
void useKLayers( std::set<int> kLayers );
@@ -150,6 +152,8 @@ protected:
caf::PdmField<bool> m_showContourLines;
caf::PdmField<bool> m_showContourLabels;
caf::PdmField<bool> m_smoothContourLines;
caf::PdmField<bool> m_showTextureImage;
caf::PdmField<bool> m_showTrianglesWithColor;
caf::PdmField<FloodingType> m_oilFloodingType;
caf::PdmField<FloodingType> m_gasFloodingType;
@@ -345,12 +345,24 @@ void RimEclipseContourMapView::appendContourMapProjectionToModel()
cvf::ref<caf::DisplayCoordTransform> transForm = displayCoordTransform();
m_contourMapProjectionPartMgr->appendProjectionToModel( contourMapProjectionModelBasicList.p(),
transForm.p(),
m_contourMapProjection->trianglesWithVertexValues(),
*m_contourMapProjection->mapGrid(),
backgroundColor(),
m_contourMapProjection->legendConfig()->scalarMapper() );
if ( m_contourMapProjection->showTrianglesWithColor() )
{
m_contourMapProjectionPartMgr->appendProjectionToModel( contourMapProjectionModelBasicList.p(),
transForm.p(),
m_contourMapProjection->trianglesWithVertexValues(),
*m_contourMapProjection->mapGrid(),
backgroundColor(),
m_contourMapProjection->legendConfig()->scalarMapper() );
}
if ( m_contourMapProjection->showImage() )
{
m_contourMapProjectionPartMgr->appendProjectionAsTexturedQuad( contourMapProjectionModelBasicList.p(),
transForm.p(),
m_contourMapProjection->legendConfig()->scalarMapper(),
*m_contourMapProjection->mapProjection(),
*m_contourMapProjection->mapGrid() );
}
contourMapProjectionModelBasicList->updateBoundingBoxesRecursive();
frameScene->addModel( contourMapProjectionModelBasicList.p() );
@@ -313,12 +313,24 @@ void RimGeoMechContourMapView::appendContourMapProjectionToModel()
cvf::ref<caf::DisplayCoordTransform> transForm = displayCoordTransform();
m_contourMapProjectionPartMgr->appendProjectionToModel( contourMapProjectionModelBasicList.p(),
transForm.p(),
m_contourMapProjection->trianglesWithVertexValues(),
*m_contourMapProjection->mapGrid(),
backgroundColor(),
m_contourMapProjection->legendConfig()->scalarMapper() );
if ( m_contourMapProjection->showTrianglesWithColor() )
{
m_contourMapProjectionPartMgr->appendProjectionToModel( contourMapProjectionModelBasicList.p(),
transForm.p(),
m_contourMapProjection->trianglesWithVertexValues(),
*m_contourMapProjection->mapGrid(),
backgroundColor(),
m_contourMapProjection->legendConfig()->scalarMapper() );
}
if ( m_contourMapProjection->showImage() )
{
m_contourMapProjectionPartMgr->appendProjectionAsTexturedQuad( contourMapProjectionModelBasicList.p(),
transForm.p(),
m_contourMapProjection->legendConfig()->scalarMapper(),
*m_contourMapProjection->mapProjection(),
*m_contourMapProjection->mapGrid() );
}
contourMapProjectionModelBasicList->updateBoundingBoxesRecursive();
frameScene->addModel( contourMapProjectionModelBasicList.p() );