Skip to content

Commit

Permalink
Merge pull request #61366 from Calinou/textmesh-improve-decomposition…
Browse files Browse the repository at this point in the history
…-error-message-3.x
  • Loading branch information
akien-mga authored May 24, 2022
2 parents 12fbc08 + 011ff93 commit c7d2805
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scene/resources/primitive_meshes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1793,18 +1793,18 @@ void TextMesh::_generate_glyph_mesh_data(uint32_t p_utf32_char, const Ref<Font>
//Decompose and triangulate.
List<TriangulatorPoly> out_poly;
if (tpart.ConvexPartition_HM(&in_poly, &out_poly) == 0) {
ERR_FAIL_MSG("Convex decomposing failed!");
ERR_FAIL_MSG("Convex decomposing failed. Make sure the font doesn't contain self-intersecting lines, as these are not supported in TextMesh.");
}
List<TriangulatorPoly> out_tris;
for (List<TriangulatorPoly>::Element *I = out_poly.front(); I; I = I->next()) {
if (tpart.Triangulate_OPT(&(I->get()), &out_tris) == 0) {
ERR_FAIL_MSG("Triangulation failed!");
ERR_FAIL_MSG("Triangulation failed. Make sure the font doesn't contain self-intersecting lines, as these are not supported in TextMesh.");
}
}

for (List<TriangulatorPoly>::Element *I = out_tris.front(); I; I = I->next()) {
TriangulatorPoly &tp = I->get();
ERR_FAIL_COND(tp.GetNumPoints() != 3); // Trianges only.
ERR_FAIL_COND(tp.GetNumPoints() != 3); // Triangles only.

for (int i = 0; i < 3; i++) {
gl_data.triangles.push_back(Vector2(tp.GetPoint(i).x, tp.GetPoint(i).y));
Expand Down

0 comments on commit c7d2805

Please sign in to comment.