summaryrefslogtreecommitdiff
path: root/assetFactory/style.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'assetFactory/style.cpp')
-rw-r--r--assetFactory/style.cpp17
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++);
+ }
+ }
}
}