Skip generating tile pieces if a color variant is invalid
This commit is contained in:
parent
f09b54b7e9
commit
38910aeead
@ -292,7 +292,9 @@ bool TilePainter::produceTerrainPrimitives(HashMap<QuadZLevel, List<RenderPrimit
|
|||||||
terrainLayer == TerrainLayer::Background ? TileLayer::Background : TileLayer::Foreground, false);
|
terrainLayer == TerrainLayer::Background ? TileLayer::Background : TileLayer::Foreground, false);
|
||||||
for (auto const& piecePair : pieces) {
|
for (auto const& piecePair : pieces) {
|
||||||
TexturePtr texture = getPieceTexture(material, piecePair.first, materialHue, false);
|
TexturePtr texture = getPieceTexture(material, piecePair.first, materialHue, false);
|
||||||
RectF textureCoords = piecePair.first->variants.get(materialColorVariant).wrap(variance);
|
auto variant = piecePair.first->variants.ptr(materialColorVariant);
|
||||||
|
if (!variant) continue;
|
||||||
|
RectF textureCoords = variant->wrap(variance);
|
||||||
RectF worldCoords = RectF::withSize(piecePair.second / TilePixels + Vec2F(pos), textureCoords.size() / TilePixels);
|
RectF worldCoords = RectF::withSize(piecePair.second / TilePixels + Vec2F(pos), textureCoords.size() / TilePixels);
|
||||||
quadList.emplace_back(std::in_place_type_t<RenderQuad>(), move(texture),
|
quadList.emplace_back(std::in_place_type_t<RenderQuad>(), move(texture),
|
||||||
worldCoords .min(),
|
worldCoords .min(),
|
||||||
@ -317,7 +319,9 @@ bool TilePainter::produceTerrainPrimitives(HashMap<QuadZLevel, List<RenderPrimit
|
|||||||
terrainLayer == TerrainLayer::Background ? TileLayer::Background : TileLayer::Foreground, true);
|
terrainLayer == TerrainLayer::Background ? TileLayer::Background : TileLayer::Foreground, true);
|
||||||
for (auto const& piecePair : pieces) {
|
for (auto const& piecePair : pieces) {
|
||||||
auto texture = getPieceTexture(mod, piecePair.first, modHue, true);
|
auto texture = getPieceTexture(mod, piecePair.first, modHue, true);
|
||||||
auto& textureCoords = piecePair.first->variants.get(modColorVariant).wrap(variance);
|
auto variant = piecePair.first->variants.ptr(modColorVariant);
|
||||||
|
if (!variant) continue;
|
||||||
|
auto& textureCoords = variant->wrap(variance);
|
||||||
RectF worldCoords = RectF::withSize(piecePair.second / TilePixels + Vec2F(pos), textureCoords.size() / TilePixels);
|
RectF worldCoords = RectF::withSize(piecePair.second / TilePixels + Vec2F(pos), textureCoords.size() / TilePixels);
|
||||||
quadList.emplace_back(std::in_place_type_t<RenderQuad>(), move(texture),
|
quadList.emplace_back(std::in_place_type_t<RenderQuad>(), move(texture),
|
||||||
worldCoords.min(), textureCoords.min(),
|
worldCoords.min(), textureCoords.min(),
|
||||||
|
Loading…
Reference in New Issue
Block a user