-
Notifications
You must be signed in to change notification settings - Fork 141
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
Fix brush transforms #283
Merged
Fix brush transforms #283
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
033870d
Fix brush transforms
dfrg 6612b7a
From typo in comment
dfrg c65c19d
add additional test scene
dfrg 3c15bff
Proper inverse of translation components
dfrg 1f938e5
linear algebra refresher
dfrg 659ab2f
simplify
dfrg f657b88
use matrix math!
dfrg 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 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,10 +120,16 @@ impl Encoding { | |
} | ||
|
||
/// Encodes a transform. | ||
pub fn encode_transform(&mut self, transform: Transform) { | ||
/// | ||
/// If the given transform is different from the current one, encodes it an | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. encodes it an -> encodes it and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops. Fixed, ty. |
||
/// returns true. Otherwise, encodes nothing and returns false. | ||
pub fn encode_transform(&mut self, transform: Transform) -> bool { | ||
if self.transforms.last() != Some(&transform) { | ||
self.path_tags.push(PathTag::TRANSFORM); | ||
self.transforms.push(transform); | ||
true | ||
} else { | ||
false | ||
} | ||
} | ||
|
||
|
This file contains 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.
When I tested this change locally as is it didn't fix the broken rotation for me on the
blend_grid
test (you can reproduce it with the new Q/E controls that @DJMcNab added).However I was able to fix it by reverting your change to fine.wgsl back to the original and applying @DJMcNab's suggestion on zulip to change shaders/draw_leaf.wgsl#153 to:
If I combined your change to fine.wgsl with the change to draw_leaf.wgsl I was getting an even weirder rotation behavior.
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 fix in this PR comes from experimenting with radial gradient rotation in general.
I used this codepen as reference: https://codepen.io/dfrgy/pen/KKxMpWj and added a corresponding example to the brush transform test scene. Without these changes, the transform is very wonky.
The original inverse calculation is algebraically correct so I'm assuming the problem is elsewhere but I haven't been able to track down the source of the reversed rotation direction in the blend grid. I'll keep investigating.
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.
Looks like the inverse of the translation components was incorrect. This seems to be working for all cases now.
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.
Or not...
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, good to go :)