use temp variables instead of creating new ones to improve memory usage
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@11012 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
77a2af25c4
commit
b06cdfc77c
@ -462,7 +462,10 @@ public final class Quaternion implements Savable, Cloneable, java.io.Serializabl
|
||||
* @return the rotation matrix representation of this quaternion.
|
||||
*/
|
||||
public Matrix4f toRotationMatrix(Matrix4f result) {
|
||||
Vector3f originalScale = result.toScaleVector();
|
||||
TempVars tempv = TempVars.get();
|
||||
Vector3f originalScale = tempv.vect1;
|
||||
|
||||
result.toScaleVector(originalScale);
|
||||
result.setScale(1, 1, 1);
|
||||
float norm = norm();
|
||||
// we explicitly test norm against one here, saving a division
|
||||
@ -496,6 +499,9 @@ public final class Quaternion implements Savable, Cloneable, java.io.Serializabl
|
||||
result.m22 = 1 - (xx + yy);
|
||||
|
||||
result.setScale(originalScale);
|
||||
|
||||
tempv.release();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user