mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 07:03:25 -06:00
3d Well Log Curves (#2783): Enable picking with the track background switched off.
* Add part to the model, but set the color mask false, depth test/write off. * Result is an invisible part that is present for picking.
This commit is contained in:
parent
9d406fef8a
commit
c5e58df751
@ -240,6 +240,14 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList*
|
||||
caf::MeshEffectGenerator gridBorderEffectGen(gridColor);
|
||||
caf::VectorEffectGenerator curveNormalsEffectGen;
|
||||
backgroundEffectGen.enableLighting(false);
|
||||
|
||||
if (!showBackground)
|
||||
{
|
||||
// Make the background invisible but still present for picking.
|
||||
backgroundEffectGen.enableColorMask(false);
|
||||
backgroundEffectGen.enableDepthTest(false);
|
||||
backgroundEffectGen.enableDepthWrite(false);
|
||||
}
|
||||
|
||||
bool gridCreated = m_3dWellLogGridGeometryGenerator->createGrid(displayCoordTransform,
|
||||
wellPathClipBoundingBox,
|
||||
@ -255,7 +263,7 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList*
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> background = m_3dWellLogGridGeometryGenerator->background();
|
||||
cvf::ref<RivObjectSourceInfo> sourceInfo = new RivObjectSourceInfo(curveCollection);
|
||||
if (showBackground && background.notNull())
|
||||
if (background.notNull())
|
||||
{
|
||||
cvf::ref<cvf::Part> part = createPart(background.p(), backgroundEffect.p());
|
||||
if (part.notNull())
|
||||
@ -265,7 +273,8 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList*
|
||||
}
|
||||
}
|
||||
|
||||
if (showGrid) {
|
||||
if (showGrid)
|
||||
{
|
||||
cvf::ref<cvf::DrawableGeo> border = m_3dWellLogGridGeometryGenerator->border();
|
||||
if (border.notNull())
|
||||
{
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "cvfMatrixState.h"
|
||||
#include "cvfRenderState_FF.h"
|
||||
#include "cvfRenderStateBlending.h"
|
||||
#include "cvfRenderStateColorMask.h"
|
||||
#include "cvfRenderStateCullFace.h"
|
||||
#include "cvfRenderStateDepth.h"
|
||||
#include "cvfRenderStateLine.h"
|
||||
@ -264,6 +265,8 @@ SurfaceEffectGenerator::SurfaceEffectGenerator(const cvf::Color4f& color, Polygo
|
||||
m_color = color;
|
||||
m_polygonOffset = polygonOffset;
|
||||
m_cullBackfaces = FC_NONE;
|
||||
m_enableColorMask = true;
|
||||
m_enableDepthTest = true;
|
||||
m_enableDepthWrite = true;
|
||||
m_enableLighting = true;
|
||||
}
|
||||
@ -278,11 +281,12 @@ SurfaceEffectGenerator::SurfaceEffectGenerator(const cvf::Color3f& color, Polygo
|
||||
m_color = cvf::Color4f(color, 1.0f);
|
||||
m_polygonOffset = polygonOffset;
|
||||
m_cullBackfaces = FC_NONE;
|
||||
m_enableColorMask = true;
|
||||
m_enableDepthTest = true;
|
||||
m_enableDepthWrite = true;
|
||||
m_enableLighting = true;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -373,10 +377,17 @@ void SurfaceEffectGenerator::updateCommonEffect(cvf::Effect* effect) const
|
||||
effect->setRenderState(faceCulling.p());
|
||||
}
|
||||
|
||||
if (!m_enableDepthWrite)
|
||||
if (!m_enableColorMask)
|
||||
{
|
||||
cvf::ref<cvf::RenderStateColorMask> color = new cvf::RenderStateColorMask(m_enableColorMask);
|
||||
effect->setRenderState(color.p());
|
||||
}
|
||||
|
||||
if (!m_enableDepthTest || !m_enableDepthWrite)
|
||||
{
|
||||
cvf::ref<cvf::RenderStateDepth> depth = new cvf::RenderStateDepth;
|
||||
depth->enableDepthWrite(false);
|
||||
depth->enableDepthTest(m_enableDepthTest);
|
||||
depth->enableDepthWrite(m_enableDepthWrite);
|
||||
effect->setRenderState(depth.p());
|
||||
}
|
||||
}
|
||||
@ -390,11 +401,13 @@ bool SurfaceEffectGenerator::isEqual(const EffectGenerator* other) const
|
||||
|
||||
if (otherSurfaceEffect)
|
||||
{
|
||||
if (m_color == otherSurfaceEffect->m_color
|
||||
if (m_color == otherSurfaceEffect->m_color
|
||||
&& m_polygonOffset == otherSurfaceEffect->m_polygonOffset
|
||||
&& m_cullBackfaces == otherSurfaceEffect->m_cullBackfaces
|
||||
&& m_enableColorMask == otherSurfaceEffect->m_enableColorMask
|
||||
&& m_enableDepthTest == otherSurfaceEffect->m_enableDepthTest
|
||||
&& m_enableDepthWrite == otherSurfaceEffect->m_enableDepthWrite
|
||||
&& m_enableLighting == otherSurfaceEffect->m_enableLighting
|
||||
&& m_cullBackfaces == otherSurfaceEffect->m_cullBackfaces)
|
||||
&& m_enableLighting == otherSurfaceEffect->m_enableLighting)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -410,6 +423,8 @@ EffectGenerator* SurfaceEffectGenerator::copy() const
|
||||
{
|
||||
SurfaceEffectGenerator* effGen = new SurfaceEffectGenerator(m_color, m_polygonOffset);
|
||||
effGen->m_cullBackfaces = m_cullBackfaces;
|
||||
effGen->m_enableColorMask = m_enableColorMask;
|
||||
effGen->m_enableDepthTest = m_enableDepthTest;
|
||||
effGen->m_enableDepthWrite = m_enableDepthWrite;
|
||||
effGen->m_enableLighting = m_enableLighting;
|
||||
return effGen;
|
||||
|
@ -134,6 +134,9 @@ public:
|
||||
SurfaceEffectGenerator(const cvf::Color3f& color, PolygonOffset polygonOffset);
|
||||
|
||||
void setCullBackfaces(FaceCulling cullBackFaces) { m_cullBackfaces = cullBackFaces; }
|
||||
|
||||
void enableColorMask(bool enableColors) { m_enableColorMask = enableColors; }
|
||||
void enableDepthTest(bool enableTest) { m_enableDepthTest = enableTest; }
|
||||
void enableDepthWrite(bool enableWrite) { m_enableDepthWrite = enableWrite; }
|
||||
void enableLighting(bool enableLighting) { m_enableLighting = enableLighting; }
|
||||
|
||||
@ -151,6 +154,8 @@ private:
|
||||
cvf::Color4f m_color;
|
||||
PolygonOffset m_polygonOffset;
|
||||
FaceCulling m_cullBackfaces;
|
||||
bool m_enableColorMask;
|
||||
bool m_enableDepthTest;
|
||||
bool m_enableDepthWrite;
|
||||
bool m_enableLighting;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user