diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-10 18:45:13 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-10 18:45:13 +0100 |
commit | b25bc3cc32c5a9057c66ad282fa1cdfe0ed6094a (patch) | |
tree | 469ffd495b9114ff7f7a7ccca75e4a1977c1f662 /assetFactory/assetFactory.cpp | |
parent | Support loading textures from an in memory buffer (diff) | |
download | ilt-b25bc3cc32c5a9057c66ad282fa1cdfe0ed6094a.tar.bz2 ilt-b25bc3cc32c5a9057c66ad282fa1cdfe0ed6094a.tar.xz ilt-b25bc3cc32c5a9057c66ad282fa1cdfe0ed6094a.zip |
First cut loading assets using assimp
This is far from perfect, specifically the created texture atlas is not compatibile with wrapping texture UVs
Diffstat (limited to 'assetFactory/assetFactory.cpp')
-rw-r--r-- | assetFactory/assetFactory.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/assetFactory/assetFactory.cpp b/assetFactory/assetFactory.cpp index ec0e19f..917edfe 100644 --- a/assetFactory/assetFactory.cpp +++ b/assetFactory/assetFactory.cpp @@ -109,7 +109,7 @@ AssetFactory::createTexutre() const std::transform( textureFragments.begin(), textureFragments.end(), std::back_inserter(imageSizes), [](const auto & tf) { return TexturePacker::Image {tf.second->image->width, tf.second->image->height}; - }); + }); const auto [layout, outSize] = TexturePacker {imageSizes}.pack(); // * create texture texture = std::make_shared<Texture>(outSize.x, outSize.y, TextureOptions {.wrap = GL_CLAMP_TO_EDGE}); @@ -134,7 +134,8 @@ AssetFactory::persist(Persistence::PersistenceStore & store) using MapObjects = Persistence::MapByMember<Shapes, std::shared_ptr<Object>>; using MapAssets = Persistence::MapByMember<Assets>; using MapTextureFragments = Persistence::MapByMember<TextureFragments>; + using MapAssImp = Persistence::MapByMember<AssImps, std::shared_ptr<AssImp>, &AssImp::path>; return STORE_TYPE && STORE_NAME_HELPER("object", shapes, MapObjects) && STORE_NAME_HELPER("textureFragment", textureFragments, MapTextureFragments) - && STORE_NAME_HELPER("asset", assets, MapAssets); + && STORE_NAME_HELPER("assimp", assimps, MapAssImp) && STORE_NAME_HELPER("asset", assets, MapAssets); } |