Fix countershading mirror
parent
5c34ae61ce
commit
59fc43f900
|
@ -333,6 +333,7 @@ nodemesh::Combiner::Mesh *MeshGenerator::combinePartMesh(const QString &partIdSt
|
|||
bool subdived = isTrueValueString(valueOfKeyInMapOrEmpty(part, "subdived"));
|
||||
bool rounded = isTrueValueString(valueOfKeyInMapOrEmpty(part, "rounded"));
|
||||
bool chamfered = isTrueValueString(valueOfKeyInMapOrEmpty(part, "chamfered"));
|
||||
bool countershaded = isTrueValueString(valueOfKeyInMapOrEmpty(part, "countershaded"));
|
||||
QString colorString = valueOfKeyInMapOrEmpty(part, "color");
|
||||
QColor partColor = colorString.isEmpty() ? m_defaultPartColor : QColor(colorString);
|
||||
float deformThickness = 1.0;
|
||||
|
@ -521,6 +522,7 @@ nodemesh::Combiner::Mesh *MeshGenerator::combinePartMesh(const QString &partIdSt
|
|||
outcomeNode.radius = nodeInfo.radius;
|
||||
outcomeNode.color = partColor;
|
||||
outcomeNode.materialId = materialId;
|
||||
outcomeNode.countershaded = countershaded;
|
||||
outcomeNode.colorSolubility = colorSolubility;
|
||||
outcomeNode.boneMark = nodeInfo.boneMark;
|
||||
outcomeNode.mirroredByPartId = mirroredPartIdString;
|
||||
|
|
|
@ -20,6 +20,7 @@ struct OutcomeNode
|
|||
QColor color;
|
||||
float colorSolubility = 0;
|
||||
QUuid materialId;
|
||||
bool countershaded = false;
|
||||
QUuid mirrorFromPartId;
|
||||
QUuid mirroredByPartId;
|
||||
BoneMark boneMark;
|
||||
|
|
|
@ -164,6 +164,7 @@ void TextureGenerator::prepare()
|
|||
return;
|
||||
|
||||
std::map<QUuid, QUuid> updatedMaterialIdMap;
|
||||
std::map<QUuid, bool> updatedCountershadedMap;
|
||||
for (const auto &partIt: m_snapshot->parts) {
|
||||
QUuid materialId;
|
||||
auto materialIdIt = partIt.second.find("materialId");
|
||||
|
@ -171,10 +172,19 @@ void TextureGenerator::prepare()
|
|||
materialId = QUuid(materialIdIt->second);
|
||||
QUuid partId = QUuid(partIt.first);
|
||||
updatedMaterialIdMap.insert({partId, materialId});
|
||||
if (isTrueValueString(valueOfKeyInMapOrEmpty(partIt.second, "countershaded")))
|
||||
m_countershadedPartIds.insert(partId);
|
||||
auto countershadedIt = partIt.second.find("countershaded");
|
||||
if (countershadedIt != partIt.second.end())
|
||||
updatedCountershadedMap.insert({partId, isTrueValueString(countershadedIt->second)});
|
||||
}
|
||||
for (const auto &bmeshNode: m_outcome->nodes) {
|
||||
|
||||
bool countershaded = bmeshNode.countershaded;
|
||||
auto findUpdatedCountershadedMap = updatedCountershadedMap.find(bmeshNode.mirrorFromPartId.isNull() ? bmeshNode.partId : bmeshNode.mirrorFromPartId);
|
||||
if (findUpdatedCountershadedMap != updatedCountershadedMap.end())
|
||||
countershaded = findUpdatedCountershadedMap->second;
|
||||
if (countershaded)
|
||||
m_countershadedPartIds.insert(bmeshNode.partId);
|
||||
|
||||
for (size_t i = 0; i < (int)TextureType::Count - 1; ++i) {
|
||||
TextureType forWhat = (TextureType)(i + 1);
|
||||
MaterialTextures materialTextures;
|
||||
|
|
Loading…
Reference in New Issue