Fix document reset
parent
ce128bff1e
commit
8b8579d02e
|
@ -67,9 +67,18 @@ void BoneGenerator::process()
|
||||||
previewTriangleNormals,
|
previewTriangleNormals,
|
||||||
0,
|
0,
|
||||||
&previewTriangleVertexNormals);
|
&previewTriangleVertexNormals);
|
||||||
|
std::vector<std::tuple<dust3d::Color, float /*metalness*/, float /*roughness*/>> vertexProperties(it.second.vertexColors.size());
|
||||||
|
for (size_t i = 0; i < vertexProperties.size(); ++i) {
|
||||||
|
vertexProperties[i] = std::make_tuple(it.second.vertexColors[i],
|
||||||
|
(float)0.0, (float)1.0);
|
||||||
|
}
|
||||||
(*m_bonePreviewMeshes)[it.first] = std::make_unique<ModelMesh>(it.second.vertices,
|
(*m_bonePreviewMeshes)[it.first] = std::make_unique<ModelMesh>(it.second.vertices,
|
||||||
it.second.triangles,
|
it.second.triangles,
|
||||||
previewTriangleVertexNormals);
|
previewTriangleVertexNormals,
|
||||||
|
dust3d::Color::createWhite(),
|
||||||
|
(float)0.0,
|
||||||
|
(float)1.0,
|
||||||
|
&vertexProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "The bone generation took" << countTimeConsumed.elapsed() << "milliseconds";
|
qDebug() << "The bone generation took" << countTimeConsumed.elapsed() << "milliseconds";
|
||||||
|
|
|
@ -2058,6 +2058,8 @@ void Document::silentReset()
|
||||||
partMap.clear();
|
partMap.clear();
|
||||||
componentMap.clear();
|
componentMap.clear();
|
||||||
rootComponent = Document::Component();
|
rootComponent = Document::Component();
|
||||||
|
boneMap.clear();
|
||||||
|
boneIdList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::reset()
|
void Document::reset()
|
||||||
|
|
|
@ -171,6 +171,7 @@ void BoneGenerator::addBonePreviewTriangle(BonePreview& bonePreview,
|
||||||
oldToNewVertexMap.insert(std::make_pair(triangle[i], bonePreview.vertices.size()));
|
oldToNewVertexMap.insert(std::make_pair(triangle[i], bonePreview.vertices.size()));
|
||||||
newTriangle[i] = bonePreview.vertices.size();
|
newTriangle[i] = bonePreview.vertices.size();
|
||||||
bonePreview.vertices.push_back(m_vertices[triangle[i]]);
|
bonePreview.vertices.push_back(m_vertices[triangle[i]]);
|
||||||
|
bonePreview.vertexColors.push_back(Color(1.0, 1.0, 1.0));
|
||||||
} else {
|
} else {
|
||||||
newTriangle[i] = findVertex->second;
|
newTriangle[i] = findVertex->second;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ public:
|
||||||
struct BonePreview {
|
struct BonePreview {
|
||||||
std::vector<Vector3> vertices;
|
std::vector<Vector3> vertices;
|
||||||
std::vector<std::vector<size_t>> triangles;
|
std::vector<std::vector<size_t>> triangles;
|
||||||
|
std::vector<Color> vertexColors;
|
||||||
};
|
};
|
||||||
|
|
||||||
BoneGenerator();
|
BoneGenerator();
|
||||||
|
|
Loading…
Reference in New Issue