diff options
Diffstat (limited to 'intern/mikktspace/mikktspace.hh')
-rw-r--r-- | intern/mikktspace/mikktspace.hh | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/intern/mikktspace/mikktspace.hh b/intern/mikktspace/mikktspace.hh index 2e5b0b065a8..e2c7084566f 100644 --- a/intern/mikktspace/mikktspace.hh +++ b/intern/mikktspace/mikktspace.hh @@ -178,24 +178,30 @@ template<typename Mesh> class Mikktspace { // put the degenerate triangles last. degenPrologue(); - // evaluate triangle level attributes and neighbor list - initTriangle(); + if (nrTriangles == 0) { + // No point in building tangents if there are no non-degenerate triangles, so just zero them + tSpaces.resize(nrTSpaces); + } + else { + // evaluate triangle level attributes and neighbor list + initTriangle(); - // match up edge pairs - buildNeighbors(); + // match up edge pairs + buildNeighbors(); - // based on the 4 rules, identify groups based on connectivity - build4RuleGroups(); + // based on the 4 rules, identify groups based on connectivity + build4RuleGroups(); - // make tspaces, each group is split up into subgroups. - // Finally a tangent space is made for every resulting subgroup - generateTSpaces(); + // make tspaces, each group is split up into subgroups. + // Finally a tangent space is made for every resulting subgroup + generateTSpaces(); - // degenerate quads with one good triangle will be fixed by copying a space from - // the good triangle to the coinciding vertex. - // all other degenerate triangles will just copy a space from any good triangle - // with the same welded index in vertices[]. - degenEpilogue(); + // degenerate quads with one good triangle will be fixed by copying a space from + // the good triangle to the coinciding vertex. + // all other degenerate triangles will just copy a space from any good triangle + // with the same welded index in vertices[]. + degenEpilogue(); + } uint index = 0; for (uint f = 0; f < nrFaces; f++) { |