summaryrefslogtreecommitdiff
path: root/assetFactory/style.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-04-13 02:20:50 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-04-13 02:20:50 +0100
commit1b97b7b4cb126c8b60ac1acbd7e72274f0ddf21f (patch)
tree5271470d667c2d1b3372848d60bbcb04a011f2fe /assetFactory/style.cpp
parentAdd missing forward declaration (diff)
downloadilt-1b97b7b4cb126c8b60ac1acbd7e72274f0ddf21f.tar.bz2
ilt-1b97b7b4cb126c8b60ac1acbd7e72274f0ddf21f.tar.xz
ilt-1b97b7b4cb126c8b60ac1acbd7e72274f0ddf21f.zip
Use texture atlas for asset factory
Diffstat (limited to 'assetFactory/style.cpp')
-rw-r--r--assetFactory/style.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/assetFactory/style.cpp b/assetFactory/style.cpp
index 12346a6..ea67fc2 100644
--- a/assetFactory/style.cpp
+++ b/assetFactory/style.cpp
@@ -30,7 +30,14 @@ Style::applyStyle(
else {
mesh.set_color(face, {});
if (auto mf = Persistence::ParseBase::getShared<const AssetFactory>("assetFactory")) {
- auto coords = mf->getTextureCoords(texture);
+ const auto material = mf->getMaterialIndex(texture);
+ mesh.property(mesh.materialFaceProperty, face) = material;
+ static constexpr std::array<ModelFactoryTraits::TexCoord2D, 4> coords {{
+ {0.f, 0.f},
+ {1.f, 0.f},
+ {1.f, 1.f},
+ {0.f, 1.f},
+ }};
auto coord = coords.begin();
// Wild assumption that face is a quad and the texture should apply linearly
for (const auto & heh : mesh.fh_range(face)) {