diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-14 16:36:22 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-14 16:36:22 +0100 |
commit | 32a2da41e0946c1d6d364b7763d1829bfa8b74db (patch) | |
tree | bb7c1014d204dabfcf10cd88623c1f7996b6f049 /assetFactory/assimp.cpp | |
parent | Define our own enum for texture mapmode (diff) | |
download | ilt-32a2da41e0946c1d6d364b7763d1829bfa8b74db.tar.bz2 ilt-32a2da41e0946c1d6d364b7763d1829bfa8b74db.tar.xz ilt-32a2da41e0946c1d6d364b7763d1829bfa8b74db.zip |
Configure texture fragment mapmode from material
Diffstat (limited to 'assetFactory/assimp.cpp')
-rw-r--r-- | assetFactory/assimp.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/assetFactory/assimp.cpp b/assetFactory/assimp.cpp index 9a49717..840c5a9 100644 --- a/assetFactory/assimp.cpp +++ b/assetFactory/assimp.cpp @@ -85,6 +85,11 @@ public: } }; +static_assert(TextureOptions::MapMode::Repeat == static_cast<TextureOptions::MapMode>(aiTextureMapMode_Wrap)); +static_assert(TextureOptions::MapMode::Clamp == static_cast<TextureOptions::MapMode>(aiTextureMapMode_Clamp)); +static_assert(TextureOptions::MapMode::Decal == static_cast<TextureOptions::MapMode>(aiTextureMapMode_Decal)); +static_assert(TextureOptions::MapMode::Mirror == static_cast<TextureOptions::MapMode>(aiTextureMapMode_Mirror)); + void AssImp::postLoad() { @@ -107,6 +112,8 @@ AssImp::postLoad() auto texture = std::make_shared<TextureFragment>(); texture->id = m->GetName().C_Str(); texture->path = path.C_Str(); + m->Get(AI_MATKEY_MAPPINGMODE_U_DIFFUSE(0), texture->mapmodeU); + m->Get(AI_MATKEY_MAPPINGMODE_V_DIFFUSE(0), texture->mapmodeV); texture->image = Worker::addWork([t = scene->GetEmbeddedTexture(path.C_Str())]() { return std::make_unique<Image>( std::span {reinterpret_cast<unsigned char *>(t->pcData), t->mWidth}, STBI_rgb_alpha); |