mirror of
https://github.com/OPM/ResInsight.git
synced 2026-08-26 13:17:35 -05:00
Use texture based ternary visualization
This commit is contained in:
@@ -54,6 +54,8 @@
|
||||
#include "RigResultAccessorFactory.h"
|
||||
#include "RivResultToTextureMapper.h"
|
||||
#include "RivTextureCoordsCreator.h"
|
||||
#include "RivTernaryTextureCoordsCreator.h"
|
||||
#include "RivTernaryScalarMapperEffectGenerator.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -229,9 +231,28 @@ void RivGridPartMgr::updateCellResultColor(size_t timeStepIndex, RimResultSlot*
|
||||
{
|
||||
if (cellResultSlot->isTernarySaturationSelected())
|
||||
{
|
||||
surfaceFacesColorArray = new cvf::Color3ubArray;
|
||||
RivTernaryTextureCoordsCreator texturer(cellResultSlot, cellResultSlot->ternaryLegendConfig(),
|
||||
timeStepIndex,
|
||||
m_grid->gridIndex(),
|
||||
m_surfaceGenerator.quadToCellFaceMapper());
|
||||
|
||||
RivTransmissibilityColorMapper::updateTernarySaturationColorArray(timeStepIndex, cellResultSlot, m_grid.p(), surfaceFacesColorArray.p(), m_surfaceGenerator.quadToCellFaceMapper());
|
||||
texturer.createTextureCoords(m_surfaceFacesTextureCoords.p());
|
||||
|
||||
//void RivGridPartMgr::applyTextureResultsToPart(cvf::Part* part, cvf::Vec2fArray* textureCoords, const cvf::ScalarMapper* mapper)
|
||||
{
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_surfaceFaces.p()->drawable());
|
||||
if (dg) dg->setTextureCoordArray(m_surfaceFacesTextureCoords.p());
|
||||
}
|
||||
|
||||
// void RivGridPartMgr::applyTextureResultsToPart(cvf::Part* part, cvf::Vec2fArray* textureCoords, const cvf::ScalarMapper* mapper)
|
||||
{
|
||||
caf::PolygonOffset polygonOffset = caf::PO_1;
|
||||
RivTernaryScalarMapperEffectGenerator scalarEffgen(cellResultSlot->ternaryLegendConfig()->scalarMapper(), polygonOffset);
|
||||
scalarEffgen.setOpacityLevel(m_opacityLevel);
|
||||
cvf::ref<cvf::Effect> scalarEffect = scalarEffgen.generateEffect();
|
||||
|
||||
m_surfaceFaces->setEffect(scalarEffect.p());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -241,26 +262,28 @@ void RivGridPartMgr::updateCellResultColor(size_t timeStepIndex, RimResultSlot*
|
||||
m_surfaceGenerator.quadToCellFaceMapper());
|
||||
|
||||
texturer.createTextureCoords(m_surfaceFacesTextureCoords.p());
|
||||
|
||||
applyTextureResultsToPart(m_surfaceFaces.p(), m_surfaceFacesTextureCoords.p(), mapper);
|
||||
}
|
||||
|
||||
|
||||
if (surfaceFacesColorArray.notNull()) // Ternary result
|
||||
{
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_surfaceFaces->drawable());
|
||||
if (dg)
|
||||
{
|
||||
dg->setColorArray(surfaceFacesColorArray.p());
|
||||
}
|
||||
|
||||
cvf::ref<cvf::Effect> perVertexColorEffect = RivGridPartMgr::createPerVertexColoringEffect(m_opacityLevel);
|
||||
m_surfaceFaces->setEffect(perVertexColorEffect.p());
|
||||
|
||||
m_surfaceFaces->setPriority(100);
|
||||
}
|
||||
else
|
||||
{
|
||||
applyTextureResultsToPart(m_surfaceFaces.p(), m_surfaceFacesTextureCoords.p(), mapper );
|
||||
}
|
||||
// if (surfaceFacesColorArray.notNull()) // Ternary result
|
||||
// {
|
||||
// cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_surfaceFaces->drawable());
|
||||
// if (dg)
|
||||
// {
|
||||
// dg->setColorArray(surfaceFacesColorArray.p());
|
||||
// }
|
||||
//
|
||||
// cvf::ref<cvf::Effect> perVertexColorEffect = RivGridPartMgr::createPerVertexColoringEffect(m_opacityLevel);
|
||||
// m_surfaceFaces->setEffect(perVertexColorEffect.p());
|
||||
//
|
||||
// m_surfaceFaces->setPriority(100);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// applyTextureResultsToPart(m_surfaceFaces.p(), m_surfaceFacesTextureCoords.p(), mapper);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,14 @@ RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator(
|
||||
CVF_ASSERT(m_texMapper.notNull());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivTernaryTextureCoordsCreator::createTextureCoords(cvf::Vec2fArray* quadTextureCoords)
|
||||
{
|
||||
createTextureCoords(quadTextureCoords, m_quadMapper.p(), m_resultAccessor.p(), m_texMapper.p());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -18,13 +18,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RigTernaryResultAccessor2d.h"
|
||||
#include "RivTernaryResultToTextureMapper.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfArray.h"
|
||||
|
||||
class RimResultSlot;
|
||||
class RigTernaryResultAccessor;
|
||||
class RivTernaryResultToTextureMapper;
|
||||
class RimTernaryLegendConfig;
|
||||
|
||||
namespace cvf
|
||||
@@ -33,6 +34,9 @@ namespace cvf
|
||||
}
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RivTernaryTextureCoordsCreator
|
||||
{
|
||||
public:
|
||||
@@ -42,10 +46,7 @@ public:
|
||||
size_t gridIndex,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadMapper);
|
||||
|
||||
void createTextureCoords(cvf::Vec2fArray* quadTextureCoords)
|
||||
{
|
||||
createTextureCoords(quadTextureCoords, m_quadMapper.p(), m_resultAccessor.p(), m_texMapper.p());
|
||||
}
|
||||
void createTextureCoords(cvf::Vec2fArray* quadTextureCoords);
|
||||
|
||||
private:
|
||||
static void createTextureCoords(cvf::Vec2fArray* quadTextureCoords,
|
||||
@@ -53,6 +54,7 @@ private:
|
||||
const RigTernaryResultAccessor* resultAccessor,
|
||||
const RivTernaryResultToTextureMapper* texMapper);
|
||||
|
||||
private:
|
||||
cvf::cref<cvf::StructGridQuadToCellFaceMapper> m_quadMapper;
|
||||
cvf::ref<RigTernaryResultAccessor> m_resultAccessor;
|
||||
cvf::ref<RivTernaryResultToTextureMapper> m_texMapper;
|
||||
|
||||
Reference in New Issue
Block a user