pmndrs / drei

🥉 useful helpers for react-three-fiber
https://docs.pmnd.rs/drei
MIT License
8.26k stars 682 forks source link

feat/add scale ratio for useSpriteLoader #2002

Closed netgfx closed 3 months ago

netgfx commented 3 months ago

Why

useSpriteLoader now has the ability to support trimmed spritesheets as it calculates the largest frame and adds a scale-ratio for the rest, this way the texture can be scaled up and down in order to match its initial size (something that we get for free when dealing with same size frames). This is a big improvement as we can now support trimmed sprites to reduce memory usage.

What

Added an extra property per frame called scaleRatio which has a value between 0 and 1 depending on the size of the frame when compared to the largest frame, it will be 1 when dealing with same size frames.

Checklist

vercel[bot] commented 3 months ago

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 Jun 20, 2024 2:44pm
codesandbox-ci[bot] commented 3 months ago

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.

github-actions[bot] commented 3 months ago

:tada: This PR is included in version 9.107.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: