summaryrefslogtreecommitdiff
path: root/assetFactory
diff options
context:
space:
mode:
Diffstat (limited to 'assetFactory')
-rw-r--r--assetFactory/assimp.cpp7
-rw-r--r--assetFactory/textureFragment.h2
2 files changed, 9 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);
diff --git a/assetFactory/textureFragment.h b/assetFactory/textureFragment.h
index 75fe96e..e6f07f3 100644
--- a/assetFactory/textureFragment.h
+++ b/assetFactory/textureFragment.h
@@ -1,6 +1,7 @@
#pragma once
#include "gfx/image.h"
+#include "gfx/models/texture.h"
#include "persistence.h"
#include "stdTypeDefs.hpp"
#include "worker.h"
@@ -9,6 +10,7 @@ class TextureFragment : public Persistence::Persistable, public StdTypeDefs<Text
public:
std::string id;
std::string path;
+ TextureOptions::MapMode mapmodeU, mapmodeV;
Worker::WorkPtrT<std::unique_ptr<Image>> image;
private: