Skip to content

Skip adding degenerate faces in textToModel #7951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2025

Conversation

davepagurek
Copy link
Contributor

@davepagurek davepagurek commented Jul 4, 2025

Addresses one case of #4791

While this warning generally indicates a problem with the user's vertex input, we also get this warning sometimes when calling font.textToModel(). In this case, there's nothing the user can do about it, so the warning is distracting and misleading. While this doesn't fully deal with that warning happening more often than it should, this resolves the textToModel case.

(EDIT: maybe this actually does fully resolve the original issue? Looking back at it, the original sketch in question was also triangulating a font. Now that we have a way to do this internally that doesn't create warnings, the rest is likely user input issues.)

Changes:

  • Adds a _validateFaces flag which, when set to true, checks if faces are valid before adding them to a p5.Geometry
    • Currently this is only used for internal triangulated shapes, so the checking is not yet done in TRIANGLE_STRIP mode.
  • Turns on this flag while generating models of text, as this uses triangulation and may get a warning after calling computeNormals otherwise.

Before:
image

After:
image

Live: https://editor.p5js.org/davepagurek/sketches/zOmI5K3__ (try toggling the script tag to 2.0.3 in index.html)

PR Checklist

Copy link
Collaborator

@perminder-17 perminder-17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me :)

@perminder-17 perminder-17 merged commit 3333411 into dev-2.0 Jul 7, 2025
5 checks passed
@perminder-17 perminder-17 deleted the fix/textToModel-warnings branch July 7, 2025 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants