diff --git a/ApplicationCode/ModelVisualization/ModelVisualization_UnitTests/RivTernaryScalarMapper-Test.cpp b/ApplicationCode/ModelVisualization/ModelVisualization_UnitTests/RivTernaryScalarMapper-Test.cpp index 6f50cb5717..f9ac412145 100644 --- a/ApplicationCode/ModelVisualization/ModelVisualization_UnitTests/RivTernaryScalarMapper-Test.cpp +++ b/ApplicationCode/ModelVisualization/ModelVisualization_UnitTests/RivTernaryScalarMapper-Test.cpp @@ -33,7 +33,7 @@ TEST(TernaryScalarMapperTest, BasicFunctions) cvf::ref scalarMapper = new RivTernaryScalarMapper(cvf::Color3f::GRAY); cvf::ref texImage = new cvf::TextureImage; - scalarMapper->updateTexture(texImage.p()); + scalarMapper->updateTexture(texImage.p(), 1.0); QImage img = cvfqt::Utils::toQImage(*(texImage.p())); diff --git a/ApplicationCode/ModelVisualization/RivTernaryScalarMapper.cpp b/ApplicationCode/ModelVisualization/RivTernaryScalarMapper.cpp index 2c5eb14efc..a81a16d2f2 100644 --- a/ApplicationCode/ModelVisualization/RivTernaryScalarMapper.cpp +++ b/ApplicationCode/ModelVisualization/RivTernaryScalarMapper.cpp @@ -28,19 +28,9 @@ RivTernaryScalarMapper::RivTernaryScalarMapper(const cvf::Color3f& undefScalarCo : m_undefScalarColor(undefScalarColor), m_textureSize(128, 256) { - m_opacityLevel = 1.0; - setTernaryRanges(0.0, 1.0, 0.0, 1.0); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RivTernaryScalarMapper::setOpacityLevel(float opacityLevel) -{ - m_opacityLevel = opacityLevel; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -77,7 +67,7 @@ cvf::Vec2f RivTernaryScalarMapper::mapToTextureCoord(double soil, double sgas, b /// A *********** B /// SWAT SOIL //-------------------------------------------------------------------------------------------------- -bool RivTernaryScalarMapper::updateTexture(cvf::TextureImage* image) const +bool RivTernaryScalarMapper::updateTexture(cvf::TextureImage* image, float opacityLevel) const { CVF_ASSERT(image); image->allocate(m_textureSize.x(), m_textureSize.y()); @@ -112,7 +102,7 @@ bool RivTernaryScalarMapper::updateTexture(cvf::TextureImage* image) const image->setPixel(xPos, yPos, clr); // Set opacity - const cvf::Color4ub clrOpacity(rByteCol, gByteCol, bByteCol, static_cast(255 * m_opacityLevel)); + const cvf::Color4ub clrOpacity(rByteCol, gByteCol, bByteCol, static_cast(255 * opacityLevel)); image->setPixel(xPos, yPos + halfTextureHeight, clrOpacity); soil_green += xStride; diff --git a/ApplicationCode/ModelVisualization/RivTernaryScalarMapper.h b/ApplicationCode/ModelVisualization/RivTernaryScalarMapper.h index 5e0c827635..566f499e01 100644 --- a/ApplicationCode/ModelVisualization/RivTernaryScalarMapper.h +++ b/ApplicationCode/ModelVisualization/RivTernaryScalarMapper.h @@ -36,16 +36,13 @@ class RivTernaryScalarMapper : public cvf::Object public: RivTernaryScalarMapper(const cvf::Color3f& undefScalarColor); - void setOpacityLevel(float opacityLevel); - void setTernaryRanges(double soilLower, double soilUpper, double sgasLower, double sgasUpper); cvf::Vec2f mapToTextureCoord(double soil, double sgas, bool isTransparent) const; - bool updateTexture(cvf::TextureImage* image) const; + bool updateTexture(cvf::TextureImage* image, float opacityLevel) const; private: cvf::Color3f m_undefScalarColor; - float m_opacityLevel; cvf::Vec2ui m_textureSize; double m_rangeMaxSoil; diff --git a/ApplicationCode/ModelVisualization/RivTernaryScalarMapperEffectGenerator.cpp b/ApplicationCode/ModelVisualization/RivTernaryScalarMapperEffectGenerator.cpp index 092929f43b..76041518bb 100644 --- a/ApplicationCode/ModelVisualization/RivTernaryScalarMapperEffectGenerator.cpp +++ b/ApplicationCode/ModelVisualization/RivTernaryScalarMapperEffectGenerator.cpp @@ -74,7 +74,7 @@ void RivTernaryScalarMapperEffectGenerator::updateForShaderBasedRendering(cvf::E // Result mapping texture m_textureImage = new cvf::TextureImage(); - m_scalarMapper->updateTexture(m_textureImage.p()); + m_scalarMapper->updateTexture(m_textureImage.p(), m_opacityLevel); cvf::ref texture = new cvf::Texture(m_textureImage.p()); cvf::ref sampler = new cvf::Sampler; @@ -108,7 +108,7 @@ void RivTernaryScalarMapperEffectGenerator::updateForFixedFunctionRendering(cvf: // Result mapping texture m_textureImage = new cvf::TextureImage; - m_scalarMapper->updateTexture(m_textureImage.p()); + m_scalarMapper->updateTexture(m_textureImage.p(), m_opacityLevel); cvf::ref texture = new cvf::Texture2D_FF(m_textureImage.p()); texture->setWrapMode(cvf::Texture2D_FF::CLAMP); @@ -191,7 +191,7 @@ bool RivTernaryScalarMapperEffectGenerator::isEqual(const EffectGenerator* other && m_enableDepthWrite == otherTextureResultEffect->m_enableDepthWrite) { cvf::ref texImg2 = new cvf::TextureImage; - otherTextureResultEffect->m_scalarMapper->updateTexture(texImg2.p()); + otherTextureResultEffect->m_scalarMapper->updateTexture(texImg2.p(), m_opacityLevel); return RivTernaryScalarMapperEffectGenerator::isImagesEqual(m_textureImage.p(), texImg2.p()); }