Unification of color texturing code in Intersection and -Box

This commit is contained in:
Jacob Støren 2019-11-19 10:21:22 +01:00
parent 57dfd3b67a
commit dcb32c285f
2 changed files with 29 additions and 23 deletions

View File

@ -86,7 +86,9 @@ void RivIntersectionBoxPartMgr::updateCellResultColor( size_t
{
if ( !m_intersectionBoxGenerator->isAnyGeometryPresent() ) return;
RimEclipseView* eclipseView;
CVF_ASSERT( scalarColorMapper );
RimEclipseView* eclipseView = nullptr;
m_rimIntersectionBox->firstAncestorOrThisOfType( eclipseView );
if ( eclipseView )

View File

@ -152,27 +152,29 @@ void RivIntersectionPartMgr::updateCellResultColor( size_t
const cvf::ScalarMapper* scalarColorMapper,
const RivTernaryScalarMapper* ternaryColorMapper )
{
CVF_ASSERT( scalarColorMapper );
if ( m_crossSectionGenerator.isNull() ) return;
if ( !m_crossSectionGenerator->isAnyGeometryPresent() ) return;
CVF_ASSERT( scalarColorMapper );
RimEclipseView* eclipseView = nullptr;
m_rimCrossSection->firstAncestorOrThisOfType( eclipseView );
if ( eclipseView )
{
RimEclipseCellColors* cellResultColors = eclipseView->cellResult();
CVF_ASSERT( cellResultColors );
CVF_ASSERT( ternaryColorMapper );
bool isLightingDisabled = eclipseView->isLightingDisabled();
RimEclipseResultDefinition* eclipseResDef = eclipseView->cellResult();
bool isTernaryResult = eclipseResDef->isTernarySaturationSelected();
RigEclipseCaseData* eclipseCaseData = eclipseResDef->eclipseCase()->eclipseCaseData();
CVF_ASSERT( eclipseResDef );
// CrossSections
if ( m_crossSectionFaces.notNull() )
{
if ( cellResultColors->isTernarySaturationSelected() )
if ( isTernaryResult )
{
RivTernaryTextureCoordsCreator texturer( cellResultColors, ternaryColorMapper, timeStepIndex );
RivTernaryTextureCoordsCreator texturer( eclipseResDef, ternaryColorMapper, timeStepIndex );
texturer.createTextureCoords( m_crossSectionFacesTextureCoords.p(),
m_crossSectionGenerator->triangleToCellIndex() );
@ -182,7 +184,7 @@ void RivIntersectionPartMgr::updateCellResultColor( size_t
ternaryColorMapper,
1.0,
caf::FC_NONE,
eclipseView->isLightingDisabled() );
isLightingDisabled );
}
else
{
@ -190,19 +192,16 @@ void RivIntersectionPartMgr::updateCellResultColor( size_t
cvf::ref<RigResultAccessor> resultAccessor;
if ( RiaDefines::isPerCellFaceResult( cellResultColors->resultVariable() ) )
if ( RiaDefines::isPerCellFaceResult( eclipseResDef->resultVariable() ) )
{
resultAccessor = new RigHugeValResultAccessor;
}
else
{
resultAccessor = RigResultAccessorFactory::createFromResultDefinition( cellResultColors
->reservoirView()
->eclipseCase()
->eclipseCaseData(),
resultAccessor = RigResultAccessorFactory::createFromResultDefinition( eclipseCaseData,
0,
timeStepIndex,
cellResultColors );
eclipseResDef );
}
RivIntersectionPartMgr::calculateEclipseTextureCoordinates( m_crossSectionFacesTextureCoords.p(),
@ -215,7 +214,7 @@ void RivIntersectionPartMgr::updateCellResultColor( size_t
scalarColorMapper,
1.0,
caf::FC_NONE,
eclipseView->isLightingDisabled() );
isLightingDisabled );
}
}
}
@ -225,13 +224,18 @@ void RivIntersectionPartMgr::updateCellResultColor( size_t
if ( geoView )
{
RimGeoMechCellColors* cellResultColors = geoView->cellResult();
RigGeoMechCaseData* caseData = cellResultColors->ownerCaseData();
bool isLightingDisabled = geoView->isLightingDisabled();
RigGeoMechCaseData* caseData = nullptr;
RigFemResultAddress resVarAddress;
{
RimGeoMechResultDefinition* geomResultDef = geoView->cellResult();
caseData = geomResultDef->ownerCaseData();
resVarAddress = geomResultDef->resultAddress();
}
if ( !caseData ) return;
RigFemResultAddress resVarAddress = cellResultColors->resultAddress();
if ( resVarAddress.resultPosType == RIG_ELEMENT )
{
const std::vector<float>& resultValues = caseData->femPartResults()->resultValues( resVarAddress,
@ -298,7 +302,7 @@ void RivIntersectionPartMgr::updateCellResultColor( size_t
scalarColorMapper,
1.0,
caf::FC_NONE,
geoView->isLightingDisabled() );
isLightingDisabled );
}
}