Whitespace

This commit is contained in:
Magne Sjaastad
2018-09-12 14:24:24 +02:00
parent fce3d586ca
commit a1518bd9ec
2 changed files with 93 additions and 74 deletions

View File

@@ -31,12 +31,13 @@
#include "RimEclipseCase.h" #include "RimEclipseCase.h"
#include "RimEclipseCellColors.h" #include "RimEclipseCellColors.h"
#include "RimEclipseView.h" #include "RimEclipseView.h"
#include "RimSimWellInViewCollection.h"
#include "RimRegularLegendConfig.h" #include "RimRegularLegendConfig.h"
#include "RimReservoirCellResultsStorage.h" #include "RimReservoirCellResultsStorage.h"
#include "RimSimWellInViewCollection.h"
#include "RimTernaryLegendConfig.h" #include "RimTernaryLegendConfig.h"
#include "RivCellEdgeEffectGenerator.h" #include "RivCellEdgeEffectGenerator.h"
#include "RivCompletionTypeResultToTextureMapper.h"
#include "RivPartPriority.h" #include "RivPartPriority.h"
#include "RivResultToTextureMapper.h" #include "RivResultToTextureMapper.h"
#include "RivScalarMapperUtils.h" #include "RivScalarMapperUtils.h"
@@ -44,7 +45,6 @@
#include "RivTernaryScalarMapperEffectGenerator.h" #include "RivTernaryScalarMapperEffectGenerator.h"
#include "RivTernaryTextureCoordsCreator.h" #include "RivTernaryTextureCoordsCreator.h"
#include "RivTextureCoordsCreator.h" #include "RivTextureCoordsCreator.h"
#include "RivCompletionTypeResultToTextureMapper.h"
#include "cafEffectGenerator.h" #include "cafEffectGenerator.h"
#include "cafPdmFieldCvfColor.h" #include "cafPdmFieldCvfColor.h"
@@ -55,9 +55,9 @@
#include "cvfMath.h" #include "cvfMath.h"
#include "cvfModelBasicList.h" #include "cvfModelBasicList.h"
#include "cvfPart.h" #include "cvfPart.h"
#include "cvfRenderState_FF.h"
#include "cvfRenderStateBlending.h" #include "cvfRenderStateBlending.h"
#include "cvfRenderStatePolygonOffset.h" #include "cvfRenderStatePolygonOffset.h"
#include "cvfRenderState_FF.h"
#include "cvfShaderProgram.h" #include "cvfShaderProgram.h"
#include "cvfShaderProgramGenerator.h" #include "cvfShaderProgramGenerator.h"
#include "cvfShaderSourceProvider.h" #include "cvfShaderSourceProvider.h"
@@ -66,21 +66,19 @@
#include "cvfTransform.h" #include "cvfTransform.h"
#include "cvfUniform.h" #include "cvfUniform.h"
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RivGridPartMgr::RivGridPartMgr(const RigGridBase* grid, size_t gridIdx) RivGridPartMgr::RivGridPartMgr(const RigGridBase* grid, size_t gridIdx)
: m_surfaceGenerator(grid), : m_surfaceGenerator(grid)
m_gridIdx(gridIdx), , m_gridIdx(gridIdx)
m_grid(grid), , m_grid(grid)
m_surfaceFaceFilter(grid), , m_surfaceFaceFilter(grid)
m_opacityLevel(1.0f), , m_opacityLevel(1.0f)
m_defaultColor(cvf::Color3::WHITE) , m_defaultColor(cvf::Color3::WHITE)
{ {
CVF_ASSERT(grid); CVF_ASSERT(grid);
m_cellVisibility = new cvf::UByteArray; m_cellVisibility = new cvf::UByteArray;
m_surfaceFacesTextureCoords = new cvf::Vec2fArray; m_surfaceFacesTextureCoords = new cvf::Vec2fArray;
} }
@@ -108,6 +106,9 @@ void RivGridPartMgr::setCellVisibility(cvf::UByteArray* cellVisibilities)
generatePartGeometry(m_surfaceGenerator); generatePartGeometry(m_surfaceGenerator);
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivGridPartMgr::generatePartGeometry(cvf::StructGridGeometryGenerator& geoBuilder) void RivGridPartMgr::generatePartGeometry(cvf::StructGridGeometryGenerator& geoBuilder)
{ {
bool useBufferObjects = true; bool useBufferObjects = true;
@@ -130,7 +131,7 @@ void RivGridPartMgr::generatePartGeometry(cvf::StructGridGeometryGenerator& geoB
part->setTransform(m_scaleTransform.p()); part->setTransform(m_scaleTransform.p());
// Set mapping from triangle face index to cell index // Set mapping from triangle face index to cell index
cvf::ref<RivSourceInfo> si = new RivSourceInfo(m_gridIdx); cvf::ref<RivSourceInfo> si = new RivSourceInfo(m_gridIdx);
si->m_cellFaceFromTriangleMapper = geoBuilder.triangleToCellFaceMapper(); si->m_cellFaceFromTriangleMapper = geoBuilder.triangleToCellFaceMapper();
part->setSourceInfo(si.p()); part->setSourceInfo(si.p());
@@ -139,7 +140,7 @@ void RivGridPartMgr::generatePartGeometry(cvf::StructGridGeometryGenerator& geoB
// Set default effect // Set default effect
caf::SurfaceEffectGenerator geometryEffgen(cvf::Color4f(cvf::Color3f::WHITE), caf::PO_1); caf::SurfaceEffectGenerator geometryEffgen(cvf::Color4f(cvf::Color3f::WHITE), caf::PO_1);
cvf::ref<cvf::Effect> geometryOnlyEffect = geometryEffgen.generateCachedEffect(); cvf::ref<cvf::Effect> geometryOnlyEffect = geometryEffgen.generateCachedEffect();
part->setEffect(geometryOnlyEffect.p()); part->setEffect(geometryOnlyEffect.p());
part->setEnableMask(surfaceBit); part->setEnableMask(surfaceBit);
@@ -171,7 +172,7 @@ void RivGridPartMgr::generatePartGeometry(cvf::StructGridGeometryGenerator& geoB
RiaPreferences* prefs = RiaApplication::instance()->preferences(); RiaPreferences* prefs = RiaApplication::instance()->preferences();
cvf::ref<cvf::Effect> eff; cvf::ref<cvf::Effect> eff;
caf::MeshEffectGenerator effGen(prefs->defaultGridLineColors()); caf::MeshEffectGenerator effGen(prefs->defaultGridLineColors());
eff = effGen.generateCachedEffect(); eff = effGen.generateCachedEffect();
@@ -191,8 +192,8 @@ void RivGridPartMgr::appendPartsToModel(cvf::ModelBasicList* model)
{ {
CVF_ASSERT(model != nullptr); CVF_ASSERT(model != nullptr);
if(m_surfaceFaces.notNull() ) model->addPart(m_surfaceFaces.p() ); if (m_surfaceFaces.notNull()) model->addPart(m_surfaceFaces.p());
if(m_surfaceGridLines.notNull()) model->addPart(m_surfaceGridLines.p()); if (m_surfaceGridLines.notNull()) model->addPart(m_surfaceGridLines.p());
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -207,18 +208,20 @@ void RivGridPartMgr::updateCellColor(cvf::Color4f color)
// Set default effect // Set default effect
caf::SurfaceEffectGenerator geometryEffgen(color, caf::PO_1); caf::SurfaceEffectGenerator geometryEffgen(color, caf::PO_1);
cvf::ref<cvf::Effect> geometryOnlyEffect = geometryEffgen.generateCachedEffect(); cvf::ref<cvf::Effect> geometryOnlyEffect = geometryEffgen.generateCachedEffect();
m_surfaceFaces->setEffect(geometryOnlyEffect.p()); m_surfaceFaces->setEffect(geometryOnlyEffect.p());
if (m_opacityLevel < 1.0f) m_surfaceFaces->setPriority(RivPartPriority::PartType::Transparent); if (m_opacityLevel < 1.0f)
else m_surfaceFaces->setPriority(RivPartPriority::PartType::BaseLevel); m_surfaceFaces->setPriority(RivPartPriority::PartType::Transparent);
else
m_surfaceFaces->setPriority(RivPartPriority::PartType::BaseLevel);
// Update mesh colors as well, in case of change // Update mesh colors as well, in case of change
if (m_surfaceGridLines.notNull()) if (m_surfaceGridLines.notNull())
{ {
RiaPreferences* prefs = RiaApplication::instance()->preferences(); RiaPreferences* prefs = RiaApplication::instance()->preferences();
caf::MeshEffectGenerator effGen(prefs->defaultGridLineColors()); caf::MeshEffectGenerator effGen(prefs->defaultGridLineColors());
cvf::ref<cvf::Effect> eff = effGen.generateCachedEffect(); cvf::ref<cvf::Effect> eff = effGen.generateCachedEffect();
m_surfaceGridLines->setEffect(eff.p()); m_surfaceGridLines->setEffect(eff.p());
} }
} }
@@ -237,7 +240,8 @@ void RivGridPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCellC
if (cellResultColors->isTernarySaturationSelected()) if (cellResultColors->isTernarySaturationSelected())
{ {
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(), RivTernaryTextureCoordsCreator texturer(cellResultColors,
cellResultColors->ternaryLegendConfig(),
timeStepIndex, timeStepIndex,
m_grid->gridIndex(), m_grid->gridIndex(),
m_surfaceGenerator.quadToCellFaceMapper()); m_surfaceGenerator.quadToCellFaceMapper());
@@ -254,10 +258,8 @@ void RivGridPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCellC
} }
else else
{ {
RivTextureCoordsCreator texturer(cellResultColors, RivTextureCoordsCreator texturer(
timeStepIndex, cellResultColors, timeStepIndex, m_grid->gridIndex(), m_surfaceGenerator.quadToCellFaceMapper());
m_grid->gridIndex(),
m_surfaceGenerator.quadToCellFaceMapper());
if (!texturer.isValid()) if (!texturer.isValid())
{ {
return; return;
@@ -265,7 +267,8 @@ void RivGridPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCellC
if (cellResultColors->isCompletionTypeSelected()) if (cellResultColors->isCompletionTypeSelected())
{ {
cvf::ref<RigPipeInCellEvaluator> pipeInCellEval = RivTextureCoordsCreator::createPipeInCellEvaluator(cellResultColors, timeStepIndex, m_grid->gridIndex()); cvf::ref<RigPipeInCellEvaluator> pipeInCellEval =
RivTextureCoordsCreator::createPipeInCellEvaluator(cellResultColors, timeStepIndex, m_grid->gridIndex());
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper(); const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
texturer.setResultToTextureMapper(new RivCompletionTypeResultToTextureMapper(mapper, pipeInCellEval.p())); texturer.setResultToTextureMapper(new RivCompletionTypeResultToTextureMapper(mapper, pipeInCellEval.p()));
@@ -283,28 +286,43 @@ void RivGridPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCellC
cellResultColors->reservoirView()->isLightingDisabled()); cellResultColors->reservoirView()->isLightingDisabled());
} }
if (effectiveOpacityLevel < 1.0f) m_surfaceFaces->setPriority(RivPartPriority::PartType::Transparent); if (effectiveOpacityLevel < 1.0f)
else m_surfaceFaces->setPriority(RivPartPriority::PartType::BaseLevel); m_surfaceFaces->setPriority(RivPartPriority::PartType::Transparent);
else
m_surfaceFaces->setPriority(RivPartPriority::PartType::BaseLevel);
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivGridPartMgr::updateCellEdgeResultColor(size_t timeStepIndex, RimEclipseCellColors* cellResultColors, RimCellEdgeColors* cellEdgeResultColors) void RivGridPartMgr::updateCellEdgeResultColor(size_t timeStepIndex,
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors)
{ {
if (m_surfaceFaces.notNull()) if (m_surfaceFaces.notNull())
{ {
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_surfaceFaces->drawable()); cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_surfaceFaces->drawable());
if (dg) if (dg)
{ {
cvf::ref<cvf::Effect> eff = RivScalarMapperUtils::createCellEdgeEffect(dg, m_surfaceGenerator.quadToCellFaceMapper(), m_grid->gridIndex(), cvf::ref<cvf::Effect> eff =
timeStepIndex, cellResultColors, cellEdgeResultColors, m_opacityLevel, m_defaultColor, caf::FC_NONE, cellResultColors->reservoirView()->isLightingDisabled()); RivScalarMapperUtils::createCellEdgeEffect(dg,
m_surfaceGenerator.quadToCellFaceMapper(),
m_grid->gridIndex(),
timeStepIndex,
cellResultColors,
cellEdgeResultColors,
m_opacityLevel,
m_defaultColor,
caf::FC_NONE,
cellResultColors->reservoirView()->isLightingDisabled());
m_surfaceFaces->setEffect(eff.p()); m_surfaceFaces->setEffect(eff.p());
if (m_opacityLevel < 1.0f) m_surfaceFaces->setPriority(RivPartPriority::PartType::Transparent); if (m_opacityLevel < 1.0f)
else m_surfaceFaces->setPriority(RivPartPriority::PartType::BaseLevel); m_surfaceFaces->setPriority(RivPartPriority::PartType::Transparent);
else
m_surfaceFaces->setPriority(RivPartPriority::PartType::BaseLevel);
} }
} }
} }
@@ -321,5 +339,3 @@ RivGridPartMgr::~RivGridPartMgr()
if (m_surfaceFaces.notNull()) m_surfaceFaces->deleteOrReleaseOpenGLResources(); if (m_surfaceFaces.notNull()) m_surfaceFaces->deleteOrReleaseOpenGLResources();
#endif #endif
} }

View File

@@ -19,11 +19,13 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
#pragma once #pragma once
#include "RigGridBase.h"
#include "cvfBase.h" #include "cvfBase.h"
#include "cvfObject.h" #include "cvfObject.h"
#include "cvfStructGridGeometryGenerator.h" #include "cvfStructGridGeometryGenerator.h"
#include "RigGridBase.h"
namespace cvf namespace cvf
{ {
@@ -59,29 +61,30 @@ public:
void updateCellColor(cvf::Color4f color); void updateCellColor(cvf::Color4f color);
void updateCellResultColor(size_t timeStepIndex, RimEclipseCellColors* cellResultColors); void updateCellResultColor(size_t timeStepIndex, RimEclipseCellColors* cellResultColors);
void updateCellEdgeResultColor(size_t timeStepIndex, RimEclipseCellColors* cellResultColors, void updateCellEdgeResultColor(size_t timeStepIndex,
RimCellEdgeColors* cellEdgeResultColors); RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors);
void appendPartsToModel(cvf::ModelBasicList* model); void appendPartsToModel(cvf::ModelBasicList* model);
private: private:
void generatePartGeometry(cvf::StructGridGeometryGenerator& geoBuilder); void generatePartGeometry(cvf::StructGridGeometryGenerator& geoBuilder);
private: private:
size_t m_gridIdx; size_t m_gridIdx;
cvf::cref<RigGridBase> m_grid; cvf::cref<RigGridBase> m_grid;
cvf::ref<cvf::Transform> m_scaleTransform; cvf::ref<cvf::Transform> m_scaleTransform;
float m_opacityLevel; float m_opacityLevel;
cvf::Color3f m_defaultColor; cvf::Color3f m_defaultColor;
// Surface visualization // Surface visualization
cvf::StructGridGeometryGenerator m_surfaceGenerator; cvf::StructGridGeometryGenerator m_surfaceGenerator;
RigGridCellFaceVisibilityFilter m_surfaceFaceFilter; RigGridCellFaceVisibilityFilter m_surfaceFaceFilter;
cvf::ref<cvf::Part> m_surfaceFaces; cvf::ref<cvf::Part> m_surfaceFaces;
cvf::ref<cvf::Vec2fArray> m_surfaceFacesTextureCoords; cvf::ref<cvf::Vec2fArray> m_surfaceFacesTextureCoords;
cvf::ref<cvf::Part> m_surfaceGridLines; cvf::ref<cvf::Part> m_surfaceGridLines;
cvf::ref<cvf::UByteArray> m_cellVisibility; cvf::ref<cvf::UByteArray> m_cellVisibility;
}; };