From 6e0eb64538010fb17626d413551af644d96b148d Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 6 Oct 2024 11:18:43 +0200 Subject: [PATCH] Use normalized path for glow texture names --- components/sceneutil/util.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/components/sceneutil/util.cpp b/components/sceneutil/util.cpp index ed891f835e..e7a9cab730 100644 --- a/components/sceneutil/util.cpp +++ b/components/sceneutil/util.cpp @@ -16,28 +16,30 @@ #include #include #include +#include namespace SceneUtil { namespace { - std::array generateGlowTextureNames() + std::array generateGlowTextureNames() { - std::array result; + constexpr VFS::Path::NormalizedView prefix("textures/magicitem"); + std::array result; for (std::size_t i = 0; i < result.size(); ++i) { std::stringstream stream; - stream << "textures/magicitem/caust"; + stream << "caust"; stream << std::setw(2); stream << std::setfill('0'); stream << i; stream << ".dds"; - result[i] = std::move(stream).str(); + result[i] = prefix / VFS::Path::Normalized(std::move(stream).str()); } return result; } - const std::array glowTextureNames = generateGlowTextureNames(); + const std::array glowTextureNames = generateGlowTextureNames(); struct FindLowestUnusedTexUnitVisitor : public osg::NodeVisitor { @@ -219,9 +221,9 @@ namespace SceneUtil const osg::Vec4f& glowColor, float glowDuration) { std::vector> textures; - for (const std::string& name : glowTextureNames) + for (const VFS::Path::Normalized& name : glowTextureNames) { - osg::ref_ptr image = resourceSystem->getImageManager()->getImage(VFS::Path::toNormalized(name)); + osg::ref_ptr image = resourceSystem->getImageManager()->getImage(name); osg::ref_ptr tex(new osg::Texture2D(image)); tex->setWrap(osg::Texture::WRAP_S, osg::Texture2D::REPEAT); tex->setWrap(osg::Texture::WRAP_T, osg::Texture2D::REPEAT);