* 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
3.0
sha..rd 14 years ago
parent 650acbc715
commit 33dac750d7
  1. 14
      engine/src/core/com/jme3/math/Quaternion.java
  2. 5
      engine/src/lwjgl-ogl/com/jme3/system/lwjgl/LwjglCanvas.java

@ -1062,7 +1062,10 @@ public final class Quaternion implements Savable, Cloneable {
/** /**
* <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.
* Please use {@link Quaternion#normalizeLocal() } instead.
*/ */
@Deprecated
public void normalize() { public void normalize() {
float n = FastMath.invSqrt(norm()); float n = FastMath.invSqrt(norm());
x *= n; x *= n;
@ -1071,6 +1074,17 @@ public final class Quaternion implements Savable, Cloneable {
w *= n; 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 * <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 * quaternion. If this quaternion does not have an inverse (if its normal is

@ -269,10 +269,13 @@ public class LwjglCanvas extends LwjglAbstractDisplay implements JmeCanvasContex
@Override @Override
protected void createContext(AppSettings settings) { 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()) if (!renderable.get())
return; return;
frameRate = settings.getFrameRate();
Display.setVSyncEnabled(settings.isVSync()); Display.setVSyncEnabled(settings.isVSync());
try{ try{

Loading…
Cancel
Save