|
|
|
@ -545,9 +545,9 @@ namespace Resource
|
|
|
|
|
namespace
|
|
|
|
|
{
|
|
|
|
|
osg::ref_ptr<osg::Node> loadNonNif(
|
|
|
|
|
const std::string& normalizedFilename, std::istream& model, Resource::ImageManager* imageManager)
|
|
|
|
|
VFS::Path::NormalizedView normalizedFilename, std::istream& model, Resource::ImageManager* imageManager)
|
|
|
|
|
{
|
|
|
|
|
auto ext = Misc::getFileExtension(normalizedFilename);
|
|
|
|
|
const std::string_view ext = Misc::getFileExtension(normalizedFilename.value());
|
|
|
|
|
osgDB::ReaderWriter* reader = osgDB::Registry::instance()->getReaderWriterForExtension(std::string(ext));
|
|
|
|
|
if (!reader)
|
|
|
|
|
{
|
|
|
|
@ -566,7 +566,7 @@ namespace Resource
|
|
|
|
|
if (ext == "dae")
|
|
|
|
|
options->setOptionString("daeUseSequencedTextureUnits");
|
|
|
|
|
|
|
|
|
|
const std::array<std::uint64_t, 2> fileHash = Files::getHash(normalizedFilename, model);
|
|
|
|
|
const std::array<std::uint64_t, 2> fileHash = Files::getHash(normalizedFilename.value(), model);
|
|
|
|
|
|
|
|
|
|
osgDB::ReaderWriter::ReadResult result = reader->readNode(model, options);
|
|
|
|
|
if (!result.success())
|
|
|
|
@ -721,10 +721,10 @@ namespace Resource
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
osg::ref_ptr<osg::Node> load(const std::string& normalizedFilename, const VFS::Manager* vfs,
|
|
|
|
|
osg::ref_ptr<osg::Node> load(VFS::Path::NormalizedView normalizedFilename, const VFS::Manager* vfs,
|
|
|
|
|
Resource::ImageManager* imageManager, Resource::NifFileManager* nifFileManager)
|
|
|
|
|
{
|
|
|
|
|
auto ext = Misc::getFileExtension(normalizedFilename);
|
|
|
|
|
const std::string_view ext = Misc::getFileExtension(normalizedFilename.value());
|
|
|
|
|
if (ext == "nif")
|
|
|
|
|
return NifOsg::Loader::load(*nifFileManager->get(normalizedFilename), imageManager);
|
|
|
|
|
else if (ext == "spt")
|
|
|
|
@ -843,11 +843,12 @@ namespace Resource
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
VFS::Path::Normalized path("meshes/marker_error.****");
|
|
|
|
|
for (const auto meshType : { "nif", "osg", "osgt", "osgb", "osgx", "osg2", "dae" })
|
|
|
|
|
{
|
|
|
|
|
const std::string normalized = "meshes/marker_error." + std::string(meshType);
|
|
|
|
|
if (mVFS->exists(normalized))
|
|
|
|
|
return load(normalized, mVFS, mImageManager, mNifFileManager);
|
|
|
|
|
path.changeExtension(meshType);
|
|
|
|
|
if (mVFS->exists(path))
|
|
|
|
|
return load(path, mVFS, mImageManager, mNifFileManager);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (const std::exception& e)
|
|
|
|
@ -869,7 +870,7 @@ namespace Resource
|
|
|
|
|
|
|
|
|
|
osg::ref_ptr<const osg::Node> SceneManager::getTemplate(std::string_view name, bool compile)
|
|
|
|
|
{
|
|
|
|
|
std::string normalized = VFS::Path::normalizeFilename(name);
|
|
|
|
|
const VFS::Path::Normalized normalized(name);
|
|
|
|
|
|
|
|
|
|
osg::ref_ptr<osg::Object> obj = mCache->getRefFromObjectCache(normalized);
|
|
|
|
|
if (obj)
|
|
|
|
|