Skip to content
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

Refactor isRenderable detection #479

Merged
merged 3 commits into from
Jan 10, 2025
Merged

Refactor isRenderable detection #479

merged 3 commits into from
Jan 10, 2025

Conversation

wouterlucas
Copy link
Contributor

✨ What changed? ✨

  • Decouple isRenderable from hasRenderableOwner as textures can be loaded asynchronously.
  • Refactored the isRenderable detection:
    • If a node has alpha = 0 or is off screen its not renderable
    • If a node has dimensions and color properties, its marked renderable and we assume its a ColorTexture.
    • If a node has a texture, it will be marked as a renderable owner. Which will trigger loading of the texture (if its the first owner)
      • If the texture is loaded, it is marked renderable
  • On renderQuads we assume everything has a texture if not we set the defaultTexture for 1x1 sampling. This is implicit but matches the old behaviour.
  • CoreTextNode overwrites behaviour and checks for text !== ''.
  • Also fixed a bug where the default texture was still loading but already referenced.
  • Added a CoreNode unit test to validate this more rapidly.

🔧 Addresses the following
Fixes #477

@wouterlucas wouterlucas added this to the 2.9.0 release milestone Jan 9, 2025
src/core/CoreNode.ts Show resolved Hide resolved
src/core/CoreNode.ts Outdated Show resolved Hide resolved
src/core/CoreNode.ts Show resolved Hide resolved
@wouterlucas wouterlucas added this pull request to the merge queue Jan 10, 2025
Merged via the queue into main with commit ad55881 Jan 10, 2025
2 checks passed
@wouterlucas wouterlucas deleted the refactor/isRenderable branch January 10, 2025 17:40
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.

All nodes are renderable
3 participants