Adding Lerp trait and common implementations#8189
Adding Lerp trait and common implementations#8189Kjolnyr wants to merge 15 commits intobevyengine:mainfrom
Lerp trait and common implementations#8189Conversation
|
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
|
I've put my example in the |
This probably belongs with |
|
Wanted to quickly make a few notes:
With these in mind, we may want to carefully approach how we structure the Lerp trait, as it will inevitably interact with both. |
My initial idea before lerping colors was to have a @james7132 Should I therefore remove my Color interpolation since it can't be accurate between color spaces? We can still keep the |
|
Removing it would make this PR significantly less controversial, and allow us to address it completely at a later time. I still want to give this a full review and ensure it can work well enough with the Animatable trait down the line though. |
|
The Also, @harudagondi, I've made the example less contrived |
|
You added a new example but didn't add metadata for it. Please update the root Cargo.toml file. |
|
@james7132 @aevyrie Sorry my github PR skills are lacking. I've removed you as reviewers by accident |
|
This definition appears similar to the widely used I don't feel strongly either way, but it seems like an important decision point. |
|
It's indeed close to the We could still have some kind of |
There was a problem hiding this comment.
Is it worth discussing the overlap of this with CubicSegment<Vec2>::ease()? You can technically define a linear shaping function and use it to lerp between two values. Obviously this is limited to f32 and is less efficient than this lerp implementation, but does any consideration need to be made to ensure we don't have multiple APIs that work slightly differently but accomplish the same thing?
I reckon one of bevy's core value is to be ergonomic, and I believe this lerp implementation is much more ergonomic than lerping using Even though they accomplish the same thing, I think we have to take in account ergonomics and efficiency. It might be noticeable when lerping in a query over a few 1000s entries. |
|
Yes, I agree with you, but my point is that this is not ergonomic. Providing multiple ways of interpolation might seem odd or confusing to users. The question I'm asking is: "Is this potential confusion enough of an issue to warrant changing the public API?" The answer might be "No", and this is a non-issue. I'm not certain I know what the answer is though. |
|
Where are we on this? Should this PR be closed in favor of #4482? |
Kjolnyr
left a comment
There was a problem hiding this comment.
I've updated it already
|
I think my preference is to close, but I'll defer to @james7132 on how this fits together. |
|
The next version of https://github.com/bitshifter/glam-rs will include a |
|
Closing in favor of just using |
Objective
f32/f64but also common bevy related types likeColorSolution
Lerptobevy_mathwhich define a linear interpolation function as show belowLerptrait tof32andf64Lerptrait toColor