mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-23 23:13:39 -06:00
Show ternary saturation data on faults
This commit is contained in:
parent
83a5a34c4b
commit
3b651d7578
@ -105,6 +105,7 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimResultSlot*
|
||||
|
||||
updateNNCColors(cellResultSlot);
|
||||
|
||||
|
||||
size_t scalarSetIndex = cellResultSlot->gridScalarIndex();
|
||||
const cvf::ScalarMapper* mapper = cellResultSlot->legendConfig()->scalarMapper();
|
||||
|
||||
@ -117,12 +118,19 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimResultSlot*
|
||||
RigCaseData* eclipseCase = cellResultSlot->reservoirView()->eclipseCase()->reservoirData();
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject = eclipseCase->dataAccessObject(m_grid.p(), porosityModel, resTimeStepIdx, scalarSetIndex);
|
||||
|
||||
if (dataAccessObject.isNull()) return;
|
||||
|
||||
// Faults
|
||||
if (m_nativeFaultFaces.notNull())
|
||||
{
|
||||
if (cellResultSlot->resultVariable().compare(RimDefines::combinedTransmissibilityResultName(), Qt::CaseInsensitive) == 0)
|
||||
cvf::ref<cvf::Color3ubArray> surfaceFacesColorArray;
|
||||
if (cellResultSlot->isTernarySaturationSelected())
|
||||
{
|
||||
surfaceFacesColorArray = new cvf::Color3ubArray;
|
||||
|
||||
const std::vector<size_t>& quadsToGridCells = m_nativeFaultGenerator->quadToGridCellIndices();
|
||||
|
||||
RivTransmissibilityColorMapper::updateTernarySaturationColorArray(timeStepIndex, cellResultSlot, m_grid.p(), surfaceFacesColorArray.p(), quadsToGridCells);
|
||||
}
|
||||
else if (cellResultSlot->resultVariable().compare(RimDefines::combinedTransmissibilityResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
const std::vector<cvf::StructGridInterface::FaceType>& quadsToFaceTypes = m_nativeFaultGenerator->quadToFace();
|
||||
const std::vector<size_t>& quadsToGridCells = m_nativeFaultGenerator->quadToGridCellIndices();
|
||||
@ -132,7 +140,10 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimResultSlot*
|
||||
}
|
||||
else
|
||||
{
|
||||
m_nativeFaultGenerator->textureCoordinates(m_nativeFaultFacesTextureCoords.p(), dataAccessObject.p(), mapper);
|
||||
if (dataAccessObject.notNull())
|
||||
{
|
||||
m_nativeFaultGenerator->textureCoordinates(m_nativeFaultFacesTextureCoords.p(), dataAccessObject.p(), mapper);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_opacityLevel < 1.0f )
|
||||
@ -159,16 +170,41 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimResultSlot*
|
||||
}
|
||||
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_nativeFaultFaces->drawable());
|
||||
if (dg) dg->setTextureCoordArray(m_nativeFaultFacesTextureCoords.p());
|
||||
if (surfaceFacesColorArray.notNull())
|
||||
{
|
||||
if (dg)
|
||||
{
|
||||
dg->setColorArray(surfaceFacesColorArray.p());
|
||||
}
|
||||
|
||||
cvf::ref<cvf::Effect> scalarEffect = cellResultEffect(mapper, caf::PO_1);
|
||||
m_nativeFaultFaces->setEffect(scalarEffect.p());
|
||||
cvf::ref<cvf::Effect> perVertexColorEffect = RivGridPartMgr::createPerVertexColoringEffect(m_opacityLevel);
|
||||
m_nativeFaultFaces->setEffect(perVertexColorEffect.p());
|
||||
|
||||
m_nativeFaultFaces->setPriority(100);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dg) dg->setTextureCoordArray(m_nativeFaultFacesTextureCoords.p());
|
||||
|
||||
cvf::ref<cvf::Effect> scalarEffect = cellResultEffect(mapper, caf::PO_1);
|
||||
m_nativeFaultFaces->setEffect(scalarEffect.p());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (m_oppositeFaultFaces.notNull())
|
||||
{
|
||||
if (cellResultSlot->resultVariable().compare(RimDefines::combinedTransmissibilityResultName(), Qt::CaseInsensitive) == 0)
|
||||
cvf::ref<cvf::Color3ubArray> surfaceFacesColorArray;
|
||||
|
||||
if (cellResultSlot->isTernarySaturationSelected())
|
||||
{
|
||||
surfaceFacesColorArray = new cvf::Color3ubArray;
|
||||
|
||||
const std::vector<size_t>& quadsToGridCells = m_oppositeFaultGenerator->quadToGridCellIndices();
|
||||
|
||||
RivTransmissibilityColorMapper::updateTernarySaturationColorArray(timeStepIndex, cellResultSlot, m_grid.p(), surfaceFacesColorArray.p(), quadsToGridCells);
|
||||
}
|
||||
else if (cellResultSlot->resultVariable().compare(RimDefines::combinedTransmissibilityResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
const std::vector<cvf::StructGridInterface::FaceType>& quadsToFaceTypes = m_oppositeFaultGenerator->quadToFace();
|
||||
const std::vector<size_t>& quadsToGridCells = m_oppositeFaultGenerator->quadToGridCellIndices();
|
||||
@ -178,7 +214,10 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimResultSlot*
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oppositeFaultGenerator->textureCoordinates(m_oppositeFaultFacesTextureCoords.p(), dataAccessObject.p(), mapper);
|
||||
if (dataAccessObject.notNull())
|
||||
{
|
||||
m_oppositeFaultGenerator->textureCoordinates(m_oppositeFaultFacesTextureCoords.p(), dataAccessObject.p(), mapper);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_opacityLevel < 1.0f )
|
||||
@ -205,12 +244,27 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimResultSlot*
|
||||
}
|
||||
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_oppositeFaultFaces->drawable());
|
||||
if (dg) dg->setTextureCoordArray(m_oppositeFaultFacesTextureCoords.p());
|
||||
if (surfaceFacesColorArray.notNull())
|
||||
{
|
||||
if (dg)
|
||||
{
|
||||
dg->setColorArray(surfaceFacesColorArray.p());
|
||||
}
|
||||
|
||||
// Use a different offset than native fault faces to avoid z-fighting
|
||||
cvf::ref<cvf::Effect> scalarEffect = cellResultEffect(mapper, caf::PO_2);
|
||||
cvf::ref<cvf::Effect> perVertexColorEffect = RivGridPartMgr::createPerVertexColoringEffect(m_opacityLevel);
|
||||
m_oppositeFaultFaces->setEffect(perVertexColorEffect.p());
|
||||
|
||||
m_oppositeFaultFaces->setEffect(scalarEffect.p());
|
||||
m_oppositeFaultFaces->setPriority(100);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dg) dg->setTextureCoordArray(m_oppositeFaultFacesTextureCoords.p());
|
||||
|
||||
// Use a different offset than native fault faces to avoid z-fighting
|
||||
cvf::ref<cvf::Effect> scalarEffect = cellResultEffect(mapper, caf::PO_2);
|
||||
|
||||
m_oppositeFaultFaces->setEffect(scalarEffect.p());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ void RivGridPartMgr::updateCellResultColor(size_t timeStepIndex, RimResultSlot*
|
||||
dg->setColorArray(surfaceFacesColorArray.p());
|
||||
}
|
||||
|
||||
cvf::ref<cvf::Effect> perVertexColorEffect = createPerVertexColoringEffect();
|
||||
cvf::ref<cvf::Effect> perVertexColorEffect = RivGridPartMgr::createPerVertexColoringEffect(m_opacityLevel);
|
||||
m_surfaceFaces->setEffect(perVertexColorEffect.p());
|
||||
|
||||
m_surfaceFaces->setPriority(100);
|
||||
@ -472,7 +472,7 @@ RivGridPartMgr::~RivGridPartMgr()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::Effect> RivGridPartMgr::createPerVertexColoringEffect()
|
||||
cvf::ref<cvf::Effect> RivGridPartMgr::createPerVertexColoringEffect(float opacity)
|
||||
{
|
||||
cvf::ref<cvf::Effect> colorArrayEffect = new cvf::Effect;
|
||||
|
||||
@ -485,14 +485,14 @@ cvf::ref<cvf::Effect> RivGridPartMgr::createPerVertexColoringEffect()
|
||||
gen.addFragmentCode(cvf::ShaderSourceRepository::fs_Standard);
|
||||
|
||||
cvf::ref<cvf::ShaderProgram> m_shaderProg = gen.generate();
|
||||
m_shaderProg->setDefaultUniform(new cvf::UniformFloat("u_alpha", m_opacityLevel));
|
||||
m_shaderProg->setDefaultUniform(new cvf::UniformFloat("u_alpha", opacity));
|
||||
|
||||
colorArrayEffect->setShaderProgram(m_shaderProg.p());
|
||||
}
|
||||
else
|
||||
{
|
||||
cvf::ref<cvf::RenderStateMaterial_FF> mat = new cvf::RenderStateMaterial_FF(cvf::Color3::BLUE);
|
||||
mat->setAlpha(m_opacityLevel);
|
||||
mat->setAlpha(opacity);
|
||||
mat->enableColorMaterial(true);
|
||||
colorArrayEffect->setRenderState(mat.p());
|
||||
|
||||
@ -502,7 +502,7 @@ cvf::ref<cvf::Effect> RivGridPartMgr::createPerVertexColoringEffect()
|
||||
}
|
||||
|
||||
// Simple transparency
|
||||
if (m_opacityLevel < 1.0f)
|
||||
if (opacity < 1.0f)
|
||||
{
|
||||
cvf::ref<cvf::RenderStateBlending> blender = new cvf::RenderStateBlending;
|
||||
blender->configureTransparencyBlending();
|
||||
|
@ -87,9 +87,10 @@ public:
|
||||
|
||||
void appendPartsToModel(cvf::ModelBasicList* model);
|
||||
|
||||
static cvf::ref<cvf::Effect> createPerVertexColoringEffect(float opacity);
|
||||
|
||||
private:
|
||||
void generatePartGeometry(cvf::StructGridGeometryGenerator& geoBuilder, bool faultGeometry);
|
||||
cvf::ref<cvf::Effect> createPerVertexColoringEffect();
|
||||
|
||||
private:
|
||||
size_t m_gridIdx;
|
||||
|
Loading…
Reference in New Issue
Block a user