-
Notifications
You must be signed in to change notification settings - Fork 336
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
Handle subpixel viewboxes for SVG skins #594
base: develop
Are you sure you want to change the base?
Conversation
6d843b0
to
7eadb5f
Compare
@@ -102,6 +102,9 @@ class Drawable { | |||
this._inverseTransformDirty = true; | |||
this._visible = true; | |||
|
|||
this._aabbDirty = true; |
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.
transformDirty means that one or more of rotationTransformDirty, skinScaleDirty, rotationCenterDirty.
transformDirty implies aabbDirty, but aabbDirty doesn't imply transformDirty
296a3de
to
9cb355c
Compare
42f8040
to
51f613a
Compare
@fsih @cwillisf This should be ready now that scratch-svg-renderer is all split up and we can do the viewbox logic here! I've also tried my best to address the review comments. Also note that this depends on #745. I remember you not liking the names |
0acff7c
to
822c5b8
Compare
Skins' "native size" is the size that their bounds are supposed to be. Their "quad size" is the size the quadrilateral is really rendered at.
_setSubpixelViewbox ensures nonzero image dimensions at all rendered scales.
822c5b8
to
67b1f49
Compare
...and just return nativeRotationCenter in getSkinRotationCenter to do so.
This was a case of premature optimization that needs to go for the next commit's optimization to work.
This is an optimization from PR scratchfoundation#470 that was taken out because of other unrelated changes in that PR which kept breaking things. We can put it back in now, and it's especially useful here to avoid going through a nested getter when accessing quadSize.
Now we only mess around with "logical bounds" in the shader if effects which distort the sprite are enabled. This also avoids passing the extra v_logicalCoord varying.
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.
This provides a slight but noticeable performance improvement, and gains back some of what was lost in the previous commit.
67b1f49
to
e88fb6b
Compare
Depends on #745
Resolves
Resolves #143
Resolves #233
Resolves #427
Resolves #533
Resolves #639
Proposed Changes
Clean up the SVGSkin code a bitDone in Always use SVG mipmaps that match or exceed the skins' screen-space size #649Reason for Changes
As I talked about in #550, these changes seem to be the best way to fix the jittering problem that vector costumes have at the moment. These do add some complexity but I'm not sure how to avoid it, so I could use your help in that area.
Test Coverage
Tests
are blocked on #537 andstill need some discussion on what should be tested