-
Notifications
You must be signed in to change notification settings - Fork 350
Only check position against effect transform if it falls within the Drawable's space #424
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
Conversation
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
… within the drawable's space
/cc @kchadha |
cwillisf
approved these changes
Apr 30, 2019
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.
👍
adroitwhiz
added a commit
to adroitwhiz/scratch-render
that referenced
this pull request
Mar 15, 2021
This results in a tad bit of duplicated code, but considering that we have 4 different code paths (colorAtNearest, colorAtLinear, isTouchingNearest, and isTouchingLinear) for sampling a silhouette, that's to be expected. This more closely matches the GPU pipeline, in which color and position calculations are more intertwined. This replaces the hacky fix in scratchfoundation#424 with a solution that matches the GPU: instead of not transforming points outside the skin bounds, just return transparency/false early.
adroitwhiz
added a commit
to adroitwhiz/scratch-render
that referenced
this pull request
Mar 15, 2021
This results in a tad bit of duplicated code, but considering that we have 4 different code paths (colorAtNearest, colorAtLinear, isTouchingNearest, and isTouchingLinear) for sampling a silhouette, that's to be expected. This more closely matches the GPU pipeline, in which color and position calculations are more intertwined. This replaces the hacky fix in scratchfoundation#424 with a solution that matches the GPU: instead of not transforming points outside the skin bounds, just return transparency/false early.
adroitwhiz
added a commit
to adroitwhiz/scratch-render
that referenced
this pull request
Mar 15, 2021
This results in a tad bit of duplicated code, but considering that we have 4 different code paths (colorAtNearest, colorAtLinear, isTouchingNearest, and isTouchingLinear) for sampling a silhouette, that's to be expected. This more closely matches the GPU pipeline, in which color and position calculations are more intertwined. This replaces the hacky fix in scratchfoundation#424 with a solution that matches the GPU: instead of not transforming points outside the skin bounds, just return transparency/false early.
adroitwhiz
added a commit
to adroitwhiz/scratch-render
that referenced
this pull request
Mar 15, 2021
This results in a tad bit of duplicated code, but considering that we have 4 different code paths (colorAtNearest, colorAtLinear, isTouchingNearest, and isTouchingLinear) for sampling a silhouette, that's to be expected. This more closely matches the GPU pipeline, in which color and position calculations are more intertwined. This replaces the hacky fix in scratchfoundation#424 with a solution that matches the GPU: instead of not transforming points outside the skin bounds, just return transparency/false early.
adroitwhiz
added a commit
to adroitwhiz/scratch-render
that referenced
this pull request
Mar 15, 2021
This results in a tad bit of duplicated code, but considering that we have 4 different code paths (colorAtNearest, colorAtLinear, isTouchingNearest, and isTouchingLinear) for sampling a silhouette, that's to be expected. This more closely matches the GPU pipeline, in which color and position calculations are more intertwined. This replaces the hacky fix in scratchfoundation#424 with a solution that matches the GPU: instead of not transforming points outside the skin bounds, just return transparency/false early.
adroitwhiz
added a commit
to adroitwhiz/scratch-render
that referenced
this pull request
Mar 15, 2021
This results in a tad bit of duplicated code, but considering that we have 4 different code paths (colorAtNearest, colorAtLinear, isTouchingNearest, and isTouchingLinear) for sampling a silhouette, that's to be expected. This more closely matches the GPU pipeline, in which color and position calculations are more intertwined. This replaces the hacky fix in scratchfoundation#424 with a solution that matches the GPU: instead of not transforming points outside the skin bounds, just return transparency/false early.
adroitwhiz
added a commit
to adroitwhiz/scratch-render
that referenced
this pull request
Mar 15, 2021
This results in a tad bit of duplicated code, but considering that we have 4 different code paths (colorAtNearest, colorAtLinear, isTouchingNearest, and isTouchingLinear) for sampling a silhouette, that's to be expected. This more closely matches the GPU pipeline, in which color and position calculations are more intertwined. This replaces the hacky fix in scratchfoundation#424 with a solution that matches the GPU: instead of not transforming points outside the skin bounds, just return transparency/false early.
adroitwhiz
added a commit
to adroitwhiz/scratch-render
that referenced
this pull request
Jun 30, 2021
This results in a tad bit of duplicated code, but considering that we have 4 different code paths (colorAtNearest, colorAtLinear, isTouchingNearest, and isTouchingLinear) for sampling a silhouette, that's to be expected. This more closely matches the GPU pipeline, in which color and position calculations are more intertwined. This replaces the hacky fix in scratchfoundation#424 with a solution that matches the GPU: instead of not transforming points outside the skin bounds, just return transparency/false early.
adroitwhiz
added a commit
to adroitwhiz/scratch-render
that referenced
this pull request
Feb 21, 2024
This results in a tad bit of duplicated code, but considering that we have 4 different code paths (colorAtNearest, colorAtLinear, isTouchingNearest, and isTouchingLinear) for sampling a silhouette, that's to be expected. This more closely matches the GPU pipeline, in which color and position calculations are more intertwined. This replaces the hacky fix in scratchfoundation#424 with a solution that matches the GPU: instead of not transforming points outside the skin bounds, just return transparency/false early.
adroitwhiz
added a commit
to adroitwhiz/scratch-render
that referenced
this pull request
Feb 21, 2024
This results in a tad bit of duplicated code, but considering that we have 4 different code paths (colorAtNearest, colorAtLinear, isTouchingNearest, and isTouchingLinear) for sampling a silhouette, that's to be expected. This more closely matches the GPU pipeline, in which color and position calculations are more intertwined. This replaces the hacky fix in scratchfoundation#424 with a solution that matches the GPU: instead of not transforming points outside the skin bounds, just return transparency/false early.
adroitwhiz
added a commit
to adroitwhiz/scratch-render
that referenced
this pull request
Feb 21, 2024
This results in a tad bit of duplicated code, but considering that we have 4 different code paths (colorAtNearest, colorAtLinear, isTouchingNearest, and isTouchingLinear) for sampling a silhouette, that's to be expected. This more closely matches the GPU pipeline, in which color and position calculations are more intertwined. This replaces the hacky fix in scratchfoundation#424 with a solution that matches the GPU: instead of not transforming points outside the skin bounds, just return transparency/false early.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Resolves
#366
Proposed Changes
Check if the local position is within the drawable's space (ie the x and y values are equal to zero or less than one) before transforming that point using
EffectTransform
.Reason for Changes
If we use the effect transform on points outside the drawable, it can falsely give the impression that a point is within a drawable when you transform it. Without this if-statement, blocks like "touching mouse-pointer" will think a transformed point is part of the drawable if the mosaic effect returns a positive modded value here
Here is a project that demos the fix: https://scratch.mit.edu/projects/293415549/editor
After clicking the green flag, click the block to add the mosaic effect. The sprite will change colors to the bottom right of it in production, even if the mouse isn't touching the sprite. With these fixes, it will only change color when it's actually being touched.