* FlyByCamera now uses Quaternion.normalizeLocal()

* Quaternion.normalize() which was deprecated has now been removed
 * Quaternion.normalizeLocal() now returns "this" object

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9404 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Sha..rd 13 years ago
parent e2652851c5
commit 45534ab0b8
  1. 2
      engine/src/core/com/jme3/input/FlyByCamera.java
  2. 31
      engine/src/core/com/jme3/math/Quaternion.java

@ -279,7 +279,7 @@ public class FlyByCamera implements AnalogListener, ActionListener {
Quaternion q = new Quaternion(); Quaternion q = new Quaternion();
q.fromAxes(left, up, dir); q.fromAxes(left, up, dir);
q.normalize(); q.normalizeLocal();
cam.setAxes(q); cam.setAxes(q);
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2009-2010 jMonkeyEngine * Copyright (c) 2009-2012 jMonkeyEngine
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -1080,29 +1080,30 @@ public final class Quaternion implements Savable, Cloneable, java.io.Serializabl
return w * w + x * x + y * y + z * z; return w * w + x * x + y * y + z * z;
} }
/** // /**
* <code>normalize</code> normalizes the current <code>Quaternion</code> // * <code>normalize</code> normalizes the current <code>Quaternion</code>
* @deprecated The naming of this method doesn't follow convention. // * @deprecated The naming of this method doesn't follow convention.
* Please use {@link Quaternion#normalizeLocal() } instead. // * Please use {@link Quaternion#normalizeLocal() } instead.
*/ // */
@Deprecated // @Deprecated
public void normalize() { // public void normalize() {
float n = FastMath.invSqrt(norm()); // float n = FastMath.invSqrt(norm());
x *= n; // x *= n;
y *= n; // y *= n;
z *= n; // z *= n;
w *= n; // w *= n;
} // }
/** /**
* <code>normalize</code> normalizes the current <code>Quaternion</code> * <code>normalize</code> normalizes the current <code>Quaternion</code>
*/ */
public void normalizeLocal() { public Quaternion normalizeLocal() {
float n = FastMath.invSqrt(norm()); float n = FastMath.invSqrt(norm());
x *= n; x *= n;
y *= n; y *= n;
z *= n; z *= n;
w *= n; w *= n;
return this;
} }
/** /**

Loading…
Cancel
Save