diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-03-14 19:16:57 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-03-14 19:18:30 +0000 |
commit | 3fea21a2d8f2aa67fd212837fe7e09e4f29ad515 (patch) | |
tree | 2c7a212745ddda5d55caf0cfd3c85b2cb39c15b5 /assetFactory/style.cpp | |
parent | Add postLoad support to persistence (diff) | |
download | ilt-3fea21a2d8f2aa67fd212837fe7e09e4f29ad515.tar.bz2 ilt-3fea21a2d8f2aa67fd212837fe7e09e4f29ad515.tar.xz ilt-3fea21a2d8f2aa67fd212837fe7e09e4f29ad515.zip |
Support creating a super texture from fragments
Currently makes wild assumptions about vertices and doesn't actually populate the texture, it's just grey
Diffstat (limited to 'assetFactory/style.cpp')
-rw-r--r-- | assetFactory/style.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/assetFactory/style.cpp b/assetFactory/style.cpp index b5ddcf1..8aecc71 100644 --- a/assetFactory/style.cpp +++ b/assetFactory/style.cpp @@ -19,8 +19,21 @@ void Style::applyStyle( ModelFactoryMesh & mesh, const ModelFactoryMesh::FaceHandle & face, EffectiveColour effectiveColour) const { - if (effectiveColour.has_value()) { - mesh.set_color(face, effectiveColour->get()); + if (texture.empty()) { + if (effectiveColour.has_value()) { + mesh.set_color(face, effectiveColour->get()); + } + } + else { + mesh.set_color(face, {}); + if (auto mf = Persistence::ParseBase::getShared<const AssetFactory>("assetFactory")) { + auto coords = mf->getTextureCoords(texture); + auto coord = coords.begin(); + // Wild assumption that face is a quad and the texture should apply linearly + for (const auto & vh : mesh.fv_range(face)) { + mesh.set_texcoord2D(vh, *coord++); + } + } } } |