You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-02 16:48:55 +00:00
Print better manifold errors and avoid crash on non manifold csg input.
* Manifold does not have a snap property. * Tolerance means simplification amount. * CSG snap has been removed * Add better error messages. * Verbose print manifold meshgl64 properties as json. * Update manifold for error fixes
This commit is contained in:
11
thirdparty/manifold/src/impl.cpp
vendored
11
thirdparty/manifold/src/impl.cpp
vendored
@@ -194,13 +194,14 @@ int GetLabels(std::vector<int>& components,
|
||||
}
|
||||
|
||||
void DedupePropVerts(manifold::Vec<ivec3>& triProp,
|
||||
const Vec<std::pair<int, int>>& vert2vert) {
|
||||
const Vec<std::pair<int, int>>& vert2vert,
|
||||
size_t numPropVert) {
|
||||
ZoneScoped;
|
||||
std::vector<int> vertLabels;
|
||||
const int numLabels = GetLabels(vertLabels, vert2vert, vert2vert.size());
|
||||
const int numLabels = GetLabels(vertLabels, vert2vert, numPropVert);
|
||||
|
||||
std::vector<int> label2vert(numLabels);
|
||||
for (size_t v = 0; v < vert2vert.size(); ++v) label2vert[vertLabels[v]] = v;
|
||||
for (size_t v = 0; v < numPropVert; ++v) label2vert[vertLabels[v]] = v;
|
||||
for (auto& prop : triProp)
|
||||
for (int i : {0, 1, 2}) prop[i] = label2vert[vertLabels[prop[i]]];
|
||||
}
|
||||
@@ -343,6 +344,8 @@ void Manifold::Impl::CreateFaces() {
|
||||
const int prop1 =
|
||||
meshRelation_
|
||||
.triProperties[pairFace][jointNum == 2 ? 0 : jointNum + 1];
|
||||
if (prop0 == prop1) return;
|
||||
|
||||
bool propEqual = true;
|
||||
for (size_t p = 0; p < numProp; ++p) {
|
||||
if (meshRelation_.properties[numProp * prop0 + p] !=
|
||||
@@ -355,7 +358,7 @@ void Manifold::Impl::CreateFaces() {
|
||||
vert2vert[edgeIdx] = std::make_pair(prop0, prop1);
|
||||
}
|
||||
});
|
||||
DedupePropVerts(meshRelation_.triProperties, vert2vert);
|
||||
DedupePropVerts(meshRelation_.triProperties, vert2vert, NumPropVert());
|
||||
}
|
||||
|
||||
for_each_n(autoPolicy(halfedge_.size(), 1e4), countAt(0), halfedge_.size(),
|
||||
|
||||
Reference in New Issue
Block a user