Move all the pixel computations to Sprite::compute_pixel_space_point.#2
Conversation
Fix stray character in docs.
# Objective - Refactor ## Solution - Refactor ## Testing - Ran 3d_scene --- ## Migration Guide `RenderCreation::Manual` variant fields are now wrapped in a struct called `RenderResources`
…o a sprite, to the pixel point to sample from.
3612c02 to
6b5a176
Compare
vandie
left a comment
There was a problem hiding this comment.
I think this is likely on the right track tbh
| // Check the alpha is above the cutoff. | ||
| color.alpha() > cutoff | ||
| } | ||
| SpritePickingMode::BoundingBox => true, |
There was a problem hiding this comment.
if you switch to bounding box mode, does this still work. We're not actually using the in rect check anywhere below
There was a problem hiding this comment.
We've already checked that compute_pixel_space_point returns Ok, which means we're in the bounds of the sprite. So we've already done the check.
There was a problem hiding this comment.
I added a comment for this though, since it definitely was confusing.
There was a problem hiding this comment.
Can we try to limit this PR to the change that we're actually trying to accomplish. Including random other changes like the structure of this file will just make it harder to merge the final change
There was a problem hiding this comment.
That just comes from the merge commit. It's already on bevy main.
… in picking_backend. Previously SpriteBackendSettings was private, making it impossible to change the SpritePickingMode. Now we can!
55e9c8c to
f46f67c
Compare
|
Ok apparently I'm being gaslit. This doesn't seem to be working correctly anymore?? I had tested it visually, but doing it now produces the wrong results. I need to investigate. |
This is already taken care of in `compute_pixel_space_point`.
|
Fixed the above issue. I must have broken things as I was cleaning up my commits. I also tested using the |
This matches the `SpritePickingPlugin`.
I merged, and then added 2 commits on top. The first is a function to compute where in the texture a sprite point is. The second is rewriting the picking backend to take advantage of this. I tested this with the
sprite_pickingexample and it seems to work quite well! Note this isn't just a move: I rewrote the logic. I've taken some of the logic fromcrates\bevy_sprite\src\render\mod.rs:406and mixed in some of my own ideas. Hopefully this is more clear and also handles more cases!I haven't dug in to figuring out SpriteImageMode yet, so that might be the next step.
PS: I goofed and originally set it to merge to your main rather than your PR.