From 33dac750d7cbdb752564ec07849b7291fd48b781 Mon Sep 17 00:00:00 2001 From: "sha..rd" Date: Wed, 27 Apr 2011 16:02:09 +0000 Subject: [PATCH] * Fix for jMonkeyPlatform "100% CPU usage" bug * Deprecate Quaternion.normalize() as it does not follow naming convention git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7332 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/core/com/jme3/math/Quaternion.java | 14 ++++++++++++++ .../com/jme3/system/lwjgl/LwjglCanvas.java | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/engine/src/core/com/jme3/math/Quaternion.java b/engine/src/core/com/jme3/math/Quaternion.java index 6843e82c4..8ea0a1245 100644 --- a/engine/src/core/com/jme3/math/Quaternion.java +++ b/engine/src/core/com/jme3/math/Quaternion.java @@ -1062,7 +1062,10 @@ public final class Quaternion implements Savable, Cloneable { /** * 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; @@ -1071,6 +1074,17 @@ public final class Quaternion implements Savable, Cloneable { w *= n; } + /** + * normalize normalizes the current Quaternion + */ + public void normalizeLocal(){ + float n = FastMath.invSqrt(norm()); + x *= n; + y *= n; + z *= n; + w *= n; + } + /** * inverse returns the inverse of this quaternion as a new * quaternion. If this quaternion does not have an inverse (if its normal is diff --git a/engine/src/lwjgl-ogl/com/jme3/system/lwjgl/LwjglCanvas.java b/engine/src/lwjgl-ogl/com/jme3/system/lwjgl/LwjglCanvas.java index dd703f117..77c8ef3c4 100644 --- a/engine/src/lwjgl-ogl/com/jme3/system/lwjgl/LwjglCanvas.java +++ b/engine/src/lwjgl-ogl/com/jme3/system/lwjgl/LwjglCanvas.java @@ -269,10 +269,13 @@ public class LwjglCanvas extends LwjglAbstractDisplay implements JmeCanvasContex @Override protected void createContext(AppSettings settings) { + // In case canvas is not visible, we still take framerate + // from settings to prevent "100% CPU usage" + frameRate = settings.getFrameRate(); + if (!renderable.get()) return; - frameRate = settings.getFrameRate(); Display.setVSyncEnabled(settings.isVSync()); try{