diff --git a/Fwk/AppFwk/CommonCode/cafEffectGenerator.cpp b/Fwk/AppFwk/CommonCode/cafEffectGenerator.cpp index bd68fc41bb..b495d5132d 100644 --- a/Fwk/AppFwk/CommonCode/cafEffectGenerator.cpp +++ b/Fwk/AppFwk/CommonCode/cafEffectGenerator.cpp @@ -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 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 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; } diff --git a/Fwk/AppFwk/CommonCode/cafEffectGenerator.h b/Fwk/AppFwk/CommonCode/cafEffectGenerator.h index 1039cf02bb..a33c08412a 100644 --- a/Fwk/AppFwk/CommonCode/cafEffectGenerator.h +++ b/Fwk/AppFwk/CommonCode/cafEffectGenerator.h @@ -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 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; };