-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Fix Segment::fade_out for 2d expansion #4712
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
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This shouldn't be necessary as
vLength()/virtualLength()takes into account 2D (and its mapping).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.
That would be correct if
fade_outwas usinggetPixelColor()/setPixelColor(), which apply the mapping. Right now it's usinggetPixelColorRaw()/setPixelColorRaw(), so it needs the "unmapped" length.The tradeoff is between calculating the color fade extra times, vs applying the mapping. Given that the author of the function chose the
Rawforms I took this to mean that they intended the former, which I agree is probably faster in most cases.The bug is pretty clearly apparent with any of the Grav* AR FX with bar expansion -- it doesn't fade out properly.
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.
Right. The author would be me.
That only means
fade_out()should use regularget/setPixelColor()and skip speed optimisations. This might hold true for all universal functions.Or re-implement mapping to correctly iterate expanded pixels.
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.
OK - I think the optimization is helpful here, but if you feel strongly that we should go the other way, that's OK by me. (Now that you mention it, there are a couple of other locations with the same issue - I should've checked more thoroughly when I spotted the one.)
Long term I think we should move any and all mapping to the blending stage, where we are guaranteed we're only calculating it once per frame. (Yes, I'm aware there are a couple of FX that do special things in certain mapping modes - I'm sure we can find solutions for them.)
Uh oh!
There was an error while loading. Please reload this page.
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.
IMO the next best thing is to do
for (int i=0; i<length(); i++) ...as that will cover all pixels.I think that will still be faster than mapping.
This is feasible as actual rendering is done in blending function.
Uh oh!
There was an error while loading. Please reload this page.
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 thought about
length()too; I went withvWidth()*vHeight()as it's smaller for any case with grouping or mirroring.Uh oh!
There was an error while loading. Please reload this page.
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.
If everything would be properly implemented those 2 functions would be unavailable in WLED_DISABLE_2D.
But I was lazy.
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.
Sometimes lazy is good. :)
I'll update with a fix for all cases.