|
|
@ -3,6 +3,7 @@
|
|
|
|
#include <components/nif/node.hpp>
|
|
|
|
#include <components/nif/node.hpp>
|
|
|
|
#include <components/nif/property.hpp>
|
|
|
|
#include <components/nif/property.hpp>
|
|
|
|
#include <components/nifosg/nifloader.hpp>
|
|
|
|
#include <components/nifosg/nifloader.hpp>
|
|
|
|
|
|
|
|
#include <components/resource/bgsmfilemanager.hpp>
|
|
|
|
#include <components/resource/imagemanager.hpp>
|
|
|
|
#include <components/resource/imagemanager.hpp>
|
|
|
|
#include <components/sceneutil/serialize.hpp>
|
|
|
|
#include <components/sceneutil/serialize.hpp>
|
|
|
|
#include <components/vfs/manager.hpp>
|
|
|
|
#include <components/vfs/manager.hpp>
|
|
|
@ -29,6 +30,7 @@ namespace
|
|
|
|
{
|
|
|
|
{
|
|
|
|
VFS::Manager mVfs;
|
|
|
|
VFS::Manager mVfs;
|
|
|
|
Resource::ImageManager mImageManager{ &mVfs, 0 };
|
|
|
|
Resource::ImageManager mImageManager{ &mVfs, 0 };
|
|
|
|
|
|
|
|
Resource::BgsmFileManager mMaterialManager{ &mVfs, 0 };
|
|
|
|
const osgDB::ReaderWriter* mReaderWriter = osgDB::Registry::instance()->getReaderWriterForExtension("osgt");
|
|
|
|
const osgDB::ReaderWriter* mReaderWriter = osgDB::Registry::instance()->getReaderWriterForExtension("osgt");
|
|
|
|
osg::ref_ptr<osgDB::Options> mOptions = new osgDB::Options;
|
|
|
|
osg::ref_ptr<osgDB::Options> mOptions = new osgDB::Options;
|
|
|
|
|
|
|
|
|
|
|
@ -70,7 +72,7 @@ namespace
|
|
|
|
init(node);
|
|
|
|
init(node);
|
|
|
|
Nif::NIFFile file("test.nif");
|
|
|
|
Nif::NIFFile file("test.nif");
|
|
|
|
file.mRoots.push_back(&node);
|
|
|
|
file.mRoots.push_back(&node);
|
|
|
|
auto result = Loader::load(file, &mImageManager, nullptr);
|
|
|
|
auto result = Loader::load(file, &mImageManager, &mMaterialManager);
|
|
|
|
EXPECT_EQ(serialize(*result), R"(
|
|
|
|
EXPECT_EQ(serialize(*result), R"(
|
|
|
|
osg::Group {
|
|
|
|
osg::Group {
|
|
|
|
UniqueID 1
|
|
|
|
UniqueID 1
|
|
|
@ -259,7 +261,7 @@ osg::Group {
|
|
|
|
node.mProperties.push_back(Nif::RecordPtrT<Nif::NiProperty>(&property));
|
|
|
|
node.mProperties.push_back(Nif::RecordPtrT<Nif::NiProperty>(&property));
|
|
|
|
Nif::NIFFile file("test.nif");
|
|
|
|
Nif::NIFFile file("test.nif");
|
|
|
|
file.mRoots.push_back(&node);
|
|
|
|
file.mRoots.push_back(&node);
|
|
|
|
auto result = Loader::load(file, &mImageManager, nullptr);
|
|
|
|
auto result = Loader::load(file, &mImageManager, &mMaterialManager);
|
|
|
|
EXPECT_EQ(serialize(*result), formatOsgNodeForBSShaderProperty(GetParam().mExpectedShaderPrefix));
|
|
|
|
EXPECT_EQ(serialize(*result), formatOsgNodeForBSShaderProperty(GetParam().mExpectedShaderPrefix));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -289,7 +291,7 @@ osg::Group {
|
|
|
|
node.mProperties.push_back(Nif::RecordPtrT<Nif::NiProperty>(&property));
|
|
|
|
node.mProperties.push_back(Nif::RecordPtrT<Nif::NiProperty>(&property));
|
|
|
|
Nif::NIFFile file("test.nif");
|
|
|
|
Nif::NIFFile file("test.nif");
|
|
|
|
file.mRoots.push_back(&node);
|
|
|
|
file.mRoots.push_back(&node);
|
|
|
|
auto result = Loader::load(file, &mImageManager, nullptr);
|
|
|
|
auto result = Loader::load(file, &mImageManager, &mMaterialManager);
|
|
|
|
EXPECT_EQ(serialize(*result), formatOsgNodeForBSLightingShaderProperty(GetParam().mExpectedShaderPrefix));
|
|
|
|
EXPECT_EQ(serialize(*result), formatOsgNodeForBSLightingShaderProperty(GetParam().mExpectedShaderPrefix));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|