mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added depth write to effect generator
This commit is contained in:
@@ -394,6 +394,7 @@ ScalarMapperEffectGenerator::ScalarMapperEffectGenerator(const cvf::ScalarMapper
|
||||
m_polygonOffset = polygonOffset;
|
||||
m_opacityLevel = 1.0f;
|
||||
m_faceCulling = FC_NONE;
|
||||
m_enableDepthWrite = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -509,6 +510,13 @@ void ScalarMapperEffectGenerator::updateCommonEffect(cvf::Effect* effect) const
|
||||
|
||||
effect->setRenderState(faceCulling.p());
|
||||
}
|
||||
|
||||
if (!m_enableDepthWrite)
|
||||
{
|
||||
cvf::ref<cvf::RenderStateDepth> depth = new cvf::RenderStateDepth;
|
||||
depth->enableDepthWrite(false);
|
||||
effect->setRenderState(depth.p());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -525,7 +533,8 @@ bool ScalarMapperEffectGenerator::isEqual(const EffectGenerator* other) const
|
||||
&& m_polygonOffset == otherTextureResultEffect->m_polygonOffset
|
||||
&& m_opacityLevel == otherTextureResultEffect->m_opacityLevel
|
||||
&& m_undefinedColor == otherTextureResultEffect->m_undefinedColor
|
||||
&& m_faceCulling == otherTextureResultEffect->m_faceCulling)
|
||||
&& m_faceCulling == otherTextureResultEffect->m_faceCulling
|
||||
&& m_enableDepthWrite == otherTextureResultEffect->m_enableDepthWrite)
|
||||
{
|
||||
cvf::ref<cvf::TextureImage> texImg2 = new cvf::TextureImage;
|
||||
otherTextureResultEffect->m_scalarMapper->updateTexture(texImg2.p());
|
||||
@@ -547,6 +556,7 @@ EffectGenerator* ScalarMapperEffectGenerator::copy() const
|
||||
scEffGen->m_opacityLevel = m_opacityLevel;
|
||||
scEffGen->m_undefinedColor = m_undefinedColor;
|
||||
scEffGen->m_faceCulling = m_faceCulling;
|
||||
scEffGen->m_enableDepthWrite = m_enableDepthWrite;
|
||||
|
||||
return scEffGen;
|
||||
}
|
||||
|
||||
@@ -158,6 +158,8 @@ public:
|
||||
void setOpacityLevel(float opacity) { m_opacityLevel = cvf::Math::clamp(opacity, 0.0f , 1.0f ); }
|
||||
void setUndefinedColor(cvf::Color3f color) { m_undefinedColor = color; }
|
||||
void setFaceCulling(FaceCulling faceCulling) { m_faceCulling = faceCulling; }
|
||||
void enableDepthWrite(bool enableWrite) { m_enableDepthWrite = enableWrite; }
|
||||
|
||||
public:
|
||||
static cvf::ref<cvf::TextureImage> addAlphaAndUndefStripes(const cvf::TextureImage* texImg, const cvf::Color3f& undefScalarColor, float opacityLevel);
|
||||
static bool isImagesEqual(const cvf::TextureImage* texImg1, const cvf::TextureImage* texImg2);
|
||||
@@ -179,6 +181,7 @@ private:
|
||||
float m_opacityLevel;
|
||||
cvf::Color3f m_undefinedColor;
|
||||
FaceCulling m_faceCulling;
|
||||
bool m_enableDepthWrite;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user