-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Update SeparateJointModelTransform.java #2409
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
base: master
Are you sure you want to change the base?
Update SeparateJointModelTransform.java #2409
Conversation
Avoid mutating input
@@ -30,9 +30,12 @@ public void getOffsetTransform(Matrix4f outTransform, Matrix4f inverseModelBindM | |||
|
|||
@Override | |||
public void applyBindPose(Transform localTransform, Matrix4f inverseModelBindMatrix, Joint parent) { | |||
localTransform.fromTransformMatrix(inverseModelBindMatrix.invert()); | |||
Matrix4f safeInverseBind = inverseModelBindMatrix.clone().invert(); // avoid mutating input |
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 Matrix4f.invert()
method already creates a new object without altering the input object, so there is no need to clone the input matrix before inverting it.
if (parent != null) { | ||
localTransform.combineWithParent(parent.getModelTransform().invert()); | ||
Transform safeParentTransform = parent.getModelTransform().clone().invert(); // same here |
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 Transform.invert()
method already creates a new object without altering the input object, so there is no need to clone the parent model Transform before inverting it.
Hi @utsavsavani01 , You don't need to clone a Edit: |
Avoid mutating input