From 45534ab0b8cfce3c60c2f24ce343dec9399ae7ac Mon Sep 17 00:00:00 2001 From: "Sha..rd" Date: Sun, 20 May 2012 19:42:30 +0000 Subject: [PATCH] * 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 --- .../src/core/com/jme3/input/FlyByCamera.java | 2 +- engine/src/core/com/jme3/math/Quaternion.java | 33 ++++++++++--------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/engine/src/core/com/jme3/input/FlyByCamera.java b/engine/src/core/com/jme3/input/FlyByCamera.java index e4d48321c..75b5b3305 100644 --- a/engine/src/core/com/jme3/input/FlyByCamera.java +++ b/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); } diff --git a/engine/src/core/com/jme3/math/Quaternion.java b/engine/src/core/com/jme3/math/Quaternion.java index a6197c526..48e483945 100644 --- a/engine/src/core/com/jme3/math/Quaternion.java +++ b/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; } - /** - * normalize normalizes the current Quaternion - * @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; - } +// /** +// * normalize normalizes the current Quaternion +// * @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; +// } /** * normalize normalizes the current Quaternion */ - public void normalizeLocal() { + public Quaternion normalizeLocal() { float n = FastMath.invSqrt(norm()); x *= n; y *= n; z *= n; w *= n; + return this; } /**