Browse Source

* 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

sha..rd 14 years ago
parent
commit
33dac750d7

+ 14 - 0
engine/src/core/com/jme3/math/Quaternion.java

@@ -1062,7 +1062,10 @@ public final class Quaternion implements Savable, Cloneable {
 
     /**
      * <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;
@@ -1071,6 +1074,17 @@ public final class Quaternion implements Savable, Cloneable {
         w *= n;
     }
 
+    /**
+     * <code>normalize</code> normalizes the current <code>Quaternion</code>
+     */
+    public void normalizeLocal(){
+        float n = FastMath.invSqrt(norm());
+        x *= n;
+        y *= n;
+        z *= n;
+        w *= n;
+    }
+
     /**
      * <code>inverse</code> returns the inverse of this quaternion as a new
      * quaternion. If this quaternion does not have an inverse (if its normal is

+ 4 - 1
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{