diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c9b995345..fb9c304e30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ Bug #6427: Enemy health bar disappears before damaging effect ends Bug #6550: Cloned body parts don't inherit texture effects Bug #6645: Enemy block sounds align with animation instead of blocked hits + Bug #6657: Distant terrain tiles become black when using FWIW mod Bug #6661: Saved games that have no preview screenshot cause issues or crashes Bug #6807: Ultimate Galleon is not working properly Bug #6893: Lua: Inconsistent behavior with actors affected by Disable and SetDelete commands diff --git a/components/terrain/material.cpp b/components/terrain/material.cpp index c56d376aeb..e7f08e7875 100644 --- a/components/terrain/material.cpp +++ b/components/terrain/material.cpp @@ -173,6 +173,27 @@ namespace } }; + class DiscardAlphaCombine + { + public: + static const osg::ref_ptr& value() + { + static DiscardAlphaCombine instance; + return instance.mValue; + } + + private: + osg::ref_ptr mValue; + + DiscardAlphaCombine() + : mValue(new osg::TexEnvCombine) + { + mValue->setCombine_Alpha(osg::TexEnvCombine::REPLACE); + mValue->setSource0_Alpha(osg::TexEnvCombine::CONSTANT); + mValue->setConstantColor(osg::Vec4(0.0, 0.0, 0.0, 1.0)); + } + }; + class UniformCollection { public: @@ -287,6 +308,8 @@ namespace Terrain stateset->setTextureAttributeAndModes( 0, LayerTexMat::value(layerTileSize), osg::StateAttribute::ON); + stateset->setTextureAttributeAndModes(0, DiscardAlphaCombine::value(), osg::StateAttribute::ON); + // Multiply by the alpha map if (!blendmaps.empty()) {