-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Add optional transparency passthrough for sprite backend with bevy_picking #16388
base: main
Are you sure you want to change the base?
Add optional transparency passthrough for sprite backend with bevy_picking #16388
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m excited for this change. I did a quick visual code review but haven’t tested it yet.
/// Off by default for backwards compatibility. This setting is provided to give you fine-grained | ||
/// control over if transparency on sprites is ignored. | ||
pub passthrough_transparency: bool, | ||
/// How Opaque does part of a sprite need to be in order count as none-transparent (defaults to 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate in the docs what the units are? 10 what? What is a valid range I could use, as a user?
#[reflect(Resource, Default)] | ||
pub struct SpriteBackendSettings { | ||
/// When set to `true` picking will ignore any part of a sprite which is transparent | ||
/// Off by default for backwards compatibility. This setting is provided to give you fine-grained |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is mainly off by default for performance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest with you, I didn't want it to change the default behaviour in a way that would break existing use cases. I tend to favour opt in than opt out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just saw/remembered per the linked issue @alice-i-cecile seems to suggest it is on by default with a way to turn off. As a user, I want this OOTB myself so on by default makes sense to me, for what it’s worth. To avoid churn feel free to wait for other reviews before changing your code.
impl Default for SpriteBackendSettings { | ||
fn default() -> Self { | ||
Self { | ||
passthrough_transparency: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mix of transparency as a prefix and suffix feels like this should have a different name, but I don’t have any good suggestions right now.
Also, worth checking if transparency is the right term compared to alpha. No strong opinions but it stood out to me as a question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're right. Alpha is absolutely a better term. Updating.
Objective
Solution
Testing
Showcase