mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1233 Improve system for setting part priorities
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include "RimLegendConfig.h"
|
||||
|
||||
#include "RivFemPickSourceInfo.h"
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivResultToTextureMapper.h"
|
||||
#include "RivScalarMapperUtils.h"
|
||||
#include "RivSourceInfo.h"
|
||||
@@ -159,8 +160,7 @@ void RivFemPartPartMgr::generatePartGeometry(RivFemPartGeometryGenerator& geoBui
|
||||
caf::MeshEffectGenerator effGen(prefs->defaultGridLineColors());
|
||||
eff = effGen.generateCachedEffect();
|
||||
|
||||
// Set priority to make sure fault lines are rendered first
|
||||
part->setPriority(10);
|
||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||
|
||||
part->setEnableMask(meshSurfaceBit);
|
||||
part->setEffect(eff.p());
|
||||
@@ -196,7 +196,7 @@ void RivFemPartPartMgr::updateCellColor(cvf::Color4f color)
|
||||
if (color.a() < 1.0f)
|
||||
{
|
||||
// Set priority to make sure this transparent geometry are rendered last
|
||||
if (m_surfaceFaces.notNull()) m_surfaceFaces->setPriority(100);
|
||||
if (m_surfaceFaces.notNull()) m_surfaceFaces->setPriority(RivPartPriority::PartType::Transparent);
|
||||
}
|
||||
|
||||
m_opacityLevel = color.a();
|
||||
|
||||
@@ -35,6 +35,7 @@ ${CEE_CURRENT_LIST_DIR}RivPipeQuadToSegmentMapper.h
|
||||
${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.h
|
||||
${CEE_CURRENT_LIST_DIR}RivSimWellPipeSourceInfo.h
|
||||
${CEE_CURRENT_LIST_DIR}RivWellSpheresPartMgr.h
|
||||
${CEE_CURRENT_LIST_DIR}RivPartPriority.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivPatchGenerator.h"
|
||||
|
||||
#include "cafEffectGenerator.h"
|
||||
@@ -620,7 +621,7 @@ void RivGridBoxGenerator::createLegend(EdgeType edge, cvf::Collection<cvf::Part>
|
||||
depth->enableDepthTest(false);
|
||||
eff->setRenderState(depth.p());
|
||||
|
||||
part->setPriority(1500);
|
||||
part->setPriority(RivPartPriority::PartType::Text);
|
||||
part->setEffect(eff.p());
|
||||
|
||||
parts->push_back(part.p());
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
|
||||
#include "RivIntersectionBoxSourceInfo.h"
|
||||
#include "RivIntersectionPartMgr.h"
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivResultToTextureMapper.h"
|
||||
#include "RivScalarMapperUtils.h"
|
||||
#include "RivTernaryScalarMapper.h"
|
||||
@@ -213,10 +214,6 @@ void RivIntersectionBoxPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
}
|
||||
|
||||
|
||||
const int priCrossSectionGeo = 1;
|
||||
const int priNncGeo = 2;
|
||||
const int priMesh = 3;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -246,7 +243,7 @@ void RivIntersectionBoxPartMgr::generatePartGeometry()
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setEnableMask(faultBit);
|
||||
part->setPriority(priCrossSectionGeo);
|
||||
part->setPriority(RivPartPriority::PartType::Intersection);
|
||||
|
||||
m_intersectionBoxFaces = part;
|
||||
}
|
||||
@@ -268,7 +265,7 @@ void RivIntersectionBoxPartMgr::generatePartGeometry()
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setEnableMask(meshFaultBit);
|
||||
part->setPriority(priMesh);
|
||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||
|
||||
m_intersectionBoxGridLines = part;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "RivHexGridIntersectionTools.h"
|
||||
#include "RivIntersectionGeometryGenerator.h"
|
||||
#include "RivIntersectionSourceInfo.h"
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivResultToTextureMapper.h"
|
||||
#include "RivScalarMapperUtils.h"
|
||||
#include "RivTernaryScalarMapper.h"
|
||||
@@ -382,10 +383,6 @@ void RivIntersectionPartMgr::calculateEclipseTextureCoordinates(cvf::Vec2fArray*
|
||||
}
|
||||
}
|
||||
|
||||
const int priCrossSectionGeo = 1;
|
||||
const int priNncGeo = 2;
|
||||
const int priMesh = 3;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -416,7 +413,7 @@ void RivIntersectionPartMgr::generatePartGeometry()
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setEnableMask(faultBit);
|
||||
part->setPriority(priCrossSectionGeo);
|
||||
part->setPriority(RivPartPriority::PartType::Intersection);
|
||||
|
||||
m_crossSectionFaces = part;
|
||||
}
|
||||
@@ -438,7 +435,7 @@ void RivIntersectionPartMgr::generatePartGeometry()
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setEnableMask(meshFaultBit);
|
||||
part->setPriority(priMesh);
|
||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||
|
||||
m_crossSectionGridLines = part;
|
||||
}
|
||||
@@ -478,7 +475,7 @@ void RivIntersectionPartMgr::createPolyLineParts(bool useBufferObjects)
|
||||
part->setDrawable(polylineGeo.p());
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setPriority(10000);
|
||||
part->setPriority(RivPartPriority::PartType::Highlight);
|
||||
|
||||
// Always show this part, also when mesh is turned off
|
||||
//part->setEnableMask(meshFaultBit);
|
||||
@@ -510,7 +507,7 @@ void RivIntersectionPartMgr::createPolyLineParts(bool useBufferObjects)
|
||||
part->setDrawable(polylinePointsGeo.p());
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setPriority(10000);
|
||||
part->setPriority(RivPartPriority::PartType::Highlight);
|
||||
|
||||
// Always show this part, also when mesh is turned off
|
||||
//part->setEnableMask(meshFaultBit);
|
||||
@@ -558,7 +555,7 @@ void RivIntersectionPartMgr::createExtrusionDirParts(bool useBufferObjects)
|
||||
part->setDrawable(polylineGeo.p());
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setPriority(10000);
|
||||
part->setPriority(RivPartPriority::PartType::Highlight);
|
||||
|
||||
// Always show this part, also when mesh is turned off
|
||||
//part->setEnableMask(meshFaultBit);
|
||||
@@ -590,7 +587,7 @@ void RivIntersectionPartMgr::createExtrusionDirParts(bool useBufferObjects)
|
||||
part->setDrawable(polylinePointsGeo.p());
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setPriority(10000);
|
||||
part->setPriority(RivPartPriority::PartType::Highlight);
|
||||
|
||||
// Always show this part, also when mesh is turned off
|
||||
//part->setEnableMask(meshFaultBit);
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "RimLegendConfig.h"
|
||||
#include "RimTernaryLegendConfig.h"
|
||||
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivResultToTextureMapper.h"
|
||||
#include "RivScalarMapperUtils.h"
|
||||
#include "RivSourceInfo.h"
|
||||
@@ -206,10 +207,6 @@ void RivFaultPartMgr::updateCellEdgeResultColor(size_t timeStepIndex, RimEclipse
|
||||
}
|
||||
}
|
||||
|
||||
const int priFaultGeo = 1;
|
||||
const int priNncGeo = 2;
|
||||
const int priMesh = 3;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -240,7 +237,7 @@ void RivFaultPartMgr::generatePartGeometry()
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setEnableMask(faultBit);
|
||||
part->setPriority(priFaultGeo);
|
||||
part->setPriority(RivPartPriority::PartType::Fault);
|
||||
|
||||
m_nativeFaultFaces = part;
|
||||
}
|
||||
@@ -262,7 +259,7 @@ void RivFaultPartMgr::generatePartGeometry()
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setEnableMask(meshFaultBit);
|
||||
part->setPriority(priMesh);
|
||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||
|
||||
m_nativeFaultGridLines = part;
|
||||
}
|
||||
@@ -292,7 +289,7 @@ void RivFaultPartMgr::generatePartGeometry()
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setEnableMask(faultBit);
|
||||
part->setPriority(priFaultGeo);
|
||||
part->setPriority(RivPartPriority::PartType::Fault);
|
||||
|
||||
m_oppositeFaultFaces = part;
|
||||
}
|
||||
@@ -314,7 +311,7 @@ void RivFaultPartMgr::generatePartGeometry()
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setEnableMask(meshFaultBit);
|
||||
part->setPriority(priMesh);
|
||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||
|
||||
m_oppositeFaultGridLines = part;
|
||||
}
|
||||
@@ -342,7 +339,7 @@ void RivFaultPartMgr::generatePartGeometry()
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setEnableMask(faultBit);
|
||||
part->setPriority(priNncGeo);
|
||||
part->setPriority(RivPartPriority::PartType::Nnc);
|
||||
|
||||
m_NNCFaces = part;
|
||||
}
|
||||
@@ -397,18 +394,18 @@ void RivFaultPartMgr::updatePartEffect()
|
||||
if (m_opacityLevel < 1.0f)
|
||||
{
|
||||
// Set priority to make sure this transparent geometry are rendered last
|
||||
if (m_nativeFaultFaces.notNull()) m_nativeFaultFaces->setPriority(100 + priFaultGeo);
|
||||
if (m_oppositeFaultFaces.notNull()) m_oppositeFaultFaces->setPriority(100 + priFaultGeo);
|
||||
if (m_NNCFaces.notNull()) m_NNCFaces->setPriority(100 + priNncGeo);
|
||||
if (m_nativeFaultFaces.notNull()) m_nativeFaultFaces->setPriority(RivPartPriority::PartType::TransparentFault);
|
||||
if (m_oppositeFaultFaces.notNull()) m_oppositeFaultFaces->setPriority(RivPartPriority::PartType::TransparentFault);
|
||||
if (m_NNCFaces.notNull()) m_NNCFaces->setPriority(RivPartPriority::PartType::TransparentNnc);
|
||||
|
||||
if (m_nativeFaultGridLines.notNull())
|
||||
{
|
||||
m_nativeFaultGridLines->setPriority(100 + priMesh);
|
||||
m_nativeFaultGridLines->setPriority(RivPartPriority::PartType::TransparentMeshLines);
|
||||
}
|
||||
|
||||
if (m_oppositeFaultGridLines.notNull())
|
||||
{
|
||||
m_oppositeFaultGridLines->setPriority(100 + priMesh);
|
||||
m_oppositeFaultGridLines->setPriority(RivPartPriority::PartType::TransparentMeshLines);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -481,7 +478,7 @@ void RivFaultPartMgr::createLabelWithAnchorLine(const cvf::Part* part)
|
||||
cvf::ref<cvf::Effect> eff = new cvf::Effect;
|
||||
|
||||
part->setEffect(eff.p());
|
||||
part->setPriority(1000);
|
||||
part->setPriority(RivPartPriority::PartType::Text);
|
||||
|
||||
m_faultLabelPart = part;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "RimTernaryLegendConfig.h"
|
||||
|
||||
#include "RivCellEdgeEffectGenerator.h"
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivResultToTextureMapper.h"
|
||||
#include "RivScalarMapperUtils.h"
|
||||
#include "RivSourceInfo.h"
|
||||
@@ -164,8 +165,7 @@ void RivGridPartMgr::generatePartGeometry(cvf::StructGridGeometryGenerator& geoB
|
||||
caf::MeshEffectGenerator effGen(prefs->defaultGridLineColors());
|
||||
eff = effGen.generateCachedEffect();
|
||||
|
||||
// Set priority to make sure fault lines are rendered first
|
||||
part->setPriority(10);
|
||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||
|
||||
part->setEnableMask(meshSurfaceBit);
|
||||
part->setEffect(eff.p());
|
||||
@@ -200,8 +200,7 @@ void RivGridPartMgr::updateCellColor(cvf::Color4f color)
|
||||
|
||||
if (color.a() < 1.0f)
|
||||
{
|
||||
// Set priority to make sure this transparent geometry are rendered last
|
||||
if (m_surfaceFaces.notNull()) m_surfaceFaces->setPriority(100);
|
||||
if (m_surfaceFaces.notNull()) m_surfaceFaces->setPriority(RivPartPriority::PartType::Transparent);
|
||||
}
|
||||
|
||||
m_opacityLevel = color.a();
|
||||
|
||||
51
ApplicationCode/ModelVisualization/RivPartPriority.h
Normal file
51
ApplicationCode/ModelVisualization/RivPartPriority.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Class used to manage part render priorities
|
||||
///
|
||||
/// The render priority determines the order in which parts get rendered. Parts with lower priorities
|
||||
/// get rendered first. The default priority is 0.
|
||||
///
|
||||
/// See also cvf::Part::setPriority()
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RivPartPriority
|
||||
{
|
||||
public:
|
||||
enum PartType
|
||||
{
|
||||
BaseLevel,
|
||||
Fault,
|
||||
Nnc,
|
||||
Intersection,
|
||||
CrossSectionNnc,
|
||||
MeshLines,
|
||||
Transparent,
|
||||
TransparentFault,
|
||||
TransparentNnc,
|
||||
TransparentMeshLines,
|
||||
Highlight,
|
||||
Text
|
||||
};
|
||||
|
||||
};
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "RimGeoMechCase.h"
|
||||
|
||||
#include "RivFemPartGeometryGenerator.h"
|
||||
#include "RivPartPriority.h"
|
||||
|
||||
#include "cafEffectGenerator.h"
|
||||
#include "cvfPart.h"
|
||||
@@ -75,7 +76,7 @@ cvf::ref<cvf::Part> RivSingleCellPartGenerator::createPart(const cvf::Color3f co
|
||||
|
||||
part->setEffect(eff.p());
|
||||
|
||||
part->setPriority(10000);
|
||||
part->setPriority(RivPartPriority::PartType::Highlight);
|
||||
|
||||
return part;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "RimEclipseWellCollection.h"
|
||||
|
||||
#include "RivPipeGeometryGenerator.h"
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivSimWellPipeSourceInfo.h"
|
||||
|
||||
#include "cafEffectGenerator.h"
|
||||
@@ -344,7 +345,7 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
|
||||
cvf::ref<cvf::Effect> eff = new cvf::Effect;
|
||||
|
||||
part->setEffect(eff.p());
|
||||
part->setPriority(11);
|
||||
part->setPriority(RivPartPriority::PartType::Text);
|
||||
part->setSourceInfo(sourceInfo.p());
|
||||
|
||||
m_wellHeadLabelPart = part;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "RivPipeGeometryGenerator.h"
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivWellPathSourceInfo.h"
|
||||
|
||||
#include "cafEffectGenerator.h"
|
||||
@@ -218,7 +219,7 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
|
||||
cvf::ref<cvf::Effect> eff = new cvf::Effect;
|
||||
|
||||
part->setEffect(eff.p());
|
||||
part->setPriority(1000);
|
||||
part->setPriority(RivPartPriority::Text);
|
||||
|
||||
m_wellLabelPart = part;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user