mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 23:15:39 +00:00
Use normalized path for glow texture names
This commit is contained in:
parent
f27030a87c
commit
6e0eb64538
1 changed files with 9 additions and 7 deletions
|
@ -16,28 +16,30 @@
|
||||||
#include <components/resource/imagemanager.hpp>
|
#include <components/resource/imagemanager.hpp>
|
||||||
#include <components/resource/scenemanager.hpp>
|
#include <components/resource/scenemanager.hpp>
|
||||||
#include <components/sceneutil/texturetype.hpp>
|
#include <components/sceneutil/texturetype.hpp>
|
||||||
|
#include <components/vfs/pathutil.hpp>
|
||||||
|
|
||||||
namespace SceneUtil
|
namespace SceneUtil
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
std::array<std::string, 32> generateGlowTextureNames()
|
std::array<VFS::Path::Normalized, 32> generateGlowTextureNames()
|
||||||
{
|
{
|
||||||
std::array<std::string, 32> result;
|
constexpr VFS::Path::NormalizedView prefix("textures/magicitem");
|
||||||
|
std::array<VFS::Path::Normalized, 32> result;
|
||||||
for (std::size_t i = 0; i < result.size(); ++i)
|
for (std::size_t i = 0; i < result.size(); ++i)
|
||||||
{
|
{
|
||||||
std::stringstream stream;
|
std::stringstream stream;
|
||||||
stream << "textures/magicitem/caust";
|
stream << "caust";
|
||||||
stream << std::setw(2);
|
stream << std::setw(2);
|
||||||
stream << std::setfill('0');
|
stream << std::setfill('0');
|
||||||
stream << i;
|
stream << i;
|
||||||
stream << ".dds";
|
stream << ".dds";
|
||||||
result[i] = std::move(stream).str();
|
result[i] = prefix / VFS::Path::Normalized(std::move(stream).str());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::array<std::string, 32> glowTextureNames = generateGlowTextureNames();
|
const std::array<VFS::Path::Normalized, 32> glowTextureNames = generateGlowTextureNames();
|
||||||
|
|
||||||
struct FindLowestUnusedTexUnitVisitor : public osg::NodeVisitor
|
struct FindLowestUnusedTexUnitVisitor : public osg::NodeVisitor
|
||||||
{
|
{
|
||||||
|
@ -219,9 +221,9 @@ namespace SceneUtil
|
||||||
const osg::Vec4f& glowColor, float glowDuration)
|
const osg::Vec4f& glowColor, float glowDuration)
|
||||||
{
|
{
|
||||||
std::vector<osg::ref_ptr<osg::Texture2D>> textures;
|
std::vector<osg::ref_ptr<osg::Texture2D>> textures;
|
||||||
for (const std::string& name : glowTextureNames)
|
for (const VFS::Path::Normalized& name : glowTextureNames)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Image> image = resourceSystem->getImageManager()->getImage(VFS::Path::toNormalized(name));
|
osg::ref_ptr<osg::Image> image = resourceSystem->getImageManager()->getImage(name);
|
||||||
osg::ref_ptr<osg::Texture2D> tex(new osg::Texture2D(image));
|
osg::ref_ptr<osg::Texture2D> tex(new osg::Texture2D(image));
|
||||||
tex->setWrap(osg::Texture::WRAP_S, osg::Texture2D::REPEAT);
|
tex->setWrap(osg::Texture::WRAP_S, osg::Texture2D::REPEAT);
|
||||||
tex->setWrap(osg::Texture::WRAP_T, osg::Texture2D::REPEAT);
|
tex->setWrap(osg::Texture::WRAP_T, osg::Texture2D::REPEAT);
|
||||||
|
|
Loading…
Reference in a new issue