mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2586 StimPlan Viz : Mesh lines flickers when interpolating result values
This commit is contained in:
@@ -340,23 +340,18 @@ cvf::ref<cvf::Part> RivWellFracturePartMgr::createEllipseSurfacePart(const RimEc
|
||||
{
|
||||
std::vector<cvf::Vec3f> nodeCoords;
|
||||
std::vector<cvf::uint> triangleIndices;
|
||||
m_rimFracture->triangleGeometry(&triangleIndices, &nodeCoords);
|
||||
|
||||
std::vector<cvf::Vec3f> displayCoords;
|
||||
m_rimFracture->fractureTemplate()->fractureTriangleGeometry(&nodeCoords, &triangleIndices);
|
||||
|
||||
for (const auto& nodeCoord : nodeCoords)
|
||||
{
|
||||
cvf::Vec3d nodeCoordsDouble = static_cast<cvf::Vec3d>(nodeCoord);
|
||||
cvf::Vec3d displayCoordsDouble = displayCoordTransform->transformToDisplayCoord(nodeCoordsDouble);
|
||||
displayCoords.push_back(static_cast<cvf::Vec3f>(displayCoordsDouble));
|
||||
}
|
||||
cvf::Mat4d fractureXf = m_rimFracture->transformMatrix();
|
||||
std::vector<cvf::Vec3f> nodeDisplayCoords = transformToFractureDisplayCoords(nodeCoords, fractureXf, *displayCoordTransform);
|
||||
|
||||
if (triangleIndices.empty() || displayCoords.empty())
|
||||
if (triangleIndices.empty() || nodeDisplayCoords.empty())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = buildDrawableGeoFromTriangles(triangleIndices, displayCoords);
|
||||
cvf::ref<cvf::DrawableGeo> geo = buildDrawableGeoFromTriangles(triangleIndices, nodeDisplayCoords);
|
||||
CVF_ASSERT(geo.notNull());
|
||||
|
||||
cvf::ref<cvf::Part> surfacePart = new cvf::Part(0, "FractureSurfacePart_ellipse");
|
||||
@@ -415,21 +410,17 @@ cvf::ref<cvf::Part> RivWellFracturePartMgr::createStimPlanColorInterpolatedSurfa
|
||||
// If this ever changes, the entire code must be revisited
|
||||
std::vector<cvf::Vec3f> nodeCoords;
|
||||
std::vector<cvf::uint> triangleIndices;
|
||||
m_rimFracture->triangleGeometry(&triangleIndices, &nodeCoords);
|
||||
|
||||
stimPlanFracTemplate->fractureTriangleGeometry(&nodeCoords, &triangleIndices);
|
||||
|
||||
if (triangleIndices.empty() || nodeCoords.empty())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Transforms the node coordinates for display
|
||||
for (auto& nodeCoord : nodeCoords)
|
||||
{
|
||||
cvf::Vec3d doubleCoord(nodeCoord);
|
||||
doubleCoord = displayCoordTransform->transformToDisplayCoord(doubleCoord);
|
||||
nodeCoord = cvf::Vec3f(doubleCoord);
|
||||
}
|
||||
|
||||
cvf::Mat4d fractureXf = m_rimFracture->transformMatrix();
|
||||
std::vector<cvf::Vec3f> nodeDisplayCoords = transformToFractureDisplayCoords(nodeCoords, fractureXf, *displayCoordTransform);
|
||||
|
||||
RimLegendConfig* legendConfig = nullptr;
|
||||
if (activeView.fractureColors() && activeView.fractureColors()->isChecked())
|
||||
{
|
||||
@@ -441,7 +432,7 @@ cvf::ref<cvf::Part> RivWellFracturePartMgr::createStimPlanColorInterpolatedSurfa
|
||||
{
|
||||
// Construct array with per node result values that correspond to the node coordinates of the triangle mesh
|
||||
// Since some time steps don't have result vales, we initialize the array to well known values before populating it
|
||||
std::vector<double> perNodeResultValues(nodeCoords.size(), HUGE_VAL);
|
||||
std::vector<double> perNodeResultValues(nodeDisplayCoords.size(), HUGE_VAL);
|
||||
{
|
||||
size_t idx = 0;
|
||||
const std::vector<std::vector<double> > dataToPlot = stimPlanFracTemplate->resultValues(activeView.fractureColors()->uiResultName(), activeView.fractureColors()->unit(), stimPlanFracTemplate->activeTimeStepIndex());
|
||||
@@ -453,8 +444,7 @@ cvf::ref<cvf::Part> RivWellFracturePartMgr::createStimPlanColorInterpolatedSurfa
|
||||
}
|
||||
}
|
||||
}
|
||||
CVF_ASSERT(perNodeResultValues.size() == nodeCoords.size());
|
||||
|
||||
CVF_ASSERT(perNodeResultValues.size() == nodeDisplayCoords.size());
|
||||
|
||||
std::vector<cvf::uint> triIndicesToInclude;
|
||||
for (size_t i = 0; i < triangleIndices.size(); i += 6)
|
||||
@@ -483,15 +473,11 @@ cvf::ref<cvf::Part> RivWellFracturePartMgr::createStimPlanColorInterpolatedSurfa
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = buildDrawableGeoFromTriangles(triIndicesToInclude, nodeCoords);
|
||||
cvf::ref<cvf::Part> surfacePart = new cvf::Part(0, "FractureSurfacePart_stimPlan");
|
||||
surfacePart->setDrawable(geo.p());
|
||||
surfacePart->setPriority(RivPartPriority::PartType::BaseLevel);
|
||||
surfacePart->setSourceInfo(new RivObjectSourceInfo(m_rimFracture));
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = buildDrawableGeoFromTriangles(triIndicesToInclude, nodeDisplayCoords);
|
||||
const cvf::ScalarMapper* scalarMapper = legendConfig->scalarMapper();
|
||||
CVF_ASSERT(scalarMapper);
|
||||
cvf::ref<cvf::Vec2fArray> textureCoords = new cvf::Vec2fArray(nodeCoords.size());
|
||||
|
||||
cvf::ref<cvf::Vec2fArray> textureCoords = new cvf::Vec2fArray(nodeDisplayCoords.size());
|
||||
textureCoords->setAll(cvf::Vec2f(0.5f, 1.0f));
|
||||
for (size_t i = 0; i < perNodeResultValues.size(); i++)
|
||||
{
|
||||
@@ -503,10 +489,7 @@ cvf::ref<cvf::Part> RivWellFracturePartMgr::createStimPlanColorInterpolatedSurfa
|
||||
}
|
||||
geo->setTextureCoordArray(textureCoords.p());
|
||||
|
||||
caf::ScalarMapperEffectGenerator effGen(scalarMapper, caf::PO_1);
|
||||
effGen.disableLighting(activeView.isLightingDisabled());
|
||||
cvf::ref<cvf::Effect> eff = effGen.generateCachedEffect();
|
||||
surfacePart->setEffect(eff.p());
|
||||
cvf::ref<cvf::Part> surfacePart = createScalarMapperPart(geo.p(), scalarMapper, m_rimFracture, activeView.isLightingDisabled());
|
||||
|
||||
return surfacePart;
|
||||
}
|
||||
@@ -640,19 +623,11 @@ cvf::ref<cvf::Part> RivWellFracturePartMgr::createStimPlanElementColorSurfacePar
|
||||
}
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = buildDrawableGeoFromTriangles(triIndicesToInclude, nodeDisplayCoords);
|
||||
cvf::ref<cvf::Part> surfacePart = new cvf::Part(0, "FractureSurfacePart_stimPlan");
|
||||
surfacePart->setDrawable(geo.p());
|
||||
surfacePart->setPriority(RivPartPriority::PartType::BaseLevel);
|
||||
surfacePart->setSourceInfo(new RivObjectSourceInfo(m_rimFracture));
|
||||
|
||||
geo->setTextureCoordArray(textureCoords.p());
|
||||
|
||||
caf::ScalarMapperEffectGenerator effGen(scalarMapper, caf::PO_1);
|
||||
effGen.disableLighting(activeView.isLightingDisabled());
|
||||
cvf::ref<cvf::Effect> eff = effGen.generateCachedEffect();
|
||||
surfacePart->setEffect(eff.p());
|
||||
cvf::ref<cvf::Part> surfacePart = createScalarMapperPart(geo.p(), scalarMapper, m_rimFracture, activeView.isLightingDisabled());
|
||||
|
||||
return surfacePart;
|
||||
return surfacePart;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -928,6 +903,28 @@ cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::createStimPlanMeshDrawable(Ri
|
||||
return stimPlanMeshGeo;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::Part> RivWellFracturePartMgr::createScalarMapperPart(cvf::DrawableGeo* drawableGeo,
|
||||
const cvf::ScalarMapper* scalarMapper,
|
||||
RimFracture* fracture,
|
||||
bool disableLighting)
|
||||
{
|
||||
cvf::ref<cvf::Part> surfacePart = new cvf::Part(0, "FractureSurfacePart_stimPlan");
|
||||
surfacePart->setDrawable(drawableGeo);
|
||||
surfacePart->setPriority(RivPartPriority::PartType::BaseLevel);
|
||||
surfacePart->setSourceInfo(new RivObjectSourceInfo(fracture));
|
||||
|
||||
caf::ScalarMapperEffectGenerator effGen(scalarMapper, caf::PO_1);
|
||||
effGen.disableLighting(disableLighting);
|
||||
|
||||
cvf::ref<cvf::Effect> eff = effGen.generateCachedEffect();
|
||||
surfacePart->setEffect(eff.p());
|
||||
|
||||
return surfacePart;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -30,10 +30,11 @@
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class ModelBasicList;
|
||||
class DrawableGeo;
|
||||
class Part;
|
||||
class Color3f;
|
||||
class ModelBasicList;
|
||||
class DrawableGeo;
|
||||
class Part;
|
||||
class Color3f;
|
||||
class ScalarMapper;
|
||||
}
|
||||
|
||||
namespace caf
|
||||
@@ -79,7 +80,9 @@ private:
|
||||
|
||||
std::vector<cvf::Vec3d> fractureBorderPolygon();
|
||||
|
||||
static std::vector<cvf::Vec3f> transformToFractureDisplayCoords(const std::vector<cvf::Vec3f>& polygon,
|
||||
static cvf::ref<cvf::Part> createScalarMapperPart(cvf::DrawableGeo* drawableGeo, const cvf::ScalarMapper* scalarMapper, RimFracture* fracture, bool disableLighting);
|
||||
|
||||
static std::vector<cvf::Vec3f> transformToFractureDisplayCoords(const std::vector<cvf::Vec3f>& polygon,
|
||||
cvf::Mat4d m,
|
||||
const caf::DisplayCoordTransform& displayCoordTransform);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user