#include "reader.hpp" #include #include #include #include "file.hpp" #include "stream.hpp" namespace Bgsm { void Reader::parse(Files::IStreamPtr&& inputStream) { BGSMStream stream(*this, std::move(inputStream)); std::array signature; stream.readArray(signature); std::string shaderType(signature.data(), 4); if (shaderType == "BGEM") { mFile = std::make_unique(); mFile->mShaderType = Bgsm::ShaderType::Effect; } else if (shaderType == "BGSM") { mFile = std::make_unique(); mFile->mShaderType = Bgsm::ShaderType::Lighting; } else throw std::runtime_error("Invalid material file"); mFile->read(stream); } }