Browse Source

* 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

Sha..rd 13 years ago
parent
commit
45534ab0b8

+ 1 - 1
engine/src/core/com/jme3/input/FlyByCamera.java

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

+ 17 - 16
engine/src/core/com/jme3/math/Quaternion.java

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