mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge remote-tracking branch 'origin/dev' into pre-proto
This commit is contained in:
@@ -103,7 +103,7 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCell
|
||||
{
|
||||
CVF_ASSERT(cellResultColors);
|
||||
|
||||
updateNNCColors(cellResultColors);
|
||||
updateNNCColors(timeStepIndex, cellResultColors);
|
||||
|
||||
RimEclipseView* eclipseView = cellResultColors->reservoirView();
|
||||
RigEclipseCaseData* eclipseCase = eclipseView->eclipseCase()->eclipseCaseData();
|
||||
@@ -181,7 +181,7 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCell
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFaultPartMgr::updateCellEdgeResultColor(size_t timeStepIndex, RimEclipseCellColors* cellResultColors, RimCellEdgeColors* cellEdgeResultColors)
|
||||
{
|
||||
updateNNCColors(cellResultColors);
|
||||
updateNNCColors(timeStepIndex, cellResultColors);
|
||||
|
||||
if (m_nativeFaultFaces.notNull())
|
||||
{
|
||||
@@ -374,7 +374,7 @@ void RivFaultPartMgr::updatePartEffect()
|
||||
m_oppositeFaultFaces->setEffect(geometryOnlyEffect.p());
|
||||
}
|
||||
|
||||
updateNNCColors(NULL);
|
||||
updateNNCColors(0, NULL);
|
||||
|
||||
// Update mesh colors as well, in case of change
|
||||
RiaPreferences* prefs = RiaApplication::instance()->preferences();
|
||||
@@ -641,12 +641,14 @@ caf::FaceCulling RivFaultPartMgr::faceCullingMode() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFaultPartMgr::updateNNCColors(RimEclipseCellColors* cellResultColors)
|
||||
void RivFaultPartMgr::updateNNCColors(size_t timeStepIndex, RimEclipseCellColors* cellResultColors)
|
||||
{
|
||||
if (m_NNCFaces.isNull()) return;
|
||||
|
||||
bool showNncsWithScalarMappedColor = false;
|
||||
|
||||
RimEclipseView* eclipseView = nullptr;
|
||||
|
||||
if (cellResultColors)
|
||||
{
|
||||
size_t scalarSetIndex = cellResultColors->scalarResultIndex();
|
||||
@@ -655,15 +657,17 @@ void RivFaultPartMgr::updateNNCColors(RimEclipseCellColors* cellResultColors)
|
||||
{
|
||||
showNncsWithScalarMappedColor = true;
|
||||
}
|
||||
eclipseView = cellResultColors->reservoirView();
|
||||
}
|
||||
|
||||
if (showNncsWithScalarMappedColor)
|
||||
{
|
||||
size_t scalarSetIndex = cellResultColors->scalarResultIndex();
|
||||
RiaDefines::ResultCatType resultType = cellResultColors->resultType();
|
||||
|
||||
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
|
||||
|
||||
m_NNCGenerator->textureCoordinates(m_NNCTextureCoords.p(), mapper, scalarSetIndex);
|
||||
m_NNCGenerator->textureCoordinates(m_NNCTextureCoords.p(), mapper, resultType, scalarSetIndex, timeStepIndex);
|
||||
|
||||
cvf::ref<cvf::Effect> nncEffect;
|
||||
|
||||
@@ -671,12 +675,14 @@ void RivFaultPartMgr::updateNNCColors(RimEclipseCellColors* cellResultColors)
|
||||
{
|
||||
// Move NNC closer to camera to avoid z-fighting with grid surface
|
||||
caf::ScalarMapperEffectGenerator nncEffgen(mapper, caf::PO_NEG_LARGE);
|
||||
if (eclipseView) nncEffgen.disableLighting(eclipseView->isLightingDisabled());
|
||||
nncEffect = nncEffgen.generateCachedEffect();
|
||||
}
|
||||
else
|
||||
{
|
||||
// If no grid is present, use same offset as grid geometry to be able to see mesh lines
|
||||
caf::ScalarMapperEffectGenerator nncEffgen(mapper, caf::PO_1);
|
||||
if (eclipseView) nncEffgen.disableLighting(eclipseView->isLightingDisabled());
|
||||
nncEffect = nncEffgen.generateCachedEffect();
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ private:
|
||||
void generatePartGeometry();
|
||||
void updatePartEffect();
|
||||
|
||||
void updateNNCColors(RimEclipseCellColors* cellResultColors);
|
||||
void updateNNCColors(size_t timeStepIndex, RimEclipseCellColors* cellResultColors);
|
||||
|
||||
caf::FaceCulling faceCullingMode() const;
|
||||
|
||||
|
||||
@@ -145,14 +145,30 @@ void RivNNCGeometryGenerator::computeArrays()
|
||||
/// Calculates the texture coordinates in a "nearly" one dimensional texture.
|
||||
/// Undefined values are coded with a y-texture coordinate value of 1.0 instead of the normal 0.5
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivNNCGeometryGenerator::textureCoordinates(cvf::Vec2fArray* textureCoords, const cvf::ScalarMapper* mapper, size_t scalarResultIndex) const
|
||||
void RivNNCGeometryGenerator::textureCoordinates(cvf::Vec2fArray* textureCoords,
|
||||
const cvf::ScalarMapper* mapper,
|
||||
RiaDefines::ResultCatType resultType,
|
||||
size_t scalarResultIndex,
|
||||
size_t timeStepIndex) const
|
||||
{
|
||||
size_t numVertices = m_vertices->size();
|
||||
|
||||
textureCoords->resize(numVertices);
|
||||
cvf::Vec2f* rawPtr = textureCoords->ptr();
|
||||
|
||||
const std::vector<double>* nncResultVals = m_nncData->connectionScalarResult(scalarResultIndex);
|
||||
const std::vector<double>* nncResultVals;
|
||||
if (resultType == RiaDefines::STATIC_NATIVE)
|
||||
{
|
||||
nncResultVals = m_nncData->staticConnectionScalarResult(scalarResultIndex);
|
||||
}
|
||||
else if (resultType == RiaDefines::DYNAMIC_NATIVE)
|
||||
{
|
||||
nncResultVals = m_nncData->dynamicConnectionScalarResult(scalarResultIndex, timeStepIndex);
|
||||
}
|
||||
else if (resultType == RiaDefines::GENERATED)
|
||||
{
|
||||
nncResultVals = m_nncData->generatedConnectionScalarResult(scalarResultIndex, timeStepIndex);
|
||||
}
|
||||
|
||||
if (!nncResultVals)
|
||||
{
|
||||
textureCoords->setAll(cvf::Vec2f(0.0f, 1.0f));
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfArray.h"
|
||||
@@ -45,7 +48,10 @@ public:
|
||||
void setCellVisibility( const cvf::UByteArray* cellVisibilities, const RigGridBase * grid);
|
||||
|
||||
void textureCoordinates(cvf::Vec2fArray* textureCoords,
|
||||
const cvf::ScalarMapper* mapper, size_t scalarResultIndex) const;
|
||||
const cvf::ScalarMapper* mapper,
|
||||
RiaDefines::ResultCatType resultType,
|
||||
size_t scalarResultIndex,
|
||||
size_t timeStepIndex) const;
|
||||
|
||||
// Mapping between cells and geometry
|
||||
cvf::ref<cvf::Array<size_t> > triangleToNNCIndex() const;
|
||||
|
||||
Reference in New Issue
Block a user