-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
flipping texture coords methods has been added to the StandardMaterial #12917
flipping texture coords methods has been added to the StandardMaterial #12917
Conversation
98fdc6f
to
e797807
Compare
@alice-i-cecile May I ask you for a review? |
/// Flip the texture coordinates of the material. | ||
pub fn flip(&mut self, horizontal: bool, vertical: bool) { | ||
if horizontal { | ||
self.uv_transform = Self::FLIP_HORIZONTAL * self.uv_transform; |
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.
self.uv_transform = Self::FLIP_HORIZONTAL * self.uv_transform; | |
self.uv_transform *= Self::FLIP_HORIZONTAL; |
Affine implements MulAssign
, so you can do this instead.
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 think this replacement is not correct, because MulAssign will make equivalent of self.uv_transform = self.uv_transform * Self::FLIP_HORIZONTAL;
but not self.uv_transform = Self::FLIP_HORIZONTAL * self.uv_transform;
. The order is important for vector math. If somebody chain flipped()
for StandardMaterial instance, he would expect that flipping transform would be done after original uv_transform, not before
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 see. Could you add a comment explaining why the order is important, then? I could see this being confusing to others.
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.
Done
Co-authored-by: BD103 <[email protected]>
Objective
Fixes #11996
The deprecated shape Quad's flip field role migrated to StandardMaterial's flip/flipped methods
Solution
flip/flipping methods of StandardMaterial is applicable to any mesh
Changelog
Migration Guide
Instead of using
Quad::flip
field, callflipped(true, false)
method on the StandardMaterial instance when adding the mesh.