diff --git a/fggl/data/assimp/module.cpp b/fggl/data/assimp/module.cpp index afa6b5fb106f887046b6e30be97da0e2d18e6c96..b8d370742b09466b67a2170364449d25510615e3 100644 --- a/fggl/data/assimp/module.cpp +++ b/fggl/data/assimp/module.cpp @@ -139,7 +139,7 @@ namespace fggl::data::models { } - static assets::AssetRefRaw load_assimp_model(assets::Loader* loader, const assets::AssetID& guid, const assets::LoaderContext& data, void* userPtr) { + assets::AssetRefRaw load_assimp_model(assets::Loader* loader, const assets::AssetID& guid, const assets::LoaderContext& data, void* userPtr) { // auto *filePath = std::get<assets::AssetPath *>(data); assets::AssetManager* manager = (assets::AssetManager*)userPtr; auto filePath = data.assetPath; @@ -191,7 +191,7 @@ namespace fggl::data::models { return nullptr; } - static assets::AssetRefRaw load_assimp_texture(assets::Loader* loader, const assets::AssetID& guid, const assets::LoaderContext& data, void* userPtr) { + assets::AssetRefRaw load_assimp_texture(assets::Loader* loader, const assets::AssetID& guid, const assets::LoaderContext& data, void* userPtr) { assets::AssetManager* manager = (assets::AssetManager*)userPtr; if ( manager->has(guid) ) { @@ -217,7 +217,7 @@ namespace fggl::data::models { return nullptr; } - static bool load_tex_stb(std::filesystem::path filePath, assets::MemoryBlock& block) { + bool load_tex_stb(std::filesystem::path filePath, assets::MemoryBlock& block) { stbi_set_flip_vertically_on_load(true); //load the texture data into memory @@ -238,7 +238,7 @@ namespace fggl::data::models { } } - static assets::AssetTypeID is_tex_stb(std::filesystem::path filePath) { + assets::AssetTypeID is_tex_stb(std::filesystem::path filePath) { // detect jpgs if ( filePath.extension() == ".jpg" || filePath.extension() == ".jpeg" ) { return TEXTURE_RGBA; @@ -252,7 +252,7 @@ namespace fggl::data::models { return assets::INVALID_ASSET_TYPE; } - static assets::AssetTypeID is_model_assimp(std::filesystem::path filePath) { + assets::AssetTypeID is_model_assimp(std::filesystem::path filePath) { if ( filePath.extension() == ".obj" ){ return MODEL_MULTI3D; } @@ -260,7 +260,7 @@ namespace fggl::data::models { return assets::INVALID_ASSET_TYPE; } - static bool extract_requirements(const std::string& packName, std::filesystem::path packRoot, assets::ResourceRecord& rr) { + bool extract_requirements(const std::string& packName, std::filesystem::path packRoot, assets::ResourceRecord& rr) { Assimp::Importer importer; const aiScene *scene = importer.ReadFile( rr.m_path, aiProcess_Triangulate | aiProcess_FlipUVs); if ( !scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode ) { @@ -304,6 +304,7 @@ namespace fggl::data::models { checkin->setLoader( MIME_OBJ, assets::NEEDS_CHECKIN, is_model_assimp ); checkin->setProcessor( MIME_OBJ, extract_requirements); + return false; } } diff --git a/include/fggl/data/assimp/module.hpp b/include/fggl/data/assimp/module.hpp index d5c40dbf56fdc0c77cee9bf7842ddc8766f3c9c7..3a7f71f9b1cad1d3c62b57f199a53be14068c8b8 100644 --- a/include/fggl/data/assimp/module.hpp +++ b/include/fggl/data/assimp/module.hpp @@ -36,6 +36,18 @@ namespace fggl::data::models { constexpr auto MODEL_MULTI3D = assets::make_asset_type("model/multi3D"); constexpr auto TEXTURE_RGBA = assets::make_asset_type("texture/rgba"); + // old-style loaders + assets::AssetRefRaw load_assimp_model(assets::Loader* loader, const assets::AssetID& guid, const assets::LoaderContext& data, void* userPtr); + assets::AssetRefRaw load_assimp_texture(assets::Loader* loader, const assets::AssetID& guid, const assets::LoaderContext& data, void* userPtr); + + // new style loaders (textures) + bool load_tex_stb(std::filesystem::path filePath, assets::MemoryBlock& block); + static assets::AssetTypeID is_tex_stb(std::filesystem::path filePath); + + // new style loaders (models) + assets::AssetTypeID is_model_assimp(std::filesystem::path filePath); + bool extract_requirements(const std::string& packName, std::filesystem::path packRoot, assets::ResourceRecord& rr); + struct AssimpModule { constexpr static const char *name = "fggl::data::Assimp"; constexpr static const std::array<modules::ModuleService, 1> provides = {