diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-13 02:20:50 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-13 02:20:50 +0100 |
commit | 1b97b7b4cb126c8b60ac1acbd7e72274f0ddf21f (patch) | |
tree | 5271470d667c2d1b3372848d60bbcb04a011f2fe /assetFactory/style.cpp | |
parent | Add missing forward declaration (diff) | |
download | ilt-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.cpp | 9 |
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)) { |