Skip to content

Feat/use sprite loader spritesheet grid detection #1971

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

Conversation

netgfx
Copy link
Contributor

@netgfx netgfx commented May 31, 2024

Why

useSpriteLoader now can support multi-rows/columns single spritesheets that don't come with .json descriptor files. It also detects and returns rows and columns as meta information, this is useful in various scenarios

What

I added a function that can detect rows, columns, frame-width and frame-height from the given texture.image and the number of frames of the spritesheet. The solution also heuristically tries to detect empty frames on the spritesheet and exclude them from the total rows and columns count.

Checklist

  • [x ] Documentation updated (example)
  • Storybook entry added (example)
  • [ x] Ready to be merged

No changes needed on the API, this function works internally.

Copy link

vercel bot commented May 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
drei ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 31, 2024 10:25am

Copy link

codesandbox-ci bot commented May 31, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@netgfx netgfx merged commit 410d657 into pmndrs:master May 31, 2024
4 checks passed
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.

1 participant