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