Browse Source

whitespace changes in jme3-core (#1760)

* jme3-core:  whitespace

* jme3-core:  whitespace again

* jme3-core:  whitespace some more

* Tweens:  tweak whitespace in javadoc

* BoneTrack:  correct indentation

* Pose:  delete extra whitespace

* Skeleton.java:  horizontal whitespace per style guide

* SkeletonControl:  delete excess whitespace

* BasicProfiler:  whitespace

* BasicProfilerState:  whitespace

* FlyCamAppState:  whitespace in javadoc

* LegacyApplication:  add space per 4.6.2.5

* SimpleApplication:  indentation

* StatsAppState:  whitespace

* AssetConfig:  add whitespace

* AssetKey:  whitespace in cast per 4.6.2.5

* AssetLoadException:  add vertical whitespace required by 4.6.1

* AssetNotFoundException:  add vertical whitespace required by 4.6.1.1

* DesktopAssetManager:  whitespace

* ImplHandler:  whitespace per the style guide

* ThreadingManager:  indentation

* WeakRefAssetCache:  cast spacing per 4.6.2.5

* WeakRefCloneAssetCache:  whitespace

* AudioBuffer:  whitespace

* AudioKey:  line wrapping

* AudioNode:  whitespace

* Filter:  whitespace per 4.6.2.5

* Listener:  delete trailing whitespace

* AlAudioRenderer:  whitespace per perferred style

* BoundingSphere:  whitespace per perferred style

* Intersection:  whitespace per perferred style

* KeyFrame:  whitespace

* MotionPath:  whitespace

* TimeLine:  delete excess vertical whitespace

* AbstractCinematicEvent:  whitespace

* AnimationEvent:  whitespace

* MotionEvent:  tweak the whitespace

* SoundEvent:  tweak the whitespace

* CollisionResult:  space after closing parenthesis of a cast

* CollisionResults:  space on both sides of a binary operator

* SweepSphere:  whitespace

* BIHTree:  space before {

* TriangleAxisComparator:  one statement per line

* ParticleEmitter:  whitespace

* ParticlePointMesh:  whitespace

* ParticleTriMesh:  misc whitespace

* ReadialParticleInfluencer:  delete extra vertical whitespace
Stephen Gold 3 years ago
parent
commit
ac8c1012d2
100 changed files with 1893 additions and 1925 deletions
  1. 28 29
      jme3-core/src/main/java/com/jme3/anim/AnimComposer.java
  2. 8 13
      jme3-core/src/main/java/com/jme3/anim/interpolator/FrameInterpolator.java
  3. 8 8
      jme3-core/src/main/java/com/jme3/anim/tween/Tweens.java
  4. 2 2
      jme3-core/src/main/java/com/jme3/anim/tween/action/ClipAction.java
  5. 48 50
      jme3-core/src/main/java/com/jme3/animation/AnimChannel.java
  6. 16 16
      jme3-core/src/main/java/com/jme3/animation/AnimControl.java
  7. 21 23
      jme3-core/src/main/java/com/jme3/animation/Animation.java
  8. 6 7
      jme3-core/src/main/java/com/jme3/animation/AnimationUtils.java
  9. 10 12
      jme3-core/src/main/java/com/jme3/animation/AudioTrack.java
  10. 91 93
      jme3-core/src/main/java/com/jme3/animation/Bone.java
  11. 9 9
      jme3-core/src/main/java/com/jme3/animation/BoneTrack.java
  12. 3 3
      jme3-core/src/main/java/com/jme3/animation/CompactFloatArray.java
  13. 3 10
      jme3-core/src/main/java/com/jme3/animation/EffectTrack.java
  14. 9 11
      jme3-core/src/main/java/com/jme3/animation/Pose.java
  15. 13 16
      jme3-core/src/main/java/com/jme3/animation/PoseTrack.java
  16. 11 11
      jme3-core/src/main/java/com/jme3/animation/Skeleton.java
  17. 37 47
      jme3-core/src/main/java/com/jme3/animation/SkeletonControl.java
  18. 9 9
      jme3-core/src/main/java/com/jme3/animation/TrackInfo.java
  19. 42 48
      jme3-core/src/main/java/com/jme3/app/BasicProfiler.java
  20. 40 45
      jme3-core/src/main/java/com/jme3/app/BasicProfilerState.java
  21. 7 7
      jme3-core/src/main/java/com/jme3/app/ChaseCameraAppState.java
  22. 15 19
      jme3-core/src/main/java/com/jme3/app/FlyCamAppState.java
  23. 69 68
      jme3-core/src/main/java/com/jme3/app/LegacyApplication.java
  24. 20 14
      jme3-core/src/main/java/com/jme3/app/SimpleApplication.java
  25. 14 17
      jme3-core/src/main/java/com/jme3/app/StatsAppState.java
  26. 3 6
      jme3-core/src/main/java/com/jme3/app/StatsView.java
  27. 7 8
      jme3-core/src/main/java/com/jme3/app/state/AbstractAppState.java
  28. 93 94
      jme3-core/src/main/java/com/jme3/app/state/AppStateManager.java
  29. 34 38
      jme3-core/src/main/java/com/jme3/app/state/BaseAppState.java
  30. 45 39
      jme3-core/src/main/java/com/jme3/app/state/ConstantVerifierState.java
  31. 5 5
      jme3-core/src/main/java/com/jme3/app/state/RootNodeAppState.java
  32. 11 11
      jme3-core/src/main/java/com/jme3/app/state/ScreenshotAppState.java
  33. 11 10
      jme3-core/src/main/java/com/jme3/asset/AssetConfig.java
  34. 2 3
      jme3-core/src/main/java/com/jme3/asset/AssetInfo.java
  35. 20 20
      jme3-core/src/main/java/com/jme3/asset/AssetKey.java
  36. 3 2
      jme3-core/src/main/java/com/jme3/asset/AssetLoadException.java
  37. 3 2
      jme3-core/src/main/java/com/jme3/asset/AssetNotFoundException.java
  38. 85 87
      jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java
  39. 2 2
      jme3-core/src/main/java/com/jme3/asset/FilterKey.java
  40. 77 77
      jme3-core/src/main/java/com/jme3/asset/ImplHandler.java
  41. 6 6
      jme3-core/src/main/java/com/jme3/asset/ModelKey.java
  42. 15 15
      jme3-core/src/main/java/com/jme3/asset/TextureKey.java
  43. 4 6
      jme3-core/src/main/java/com/jme3/asset/ThreadingManager.java
  44. 23 22
      jme3-core/src/main/java/com/jme3/asset/cache/WeakRefAssetCache.java
  45. 44 43
      jme3-core/src/main/java/com/jme3/asset/cache/WeakRefCloneAssetCache.java
  46. 13 13
      jme3-core/src/main/java/com/jme3/audio/AudioBuffer.java
  47. 4 4
      jme3-core/src/main/java/com/jme3/audio/AudioContext.java
  48. 6 6
      jme3-core/src/main/java/com/jme3/audio/AudioData.java
  49. 21 24
      jme3-core/src/main/java/com/jme3/audio/AudioKey.java
  50. 41 33
      jme3-core/src/main/java/com/jme3/audio/AudioNode.java
  51. 4 4
      jme3-core/src/main/java/com/jme3/audio/Environment.java
  52. 5 5
      jme3-core/src/main/java/com/jme3/audio/Filter.java
  53. 9 9
      jme3-core/src/main/java/com/jme3/audio/Listener.java
  54. 6 6
      jme3-core/src/main/java/com/jme3/audio/LowPassFilter.java
  55. 76 76
      jme3-core/src/main/java/com/jme3/audio/openal/ALAudioRenderer.java
  56. 67 68
      jme3-core/src/main/java/com/jme3/bounding/BoundingSphere.java
  57. 24 24
      jme3-core/src/main/java/com/jme3/bounding/Intersection.java
  58. 6 6
      jme3-core/src/main/java/com/jme3/cinematic/Cinematic.java
  59. 5 8
      jme3-core/src/main/java/com/jme3/cinematic/KeyFrame.java
  60. 4 5
      jme3-core/src/main/java/com/jme3/cinematic/MotionPath.java
  61. 2 4
      jme3-core/src/main/java/com/jme3/cinematic/TimeLine.java
  62. 18 20
      jme3-core/src/main/java/com/jme3/cinematic/events/AbstractCinematicEvent.java
  63. 18 20
      jme3-core/src/main/java/com/jme3/cinematic/events/AnimationEvent.java
  64. 9 12
      jme3-core/src/main/java/com/jme3/cinematic/events/CameraEvent.java
  65. 15 15
      jme3-core/src/main/java/com/jme3/cinematic/events/MotionEvent.java
  66. 14 16
      jme3-core/src/main/java/com/jme3/cinematic/events/SoundEvent.java
  67. 9 9
      jme3-core/src/main/java/com/jme3/collision/CollisionResult.java
  68. 22 23
      jme3-core/src/main/java/com/jme3/collision/CollisionResults.java
  69. 71 71
      jme3-core/src/main/java/com/jme3/collision/SweepSphere.java
  70. 12 12
      jme3-core/src/main/java/com/jme3/collision/bih/BIHTree.java
  71. 32 18
      jme3-core/src/main/java/com/jme3/collision/bih/BIHTriangle.java
  72. 18 7
      jme3-core/src/main/java/com/jme3/collision/bih/TriangleAxisComparator.java
  73. 43 42
      jme3-core/src/main/java/com/jme3/effect/ParticleEmitter.java
  74. 12 12
      jme3-core/src/main/java/com/jme3/effect/ParticlePointMesh.java
  75. 28 29
      jme3-core/src/main/java/com/jme3/effect/ParticleTriMesh.java
  76. 3 3
      jme3-core/src/main/java/com/jme3/effect/influencers/DefaultParticleInfluencer.java
  77. 1 1
      jme3-core/src/main/java/com/jme3/effect/influencers/EmptyParticleInfluencer.java
  78. 1 2
      jme3-core/src/main/java/com/jme3/effect/influencers/RadialParticleInfluencer.java
  79. 1 1
      jme3-core/src/main/java/com/jme3/effect/shapes/EmitterBoxShape.java
  80. 2 2
      jme3-core/src/main/java/com/jme3/effect/shapes/EmitterMeshVertexShape.java
  81. 1 1
      jme3-core/src/main/java/com/jme3/effect/shapes/EmitterPointShape.java
  82. 1 1
      jme3-core/src/main/java/com/jme3/effect/shapes/EmitterSphereShape.java
  83. 4 4
      jme3-core/src/main/java/com/jme3/environment/EnvironmentCamera.java
  84. 4 9
      jme3-core/src/main/java/com/jme3/environment/util/LightsDebugState.java
  85. 4 4
      jme3-core/src/main/java/com/jme3/export/FormatVersion.java
  86. 16 15
      jme3-core/src/main/java/com/jme3/export/SavableClassUtil.java
  87. 8 8
      jme3-core/src/main/java/com/jme3/font/BitmapCharacter.java
  88. 8 8
      jme3-core/src/main/java/com/jme3/font/BitmapCharacterSet.java
  89. 29 30
      jme3-core/src/main/java/com/jme3/font/BitmapFont.java
  90. 5 4
      jme3-core/src/main/java/com/jme3/font/BitmapText.java
  91. 2 2
      jme3-core/src/main/java/com/jme3/font/BitmapTextPage.java
  92. 13 13
      jme3-core/src/main/java/com/jme3/font/ColorTags.java
  93. 41 41
      jme3-core/src/main/java/com/jme3/font/LetterQuad.java
  94. 6 5
      jme3-core/src/main/java/com/jme3/font/Letters.java
  95. 4 3
      jme3-core/src/main/java/com/jme3/font/Rectangle.java
  96. 11 11
      jme3-core/src/main/java/com/jme3/font/StringBlock.java
  97. 25 25
      jme3-core/src/main/java/com/jme3/input/AbstractJoystick.java
  98. 33 24
      jme3-core/src/main/java/com/jme3/input/ChaseCamera.java
  99. 11 11
      jme3-core/src/main/java/com/jme3/input/DefaultJoystickAxis.java
  100. 13 13
      jme3-core/src/main/java/com/jme3/input/DefaultJoystickButton.java

+ 28 - 29
jme3-core/src/main/java/com/jme3/anim/AnimComposer.java

@@ -48,11 +48,10 @@ import java.util.*;
 /**
 /**
  * AnimComposer is a Spatial control that allows manipulation of
  * AnimComposer is a Spatial control that allows manipulation of
  * {@link Armature armature} (skeletal) animation.
  * {@link Armature armature} (skeletal) animation.
- * 
+ *
  * @author Nehon
  * @author Nehon
  */
  */
 public class AnimComposer extends AbstractControl {
 public class AnimComposer extends AbstractControl {
-
     /**
     /**
      * The name of the default layer.
      * The name of the default layer.
      */
      */
@@ -72,7 +71,7 @@ public class AnimComposer extends AbstractControl {
 
 
     /**
     /**
      * Tells if an animation is contained in the list of animations.
      * Tells if an animation is contained in the list of animations.
-     * 
+     *
      * @param name The name of the animation.
      * @param name The name of the animation.
      * @return true, if the named animation is in the list of animations.
      * @return true, if the named animation is in the list of animations.
      */
      */
@@ -117,17 +116,17 @@ public class AnimComposer extends AbstractControl {
 
 
     /**
     /**
      * Run an action on the default layer.
      * Run an action on the default layer.
-     * 
+     *
      * @param name The name of the action to run.
      * @param name The name of the action to run.
      * @return The action corresponding to the given name.
      * @return The action corresponding to the given name.
      */
      */
     public Action setCurrentAction(String name) {
     public Action setCurrentAction(String name) {
         return setCurrentAction(name, DEFAULT_LAYER);
         return setCurrentAction(name, DEFAULT_LAYER);
     }
     }
-    
+
     /**
     /**
      * Run an action on specified layer.
      * Run an action on specified layer.
-     * 
+     *
      * @param actionName The name of the action to run.
      * @param actionName The name of the action to run.
      * @param layerName The layer on which action should run.
      * @param layerName The layer on which action should run.
      * @return The action corresponding to the given name.
      * @return The action corresponding to the given name.
@@ -139,19 +138,19 @@ public class AnimComposer extends AbstractControl {
 
 
         return currentAction;
         return currentAction;
     }
     }
-    
+
     /**
     /**
      * Return the current action on the default layer.
      * Return the current action on the default layer.
-     * 
-     * @return  The action corresponding to the given name.
+     *
+     * @return The action corresponding to the given name.
      */
      */
     public Action getCurrentAction() {
     public Action getCurrentAction() {
         return getCurrentAction(DEFAULT_LAYER);
         return getCurrentAction(DEFAULT_LAYER);
     }
     }
-    
+
     /**
     /**
      * Return current action on specified layer.
      * Return current action on specified layer.
-     * 
+     *
      * @param layerName The layer on which action should run.
      * @param layerName The layer on which action should run.
      * @return The action corresponding to the given name.
      * @return The action corresponding to the given name.
      */
      */
@@ -161,14 +160,14 @@ public class AnimComposer extends AbstractControl {
 
 
         return result;
         return result;
     }
     }
-    
+
     /**
     /**
      * Remove current action on default layer.
      * Remove current action on default layer.
      */
      */
     public void removeCurrentAction() {
     public void removeCurrentAction() {
         removeCurrentAction(DEFAULT_LAYER);
         removeCurrentAction(DEFAULT_LAYER);
     }
     }
-    
+
     /**
     /**
      * Remove current action on specified layer.
      * Remove current action on specified layer.
      *
      *
@@ -178,19 +177,19 @@ public class AnimComposer extends AbstractControl {
         AnimLayer l = getLayer(layerName);
         AnimLayer l = getLayer(layerName);
         l.setCurrentAction(null);
         l.setCurrentAction(null);
     }
     }
-    
+
     /**
     /**
      * Returns current time of the default layer.
      * Returns current time of the default layer.
-     * 
+     *
      * @return The current time.
      * @return The current time.
      */
      */
     public double getTime() {
     public double getTime() {
         return getTime(DEFAULT_LAYER);
         return getTime(DEFAULT_LAYER);
     }
     }
-    
+
     /**
     /**
      * Returns current time of the specified layer.
      * Returns current time of the specified layer.
-     * 
+     *
      * @param layerName The layer from which to get the time.
      * @param layerName The layer from which to get the time.
      * @return the time (in seconds)
      * @return the time (in seconds)
      */
      */
@@ -200,7 +199,7 @@ public class AnimComposer extends AbstractControl {
 
 
         return result;
         return result;
     }
     }
-    
+
     /**
     /**
      * Sets current time on the default layer.
      * Sets current time on the default layer.
      *
      *
@@ -226,7 +225,7 @@ public class AnimComposer extends AbstractControl {
     }
     }
 
 
     /**
     /**
-     * 
+     *
      * @param name The name of the action to return.
      * @param name The name of the action to return.
      * @return The action registered with specified name. It will make a new action if there isn't any.
      * @return The action registered with specified name. It will make a new action if there isn't any.
      * @see #makeAction(java.lang.String)
      * @see #makeAction(java.lang.String)
@@ -239,29 +238,29 @@ public class AnimComposer extends AbstractControl {
         }
         }
         return action;
         return action;
     }
     }
-    
+
     /**
     /**
-     * 
+     *
      * @param name The name of the action to return.
      * @param name The name of the action to return.
      * @return The action registered with specified name or null if nothing is registered.
      * @return The action registered with specified name or null if nothing is registered.
      */
      */
-    public Action getAction(String name){
+    public Action getAction(String name) {
         return actions.get(name);
         return actions.get(name);
     }
     }
-    
+
     /**
     /**
      * Register given action with specified name.
      * Register given action with specified name.
-     * 
+     *
      * @param name The name of the action.
      * @param name The name of the action.
      * @param action The action to add.
      * @param action The action to add.
      */
      */
-    public void addAction(String name, Action action){
+    public void addAction(String name, Action action) {
         actions.put(name, action);
         actions.put(name, action);
     }
     }
 
 
     /**
     /**
      * Create a new ClipAction with specified clip name.
      * Create a new ClipAction with specified clip name.
-     * 
+     *
      * @param name The name of the clip.
      * @param name The name of the clip.
      * @return a new action
      * @return a new action
      * @throws IllegalArgumentException if clip with specified name not found.
      * @throws IllegalArgumentException if clip with specified name not found.
@@ -275,17 +274,17 @@ public class AnimComposer extends AbstractControl {
         action = new ClipAction(clip);
         action = new ClipAction(clip);
         return action;
         return action;
     }
     }
-    
+
     /**
     /**
      * Tells if an action is contained in the list of actions.
      * Tells if an action is contained in the list of actions.
-     * 
+     *
      * @param name The name of the action.
      * @param name The name of the action.
      * @return true, if the named action is in the list of actions.
      * @return true, if the named action is in the list of actions.
      */
      */
     public boolean hasAction(String name) {
     public boolean hasAction(String name) {
         return actions.containsKey(name);
         return actions.containsKey(name);
     }
     }
-    
+
     /**
     /**
      * Remove specified action.
      * Remove specified action.
      *
      *

+ 8 - 13
jme3-core/src/main/java/com/jme3/anim/interpolator/FrameInterpolator.java

@@ -38,7 +38,6 @@ import com.jme3.math.*;
  * Created by nehon on 15/04/17.
  * Created by nehon on 15/04/17.
  */
  */
 public class FrameInterpolator {
 public class FrameInterpolator {
-
     public static final FrameInterpolator DEFAULT = new FrameInterpolator();
     public static final FrameInterpolator DEFAULT = new FrameInterpolator();
 
 
     private AnimInterpolator<Float> timeInterpolator;
     private AnimInterpolator<Float> timeInterpolator;
@@ -51,23 +50,23 @@ public class FrameInterpolator {
     final private TrackDataReader<Vector3f> scaleReader = new TrackDataReader<>();
     final private TrackDataReader<Vector3f> scaleReader = new TrackDataReader<>();
     final private TrackTimeReader timesReader = new TrackTimeReader();
     final private TrackTimeReader timesReader = new TrackTimeReader();
 
 
-
     final private Transform transforms = new Transform();
     final private Transform transforms = new Transform();
 
 
-    public Transform interpolate(float t, int currentIndex, CompactVector3Array translations, CompactQuaternionArray rotations, CompactVector3Array scales, float[] times){
+    public Transform interpolate(float t, int currentIndex, CompactVector3Array translations,
+            CompactQuaternionArray rotations, CompactVector3Array scales, float[] times) {
         timesReader.setData(times);
         timesReader.setData(times);
-        if( timeInterpolator != null){
-            t = timeInterpolator.interpolate(t,currentIndex, null, timesReader, null );
+        if (timeInterpolator != null) {
+            t = timeInterpolator.interpolate(t, currentIndex, null, timesReader, null);
         }
         }
-        if(translations != null) {
+        if (translations != null) {
             translationReader.setData(translations);
             translationReader.setData(translations);
             translationInterpolator.interpolate(t, currentIndex, translationReader, timesReader, transforms.getTranslation());
             translationInterpolator.interpolate(t, currentIndex, translationReader, timesReader, transforms.getTranslation());
         }
         }
-        if(rotations != null) {
+        if (rotations != null) {
             rotationReader.setData(rotations);
             rotationReader.setData(rotations);
             rotationInterpolator.interpolate(t, currentIndex, rotationReader, timesReader, transforms.getRotation());
             rotationInterpolator.interpolate(t, currentIndex, rotationReader, timesReader, transforms.getRotation());
         }
         }
-        if(scales != null){
+        if (scales != null) {
             scaleReader.setData(scales);
             scaleReader.setData(scales);
             scaleInterpolator.interpolate(t, currentIndex, scaleReader, timesReader, transforms.getScale());
             scaleInterpolator.interpolate(t, currentIndex, scaleReader, timesReader, transforms.getScale());
         }
         }
@@ -83,7 +82,7 @@ public class FrameInterpolator {
                 next = current;
                 next = current;
             }
             }
 
 
-            float val =  FastMath.interpolateLinear(t, weights[current], weights[next]);
+            float val = FastMath.interpolateLinear(t, weights[current], weights[next]);
             store[i] = val;
             store[i] = val;
         }
         }
     }
     }
@@ -104,7 +103,6 @@ public class FrameInterpolator {
         this.scaleInterpolator = scaleInterpolator;
         this.scaleInterpolator = scaleInterpolator;
     }
     }
 
 
-
     public static class TrackTimeReader {
     public static class TrackTimeReader {
         private float[] data;
         private float[] data;
 
 
@@ -122,7 +120,6 @@ public class FrameInterpolator {
     }
     }
 
 
     public static class TrackDataReader<T> {
     public static class TrackDataReader<T> {
-
         private CompactArray<T> data;
         private CompactArray<T> data;
 
 
         protected void setData(CompactArray<T> data) {
         protected void setData(CompactArray<T> data) {
@@ -148,7 +145,6 @@ public class FrameInterpolator {
 
 
             index = mod(index, total);
             index = mod(index, total);
 
 
-
             return data.get(index, store);
             return data.get(index, store);
         }
         }
     }
     }
@@ -163,5 +159,4 @@ public class FrameInterpolator {
     private static int mod(int val, int n) {
     private static int mod(int val, int n) {
         return ((val % n) + n) % n;
         return ((val % n) + n) % n;
     }
     }
-
 }
 }

+ 8 - 8
jme3-core/src/main/java/com/jme3/anim/tween/Tweens.java

@@ -163,11 +163,11 @@ public class Tweens {
      * <pre>Tweens.callTweenMethod(1, myObject, "foo", "bar")</pre>
      * <pre>Tweens.callTweenMethod(1, myObject, "foo", "bar")</pre>
      * <p>Would work for any of the following method signatures:</p>
      * <p>Would work for any of the following method signatures:</p>
      * <pre>
      * <pre>
-     *    void foo( float t, String arg )
-     *    void foo( double t, String arg )
-     *    void foo( String arg, float t )
-     *    void foo( String arg, double t )
-     *  </pre>
+     *    void foo(float t, String arg)
+     *    void foo(double t, String arg)
+     *    void foo(String arg, float t)
+     *    void foo(String arg, double t)
+     * </pre>
      *
      *
      * @param length the desired duration (in seconds)
      * @param length the desired duration (in seconds)
      * @param target object on which the method is to be invoked
      * @param target object on which the method is to be invoked
@@ -208,7 +208,7 @@ public class Tweens {
             } else if (t > 1) {
             } else if (t > 1) {
                 return 1;
                 return 1;
             }
             }
-            // Sine starting at -90 will go from -1 to 1 through 0 
+            // Sine starting at -90 will go from -1 to 1 through 0
             double result = Math.sin(t * Math.PI - Math.PI * 0.5);
             double result = Math.sin(t * Math.PI - Math.PI * 0.5);
             return (result + 1) * 0.5;
             return (result + 1) * 0.5;
         }
         }
@@ -575,7 +575,7 @@ public class Tweens {
                 // We accept the 't' parameter as either first or last,
                 // We accept the 't' parameter as either first or last,
                 // so we'll see which one matches.
                 // so we'll see which one matches.
                 if (isFloatType(paramTypes[0]) || isDoubleType(paramTypes[0])) {
                 if (isFloatType(paramTypes[0]) || isDoubleType(paramTypes[0])) {
-                    // Try it as the first parameter 
+                    // Try it as the first parameter
                     int matches = 0;
                     int matches = 0;
 
 
                     for (int i = 1; i < paramTypes.length; i++) {
                     for (int i = 1; i < paramTypes.length; i++) {
@@ -597,7 +597,7 @@ public class Tweens {
                     return m;
                     return m;
                 }
                 }
 
 
-                // Else try it at the end                
+                // Else try it at the end
                 int last = paramTypes.length - 1;
                 int last = paramTypes.length - 1;
                 if (isFloatType(paramTypes[last]) || isDoubleType(paramTypes[last])) {
                 if (isFloatType(paramTypes[last]) || isDoubleType(paramTypes[last])) {
                     int matches = 0;
                     int matches = 0;

+ 2 - 2
jme3-core/src/main/java/com/jme3/anim/tween/action/ClipAction.java

@@ -10,7 +10,6 @@ import java.util.Collection;
 import java.util.List;
 import java.util.List;
 
 
 public class ClipAction extends BlendableAction {
 public class ClipAction extends BlendableAction {
-
     private AnimClip clip;
     private AnimClip clip;
     private Transform transform = new Transform();
     private Transform transform = new Transform();
 
 
@@ -25,7 +24,7 @@ public class ClipAction extends BlendableAction {
         for (AnimTrack track : tracks) {
         for (AnimTrack track : tracks) {
             if (track instanceof TransformTrack) {
             if (track instanceof TransformTrack) {
                 TransformTrack tt = (TransformTrack) track;
                 TransformTrack tt = (TransformTrack) track;
-                if(getMask() != null && !getMask().contains(tt.getTarget())){
+                if (getMask() != null && !getMask().contains(tt.getTarget())) {
                     continue;
                     continue;
                 }
                 }
                 interpolateTransformTrack(t, tt);
                 interpolateTransformTrack(t, tt);
@@ -46,6 +45,7 @@ public class ClipAction extends BlendableAction {
             this.collectTransform(target, transform, getTransitionWeight(), this);
             this.collectTransform(target, transform, getTransitionWeight(), this);
         }
         }
     }
     }
+
     private void interpolateMorphTrack(double t, MorphTrack track) {
     private void interpolateMorphTrack(double t, MorphTrack track) {
         Geometry target = track.getTarget();
         Geometry target = track.getTarget();
         float[] weights = target.getMorphState();
         float[] weights = target.getMorphState();

+ 48 - 50
jme3-core/src/main/java/com/jme3/animation/AnimChannel.java

@@ -44,14 +44,13 @@ import java.util.BitSet;
  * various parts of its body. For example, a character model may have an
  * various parts of its body. For example, a character model may have an
  * animation channel for its feet, and another for its torso, and
  * animation channel for its feet, and another for its torso, and
  * the animations for each channel are controlled independently.
  * the animations for each channel are controlled independently.
- * 
+ *
  * @author Kirill Vainer
  * @author Kirill Vainer
  */
  */
 @Deprecated
 @Deprecated
 public final class AnimChannel {
 public final class AnimChannel {
-
     private static final float DEFAULT_BLEND_TIME = 0.15f;
     private static final float DEFAULT_BLEND_TIME = 0.15f;
-    
+
     private AnimControl control;
     private AnimControl control;
 
 
     private BitSet affectedBones;
     private BitSet affectedBones;
@@ -63,36 +62,35 @@ public final class AnimChannel {
     private float timeBlendFrom;
     private float timeBlendFrom;
     private float blendTime;
     private float blendTime;
     private float speedBlendFrom;
     private float speedBlendFrom;
-    private boolean notified=false;
+    private boolean notified = false;
 
 
     private LoopMode loopMode, loopModeBlendFrom;
     private LoopMode loopMode, loopModeBlendFrom;
-    
+
     private float blendAmount = 1f;
     private float blendAmount = 1f;
-    private float blendRate   = 0;
-    
-    public AnimChannel(){
-        
+    private float blendRate = 0;
+
+    public AnimChannel() {
     }
     }
-    
-    public AnimChannel(AnimControl control){
+
+    public AnimChannel(AnimControl control) {
         this.control = control;
         this.control = control;
     }
     }
 
 
     /**
     /**
      * Returns the parent control of this AnimChannel.
      * Returns the parent control of this AnimChannel.
-     * 
+     *
      * @return the parent control of this AnimChannel.
      * @return the parent control of this AnimChannel.
      * @see AnimControl
      * @see AnimControl
      */
      */
     public AnimControl getControl() {
     public AnimControl getControl() {
         return control;
         return control;
     }
     }
-    
+
     /**
     /**
      * @return The name of the currently playing animation, or null if
      * @return The name of the currently playing animation, or null if
      * none is assigned.
      * none is assigned.
      *
      *
-     * @see AnimChannel#setAnim(java.lang.String) 
+     * @see AnimChannel#setAnim(java.lang.String)
      */
      */
     public String getAnimationName() {
     public String getAnimationName() {
         return animation != null ? animation.getName() : null;
         return animation != null ? animation.getName() : null;
@@ -102,7 +100,7 @@ public final class AnimChannel {
      * @return The loop mode currently set for the animation. The loop mode
      * @return The loop mode currently set for the animation. The loop mode
      * determines what will happen to the animation once it finishes
      * determines what will happen to the animation once it finishes
      * playing.
      * playing.
-     * 
+     *
      * For more information, see the LoopMode enum class.
      * For more information, see the LoopMode enum class.
      * @see LoopMode
      * @see LoopMode
      * @see AnimChannel#setLoopMode(com.jme3.animation.LoopMode)
      * @see AnimChannel#setLoopMode(com.jme3.animation.LoopMode)
@@ -141,10 +139,10 @@ public final class AnimChannel {
      */
      */
     public void setSpeed(float speed) {
     public void setSpeed(float speed) {
         this.speed = speed;
         this.speed = speed;
-        if(blendTime>0){
+        if (blendTime > 0) {
             this.speedBlendFrom = speed;
             this.speedBlendFrom = speed;
-            blendTime = Math.min(blendTime, animation.getLength() / speed);  
-            blendRate = 1/ blendTime;
+            blendTime = Math.min(blendTime, animation.getLength() / speed);
+            blendRate = 1 / blendTime;
         }
         }
     }
     }
 
 
@@ -160,7 +158,7 @@ public final class AnimChannel {
 
 
     /**
     /**
      * @param time Set the time of the currently playing animation, the time
      * @param time Set the time of the currently playing animation, the time
-     * is clamped from 0 to {@link #getAnimMaxTime()}. 
+     * is clamped from 0 to {@link #getAnimMaxTime()}.
      */
      */
     public void setTime(float time) {
     public void setTime(float time) {
         this.time = FastMath.clamp(time, 0, getAnimMaxTime());
         this.time = FastMath.clamp(time, 0, getAnimMaxTime());
@@ -172,7 +170,7 @@ public final class AnimChannel {
      *
      *
      * @see AnimChannel#getTime()
      * @see AnimChannel#getTime()
      */
      */
-    public float getAnimMaxTime(){
+    public float getAnimMaxTime() {
         return animation != null ? animation.getLength() : 0f;
         return animation != null ? animation.getLength() : 0f;
     }
     }
 
 
@@ -188,7 +186,7 @@ public final class AnimChannel {
      * with the old one. If zero, then no blending will occur and the new
      * with the old one. If zero, then no blending will occur and the new
      * animation will be applied instantly.
      * animation will be applied instantly.
      */
      */
-    public void setAnim(String name, float blendTime){
+    public void setAnim(String name, float blendTime) {
         if (name == null)
         if (name == null)
             throw new IllegalArgumentException("name cannot be null");
             throw new IllegalArgumentException("name cannot be null");
 
 
@@ -197,21 +195,21 @@ public final class AnimChannel {
 
 
         Animation anim = control.animationMap.get(name);
         Animation anim = control.animationMap.get(name);
         if (anim == null)
         if (anim == null)
-            throw new IllegalArgumentException("Cannot find animation named: '"+name+"'");
+            throw new IllegalArgumentException("Cannot find animation named: '" + name + "'");
 
 
         control.notifyAnimChange(this, name);
         control.notifyAnimChange(this, name);
 
 
-        if (animation != null && blendTime > 0f){
+        if (animation != null && blendTime > 0f) {
             this.blendTime = blendTime;
             this.blendTime = blendTime;
             // activate blending
             // activate blending
-            blendTime = Math.min(blendTime, anim.getLength() / speed);            
+            blendTime = Math.min(blendTime, anim.getLength() / speed);
             blendFrom = animation;
             blendFrom = animation;
             timeBlendFrom = time;
             timeBlendFrom = time;
             speedBlendFrom = speed;
             speedBlendFrom = speed;
             loopModeBlendFrom = loopMode;
             loopModeBlendFrom = loopMode;
             blendAmount = 0f;
             blendAmount = 0f;
-            blendRate   = 1f / blendTime;
-        }else{
+            blendRate = 1f / blendTime;
+        } else {
             blendFrom = null;
             blendFrom = null;
         }
         }
 
 
@@ -227,10 +225,10 @@ public final class AnimChannel {
      * <p>
      * <p>
      * See {@link #setAnim(java.lang.String, float)}.
      * See {@link #setAnim(java.lang.String, float)}.
      * The blendTime argument by default is 150 milliseconds.
      * The blendTime argument by default is 150 milliseconds.
-     * 
+     *
      * @param name The name of the animation to play
      * @param name The name of the animation to play
      */
      */
-    public void setAnim(String name){
+    public void setAnim(String name) {
         setAnim(name, DEFAULT_BLEND_TIME);
         setAnim(name, DEFAULT_BLEND_TIME);
     }
     }
 
 
@@ -244,7 +242,7 @@ public final class AnimChannel {
 
 
     /**
     /**
      * Add a single bone to be influenced by this animation channel.
      * Add a single bone to be influenced by this animation channel.
-     * 
+     *
      * @param name the name of the Bone to be influenced
      * @param name the name of the Bone to be influenced
      */
      */
     public void addBone(String name) {
     public void addBone(String name) {
@@ -258,7 +256,7 @@ public final class AnimChannel {
      */
      */
     public void addBone(Bone bone) {
     public void addBone(Bone bone) {
         int boneIndex = control.getSkeleton().getBoneIndex(bone);
         int boneIndex = control.getSkeleton().getBoneIndex(bone);
-        if(affectedBones == null) {
+        if (affectedBones == null) {
             affectedBones = new BitSet(control.getSkeleton().getBoneCount());
             affectedBones = new BitSet(control.getSkeleton().getBoneCount());
         }
         }
         affectedBones.set(boneIndex);
         affectedBones.set(boneIndex);
@@ -314,19 +312,19 @@ public final class AnimChannel {
         }
         }
     }
     }
 
 
-    BitSet getAffectedBones(){
+    BitSet getAffectedBones() {
         return affectedBones;
         return affectedBones;
     }
     }
-    
-    public void reset(boolean rewind){
-        if(rewind){
-            setTime(0);        
-            if(control.getSkeleton()!=null){
+
+    public void reset(boolean rewind) {
+        if (rewind) {
+            setTime(0);
+            if (control.getSkeleton() != null) {
                 control.getSkeleton().resetAndUpdate();
                 control.getSkeleton().resetAndUpdate();
-            }else{
+            } else {
                 TempVars vars = TempVars.get();
                 TempVars vars = TempVars.get();
                 update(0, vars);
                 update(0, vars);
-                vars.release();    
+                vars.release();
             }
             }
         }
         }
         animation = null;
         animation = null;
@@ -337,31 +335,31 @@ public final class AnimChannel {
         if (animation == null)
         if (animation == null)
             return;
             return;
 
 
-        if (blendFrom != null && blendAmount != 1.0f){
+        if (blendFrom != null && blendAmount != 1.0f) {
             // The blendFrom anim is set, the actual animation
             // The blendFrom anim is set, the actual animation
-            // playing will be set 
+            // playing will be set
 //            blendFrom.setTime(timeBlendFrom, 1f, control, this, vars);
 //            blendFrom.setTime(timeBlendFrom, 1f, control, this, vars);
             blendFrom.setTime(timeBlendFrom, 1f - blendAmount, control, this, vars);
             blendFrom.setTime(timeBlendFrom, 1f - blendAmount, control, this, vars);
-            
+
             timeBlendFrom += tpf * speedBlendFrom;
             timeBlendFrom += tpf * speedBlendFrom;
             timeBlendFrom = AnimationUtils.clampWrapTime(timeBlendFrom,
             timeBlendFrom = AnimationUtils.clampWrapTime(timeBlendFrom,
-                                          blendFrom.getLength(),
-                                          loopModeBlendFrom);
-            if (timeBlendFrom < 0){
+                    blendFrom.getLength(),
+                    loopModeBlendFrom);
+            if (timeBlendFrom < 0) {
                 timeBlendFrom = -timeBlendFrom;
                 timeBlendFrom = -timeBlendFrom;
                 speedBlendFrom = -speedBlendFrom;
                 speedBlendFrom = -speedBlendFrom;
             }
             }
 
 
             blendAmount += tpf * blendRate;
             blendAmount += tpf * blendRate;
-            if (blendAmount > 1f){
+            if (blendAmount > 1f) {
                 blendAmount = 1f;
                 blendAmount = 1f;
                 blendFrom = null;
                 blendFrom = null;
             }
             }
         }
         }
-        
+
         animation.setTime(time, blendAmount, control, this, vars);
         animation.setTime(time, blendAmount, control, this, vars);
-        time += tpf * speed;      
-        if (animation.getLength() > 0){
+        time += tpf * speed;
+        if (animation.getLength() > 0) {
             if (!notified && (time >= animation.getLength() || time < 0)) {
             if (!notified && (time >= animation.getLength() || time < 0)) {
                 if (loopMode == LoopMode.DontLoop) {
                 if (loopMode == LoopMode.DontLoop) {
                     // Note that this flag has to be set before calling the notify,
                     // Note that this flag has to be set before calling the notify,
@@ -370,10 +368,10 @@ public final class AnimChannel {
                     notified = true;
                     notified = true;
                 }
                 }
                 control.notifyAnimCycleDone(this, animation.getName());
                 control.notifyAnimCycleDone(this, animation.getName());
-            } 
+            }
         }
         }
         time = AnimationUtils.clampWrapTime(time, animation.getLength(), loopMode);
         time = AnimationUtils.clampWrapTime(time, animation.getLength(), loopMode);
-        if (time < 0){
+        if (time < 0) {
             // Negative time indicates that speed should be inverted
             // Negative time indicates that speed should be inverted
             // (for cycle loop mode only)
             // (for cycle loop mode only)
             time = -time;
             time = -time;

+ 16 - 16
jme3-core/src/main/java/com/jme3/animation/AnimControl.java

@@ -109,32 +109,32 @@ public final class AnimControl extends AbstractControl implements Cloneable, Jme
     public AnimControl() {
     public AnimControl() {
     }
     }
 
 
-    @Override   
+    @Override
     public Object jmeClone() {
     public Object jmeClone() {
         AnimControl clone = (AnimControl) super.jmeClone();
         AnimControl clone = (AnimControl) super.jmeClone();
         clone.channels = new ArrayList<AnimChannel>();
         clone.channels = new ArrayList<AnimChannel>();
         clone.listeners = new ArrayList<AnimEventListener>();
         clone.listeners = new ArrayList<AnimEventListener>();
 
 
         return clone;
         return clone;
-    }     
+    }
 
 
-    @Override   
-    public void cloneFields( Cloner cloner, Object original ) {
+    @Override
+    public void cloneFields(Cloner cloner, Object original) {
         super.cloneFields(cloner, original);
         super.cloneFields(cloner, original);
-        
+
         this.skeleton = cloner.clone(skeleton);
         this.skeleton = cloner.clone(skeleton);
- 
-        // Note cloneForSpatial() never actually cloned the animation map... just its reference       
+
+        // Note cloneForSpatial() never actually cloned the animation map... just its reference
         HashMap<String, Animation> newMap = new HashMap<>();
         HashMap<String, Animation> newMap = new HashMap<>();
-         
-        // animationMap is cloned, but only cloneable tracks will be cloned as they need a reference to a cloned spatial
-        for( Map.Entry<String, Animation> e : animationMap.entrySet() ) {
+
+        // animationMap is cloned, but only ClonableTracks will be cloned as they need a reference to a cloned spatial
+        for (Map.Entry<String, Animation> e : animationMap.entrySet()) {
             newMap.put(e.getKey(), cloner.clone(e.getValue()));
             newMap.put(e.getKey(), cloner.clone(e.getValue()));
         }
         }
-        
+
         this.animationMap = newMap;
         this.animationMap = newMap;
     }
     }
-         
+
     /**
     /**
      * @param animations Set the animations that this <code>AnimControl</code>
      * @param animations Set the animations that this <code>AnimControl</code>
      * will be capable of playing. The animations should be compatible
      * will be capable of playing. The animations should be compatible
@@ -182,7 +182,7 @@ public final class AnimControl extends AbstractControl implements Cloneable, Jme
     /**
     /**
      * Create a new animation channel, by default assigned to all bones
      * Create a new animation channel, by default assigned to all bones
      * in the skeleton.
      * in the skeleton.
-     * 
+     *
      * @return A new animation channel for this <code>AnimControl</code>.
      * @return A new animation channel for this <code>AnimControl</code>.
      */
      */
     public AnimChannel createChannel() {
     public AnimChannel createChannel() {
@@ -376,11 +376,11 @@ public final class AnimControl extends AbstractControl implements Cloneable, Jme
         }
         }
 
 
         if (im.getFormatVersion() == 0) {
         if (im.getFormatVersion() == 0) {
-            // Changed for backward compatibility with j3o files generated 
+            // Changed for backward compatibility with j3o files generated
             // before the AnimControl/SkeletonControl split.
             // before the AnimControl/SkeletonControl split.
 
 
-            // If we find a target mesh array the AnimControl creates the 
-            // SkeletonControl for old files and add it to the spatial.        
+            // If we find a target mesh array the AnimControl creates the
+            // SkeletonControl for old files and add it to the spatial.
             // When backward compatibility isn't needed anymore, this can be deleted.
             // When backward compatibility isn't needed anymore, this can be deleted.
             Savable[] sav = in.readSavableArray("targets", null);
             Savable[] sav = in.readSavableArray("targets", null);
             if (sav != null) {
             if (sav != null) {

+ 21 - 23
jme3-core/src/main/java/com/jme3/animation/Animation.java

@@ -42,23 +42,22 @@ import java.io.IOException;
 
 
 /**
 /**
  * The animation class updates the animation target with the tracks of a given type.
  * The animation class updates the animation target with the tracks of a given type.
- * 
+ *
  * @author Kirill Vainer, Marcin Roguski (Kaelthas)
  * @author Kirill Vainer, Marcin Roguski (Kaelthas)
  * @deprecated use {@link com.jme3.anim.AnimClip}
  * @deprecated use {@link com.jme3.anim.AnimClip}
  */
  */
 @Deprecated
 @Deprecated
 public class Animation implements Savable, Cloneable, JmeCloneable {
 public class Animation implements Savable, Cloneable, JmeCloneable {
-
-    /** 
-     * The name of the animation. 
+    /**
+     * The name of the animation.
      */
      */
     private String name;
     private String name;
-    /** 
-     * The length of the animation. 
+    /**
+     * The length of the animation.
      */
      */
     private float length;
     private float length;
-    /** 
-     * The tracks of the animation. 
+    /**
+     * The tracks of the animation.
      */
      */
     private SafeArrayList<Track> tracks = new SafeArrayList<>(Track.class);
     private SafeArrayList<Track> tracks = new SafeArrayList<>(Track.class);
 
 
@@ -70,7 +69,7 @@ public class Animation implements Savable, Cloneable, JmeCloneable {
 
 
     /**
     /**
      * Creates a new <code>Animation</code> with the given name and length.
      * Creates a new <code>Animation</code> with the given name and length.
-     * 
+     *
      * @param name The name of the animation.
      * @param name The name of the animation.
      * @param length Length in seconds of the animation.
      * @param length Length in seconds of the animation.
      */
      */
@@ -89,7 +88,7 @@ public class Animation implements Savable, Cloneable, JmeCloneable {
 
 
     /**
     /**
      * Returns the length in seconds of this animation
      * Returns the length in seconds of this animation
-     * 
+     *
      * @return the length in seconds of this animation
      * @return the length in seconds of this animation
      */
      */
     public float getLength() {
     public float getLength() {
@@ -118,7 +117,7 @@ public class Animation implements Savable, Cloneable, JmeCloneable {
      * This method sets the current time of the animation.
      * This method sets the current time of the animation.
      * This method behaves differently for every known track type.
      * This method behaves differently for every known track type.
      * Override this method if you have your own type of track.
      * Override this method if you have your own type of track.
-     * 
+     *
      * @param time the time of the animation
      * @param time the time of the animation
      * @param blendAmount the blend amount factor
      * @param blendAmount the blend amount factor
      * @param control the animation control
      * @param control the animation control
@@ -136,7 +135,7 @@ public class Animation implements Savable, Cloneable, JmeCloneable {
 
 
     /**
     /**
      * Set the {@link Track}s to be used by this animation.
      * Set the {@link Track}s to be used by this animation.
-     * 
+     *
      * @param tracksArray The tracks to set.
      * @param tracksArray The tracks to set.
      */
      */
     public void setTracks(Track[] tracksArray) {
     public void setTracks(Track[] tracksArray) {
@@ -166,7 +165,7 @@ public class Animation implements Savable, Cloneable, JmeCloneable {
 
 
     /**
     /**
      * Returns the tracks set in {@link #setTracks(com.jme3.animation.Track[]) }.
      * Returns the tracks set in {@link #setTracks(com.jme3.animation.Track[]) }.
-     * 
+     *
      * @return the tracks set previously
      * @return the tracks set previously
      */
      */
     public Track[] getTracks() {
     public Track[] getTracks() {
@@ -192,7 +191,7 @@ public class Animation implements Savable, Cloneable, JmeCloneable {
     }
     }
 
 
     /**
     /**
-     * 
+     *
      * @param spat the Spatial to clone for
      * @param spat the Spatial to clone for
      * @return a new instance
      * @return a new instance
      */
      */
@@ -213,33 +212,32 @@ public class Animation implements Savable, Cloneable, JmeCloneable {
         }
         }
     }
     }
 
 
-    @Override   
+    @Override
     public Object jmeClone() {
     public Object jmeClone() {
         try {
         try {
             return super.clone();
             return super.clone();
-        } catch( CloneNotSupportedException e ) {
+        } catch (CloneNotSupportedException e) {
             throw new RuntimeException("Error cloning", e);
             throw new RuntimeException("Error cloning", e);
         }
         }
-    }     
+    }
 
 
-    @Override   
-    public void cloneFields( Cloner cloner, Object original ) {
-         
+    @Override
+    public void cloneFields(Cloner cloner, Object original) {
         // There is some logic here that I'm copying, but I'm not sure if
         // There is some logic here that I'm copying, but I'm not sure if
         // it's a mistake or not.  If a track is not a CloneableTrack then it
         // it's a mistake or not.  If a track is not a CloneableTrack then it
         // isn't cloned at all... even though they all implement clone() methods. -pspeed
         // isn't cloned at all... even though they all implement clone() methods. -pspeed
         SafeArrayList<Track> newTracks = new SafeArrayList<>(Track.class);
         SafeArrayList<Track> newTracks = new SafeArrayList<>(Track.class);
-        for( Track track : tracks ) {
+        for (Track track : tracks) {
             if (track instanceof JmeCloneable) {
             if (track instanceof JmeCloneable) {
                 newTracks.add(cloner.clone(track));
                 newTracks.add(cloner.clone(track));
             } else {
             } else {
-                // this is the part that seems fishy 
+                // this is the part that seems fishy
                 newTracks.add(track);
                 newTracks.add(track);
             }
             }
         }
         }
         this.tracks = newTracks;
         this.tracks = newTracks;
     }
     }
-         
+
     @Override
     @Override
     public String toString() {
     public String toString() {
         return getClass().getSimpleName() + "[name=" + name + ", length=" + length + ']';
         return getClass().getSimpleName() + "[name=" + name + ", length=" + length + ']';

+ 6 - 7
jme3-core/src/main/java/com/jme3/animation/AnimationUtils.java

@@ -36,10 +36,9 @@ package com.jme3.animation;
  * @author Nehon
  * @author Nehon
  */
  */
 public class AnimationUtils {
 public class AnimationUtils {
-    
-    private AnimationUtils(){
-        
+    private AnimationUtils() {
     }
     }
+
     /**
     /**
      * Clamps the time according to duration and loopMode
      * Clamps the time according to duration and loopMode
      *
      *
@@ -48,10 +47,10 @@ public class AnimationUtils {
      * @param loopMode the animation's looping behavior (not null)
      * @param loopMode the animation's looping behavior (not null)
      * @return the clamped time (in seconds)
      * @return the clamped time (in seconds)
      */
      */
-     public static float clampWrapTime(float time, float duration, LoopMode loopMode){
-         if (time == 0 || duration == 0) {
+    public static float clampWrapTime(float time, float duration, LoopMode loopMode) {
+        if (time == 0 || duration == 0) {
             return 0; // prevent division by 0 errors
             return 0; // prevent division by 0 errors
-        }        
+        }
         switch (loopMode) {
         switch (loopMode) {
             case Cycle:
             case Cycle:
                 boolean sign = ((int) (time / duration) % 2) != 0;
                 boolean sign = ((int) (time / duration) % 2) != 0;
@@ -62,5 +61,5 @@ public class AnimationUtils {
                 return time % duration;
                 return time % duration;
         }
         }
         return time;
         return time;
-     }
+    }
 }
 }

+ 10 - 12
jme3-core/src/main/java/com/jme3/animation/AudioTrack.java

@@ -156,9 +156,9 @@ public class AudioTrack implements ClonableTrack {
 
 
     @Override
     @Override
     public float[] getKeyFrameTimes() {
     public float[] getKeyFrameTimes() {
-        return new float[] { startOffset };
+        return new float[]{startOffset};
     }
     }
-    
+
     /**
     /**
      * Clone this track
      * Clone this track
      *
      *
@@ -197,27 +197,25 @@ public class AudioTrack implements ClonableTrack {
         return audioTrack;
         return audioTrack;
     }
     }
 
 
-    @Override   
+    @Override
     public Object jmeClone() {
     public Object jmeClone() {
         try {
         try {
             return super.clone();
             return super.clone();
-        } catch( CloneNotSupportedException e ) {
+        } catch (CloneNotSupportedException e) {
             throw new RuntimeException("Error cloning", e);
             throw new RuntimeException("Error cloning", e);
         }
         }
-    }     
-
+    }
 
 
-    @Override   
-    public void cloneFields( Cloner cloner, Object original ) {
+    @Override
+    public void cloneFields(Cloner cloner, Object original) {
         // Duplicating the old cloned state from cloneForSpatial()
         // Duplicating the old cloned state from cloneForSpatial()
         this.initialized = false;
         this.initialized = false;
         this.started = false;
         this.started = false;
-        this.played = false; 
+        this.played = false;
         this.audio = cloner.clone(audio);
         this.audio = cloner.clone(audio);
     }
     }
-         
-         
-    /**    
+
+    /**
      * recursive function responsible for finding the newly cloned AudioNode
      * recursive function responsible for finding the newly cloned AudioNode
      *
      *
      * @param spat
      * @param spat

+ 91 - 93
jme3-core/src/main/java/com/jme3/animation/Bone.java

@@ -48,21 +48,21 @@ import java.util.ArrayList;
  * <code>Bone</code> describes a bone in the bone-weight skeletal animation
  * <code>Bone</code> describes a bone in the bone-weight skeletal animation
  * system. A bone contains a name and an index, as well as relevant
  * system. A bone contains a name and an index, as well as relevant
  * transformation data.
  * transformation data.
- * 
+ *
  * A bone has 3 sets of transforms :
  * A bone has 3 sets of transforms :
  * 1. The bind transforms, that are the transforms of the bone when the skeleton
  * 1. The bind transforms, that are the transforms of the bone when the skeleton
- * is in its rest pose (also called bind pose or T pose in the literature). 
- * The bind transforms are expressed in Local space meaning relatively to the 
+ * is in its rest pose (also called bind pose or T pose in the literature).
+ * The bind transforms are expressed in Local space meaning relatively to the
  * parent bone.
  * parent bone.
- * 
+ *
  * 2. The Local transforms, that are the transforms of the bone once animation
  * 2. The Local transforms, that are the transforms of the bone once animation
  * or user transforms has been applied to the bind pose. The local transforms are
  * or user transforms has been applied to the bind pose. The local transforms are
  * expressed in Local space meaning relatively to the parent bone.
  * expressed in Local space meaning relatively to the parent bone.
- * 
- * 3. The Model transforms, that are the transforms of the bone relatives to the 
- * rootBone of the skeleton. Those transforms are what is needed to apply skinning 
+ *
+ * 3. The Model transforms, that are the transforms of the bone relatives to the
+ * rootBone of the skeleton. Those transforms are what is needed to apply skinning
  * to the mesh the skeleton controls.
  * to the mesh the skeleton controls.
- * Note that there can be several rootBones in a skeleton. The one considered for 
+ * Note that there can be several rootBones in a skeleton. The one considered for
  * these transforms is the one that is an ancestor of this bone.
  * these transforms is the one that is an ancestor of this bone.
  *
  *
  * @author Kirill Vainer
  * @author Kirill Vainer
@@ -96,14 +96,14 @@ public final class Bone implements Savable, JmeCloneable {
     private Vector3f bindPos;
     private Vector3f bindPos;
     private Quaternion bindRot;
     private Quaternion bindRot;
     private Vector3f bindScale;
     private Vector3f bindScale;
-    
+
     /**
     /**
-     * The inverse bind transforms of this bone expressed in model space     
+     * The inverse bind transforms of this bone expressed in model space
      */
      */
     private Vector3f modelBindInversePos;
     private Vector3f modelBindInversePos;
     private Quaternion modelBindInverseRot;
     private Quaternion modelBindInverseRot;
     private Vector3f modelBindInverseScale;
     private Vector3f modelBindInverseScale;
-    
+
     /**
     /**
      * The local animated or user transform combined with the local bind transform
      * The local animated or user transform combined with the local bind transform
      */
      */
@@ -111,15 +111,15 @@ public final class Bone implements Savable, JmeCloneable {
     private Quaternion localRot = new Quaternion();
     private Quaternion localRot = new Quaternion();
     private Vector3f localScale = new Vector3f(1.0f, 1.0f, 1.0f);
     private Vector3f localScale = new Vector3f(1.0f, 1.0f, 1.0f);
     /**
     /**
-     * The model transforms of this bone     
+     * The model transforms of this bone
      */
      */
     private Vector3f modelPos = new Vector3f();
     private Vector3f modelPos = new Vector3f();
     private Quaternion modelRot = new Quaternion();
     private Quaternion modelRot = new Quaternion();
     private Vector3f modelScale = new Vector3f();
     private Vector3f modelScale = new Vector3f();
-    
+
     // Used for getCombinedTransform
     // Used for getCombinedTransform
     private Transform tmpTransform;
     private Transform tmpTransform;
-    
+
     /**
     /**
      * Used to handle blending from one animation to another.
      * Used to handle blending from one animation to another.
      * See {@link #blendAnimTransforms(com.jme3.math.Vector3f, com.jme3.math.Quaternion, com.jme3.math.Vector3f, float)}
      * See {@link #blendAnimTransforms(com.jme3.math.Vector3f, com.jme3.math.Quaternion, com.jme3.math.Vector3f, float)}
@@ -129,13 +129,13 @@ public final class Bone implements Savable, JmeCloneable {
 
 
     /**
     /**
      * Creates a new bone with the given name.
      * Creates a new bone with the given name.
-     * 
+     *
      * @param name Name to give to this bone
      * @param name Name to give to this bone
      */
      */
     public Bone(String name) {
     public Bone(String name) {
         if (name == null)
         if (name == null)
             throw new IllegalArgumentException("Name cannot be null");
             throw new IllegalArgumentException("Name cannot be null");
-        
+
         this.name = name;
         this.name = name;
 
 
         bindPos = new Vector3f();
         bindPos = new Vector3f();
@@ -148,13 +148,13 @@ public final class Bone implements Savable, JmeCloneable {
     }
     }
 
 
     /**
     /**
-     * Special-purpose copy constructor. 
+     * Special-purpose copy constructor.
      * <p>
      * <p>
      * Only copies the name, user control state and bind pose transforms from the original.
      * Only copies the name, user control state and bind pose transforms from the original.
      * <p>
      * <p>
      * The rest of the data is <em>NOT</em> copied, as it will be
      * The rest of the data is <em>NOT</em> copied, as it will be
      * generated automatically when the bone is animated.
      * generated automatically when the bone is animated.
-     * 
+     *
      * @param source The bone from which to copy the data.
      * @param source The bone from which to copy the data.
      */
      */
     Bone(Bone source) {
     Bone(Bone source) {
@@ -178,48 +178,48 @@ public final class Bone implements Savable, JmeCloneable {
      */
      */
     protected Bone() {
     protected Bone() {
     }
     }
-    
-    @Override   
+
+    @Override
     public Object jmeClone() {
     public Object jmeClone() {
         try {
         try {
-            Bone clone = (Bone)super.clone();
+            Bone clone = (Bone) super.clone();
             return clone;
             return clone;
         } catch (CloneNotSupportedException ex) {
         } catch (CloneNotSupportedException ex) {
             throw new AssertionError();
             throw new AssertionError();
         }
         }
-    }     
+    }
+
+    @Override
+    public void cloneFields(Cloner cloner, Object original) {
 
 
-    @Override   
-    public void cloneFields( Cloner cloner, Object original ) {
-    
         this.parent = cloner.clone(parent);
         this.parent = cloner.clone(parent);
-        this.children = cloner.clone(children);    
-        
+        this.children = cloner.clone(children);
+
         this.attachNode = cloner.clone(attachNode);
         this.attachNode = cloner.clone(attachNode);
         this.targetGeometry = cloner.clone(targetGeometry);
         this.targetGeometry = cloner.clone(targetGeometry);
 
 
         this.bindPos = cloner.clone(bindPos);
         this.bindPos = cloner.clone(bindPos);
         this.bindRot = cloner.clone(bindRot);
         this.bindRot = cloner.clone(bindRot);
         this.bindScale = cloner.clone(bindScale);
         this.bindScale = cloner.clone(bindScale);
-        
+
         this.modelBindInversePos = cloner.clone(modelBindInversePos);
         this.modelBindInversePos = cloner.clone(modelBindInversePos);
         this.modelBindInverseRot = cloner.clone(modelBindInverseRot);
         this.modelBindInverseRot = cloner.clone(modelBindInverseRot);
         this.modelBindInverseScale = cloner.clone(modelBindInverseScale);
         this.modelBindInverseScale = cloner.clone(modelBindInverseScale);
-    
+
         this.localPos = cloner.clone(localPos);
         this.localPos = cloner.clone(localPos);
         this.localRot = cloner.clone(localRot);
         this.localRot = cloner.clone(localRot);
         this.localScale = cloner.clone(localScale);
         this.localScale = cloner.clone(localScale);
-        
+
         this.modelPos = cloner.clone(modelPos);
         this.modelPos = cloner.clone(modelPos);
         this.modelRot = cloner.clone(modelRot);
         this.modelRot = cloner.clone(modelRot);
         this.modelScale = cloner.clone(modelScale);
         this.modelScale = cloner.clone(modelScale);
-    
+
         this.tmpTransform = cloner.clone(tmpTransform);
         this.tmpTransform = cloner.clone(tmpTransform);
     }
     }
 
 
     /**
     /**
      * Returns the name of the bone, set in the constructor.
      * Returns the name of the bone, set in the constructor.
-     * 
+     *
      * @return The name of the bone, set in the constructor.
      * @return The name of the bone, set in the constructor.
      */
      */
     public String getName() {
     public String getName() {
@@ -236,7 +236,7 @@ public final class Bone implements Savable, JmeCloneable {
 
 
     /**
     /**
      * Returns all the children bones of this bone.
      * Returns all the children bones of this bone.
-     * 
+     *
      * @return All the children bones of this bone.
      * @return All the children bones of this bone.
      */
      */
     public ArrayList<Bone> getChildren() {
     public ArrayList<Bone> getChildren() {
@@ -245,7 +245,7 @@ public final class Bone implements Savable, JmeCloneable {
 
 
     /**
     /**
      * Returns the local position of the bone, relative to the parent bone.
      * Returns the local position of the bone, relative to the parent bone.
-     * 
+     *
      * @return The local position of the bone, relative to the parent bone.
      * @return The local position of the bone, relative to the parent bone.
      */
      */
     public Vector3f getLocalPosition() {
     public Vector3f getLocalPosition() {
@@ -254,7 +254,7 @@ public final class Bone implements Savable, JmeCloneable {
 
 
     /**
     /**
      * Returns the local rotation of the bone, relative to the parent bone.
      * Returns the local rotation of the bone, relative to the parent bone.
-     * 
+     *
      * @return The local rotation of the bone, relative to the parent bone.
      * @return The local rotation of the bone, relative to the parent bone.
      */
      */
     public Quaternion getLocalRotation() {
     public Quaternion getLocalRotation() {
@@ -263,7 +263,7 @@ public final class Bone implements Savable, JmeCloneable {
 
 
     /**
     /**
      * Returns the local scale of the bone, relative to the parent bone.
      * Returns the local scale of the bone, relative to the parent bone.
-     * 
+     *
      * @return The local scale of the bone, relative to the parent bone.
      * @return The local scale of the bone, relative to the parent bone.
      */
      */
     public Vector3f getLocalScale() {
     public Vector3f getLocalScale() {
@@ -272,7 +272,7 @@ public final class Bone implements Savable, JmeCloneable {
 
 
     /**
     /**
      * Returns the position of the bone in model space.
      * Returns the position of the bone in model space.
-     * 
+     *
      * @return The position of the bone in model space.
      * @return The position of the bone in model space.
      */
      */
     public Vector3f getModelSpacePosition() {
     public Vector3f getModelSpacePosition() {
@@ -281,7 +281,7 @@ public final class Bone implements Savable, JmeCloneable {
 
 
     /**
     /**
      * Returns the rotation of the bone in model space.
      * Returns the rotation of the bone in model space.
-     * 
+     *
      * @return The rotation of the bone in model space.
      * @return The rotation of the bone in model space.
      */
      */
     public Quaternion getModelSpaceRotation() {
     public Quaternion getModelSpaceRotation() {
@@ -290,7 +290,7 @@ public final class Bone implements Savable, JmeCloneable {
 
 
     /**
     /**
      * Returns the scale of the bone in model space.
      * Returns the scale of the bone in model space.
-     * 
+     *
      * @return The scale of the bone in model space.
      * @return The scale of the bone in model space.
      */
      */
     public Vector3f getModelSpaceScale() {
     public Vector3f getModelSpaceScale() {
@@ -301,19 +301,19 @@ public final class Bone implements Savable, JmeCloneable {
      * @return the pre-existing vector
      * @return the pre-existing vector
      * @deprecated use {@link #getModelBindInversePosition()}
      * @deprecated use {@link #getModelBindInversePosition()}
      */
      */
-    @Deprecated 
+    @Deprecated
     public Vector3f getWorldBindInversePosition() {
     public Vector3f getWorldBindInversePosition() {
         return modelBindInversePos;
         return modelBindInversePos;
     }
     }
-    
-      /**
+
+    /**
      * Returns the inverse Bind position of this bone expressed in model space.
      * Returns the inverse Bind position of this bone expressed in model space.
      * <p>
      * <p>
      * The inverse bind pose transform of the bone in model space is its "default"
      * The inverse bind pose transform of the bone in model space is its "default"
      * transform with no animation applied.
      * transform with no animation applied.
-     * 
+     *
      * @return the inverse bind position of this bone expressed in model space.
      * @return the inverse bind position of this bone expressed in model space.
-     */   
+     */
     public Vector3f getModelBindInversePosition() {
     public Vector3f getModelBindInversePosition() {
         return modelBindInversePos;
         return modelBindInversePos;
     }
     }
@@ -326,20 +326,19 @@ public final class Bone implements Savable, JmeCloneable {
     public Quaternion getWorldBindInverseRotation() {
     public Quaternion getWorldBindInverseRotation() {
         return modelBindInverseRot;
         return modelBindInverseRot;
     }
     }
-    
-      /**
+
+    /**
      * Returns the inverse bind rotation of this bone expressed in model space.
      * Returns the inverse bind rotation of this bone expressed in model space.
      * <p>
      * <p>
      * The inverse bind pose transform of the bone in model space is its "default"
      * The inverse bind pose transform of the bone in model space is its "default"
      * transform with no animation applied.
      * transform with no animation applied.
-     * 
+     *
      * @return the inverse bind rotation of this bone expressed in model space.
      * @return the inverse bind rotation of this bone expressed in model space.
      */
      */
     public Quaternion getModelBindInverseRotation() {
     public Quaternion getModelBindInverseRotation() {
         return modelBindInverseRot;
         return modelBindInverseRot;
     }
     }
 
 
-
     /**
     /**
      * @return the pre-existing vector
      * @return the pre-existing vector
      * @deprecated use {@link #getModelBindInverseScale()}
      * @deprecated use {@link #getModelBindInverseScale()}
@@ -348,13 +347,13 @@ public final class Bone implements Savable, JmeCloneable {
     public Vector3f getWorldBindInverseScale() {
     public Vector3f getWorldBindInverseScale() {
         return modelBindInverseScale;
         return modelBindInverseScale;
     }
     }
-    
+
     /**
     /**
      * Returns the inverse world bind pose scale.
      * Returns the inverse world bind pose scale.
      * <p>
      * <p>
      * The inverse bind pose transform of the bone in model space is its "default"
      * The inverse bind pose transform of the bone in model space is its "default"
      * transform with no animation applied.
      * transform with no animation applied.
-     * 
+     *
      * @return the inverse world bind pose scale.
      * @return the inverse world bind pose scale.
      */
      */
     public Vector3f getModelBindInverseScale() {
     public Vector3f getModelBindInverseScale() {
@@ -370,7 +369,7 @@ public final class Bone implements Savable, JmeCloneable {
         }
         }
         return t;
         return t;
     }
     }
-    
+
     public Transform getBindInverseTransform() {
     public Transform getBindInverseTransform() {
         Transform t = new Transform();
         Transform t = new Transform();
         t.setTranslation(bindPos);
         t.setTranslation(bindPos);
@@ -380,7 +379,7 @@ public final class Bone implements Savable, JmeCloneable {
         }
         }
         return t.invert();
         return t.invert();
     }
     }
-    
+
     /**
     /**
      * @return the pre-existing vector
      * @return the pre-existing vector
      * @deprecated use {@link #getBindPosition()}
      * @deprecated use {@link #getBindPosition()}
@@ -389,13 +388,13 @@ public final class Bone implements Savable, JmeCloneable {
     public Vector3f getWorldBindPosition() {
     public Vector3f getWorldBindPosition() {
         return bindPos;
         return bindPos;
     }
     }
-    
-     /**
+
+    /**
      * Returns the bind position expressed in local space (relative to the parent bone).
      * Returns the bind position expressed in local space (relative to the parent bone).
      * <p>
      * <p>
      * The bind pose transform of the bone in local space is its "default"
      * The bind pose transform of the bone in local space is its "default"
      * transform with no animation applied.
      * transform with no animation applied.
-     * 
+     *
      * @return the bind position in local space.
      * @return the bind position in local space.
      */
      */
     public Vector3f getBindPosition() {
     public Vector3f getBindPosition() {
@@ -405,7 +404,7 @@ public final class Bone implements Savable, JmeCloneable {
     /**
     /**
      * @return the pre-existing Quaternion
      * @return the pre-existing Quaternion
      * @deprecated use {@link #getBindRotation() }
      * @deprecated use {@link #getBindRotation() }
-     */    
+     */
     @Deprecated
     @Deprecated
     public Quaternion getWorldBindRotation() {
     public Quaternion getWorldBindRotation() {
         return bindRot;
         return bindRot;
@@ -416,13 +415,13 @@ public final class Bone implements Savable, JmeCloneable {
      * <p>
      * <p>
      * The bind pose transform of the bone in local space is its "default"
      * The bind pose transform of the bone in local space is its "default"
      * transform with no animation applied.
      * transform with no animation applied.
-     * 
+     *
      * @return the bind rotation in local space.
      * @return the bind rotation in local space.
-     */    
+     */
     public Quaternion getBindRotation() {
     public Quaternion getBindRotation() {
         return bindRot;
         return bindRot;
-    }  
-    
+    }
+
     /**
     /**
      * @return the pre-existing vector
      * @return the pre-existing vector
      * @deprecated use {@link #getBindScale() }
      * @deprecated use {@link #getBindScale() }
@@ -431,13 +430,13 @@ public final class Bone implements Savable, JmeCloneable {
     public Vector3f getWorldBindScale() {
     public Vector3f getWorldBindScale() {
         return bindScale;
         return bindScale;
     }
     }
-    
+
     /**
     /**
      * Returns the  bind scale expressed in local space (relative to the parent bone).
      * Returns the  bind scale expressed in local space (relative to the parent bone).
      * <p>
      * <p>
      * The bind pose transform of the bone in local space is its "default"
      * The bind pose transform of the bone in local space is its "default"
      * transform with no animation applied.
      * transform with no animation applied.
-     * 
+     *
      * @return the bind scale in local space.
      * @return the bind scale in local space.
      */
      */
     public Vector3f getBindScale() {
     public Vector3f getBindScale() {
@@ -457,7 +456,7 @@ public final class Bone implements Savable, JmeCloneable {
     /**
     /**
      * Add a new child to this bone. Shouldn't be used by user code.
      * Add a new child to this bone. Shouldn't be used by user code.
      * Can corrupt skeleton.
      * Can corrupt skeleton.
-     * 
+     *
      * @param bone The bone to add
      * @param bone The bone to add
      */
      */
     public void addChild(Bone bone) {
     public void addChild(Bone bone) {
@@ -466,15 +465,14 @@ public final class Bone implements Savable, JmeCloneable {
     }
     }
 
 
     /**
     /**
-     * 
+     *
      * @deprecated use {@link #updateModelTransforms() }
      * @deprecated use {@link #updateModelTransforms() }
      */
      */
     @Deprecated
     @Deprecated
-    public final void updateWorldVectors(){
+    public final void updateWorldVectors() {
         updateModelTransforms();
         updateModelTransforms();
     }
     }
-            
-            
+
     /**
     /**
      * Updates the model transforms for this bone and, possibly, the attachments node
      * Updates the model transforms for this bone and, possibly, the attachments node
      * if not null.
      * if not null.
@@ -497,11 +495,11 @@ public final class Bone implements Savable, JmeCloneable {
                 localPos.interpolateLocal(bindPos, invWeightSum);
                 localPos.interpolateLocal(bindPos, invWeightSum);
                 localScale.interpolateLocal(bindScale, invWeightSum);
                 localScale.interpolateLocal(bindScale, invWeightSum);
             }
             }
-            
+
             // Future invocations of transform blend will start over.
             // Future invocations of transform blend will start over.
             currentWeightSum = -1;
             currentWeightSum = -1;
         }
         }
-        
+
         if (parent != null) {
         if (parent != null) {
             //rotation
             //rotation
             parent.modelRot.mult(localRot, modelRot);
             parent.modelRot.mult(localRot, modelRot);
@@ -512,7 +510,7 @@ public final class Bone implements Savable, JmeCloneable {
             parent.modelScale.mult(localScale, modelScale);
             parent.modelScale.mult(localScale, modelScale);
 
 
             //translation
             //translation
-            //scale and rotation of parent affect bone position            
+            //scale and rotation of parent affect bone position
             parent.modelRot.mult(localPos, modelPos);
             parent.modelRot.mult(localPos, modelPos);
             modelPos.multLocal(parent.modelScale);
             modelPos.multLocal(parent.modelScale);
             modelPos.addLocal(parent.modelPos);
             modelPos.addLocal(parent.modelPos);
@@ -624,14 +622,14 @@ public final class Bone implements Savable, JmeCloneable {
         }
         }
     }
     }
 
 
-     /**
+    /**
      * Stores the skinning transform in the specified Matrix4f.
      * Stores the skinning transform in the specified Matrix4f.
      * The skinning transform applies the animation of the bone to a vertex.
      * The skinning transform applies the animation of the bone to a vertex.
-     * 
+     *
      * This assumes that the world transforms for the entire bone hierarchy
      * This assumes that the world transforms for the entire bone hierarchy
      * have already been computed, otherwise this method will return undefined
      * have already been computed, otherwise this method will return undefined
      * results.
      * results.
-     * 
+     *
      * @param outTransform
      * @param outTransform
      */
      */
     void getOffsetTransform(Matrix4f outTransform, Quaternion tmp1, Vector3f tmp2, Vector3f tmp3, Matrix3f tmp4) {
     void getOffsetTransform(Matrix4f outTransform, Quaternion tmp1, Vector3f tmp2, Vector3f tmp3, Matrix3f tmp4) {
@@ -650,7 +648,7 @@ public final class Bone implements Savable, JmeCloneable {
     }
     }
 
 
     /**
     /**
-     * 
+     *
      * Sets the transforms of this bone in local space (relative to the parent bone)
      * Sets the transforms of this bone in local space (relative to the parent bone)
      *
      *
      * @param translation the translation in local space
      * @param translation the translation in local space
@@ -673,7 +671,7 @@ public final class Bone implements Savable, JmeCloneable {
 
 
     /**
     /**
      * Sets the transforms of this bone in model space (relative to the root bone)
      * Sets the transforms of this bone in model space (relative to the root bone)
-     * 
+     *
      * Must update all bones in skeleton for this to work.
      * Must update all bones in skeleton for this to work.
      * @param translation translation in model space
      * @param translation translation in model space
      * @param rotation rotation in model space
      * @param rotation rotation in model space
@@ -686,9 +684,9 @@ public final class Bone implements Savable, JmeCloneable {
         // TODO: add scale here ???
         // TODO: add scale here ???
         modelPos.set(translation);
         modelPos.set(translation);
         modelRot.set(rotation);
         modelRot.set(rotation);
-        
-        //if there is an attached Node we need to set its local transforms too.
-        if(attachNode != null){
+
+        // if there is an attached Node we need to set its local transforms too.
+        if (attachNode != null) {
             attachNode.setLocalTranslation(translation);
             attachNode.setLocalTranslation(translation);
             attachNode.setLocalRotation(rotation);
             attachNode.setLocalRotation(rotation);
         }
         }
@@ -701,7 +699,7 @@ public final class Bone implements Savable, JmeCloneable {
      * @return the resulting Transform (in reusable temporary storage!)
      * @return the resulting Transform (in reusable temporary storage!)
      */
      */
     public Transform getCombinedTransform(Vector3f position, Quaternion rotation) {
     public Transform getCombinedTransform(Vector3f position, Quaternion rotation) {
-        if(tmpTransform == null){
+        if (tmpTransform == null) {
             tmpTransform = new Transform();
             tmpTransform = new Transform();
         }
         }
         rotation.mult(localPos, tmpTransform.getTranslation()).addLocal(position);
         rotation.mult(localPos, tmpTransform.getTranslation()).addLocal(position);
@@ -781,7 +779,7 @@ public final class Bone implements Savable, JmeCloneable {
      * updateModelTransforms() call will result in final transform = transform * 0.5.
      * updateModelTransforms() call will result in final transform = transform * 0.5.
      * Two transform blends with weight = 0.5 each will result in the two
      * Two transform blends with weight = 0.5 each will result in the two
      * transforms blended together (nlerp) with blend = 0.5.
      * transforms blended together (nlerp) with blend = 0.5.
-     * 
+     *
      * @param translation The translation to blend in
      * @param translation The translation to blend in
      * @param rotation The rotation to blend in
      * @param rotation The rotation to blend in
      * @param scale The scale to blend in
      * @param scale The scale to blend in
@@ -792,13 +790,13 @@ public final class Bone implements Savable, JmeCloneable {
         if (userControl) {
         if (userControl) {
             return;
             return;
         }
         }
-        
+
         if (weight == 0) {
         if (weight == 0) {
             // Do not apply this transform at all.
             // Do not apply this transform at all.
             return;
             return;
         }
         }
 
 
-        if (currentWeightSum == 1){
+        if (currentWeightSum == 1) {
             return; // More than 2 transforms are being blended
             return; // More than 2 transforms are being blended
         } else if (currentWeightSum == -1 || currentWeightSum == 0) {
         } else if (currentWeightSum == -1 || currentWeightSum == 0) {
             // Set the transform fully
             // Set the transform fully
@@ -810,14 +808,14 @@ public final class Bone implements Savable, JmeCloneable {
             // Set the weight. It will be applied in updateModelTransforms().
             // Set the weight. It will be applied in updateModelTransforms().
             currentWeightSum = weight;
             currentWeightSum = weight;
         } else {
         } else {
-            // The weight is already set. 
+            // The weight is already set.
             // Blend in the new transform.
             // Blend in the new transform.
             TempVars vars = TempVars.get();
             TempVars vars = TempVars.get();
 
 
             Vector3f tmpV = vars.vect1;
             Vector3f tmpV = vars.vect1;
             Vector3f tmpV2 = vars.vect2;
             Vector3f tmpV2 = vars.vect2;
             Quaternion tmpQ = vars.quat1;
             Quaternion tmpQ = vars.quat1;
-            
+
             tmpV.set(bindPos).addLocal(translation);
             tmpV.set(bindPos).addLocal(translation);
             localPos.interpolateLocal(tmpV, weight);
             localPos.interpolateLocal(tmpV, weight);
 
 
@@ -828,10 +826,10 @@ public final class Bone implements Savable, JmeCloneable {
                 tmpV2.set(bindScale).multLocal(scale);
                 tmpV2.set(bindScale).multLocal(scale);
                 localScale.interpolateLocal(tmpV2, weight);
                 localScale.interpolateLocal(tmpV2, weight);
             }
             }
-        
+
             // Ensures no new weights will be blended in the future.
             // Ensures no new weights will be blended in the future.
             currentWeightSum = 1;
             currentWeightSum = 1;
-            
+
             vars.release();
             vars.release();
         }
         }
     }
     }
@@ -884,16 +882,16 @@ public final class Bone implements Savable, JmeCloneable {
 
 
         name = input.readString("name", null);
         name = input.readString("name", null);
         int ver = input.getSavableVersion(Bone.class);
         int ver = input.getSavableVersion(Bone.class);
-        if(ver < 2){
+        if (ver < 2) {
             bindPos = (Vector3f) input.readSavable("initialPos", null);
             bindPos = (Vector3f) input.readSavable("initialPos", null);
             bindRot = (Quaternion) input.readSavable("initialRot", null);
             bindRot = (Quaternion) input.readSavable("initialRot", null);
             bindScale = (Vector3f) input.readSavable("initialScale", new Vector3f(1.0f, 1.0f, 1.0f));
             bindScale = (Vector3f) input.readSavable("initialScale", new Vector3f(1.0f, 1.0f, 1.0f));
-        }else{
+        } else {
             bindPos = (Vector3f) input.readSavable("bindPos", null);
             bindPos = (Vector3f) input.readSavable("bindPos", null);
             bindRot = (Quaternion) input.readSavable("bindRot", null);
             bindRot = (Quaternion) input.readSavable("bindRot", null);
             bindScale = (Vector3f) input.readSavable("bindScale", new Vector3f(1.0f, 1.0f, 1.0f));
             bindScale = (Vector3f) input.readSavable("bindScale", new Vector3f(1.0f, 1.0f, 1.0f));
         }
         }
-        
+
         attachNode = (Node) input.readSavable("attachNode", null);
         attachNode = (Node) input.readSavable("attachNode", null);
         targetGeometry = (Geometry) input.readSavable("targetGeometry", null);
         targetGeometry = (Geometry) input.readSavable("targetGeometry", null);
 
 
@@ -931,7 +929,7 @@ public final class Bone implements Savable, JmeCloneable {
      *
      *
      * @param rot the desired rotation (not null, unaffected)
      * @param rot the desired rotation (not null, unaffected)
      */
      */
-    public void setLocalRotation(Quaternion rot){
+    public void setLocalRotation(Quaternion rot) {
         if (!userControl) {
         if (!userControl) {
             throw new IllegalStateException("User control must be on bone to allow user transforms");
             throw new IllegalStateException("User control must be on bone to allow user transforms");
         }
         }
@@ -944,7 +942,7 @@ public final class Bone implements Savable, JmeCloneable {
      *
      *
      * @param pos the desired translation (not null, unaffected)
      * @param pos the desired translation (not null, unaffected)
      */
      */
-    public void setLocalTranslation(Vector3f pos){
+    public void setLocalTranslation(Vector3f pos) {
         if (!userControl) {
         if (!userControl) {
             throw new IllegalStateException("User control must be on bone to allow user transforms");
             throw new IllegalStateException("User control must be on bone to allow user transforms");
         }
         }
@@ -956,7 +954,7 @@ public final class Bone implements Savable, JmeCloneable {
      * Warning: you need to call {@link #setUserControl(boolean)} with true to be able to do that operation
      * Warning: you need to call {@link #setUserControl(boolean)} with true to be able to do that operation
      * @param scale the scale to apply
      * @param scale the scale to apply
      */
      */
-    public void setLocalScale(Vector3f scale){
+    public void setLocalScale(Vector3f scale) {
         if (!userControl) {
         if (!userControl) {
             throw new IllegalStateException("User control must be on bone to allow user transforms");
             throw new IllegalStateException("User control must be on bone to allow user transforms");
         }
         }
@@ -968,7 +966,7 @@ public final class Bone implements Savable, JmeCloneable {
      * @see #setUserControl(boolean)
      * @see #setUserControl(boolean)
      * @return true if it can be manipulated
      * @return true if it can be manipulated
      */
      */
-    public boolean hasUserControl(){
+    public boolean hasUserControl() {
         return userControl;
         return userControl;
     }
     }
 }
 }

+ 9 - 9
jme3-core/src/main/java/com/jme3/animation/BoneTrack.java

@@ -42,7 +42,7 @@ import java.util.BitSet;
 
 
 /**
 /**
  * Contains a list of transforms and times for each keyframe.
  * Contains a list of transforms and times for each keyframe.
- * 
+ *
  * @author Kirill Vainer
  * @author Kirill Vainer
  * @deprecated use {@link com.jme3.anim.AnimTrack}
  * @deprecated use {@link com.jme3.anim.AnimTrack}
  */
  */
@@ -53,7 +53,7 @@ public final class BoneTrack implements JmeCloneable, Track {
      * Bone index in the skeleton which this track affects.
      * Bone index in the skeleton which this track affects.
      */
      */
     private int targetBoneIndex;
     private int targetBoneIndex;
-    
+
     /**
     /**
      * Transforms and times for track.
      * Transforms and times for track.
      */
      */
@@ -61,7 +61,7 @@ public final class BoneTrack implements JmeCloneable, Track {
     private CompactQuaternionArray rotations;
     private CompactQuaternionArray rotations;
     private CompactVector3Array scales;
     private CompactVector3Array scales;
     private float[] times;
     private float[] times;
-    
+
     /**
     /**
      * Serialization-only. Do not use.
      * Serialization-only. Do not use.
      */
      */
@@ -191,7 +191,7 @@ public final class BoneTrack implements JmeCloneable, Track {
     }
     }
 
 
     /**
     /**
-     * 
+     *
      * Modify the bone which this track modifies in the skeleton to contain
      * Modify the bone which this track modifies in the skeleton to contain
      * the correct animation transforms for a given time.
      * the correct animation transforms for a given time.
      * The transforms can be interpolated in some method from the keyframes.
      * The transforms can be interpolated in some method from the keyframes.
@@ -208,7 +208,7 @@ public final class BoneTrack implements JmeCloneable, Track {
         if (affectedBones != null && !affectedBones.get(targetBoneIndex)) {
         if (affectedBones != null && !affectedBones.get(targetBoneIndex)) {
             return;
             return;
         }
         }
-        
+
         Bone target = control.getSkeleton().getBone(targetBoneIndex);
         Bone target = control.getSkeleton().getBone(targetBoneIndex);
 
 
         Vector3f tempV = vars.vect1;
         Vector3f tempV = vars.vect1;
@@ -217,7 +217,7 @@ public final class BoneTrack implements JmeCloneable, Track {
         Vector3f tempV2 = vars.vect3;
         Vector3f tempV2 = vars.vect3;
         Vector3f tempS2 = vars.vect4;
         Vector3f tempS2 = vars.vect4;
         Quaternion tempQ2 = vars.quat2;
         Quaternion tempQ2 = vars.quat2;
-        
+
         int lastFrame = times.length - 1;
         int lastFrame = times.length - 1;
         if (time < 0 || lastFrame == 0) {
         if (time < 0 || lastFrame == 0) {
             rotations.get(0, tempQ);
             rotations.get(0, tempQ);
@@ -260,12 +260,12 @@ public final class BoneTrack implements JmeCloneable, Track {
         }
         }
 
 
 //        if (weight != 1f) {
 //        if (weight != 1f) {
-            target.blendAnimTransforms(tempV, tempQ, scales != null ? tempS : null, weight);
+        target.blendAnimTransforms(tempV, tempQ, scales != null ? tempS : null, weight);
 //        } else {
 //        } else {
 //            target.setAnimTransforms(tempV, tempQ, scales != null ? tempS : null);
 //            target.setAnimTransforms(tempV, tempQ, scales != null ? tempS : null);
 //        }
 //        }
     }
     }
-    
+
     /**
     /**
      * @return the length of the track
      * @return the length of the track
      */
      */
@@ -341,7 +341,7 @@ public final class BoneTrack implements JmeCloneable, Track {
         scales = (CompactVector3Array) ic.readSavable("scales", null);
         scales = (CompactVector3Array) ic.readSavable("scales", null);
 
 
         //Backward compatibility for old j3o files generated before revision 6807
         //Backward compatibility for old j3o files generated before revision 6807
-        if (im.getFormatVersion() == 0){
+        if (im.getFormatVersion() == 0) {
             if (translations == null) {
             if (translations == null) {
                 Savable[] sav = ic.readSavableArray("translations", null);
                 Savable[] sav = ic.readSavableArray("translations", null);
                 if (sav != null) {
                 if (sav != null) {

+ 3 - 3
jme3-core/src/main/java/com/jme3/animation/CompactFloatArray.java

@@ -81,12 +81,12 @@ public class CompactFloatArray extends CompactArray<Float> implements Savable {
         index = in.readIntArray("index", null);
         index = in.readIntArray("index", null);
     }
     }
 
 
-    public void fill(int startIndex, float[] store ){
+    public void fill(int startIndex, float[] store) {
         for (int i = 0; i < store.length; i++) {
         for (int i = 0; i < store.length; i++) {
             store[i] = get(startIndex + i, null);
             store[i] = get(startIndex + i, null);
         }
         }
     }
     }
-    
+
     @Override
     @Override
     protected void serialize(int i, Float data) {
     protected void serialize(int i, Float data) {
         array[i] = data;
         array[i] = data;
@@ -96,4 +96,4 @@ public class CompactFloatArray extends CompactArray<Float> implements Savable {
     protected Float deserialize(int i, Float store) {
     protected Float deserialize(int i, Float store) {
         return array[i];
         return array[i];
     }
     }
-}
+}

+ 3 - 10
jme3-core/src/main/java/com/jme3/animation/EffectTrack.java

@@ -96,8 +96,6 @@ public class EffectTrack implements ClonableTrack {
                     throw new IllegalArgumentException("KillParticleEmitter can only ba attached to ParticleEmitter");
                     throw new IllegalArgumentException("KillParticleEmitter can only ba attached to ParticleEmitter");
                 }
                 }
             }
             }
-
-
         }
         }
 
 
         @Override
         @Override
@@ -241,7 +239,7 @@ public class EffectTrack implements ClonableTrack {
 
 
     @Override
     @Override
     public float[] getKeyFrameTimes() {
     public float[] getKeyFrameTimes() {
-        return new float[] { startOffset };
+        return new float[]{startOffset};
     }
     }
 
 
     /**
     /**
@@ -288,14 +286,13 @@ public class EffectTrack implements ClonableTrack {
     public Object jmeClone() {
     public Object jmeClone() {
         try {
         try {
             return super.clone();
             return super.clone();
-        } catch( CloneNotSupportedException e ) {
+        } catch (CloneNotSupportedException e) {
             throw new RuntimeException("Error cloning", e);
             throw new RuntimeException("Error cloning", e);
         }
         }
     }
     }
 
 
-
     @Override
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         this.emitter = cloner.clone(emitter);
         this.emitter = cloner.clone(emitter);
     }
     }
 
 
@@ -391,8 +388,6 @@ public class EffectTrack implements ClonableTrack {
 
 
         //adding the given Track to the TrackInfo.
         //adding the given Track to the TrackInfo.
         data.addTrack(effectTrack);
         data.addTrack(effectTrack);
-
-
     }
     }
 
 
     private void removeUserData(EffectTrack effectTrack) {
     private void removeUserData(EffectTrack effectTrack) {
@@ -406,8 +401,6 @@ public class EffectTrack implements ClonableTrack {
 
 
         //removing the given Track to the TrackInfo.
         //removing the given Track to the TrackInfo.
         data.getTracks().remove(effectTrack);
         data.getTracks().remove(effectTrack);
-
-
     }
     }
 
 
     /**
     /**

+ 9 - 11
jme3-core/src/main/java/com/jme3/animation/Pose.java

@@ -50,10 +50,10 @@ public final class Pose implements Savable, Cloneable {
     private Vector3f[] offsets;
     private Vector3f[] offsets;
     private int[] indices;
     private int[] indices;
 
 
-    private transient final Vector3f tempVec  = new Vector3f();
+    private transient final Vector3f tempVec = new Vector3f();
     private transient final Vector3f tempVec2 = new Vector3f();
     private transient final Vector3f tempVec2 = new Vector3f();
 
 
-    public Pose(String name, int targetMeshIndex, Vector3f[] offsets, int[] indices){
+    public Pose(String name, int targetMeshIndex, Vector3f[] offsets, int[] indices) {
         this.name = name;
         this.name = name;
         this.targetMeshIndex = targetMeshIndex;
         this.targetMeshIndex = targetMeshIndex;
         this.offsets = offsets;
         this.offsets = offsets;
@@ -63,25 +63,23 @@ public final class Pose implements Savable, Cloneable {
     /**
     /**
      * Serialization-only. Do not use.
      * Serialization-only. Do not use.
      */
      */
-    protected Pose()
-    {
+    protected Pose() {
     }
     }
-    
-    public int getTargetMeshIndex(){
+
+    public int getTargetMeshIndex() {
         return targetMeshIndex;
         return targetMeshIndex;
     }
     }
 
 
-
     /**
     /**
      * Applies the offsets of this pose to the vertex buffer given by the blend factor.
      * Applies the offsets of this pose to the vertex buffer given by the blend factor.
      *
      *
      * @param blend Blend factor, 0 = no change to vertex buffer, 1 = apply full offsets
      * @param blend Blend factor, 0 = no change to vertex buffer, 1 = apply full offsets
      * @param vertexBuffer Vertex buffer to apply this pose to
      * @param vertexBuffer Vertex buffer to apply this pose to
      */
      */
-    public void apply(float blend, FloatBuffer vertexBuffer){
-        for (int i = 0; i < indices.length; i++){
+    public void apply(float blend, FloatBuffer vertexBuffer) {
+        for (int i = 0; i < indices.length; i++) {
             Vector3f offset = offsets[i];
             Vector3f offset = offsets[i];
-            int vertIndex   = indices[i];
+            int vertIndex = indices[i];
 
 
             tempVec.set(offset).multLocal(blend);
             tempVec.set(offset).multLocal(blend);
 
 
@@ -95,7 +93,7 @@ public final class Pose implements Savable, Cloneable {
             BufferUtils.setInBuffer(tempVec2, vertexBuffer, vertIndex);
             BufferUtils.setInBuffer(tempVec2, vertexBuffer, vertIndex);
         }
         }
     }
     }
-    
+
     /**
     /**
      * This method creates a clone of the current object.
      * This method creates a clone of the current object.
      * @return a clone of the current object
      * @return a clone of the current object

+ 13 - 16
jme3-core/src/main/java/com/jme3/animation/PoseTrack.java

@@ -40,7 +40,6 @@ import java.io.IOException;
  */
  */
 @Deprecated
 @Deprecated
 public final class PoseTrack implements Track {
 public final class PoseTrack implements Track {
-    
     private int targetMeshIndex;
     private int targetMeshIndex;
     private PoseFrame[] frames;
     private PoseFrame[] frames;
     private float[] times;
     private float[] times;
@@ -54,14 +53,13 @@ public final class PoseTrack implements Track {
             this.poses = poses;
             this.poses = poses;
             this.weights = weights;
             this.weights = weights;
         }
         }
-        
+
         /**
         /**
          * Serialization-only. Do not use.
          * Serialization-only. Do not use.
          */
          */
-        protected PoseFrame()
-        {
+        protected PoseFrame() {
         }
         }
-        
+
         /**
         /**
          * This method creates a clone of the current object.
          * This method creates a clone of the current object.
          * @return a clone of the current object
          * @return a clone of the current object
@@ -94,7 +92,7 @@ public final class PoseTrack implements Track {
         public void read(JmeImporter i) throws IOException {
         public void read(JmeImporter i) throws IOException {
             InputCapsule in = i.getCapsule(this);
             InputCapsule in = i.getCapsule(this);
             weights = in.readFloatArray("weights", null);
             weights = in.readFloatArray("weights", null);
-            
+
             Savable[] readSavableArray = in.readSavableArray("poses", null);
             Savable[] readSavableArray = in.readSavableArray("poses", null);
             if (readSavableArray != null) {
             if (readSavableArray != null) {
                 poses = new Pose[readSavableArray.length];
                 poses = new Pose[readSavableArray.length];
@@ -103,24 +101,23 @@ public final class PoseTrack implements Track {
         }
         }
     }
     }
 
 
-    public PoseTrack(int targetMeshIndex, float[] times, PoseFrame[] frames){
+    public PoseTrack(int targetMeshIndex, float[] times, PoseFrame[] frames) {
         this.targetMeshIndex = targetMeshIndex;
         this.targetMeshIndex = targetMeshIndex;
         this.times = times;
         this.times = times;
         this.frames = frames;
         this.frames = frames;
     }
     }
-    
+
     /**
     /**
      * Serialization-only. Do not use.
      * Serialization-only. Do not use.
      */
      */
-    protected PoseTrack()
-    {
+    protected PoseTrack() {
     }
     }
-    
+
     @Override
     @Override
     public void setTime(float time, float weight, AnimControl control, AnimChannel channel, TempVars vars) {
     public void setTime(float time, float weight, AnimControl control, AnimChannel channel, TempVars vars) {
         // TODO: When MeshControl is created, it will gather targets
         // TODO: When MeshControl is created, it will gather targets
         // list automatically which is then retrieved here.
         // list automatically which is then retrieved here.
-        
+
         /*
         /*
         Mesh target = targets[targetMeshIndex];
         Mesh target = targets[targetMeshIndex];
         if (time < times[0]) {
         if (time < times[0]) {
@@ -150,12 +147,12 @@ public final class PoseTrack implements Track {
     public float getLength() {
     public float getLength() {
         return times == null ? 0 : times[times.length - 1] - times[0];
         return times == null ? 0 : times[times.length - 1] - times[0];
     }
     }
-    
+
     @Override
     @Override
     public float[] getKeyFrameTimes() {
     public float[] getKeyFrameTimes() {
         return times;
         return times;
     }
     }
-    
+
     /**
     /**
      * This method creates a clone of the current object.
      * This method creates a clone of the current object.
      * @return a clone of the current object
      * @return a clone of the current object
@@ -176,7 +173,7 @@ public final class PoseTrack implements Track {
             throw new AssertionError();
             throw new AssertionError();
         }
         }
     }
     }
-    
+
     @Override
     @Override
     public void write(JmeExporter e) throws IOException {
     public void write(JmeExporter e) throws IOException {
         OutputCapsule out = e.getCapsule(this);
         OutputCapsule out = e.getCapsule(this);
@@ -190,7 +187,7 @@ public final class PoseTrack implements Track {
         InputCapsule in = i.getCapsule(this);
         InputCapsule in = i.getCapsule(this);
         targetMeshIndex = in.readInt("meshIndex", 0);
         targetMeshIndex = in.readInt("meshIndex", 0);
         times = in.readFloatArray("times", null);
         times = in.readFloatArray("times", null);
-        
+
         Savable[] readSavableArray = in.readSavableArray("frames", null);
         Savable[] readSavableArray = in.readSavableArray("frames", null);
         if (readSavableArray != null) {
         if (readSavableArray != null) {
             frames = new PoseFrame[readSavableArray.length];
             frames = new PoseFrame[readSavableArray.length];

+ 11 - 11
jme3-core/src/main/java/com/jme3/animation/Skeleton.java

@@ -46,7 +46,7 @@ import java.util.List;
  * <code>Skeleton</code> is a convenience class for managing a bone hierarchy.
  * <code>Skeleton</code> is a convenience class for managing a bone hierarchy.
  * Skeleton updates the world transforms to reflect the current local
  * Skeleton updates the world transforms to reflect the current local
  * animated matrixes.
  * animated matrixes.
- * 
+ *
  * @author Kirill Vainer
  * @author Kirill Vainer
  * @deprecated use {@link Armature}
  * @deprecated use {@link Armature}
  */
  */
@@ -55,7 +55,7 @@ public final class Skeleton implements Savable, JmeCloneable {
 
 
     private Bone[] rootBones;
     private Bone[] rootBones;
     private Bone[] boneList;
     private Bone[] boneList;
-    
+
     /**
     /**
      * Contains the skinning matrices, multiplying it by a vertex affected by a bone
      * Contains the skinning matrices, multiplying it by a vertex affected by a bone
      * will cause it to go to the animated position.
      * will cause it to go to the animated position.
@@ -63,12 +63,12 @@ public final class Skeleton implements Savable, JmeCloneable {
     private transient Matrix4f[] skinningMatrixes;
     private transient Matrix4f[] skinningMatrixes;
 
 
     /**
     /**
-     * Creates a skeleton from a bone list. 
+     * Creates a skeleton from a bone list.
      * The root bones are found automatically.
      * The root bones are found automatically.
      * <p>
      * <p>
      * Note that using this constructor will cause the bones in the list
      * Note that using this constructor will cause the bones in the list
      * to have their bind pose recomputed based on their local transforms.
      * to have their bind pose recomputed based on their local transforms.
-     * 
+     *
      * @param boneList The list of bones to manage by this Skeleton
      * @param boneList The list of bones to manage by this Skeleton
      */
      */
     public Skeleton(Bone[] boneList) {
     public Skeleton(Bone[] boneList) {
@@ -97,7 +97,7 @@ public final class Skeleton implements Savable, JmeCloneable {
      * <p>
      * <p>
      * Shallow copies bind pose data from the source skeleton, does not
      * Shallow copies bind pose data from the source skeleton, does not
      * copy any other data.
      * copy any other data.
-     * 
+     *
      * @param source The source Skeleton to copy from
      * @param source The source Skeleton to copy from
      */
      */
     public Skeleton(Skeleton source) {
     public Skeleton(Skeleton source) {
@@ -124,18 +124,18 @@ public final class Skeleton implements Savable, JmeCloneable {
     protected Skeleton() {
     protected Skeleton() {
     }
     }
 
 
-    @Override   
+    @Override
     public Object jmeClone() {
     public Object jmeClone() {
         try {
         try {
-            Skeleton clone = (Skeleton)super.clone();
+            Skeleton clone = (Skeleton) super.clone();
             return clone;
             return clone;
         } catch (CloneNotSupportedException ex) {
         } catch (CloneNotSupportedException ex) {
             throw new AssertionError();
             throw new AssertionError();
         }
         }
-    }     
+    }
 
 
-    @Override   
-    public void cloneFields( Cloner cloner, Object original ) {
+    @Override
+    public void cloneFields(Cloner cloner, Object original) {
         this.rootBones = cloner.clone(rootBones);
         this.rootBones = cloner.clone(rootBones);
         this.boneList = cloner.clone(boneList);
         this.boneList = cloner.clone(boneList);
         this.skinningMatrixes = cloner.clone(skinningMatrixes);
         this.skinningMatrixes = cloner.clone(skinningMatrixes);
@@ -254,7 +254,7 @@ public final class Skeleton implements Savable, JmeCloneable {
      * returns the bone index of the bone that has the given name
      * returns the bone index of the bone that has the given name
      *
      *
      * @param name the name to search for
      * @param name the name to search for
-     * @return the index (&ge;0) or -1 if not found 
+     * @return the index (&ge;0) or -1 if not found
      */
      */
     public int getBoneIndex(String name) {
     public int getBoneIndex(String name) {
         for (int i = 0; i < boneList.length; i++) {
         for (int i = 0; i < boneList.length; i++) {

+ 37 - 47
jme3-core/src/main/java/com/jme3/animation/SkeletonControl.java

@@ -78,38 +78,37 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
      * are visible in at least one camera.
      * are visible in at least one camera.
      */
      */
     private boolean wasMeshUpdated = false;
     private boolean wasMeshUpdated = false;
-    
+
     /**
     /**
      * User wishes to use hardware skinning if available.
      * User wishes to use hardware skinning if available.
      */
      */
     private transient boolean hwSkinningDesired = true;
     private transient boolean hwSkinningDesired = true;
-    
+
     /**
     /**
      * Hardware skinning is currently being used.
      * Hardware skinning is currently being used.
      */
      */
     private transient boolean hwSkinningEnabled = false;
     private transient boolean hwSkinningEnabled = false;
-    
+
     /**
     /**
      * Hardware skinning was tested on this GPU, results
      * Hardware skinning was tested on this GPU, results
      * are stored in {@link #hwSkinningSupported} variable.
      * are stored in {@link #hwSkinningSupported} variable.
      */
      */
     private transient boolean hwSkinningTested = false;
     private transient boolean hwSkinningTested = false;
-    
+
     /**
     /**
      * If hardware skinning was {@link #hwSkinningTested tested}, then
      * If hardware skinning was {@link #hwSkinningTested tested}, then
      * this variable will be set to true if supported, and false if otherwise.
      * this variable will be set to true if supported, and false if otherwise.
      */
      */
     private transient boolean hwSkinningSupported = false;
     private transient boolean hwSkinningSupported = false;
-    
+
     /**
     /**
      * Bone offset matrices, recreated each frame
      * Bone offset matrices, recreated each frame
      */
      */
     private transient Matrix4f[] offsetMatrices;
     private transient Matrix4f[] offsetMatrices;
 
 
-    
     private MatParamOverride numberOfBonesParam;
     private MatParamOverride numberOfBonesParam;
     private MatParamOverride boneMatricesParam;
     private MatParamOverride boneMatricesParam;
-    
+
     /**
     /**
      * Serialization only. Do not use.
      * Serialization only. Do not use.
      */
      */
@@ -119,11 +118,11 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
     private void switchToHardware() {
     private void switchToHardware() {
         numberOfBonesParam.setEnabled(true);
         numberOfBonesParam.setEnabled(true);
         boneMatricesParam.setEnabled(true);
         boneMatricesParam.setEnabled(true);
-        
+
         // Next full 10 bones (e.g. 30 on 24 bones)
         // Next full 10 bones (e.g. 30 on 24 bones)
         int numBones = ((skeleton.getBoneCount() / 10) + 1) * 10;
         int numBones = ((skeleton.getBoneCount() / 10) + 1) * 10;
         numberOfBonesParam.setValue(numBones);
         numberOfBonesParam.setValue(numBones);
-        
+
         for (Geometry geometry : targets) {
         for (Geometry geometry : targets) {
             Mesh mesh = geometry.getMesh();
             Mesh mesh = geometry.getMesh();
             if (mesh != null && mesh.isAnimated()) {
             if (mesh != null && mesh.isAnimated()) {
@@ -135,7 +134,7 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
     private void switchToSoftware() {
     private void switchToSoftware() {
         numberOfBonesParam.setEnabled(false);
         numberOfBonesParam.setEnabled(false);
         boneMatricesParam.setEnabled(false);
         boneMatricesParam.setEnabled(false);
-        
+
         for (Geometry geometry : targets) {
         for (Geometry geometry : targets) {
             Mesh mesh = geometry.getMesh();
             Mesh mesh = geometry.getMesh();
             if (mesh != null && mesh.isAnimated()) {
             if (mesh != null && mesh.isAnimated()) {
@@ -152,7 +151,7 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
         }
         }
 
 
         switchToHardware();
         switchToHardware();
-        
+
         try {
         try {
             rm.preloadScene(spatial);
             rm.preloadScene(spatial);
             return true;
             return true;
@@ -166,32 +165,32 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
      * Specifies if hardware skinning is preferred. If it is preferred and
      * Specifies if hardware skinning is preferred. If it is preferred and
      * supported by GPU, it shall be enabled, if it's not preferred, or not
      * supported by GPU, it shall be enabled, if it's not preferred, or not
      * supported by GPU, then it shall be disabled.
      * supported by GPU, then it shall be disabled.
-     * 
-     * @param preferred true to prefer hardware skinning, false to prefer 
+     *
+     * @param preferred true to prefer hardware skinning, false to prefer
      * software skinning (default=true)
      * software skinning (default=true)
-     * @see #isHardwareSkinningUsed() 
+     * @see #isHardwareSkinningUsed()
      */
      */
     public void setHardwareSkinningPreferred(boolean preferred) {
     public void setHardwareSkinningPreferred(boolean preferred) {
         hwSkinningDesired = preferred;
         hwSkinningDesired = preferred;
     }
     }
-    
+
     /**
     /**
      * @return True if hardware skinning is preferable to software skinning.
      * @return True if hardware skinning is preferable to software skinning.
      * Set to false by default.
      * Set to false by default.
-     * 
-     * @see #setHardwareSkinningPreferred(boolean) 
+     *
+     * @see #setHardwareSkinningPreferred(boolean)
      */
      */
     public boolean isHardwareSkinningPreferred() {
     public boolean isHardwareSkinningPreferred() {
         return hwSkinningDesired;
         return hwSkinningDesired;
     }
     }
-    
+
     /**
     /**
      * @return True is hardware skinning is activated and is currently used, false otherwise.
      * @return True is hardware skinning is activated and is currently used, false otherwise.
      */
      */
     public boolean isHardwareSkinningUsed() {
     public boolean isHardwareSkinningUsed() {
         return hwSkinningEnabled;
         return hwSkinningEnabled;
     }
     }
-    
+
     /**
     /**
      * Creates a skeleton control. The list of targets will be acquired
      * Creates a skeleton control. The list of targets will be acquired
      * automatically when the control is attached to a node.
      * automatically when the control is attached to a node.
@@ -216,7 +215,6 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
         if (mesh != null && mesh.isAnimated()) {
         if (mesh != null && mesh.isAnimated()) {
             targets.add(geometry);
             targets.add(geometry);
         }
         }
-        
     }
     }
 
 
     private void findTargets(Node node) {
     private void findTargets(Node node) {
@@ -234,12 +232,12 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
         Spatial oldSpatial = this.spatial;
         Spatial oldSpatial = this.spatial;
         super.setSpatial(spatial);
         super.setSpatial(spatial);
         updateTargetsAndMaterials(spatial);
         updateTargetsAndMaterials(spatial);
-        
+
         if (oldSpatial != null) {
         if (oldSpatial != null) {
             oldSpatial.removeMatParamOverride(numberOfBonesParam);
             oldSpatial.removeMatParamOverride(numberOfBonesParam);
             oldSpatial.removeMatParamOverride(boneMatricesParam);
             oldSpatial.removeMatParamOverride(boneMatricesParam);
         }
         }
-        
+
         if (spatial != null) {
         if (spatial != null) {
             spatial.removeMatParamOverride(numberOfBonesParam);
             spatial.removeMatParamOverride(numberOfBonesParam);
             spatial.removeMatParamOverride(boneMatricesParam);
             spatial.removeMatParamOverride(boneMatricesParam);
@@ -259,19 +257,19 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
             // already ensured this mesh is animated.
             // already ensured this mesh is animated.
             // Otherwise a crash will happen in skin update.
             // Otherwise a crash will happen in skin update.
             softwareSkinUpdate(mesh, offsetMatrices);
             softwareSkinUpdate(mesh, offsetMatrices);
-        }     
+        }
     }
     }
-    
+
     private void controlRenderHardware() {
     private void controlRenderHardware() {
         offsetMatrices = skeleton.computeSkinningMatrices();
         offsetMatrices = skeleton.computeSkinningMatrices();
         boneMatricesParam.setValue(offsetMatrices);
         boneMatricesParam.setValue(offsetMatrices);
     }
     }
-    
+
     @Override
     @Override
     protected void controlRender(RenderManager rm, ViewPort vp) {
     protected void controlRender(RenderManager rm, ViewPort vp) {
         if (!wasMeshUpdated) {
         if (!wasMeshUpdated) {
             updateTargetsAndMaterials(spatial);
             updateTargetsAndMaterials(spatial);
-            
+
             // Prevent illegal cases. These should never happen.
             // Prevent illegal cases. These should never happen.
             assert hwSkinningTested || (!hwSkinningTested && !hwSkinningSupported && !hwSkinningEnabled);
             assert hwSkinningTested || (!hwSkinningTested && !hwSkinningSupported && !hwSkinningEnabled);
             assert !hwSkinningEnabled || (hwSkinningEnabled && hwSkinningTested && hwSkinningSupported);
             assert !hwSkinningEnabled || (hwSkinningEnabled && hwSkinningTested && hwSkinningSupported);
@@ -282,7 +280,7 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
 
 
                 if (hwSkinningSupported) {
                 if (hwSkinningSupported) {
                     hwSkinningEnabled = true;
                     hwSkinningEnabled = true;
-                    
+
                     Logger.getLogger(SkeletonControl.class.getName()).log(Level.INFO, "Hardware skinning engaged for {0}", spatial);
                     Logger.getLogger(SkeletonControl.class.getName()).log(Level.INFO, "Hardware skinning engaged for {0}", spatial);
                 } else {
                 } else {
                     switchToSoftware();
                     switchToSoftware();
@@ -308,7 +306,7 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
     @Override
     @Override
     protected void controlUpdate(float tpf) {
     protected void controlUpdate(float tpf) {
         wasMeshUpdated = false;
         wasMeshUpdated = false;
-     }
+    }
 
 
     //only do this for software updates
     //only do this for software updates
     void resetToBind() {
     void resetToBind() {
@@ -344,32 +342,31 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
                     tb.put(btb).clear();
                     tb.put(btb).clear();
                 }
                 }
 
 
-
                 pb.put(bpb).clear();
                 pb.put(bpb).clear();
                 nb.put(bnb).clear();
                 nb.put(bnb).clear();
             }
             }
         }
         }
     }
     }
 
 
-    @Override   
+    @Override
     public Object jmeClone() {
     public Object jmeClone() {
         return super.jmeClone();
         return super.jmeClone();
-    }     
+    }
 
 
-    @Override   
-    public void cloneFields( Cloner cloner, Object original ) {
+    @Override
+    public void cloneFields(Cloner cloner, Object original) {
         super.cloneFields(cloner, original);
         super.cloneFields(cloner, original);
-         
+
         this.skeleton = cloner.clone(skeleton);
         this.skeleton = cloner.clone(skeleton);
-        
+
         // If the targets were cloned then this will clone them.  If the targets
         // If the targets were cloned then this will clone them.  If the targets
         // were shared then this will share them.
         // were shared then this will share them.
         this.targets = cloner.clone(targets);
         this.targets = cloner.clone(targets);
-        
+
         this.numberOfBonesParam = cloner.clone(numberOfBonesParam);
         this.numberOfBonesParam = cloner.clone(numberOfBonesParam);
         this.boneMatricesParam = cloner.clone(boneMatricesParam);
         this.boneMatricesParam = cloner.clone(boneMatricesParam);
     }
     }
-         
+
     /**
     /**
      * Access the attachments node of the named bone. If the bone doesn't
      * Access the attachments node of the named bone. If the bone doesn't
      * already have an attachments node, create one and attach it to the scene
      * already have an attachments node, create one and attach it to the scene
@@ -445,8 +442,6 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
             //if there are tangents use the skinning with tangents
             //if there are tangents use the skinning with tangents
             applySkinningTangents(mesh, offsetMatrices, tb);
             applySkinningTangents(mesh, offsetMatrices, tb);
         }
         }
-
-
     }
     }
 
 
     /**
     /**
@@ -582,11 +577,9 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
         FloatBuffer fnb = (FloatBuffer) nb.getData();
         FloatBuffer fnb = (FloatBuffer) nb.getData();
         fnb.rewind();
         fnb.rewind();
 
 
-
         FloatBuffer ftb = (FloatBuffer) tb.getData();
         FloatBuffer ftb = (FloatBuffer) tb.getData();
         ftb.rewind();
         ftb.rewind();
 
 
-
         // get boneIndexes and weights for mesh
         // get boneIndexes and weights for mesh
         IndexBuffer ib = IndexBuffer.wrapIndexBuffer(mesh.getBuffer(Type.BoneIndex).getData());
         IndexBuffer ib = IndexBuffer.wrapIndexBuffer(mesh.getBuffer(Type.BoneIndex).getData());
         FloatBuffer wb = (FloatBuffer) mesh.getBuffer(Type.BoneWeight).getData();
         FloatBuffer wb = (FloatBuffer) mesh.getBuffer(Type.BoneWeight).getData();
@@ -598,7 +591,6 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
 
 
         TempVars vars = TempVars.get();
         TempVars vars = TempVars.get();
 
 
-
         float[] posBuf = vars.skinPositions;
         float[] posBuf = vars.skinPositions;
         float[] normBuf = vars.skinNormals;
         float[] normBuf = vars.skinNormals;
         float[] tanBuf = vars.skinTangents;
         float[] tanBuf = vars.skinTangents;
@@ -695,8 +687,6 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
         vb.updateData(fvb);
         vb.updateData(fvb);
         nb.updateData(fnb);
         nb.updateData(fnb);
         tb.updateData(ftb);
         tb.updateData(ftb);
-
-
     }
     }
 
 
     @Override
     @Override
@@ -704,7 +694,7 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
         super.write(ex);
         super.write(ex);
         OutputCapsule oc = ex.getCapsule(this);
         OutputCapsule oc = ex.getCapsule(this);
         oc.write(skeleton, "skeleton", null);
         oc.write(skeleton, "skeleton", null);
-        
+
         oc.write(numberOfBonesParam, "numberOfBonesParam", null);
         oc.write(numberOfBonesParam, "numberOfBonesParam", null);
         oc.write(boneMatricesParam, "boneMatricesParam", null);
         oc.write(boneMatricesParam, "boneMatricesParam", null);
     }
     }
@@ -714,10 +704,10 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
         super.read(im);
         super.read(im);
         InputCapsule in = im.getCapsule(this);
         InputCapsule in = im.getCapsule(this);
         skeleton = (Skeleton) in.readSavable("skeleton", null);
         skeleton = (Skeleton) in.readSavable("skeleton", null);
-        
+
         numberOfBonesParam = (MatParamOverride) in.readSavable("numberOfBonesParam", null);
         numberOfBonesParam = (MatParamOverride) in.readSavable("numberOfBonesParam", null);
         boneMatricesParam = (MatParamOverride) in.readSavable("boneMatricesParam", null);
         boneMatricesParam = (MatParamOverride) in.readSavable("boneMatricesParam", null);
-        
+
         if (numberOfBonesParam == null) {
         if (numberOfBonesParam == null) {
             numberOfBonesParam = new MatParamOverride(VarType.Int, "NumberOfBones", null);
             numberOfBonesParam = new MatParamOverride(VarType.Int, "NumberOfBones", null);
             boneMatricesParam = new MatParamOverride(VarType.Matrix4Array, "BoneMatrices", null);
             boneMatricesParam = new MatParamOverride(VarType.Matrix4Array, "BoneMatrices", null);

+ 9 - 9
jme3-core/src/main/java/com/jme3/animation/TrackInfo.java

@@ -42,7 +42,7 @@ import java.util.ArrayList;
  * This class is intended as a UserData added to a Spatial that is referenced by a Track.
  * This class is intended as a UserData added to a Spatial that is referenced by a Track.
  * (ParticleEmitter for EffectTrack and AudioNode for AudioTrack)
  * (ParticleEmitter for EffectTrack and AudioNode for AudioTrack)
  * It holds the list of tracks that are directly referencing the Spatial.
  * It holds the list of tracks that are directly referencing the Spatial.
- * 
+ *
  * This is used when loading a Track to find the cloned reference of a Spatial in the cloned model returned by the assetManager.
  * This is used when loading a Track to find the cloned reference of a Spatial in the cloned model returned by the assetManager.
  *
  *
  * @author Nehon
  * @author Nehon
@@ -75,18 +75,18 @@ public class TrackInfo implements Savable, JmeCloneable {
     public void addTrack(Track track) {
     public void addTrack(Track track) {
         tracks.add(track);
         tracks.add(track);
     }
     }
-    
-    @Override   
+
+    @Override
     public Object jmeClone() {
     public Object jmeClone() {
         try {
         try {
             return super.clone();
             return super.clone();
-        } catch( CloneNotSupportedException e ) {
+        } catch (CloneNotSupportedException e) {
             throw new RuntimeException("Error cloning", e);
             throw new RuntimeException("Error cloning", e);
         }
         }
-    }     
+    }
 
 
-    @Override   
-    public void cloneFields( Cloner cloner, Object original ) {
-        this.tracks = cloner.clone(tracks); 
-    }             
+    @Override
+    public void cloneFields(Cloner cloner, Object original) {
+        this.tracks = cloner.clone(tracks);
+    }
 }
 }

+ 42 - 48
jme3-core/src/main/java/com/jme3/app/BasicProfiler.java

@@ -29,7 +29,7 @@
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
  */
- 
+
 package com.jme3.app;
 package com.jme3.app;
 
 
 import com.jme3.profile.*;
 import com.jme3.profile.*;
@@ -40,13 +40,12 @@ import com.jme3.scene.VertexBuffer.Type;
 import com.jme3.util.BufferUtils;
 import com.jme3.util.BufferUtils;
 import java.nio.FloatBuffer;
 import java.nio.FloatBuffer;
 
 
-
 /**
 /**
  *  An AppProfiler implementation that collects two
  *  An AppProfiler implementation that collects two
- *  per-frame application-wide timings for update versus 
- *  render and uses it to create a bar chart style Mesh.  
- *  The number of frames displayed and the update interval 
- *  can be specified.  The chart Mesh is in 'milliseconds' 
+ *  per-frame application-wide timings for update versus
+ *  render and uses it to create a bar chart style Mesh.
+ *  The number of frames displayed and the update interval
+ *  can be specified.  The chart Mesh is in 'milliseconds'
  *  and can be scaled up or down as required.
  *  and can be scaled up or down as required.
  *
  *
  *  <p>Each column of the chart represents a single frames
  *  <p>Each column of the chart represents a single frames
@@ -56,9 +55,9 @@ import java.nio.FloatBuffer;
  *  the cyan portion represents the rendering time.</p>
  *  the cyan portion represents the rendering time.</p>
  *
  *
  *  <p>When the end of the chart is reached, the current
  *  <p>When the end of the chart is reached, the current
- *  frame cycles back around to the beginning.</p> 
+ *  frame cycles back around to the beginning.</p>
  *
  *
- *  @author    Paul Speed
+ * @author Paul Speed
  */
  */
 public class BasicProfiler implements AppProfiler {
 public class BasicProfiler implements AppProfiler {
 
 
@@ -69,38 +68,38 @@ public class BasicProfiler implements AppProfiler {
     private long renderTime;
     private long renderTime;
     private long updateInterval = 1000000L; // once a millisecond
     private long updateInterval = 1000000L; // once a millisecond
     private long lastUpdate = 0;
     private long lastUpdate = 0;
-    
+
     private Mesh mesh;
     private Mesh mesh;
-    
+
     public BasicProfiler() {
     public BasicProfiler() {
         this(1280);
         this(1280);
     }
     }
-    
-    public BasicProfiler( int size ) {
+
+    public BasicProfiler(int size) {
         setFrameCount(size);
         setFrameCount(size);
     }
     }
 
 
     /**
     /**
      *  Sets the number of frames to display and track.  By default,
      *  Sets the number of frames to display and track.  By default,
      *  this is 1280.
      *  this is 1280.
-     * 
+     *
      * @param size the desired number of frames (&ge;0, default=1280)
      * @param size the desired number of frames (&ge;0, default=1280)
      */
      */
-    public final void setFrameCount( int size ) {
-        if( this.size == size ) {
+    public final void setFrameCount(int size) {
+        if (this.size == size) {
             return;
             return;
         }
         }
-        
+
         this.size = size;
         this.size = size;
-        this.frames = new long[size*2];
- 
+        this.frames = new long[size * 2];
+
         createMesh();
         createMesh();
-        
-        if( frameIndex >= size ) {
+
+        if (frameIndex >= size) {
             frameIndex = 0;
             frameIndex = 0;
-        }       
+        }
     }
     }
-    
+
     public int getFrameCount() {
     public int getFrameCount() {
         return size;
         return size;
     }
     }
@@ -108,13 +107,13 @@ public class BasicProfiler implements AppProfiler {
     /**
     /**
      *  Sets the number of nanoseconds to wait before updating the
      *  Sets the number of nanoseconds to wait before updating the
      *  mesh.  By default, this is once a millisecond, i.e. 1000000 nanoseconds.
      *  mesh.  By default, this is once a millisecond, i.e. 1000000 nanoseconds.
-     * 
+     *
      * @param nanos the desired update interval (in nanoseconds, default=1e6)
      * @param nanos the desired update interval (in nanoseconds, default=1e6)
      */
      */
-    public void setUpdateInterval( long nanos ) {
+    public void setUpdateInterval(long nanos) {
         this.updateInterval = nanos;
         this.updateInterval = nanos;
     }
     }
-    
+
     public long getUpdateInterval() {
     public long getUpdateInterval() {
         return updateInterval;
         return updateInterval;
     }
     }
@@ -122,7 +121,7 @@ public class BasicProfiler implements AppProfiler {
     /**
     /**
      *  Returns the mesh that contains the bar chart of tracked frame
      *  Returns the mesh that contains the bar chart of tracked frame
      *  timings.
      *  timings.
-     * 
+     *
      * @return the pre-existing Mesh
      * @return the pre-existing Mesh
      */
      */
     public Mesh getMesh() {
     public Mesh getMesh() {
@@ -130,33 +129,33 @@ public class BasicProfiler implements AppProfiler {
     }
     }
 
 
     protected final void createMesh() {
     protected final void createMesh() {
-        if( mesh == null ) {
+        if (mesh == null) {
             mesh = new Mesh();
             mesh = new Mesh();
             mesh.setMode(Mesh.Mode.Lines);
             mesh.setMode(Mesh.Mode.Lines);
         }
         }
-        
+
         mesh.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(size * 4 * 3));
         mesh.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(size * 4 * 3));
-        
+
         FloatBuffer cb = BufferUtils.createFloatBuffer(size * 4 * 4);
         FloatBuffer cb = BufferUtils.createFloatBuffer(size * 4 * 4);
-        for( int i = 0; i < size; i++ ) {
+        for (int i = 0; i < size; i++) {
             // For each index we add 4 colors, one for each line
             // For each index we add 4 colors, one for each line
             // endpoint for two layers.
             // endpoint for two layers.
             cb.put(0.5f).put(0.5f).put(0).put(1);
             cb.put(0.5f).put(0.5f).put(0).put(1);
             cb.put(1).put(1).put(0).put(1);
             cb.put(1).put(1).put(0).put(1);
             cb.put(0).put(0.5f).put(0.5f).put(1);
             cb.put(0).put(0.5f).put(0.5f).put(1);
             cb.put(0).put(1).put(1).put(1);
             cb.put(0).put(1).put(1).put(1);
-        }         
+        }
         mesh.setBuffer(Type.Color, 4, cb);
         mesh.setBuffer(Type.Color, 4, cb);
     }
     }
-    
+
     protected void updateMesh() {
     protected void updateMesh() {
-        FloatBuffer pb = (FloatBuffer)mesh.getBuffer(Type.Position).getData();
+        FloatBuffer pb = (FloatBuffer) mesh.getBuffer(Type.Position).getData();
         pb.rewind();
         pb.rewind();
         float scale = 1 / 1000000f; // scaled to ms as pixels
         float scale = 1 / 1000000f; // scaled to ms as pixels
-        for( int i = 0; i < size; i++ ) {
+        for (int i = 0; i < size; i++) {
             float t1 = frames[i * 2] * scale;
             float t1 = frames[i * 2] * scale;
             float t2 = frames[i * 2 + 1] * scale;
             float t2 = frames[i * 2 + 1] * scale;
-            
+
             pb.put(i).put(0).put(0);
             pb.put(i).put(0).put(0);
             pb.put(i).put(t1).put(0);
             pb.put(i).put(t1).put(0);
             pb.put(i).put(t1).put(0);
             pb.put(i).put(t1).put(0);
@@ -166,9 +165,8 @@ public class BasicProfiler implements AppProfiler {
     }
     }
 
 
     @Override
     @Override
-    public void appStep( AppStep step ) {
-        
-        switch(step) {
+    public void appStep(AppStep step) {
+        switch (step) {
             case BeginFrame:
             case BeginFrame:
                 startTime = System.nanoTime();
                 startTime = System.nanoTime();
                 break;
                 break;
@@ -180,30 +178,26 @@ public class BasicProfiler implements AppProfiler {
                 long time = System.nanoTime();
                 long time = System.nanoTime();
                 frames[frameIndex * 2 + 1] = time - renderTime;
                 frames[frameIndex * 2 + 1] = time - renderTime;
                 frameIndex++;
                 frameIndex++;
-                if( frameIndex >= size ) {
+                if (frameIndex >= size) {
                     frameIndex = 0;
                     frameIndex = 0;
                 }
                 }
-                if( startTime - lastUpdate > updateInterval ) {
+                if (startTime - lastUpdate > updateInterval) {
                     updateMesh();
                     updateMesh();
                     lastUpdate = startTime;
                     lastUpdate = startTime;
-                }                
+                }
                 break;
                 break;
         }
         }
     }
     }
-    
+
     @Override
     @Override
     public void appSubStep(String... additionalInfo) {
     public void appSubStep(String... additionalInfo) {
     }
     }
-    
+
     @Override
     @Override
-    public void vpStep( VpStep step, ViewPort vp, Bucket bucket ) {
+    public void vpStep(VpStep step, ViewPort vp, Bucket bucket) {
     }
     }
 
 
     @Override
     @Override
     public void spStep(SpStep step, String... additionalInfo) {
     public void spStep(SpStep step, String... additionalInfo) {
-
     }
     }
-
 }
 }
-
-

+ 40 - 45
jme3-core/src/main/java/com/jme3/app/BasicProfilerState.java

@@ -29,7 +29,7 @@
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
  */
- 
+
 package com.jme3.app;
 package com.jme3.app;
 
 
 import com.jme3.app.state.BaseAppState;
 import com.jme3.app.state.BaseAppState;
@@ -44,13 +44,12 @@ import com.jme3.scene.Mesh;
 import com.jme3.scene.Node;
 import com.jme3.scene.Node;
 import com.jme3.scene.VertexBuffer.Type;
 import com.jme3.scene.VertexBuffer.Type;
 
 
-
 /**
 /**
  *  Provides a basic profiling visualization that shows
  *  Provides a basic profiling visualization that shows
  *  per-frame application-wide timings for update and
  *  per-frame application-wide timings for update and
  *  rendering.
  *  rendering.
  *
  *
- *  @author    Paul Speed
+ * @author Paul Speed
  */
  */
 public class BasicProfilerState extends BaseAppState {
 public class BasicProfilerState extends BaseAppState {
 
 
@@ -67,7 +66,7 @@ public class BasicProfilerState extends BaseAppState {
         this(false);
         this(false);
     }
     }
 
 
-    public BasicProfilerState( boolean enabled ) {
+    public BasicProfilerState(boolean enabled) {
         setEnabled(enabled);
         setEnabled(enabled);
         this.profiler = new BasicProfiler();
         this.profiler = new BasicProfiler();
     }
     }
@@ -86,82 +85,82 @@ public class BasicProfilerState extends BaseAppState {
      *  single millisecond stretches two pixels high.
      *  single millisecond stretches two pixels high.
      * @param scale the scale
      * @param scale the scale
      */
      */
-    public void setGraphScale( float scale ) {
-        if( this.scale == scale ) {
+    public void setGraphScale(float scale) {
+        if (this.scale == scale) {
             return;
             return;
         }
         }
         this.scale = scale;
         this.scale = scale;
-        if( graph != null ) {
-            graph.setLocalScale(1, scale, 1);            
+        if (graph != null) {
+            graph.setLocalScale(1, scale, 1);
         }
         }
     }
     }
 
 
     public float getGraphScale() {
     public float getGraphScale() {
         return scale;
         return scale;
     }
     }
- 
+
     /**
     /**
      *  Sets the number frames displayed and tracked.
      *  Sets the number frames displayed and tracked.
      * @param count the number of frames
      * @param count the number of frames
      */
      */
-    public void setFrameCount( int count ) {
-        if( profiler.getFrameCount() == count ) {
+    public void setFrameCount(int count) {
+        if (profiler.getFrameCount() == count) {
             return;
             return;
         }
         }
         profiler.setFrameCount(count);
         profiler.setFrameCount(count);
         refreshBackground();
         refreshBackground();
     }
     }
-    
+
     public int getFrameCount() {
     public int getFrameCount() {
         return profiler.getFrameCount();
         return profiler.getFrameCount();
     }
     }
-    
+
     protected void refreshBackground() {
     protected void refreshBackground() {
         Mesh mesh = background.getMesh();
         Mesh mesh = background.getMesh();
-        
+
         int size = profiler.getFrameCount();
         int size = profiler.getFrameCount();
         float frameTime = 1000f / 60;
         float frameTime = 1000f / 60;
         mesh.setBuffer(Type.Position, 3, new float[] {
         mesh.setBuffer(Type.Position, 3, new float[] {
-                    
+
                     // first quad
                     // first quad
                     0, 0, 0,
                     0, 0, 0,
                     size, 0, 0,
                     size, 0, 0,
                     size, frameTime, 0,
                     size, frameTime, 0,
                     0, frameTime, 0,
                     0, frameTime, 0,
-                    
+
                     // second quad
                     // second quad
                     0, frameTime, 0,
                     0, frameTime, 0,
                     size, frameTime, 0,
                     size, frameTime, 0,
                     size, frameTime * 2, 0,
                     size, frameTime * 2, 0,
                     0, frameTime * 2, 0,
                     0, frameTime * 2, 0,
-                    
+
                     // A lower dark border just to frame the
                     // A lower dark border just to frame the
                     // 'update' stats against bright backgrounds
                     // 'update' stats against bright backgrounds
                     0, -2, 0,
                     0, -2, 0,
                     size, -2, 0,
                     size, -2, 0,
                     size, 0, 0,
                     size, 0, 0,
-                    0, 0, 0 
+                    0, 0, 0
                 });
                 });
-                
+
         mesh.setBuffer(Type.Color, 4, new float[] {
         mesh.setBuffer(Type.Color, 4, new float[] {
                     // first quad, within normal frame limits
                     // first quad, within normal frame limits
                     0, 1, 0, 0.25f,
                     0, 1, 0, 0.25f,
                     0, 1, 0, 0.25f,
                     0, 1, 0, 0.25f,
                     0, 0.25f, 0, 0.25f,
                     0, 0.25f, 0, 0.25f,
                     0, 0.25f, 0, 0.25f,
                     0, 0.25f, 0, 0.25f,
-                    
-                    // Second quad, dropped frames                    
+
+                    // Second quad, dropped frames
                     0.25f, 0, 0, 0.25f,
                     0.25f, 0, 0, 0.25f,
                     0.25f, 0, 0, 0.25f,
                     0.25f, 0, 0, 0.25f,
                     1, 0, 0, 0.25f,
                     1, 0, 0, 0.25f,
                     1, 0, 0, 0.25f,
                     1, 0, 0, 0.25f,
-                    
+
                     0, 0, 0, 0.5f,
                     0, 0, 0, 0.5f,
                     0, 0, 0, 0.5f,
                     0, 0, 0, 0.5f,
                     0, 0, 0, 0.5f,
                     0, 0, 0, 0.5f,
-                    0, 0, 0, 0.5f                                         
+                    0, 0, 0, 0.5f
                 });
                 });
-                
+
         mesh.setBuffer(Type.Index, 3, new short[] {
         mesh.setBuffer(Type.Index, 3, new short[] {
                     0, 1, 2,
                     0, 1, 2,
                     0, 2, 3,
                     0, 2, 3,
@@ -173,16 +172,15 @@ public class BasicProfilerState extends BaseAppState {
     }
     }
 
 
     @Override
     @Override
-    protected void initialize( Application app ) {
-        
+    protected void initialize(Application app) {
         graph = new Geometry("profiler", profiler.getMesh());
         graph = new Geometry("profiler", profiler.getMesh());
-        
+
         Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
         Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
         mat.setBoolean("VertexColor", true);
         mat.setBoolean("VertexColor", true);
         graph.setMaterial(mat);
         graph.setMaterial(mat);
         graph.setLocalTranslation(0, 300, 0);
         graph.setLocalTranslation(0, 300, 0);
         graph.setLocalScale(1, scale, 1);
         graph.setLocalScale(1, scale, 1);
-               
+
         Mesh mesh = new Mesh();
         Mesh mesh = new Mesh();
         background = new Geometry("profiler.background", mesh);
         background = new Geometry("profiler.background", mesh);
         mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
         mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
@@ -190,34 +188,33 @@ public class BasicProfilerState extends BaseAppState {
         mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
         mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
         background.setMaterial(mat);
         background.setMaterial(mat);
         background.setLocalTranslation(0, 300, -1);
         background.setLocalTranslation(0, 300, -1);
-        background.setLocalScale(1, scale, 1);        
-        
+        background.setLocalScale(1, scale, 1);
+
         refreshBackground();
         refreshBackground();
-        
-        InputManager inputManager = app.getInputManager();        
-        if( inputManager != null ) { 
+
+        InputManager inputManager = app.getInputManager();
+        if (inputManager != null) {
             inputManager.addMapping(INPUT_MAPPING_PROFILER_TOGGLE, new KeyTrigger(KeyInput.KEY_F6));
             inputManager.addMapping(INPUT_MAPPING_PROFILER_TOGGLE, new KeyTrigger(KeyInput.KEY_F6));
-            inputManager.addListener(keyListener, INPUT_MAPPING_PROFILER_TOGGLE); 
-        }               
+            inputManager.addListener(keyListener, INPUT_MAPPING_PROFILER_TOGGLE);
+        }
     }
     }
 
 
     @Override
     @Override
-    protected void cleanup( Application app ) {    
-        InputManager inputManager = app.getInputManager();        
-        if( inputManager.hasMapping(INPUT_MAPPING_PROFILER_TOGGLE) ) {
-            inputManager.deleteMapping(INPUT_MAPPING_PROFILER_TOGGLE);        
+    protected void cleanup(Application app) {
+        InputManager inputManager = app.getInputManager();
+        if (inputManager.hasMapping(INPUT_MAPPING_PROFILER_TOGGLE)) {
+            inputManager.deleteMapping(INPUT_MAPPING_PROFILER_TOGGLE);
         }
         }
         inputManager.removeListener(keyListener);
         inputManager.removeListener(keyListener);
     }
     }
 
 
     @Override
     @Override
     protected void onEnable() {
     protected void onEnable() {
-    
         // Set the number of visible frames to the current width of the screen
         // Set the number of visible frames to the current width of the screen
         setFrameCount(getApplication().getCamera().getWidth());
         setFrameCount(getApplication().getCamera().getWidth());
-    
+
         getApplication().setAppProfiler(profiler);
         getApplication().setAppProfiler(profiler);
-        Node gui = ((SimpleApplication)getApplication()).getGuiNode();
+        Node gui = ((SimpleApplication) getApplication()).getGuiNode();
         gui.attachChild(graph);
         gui.attachChild(graph);
         gui.attachChild(background);
         gui.attachChild(background);
     }
     }
@@ -228,9 +225,8 @@ public class BasicProfilerState extends BaseAppState {
         graph.removeFromParent();
         graph.removeFromParent();
         background.removeFromParent();
         background.removeFromParent();
     }
     }
-    
-    private class ProfilerKeyListener implements ActionListener {
 
 
+    private class ProfilerKeyListener implements ActionListener {
         @Override
         @Override
         public void onAction(String name, boolean value, float tpf) {
         public void onAction(String name, boolean value, float tpf) {
             if (!value) {
             if (!value) {
@@ -240,4 +236,3 @@ public class BasicProfilerState extends BaseAppState {
         }
         }
     }
     }
 }
 }
-

+ 7 - 7
jme3-core/src/main/java/com/jme3/app/ChaseCameraAppState.java

@@ -97,7 +97,7 @@ public class ChaseCameraAppState extends AbstractAppState implements ActionListe
         super.initialize(stateManager, app);
         super.initialize(stateManager, app);
         this.inputManager = app.getInputManager();
         this.inputManager = app.getInputManager();
         target = new Node("ChaseCamTarget");
         target = new Node("ChaseCamTarget");
-        camNode.setCamera(app.getCamera());        
+        camNode.setCamera(app.getCamera());
         camNode.setControlDir(CameraControl.ControlDirection.SpatialToCamera);
         camNode.setControlDir(CameraControl.ControlDirection.SpatialToCamera);
         target.attachChild(camNode);
         target.attachChild(camNode);
         camNode.setLocalTranslation(0, 0, distance);
         camNode.setLocalTranslation(0, 0, distance);
@@ -281,7 +281,7 @@ public class ChaseCameraAppState extends AbstractAppState implements ActionListe
      */
      */
     public void setMaxDistance(float maxDistance) {
     public void setMaxDistance(float maxDistance) {
         this.maxDistance = maxDistance;
         this.maxDistance = maxDistance;
-        if(initialized){
+        if (initialized) {
             zoomCamera(distance);
             zoomCamera(distance);
         }
         }
     }
     }
@@ -297,13 +297,13 @@ public class ChaseCameraAppState extends AbstractAppState implements ActionListe
 
 
     /**
     /**
      * Sets the min zoom distance of the camera (default is 1)
      * Sets the min zoom distance of the camera (default is 1)
-     * 
+     *
      * @param minDistance the desired minimum distance (in world units,
      * @param minDistance the desired minimum distance (in world units,
      * default=1)
      * default=1)
      */
      */
     public void setMinDistance(float minDistance) {
     public void setMinDistance(float minDistance) {
         this.minDistance = minDistance;
         this.minDistance = minDistance;
-        if(initialized){
+        if (initialized) {
             zoomCamera(distance);
             zoomCamera(distance);
         }
         }
     }
     }
@@ -325,7 +325,7 @@ public class ChaseCameraAppState extends AbstractAppState implements ActionListe
      */
      */
     public void setMaxVerticalRotation(float maxVerticalRotation) {
     public void setMaxVerticalRotation(float maxVerticalRotation) {
         this.maxVerticalRotation = maxVerticalRotation;
         this.maxVerticalRotation = maxVerticalRotation;
-        if(initialized){
+        if (initialized) {
             rotateCamera();
             rotateCamera();
         }
         }
     }
     }
@@ -347,7 +347,7 @@ public class ChaseCameraAppState extends AbstractAppState implements ActionListe
      */
      */
     public void setMinVerticalRotation(float minHeight) {
     public void setMinVerticalRotation(float minHeight) {
         this.minVerticalRotation = minHeight;
         this.minVerticalRotation = minHeight;
-        if(initialized){
+        if (initialized) {
             rotateCamera();
             rotateCamera();
         }
         }
     }
     }
@@ -438,7 +438,7 @@ public class ChaseCameraAppState extends AbstractAppState implements ActionListe
     public void setDragToRotate(boolean dragToRotate) {
     public void setDragToRotate(boolean dragToRotate) {
         this.dragToRotate = dragToRotate;
         this.dragToRotate = dragToRotate;
         this.canRotate = !dragToRotate;
         this.canRotate = !dragToRotate;
-        if(inputManager != null){
+        if (inputManager != null) {
             inputManager.setCursorVisible(dragToRotate);
             inputManager.setCursorVisible(dragToRotate);
         }
         }
     }
     }

+ 15 - 19
jme3-core/src/main/java/com/jme3/app/FlyCamAppState.java

@@ -35,11 +35,10 @@ import com.jme3.app.state.AbstractAppState;
 import com.jme3.app.state.AppStateManager;
 import com.jme3.app.state.AppStateManager;
 import com.jme3.input.FlyByCamera;
 import com.jme3.input.FlyByCamera;
 
 
-
 /**
 /**
- *  Manages a FlyByCamera.  
+ *  Manages a FlyByCamera.
  *
  *
- *  @author    Paul Speed
+ * @author Paul Speed
  */
  */
 public class FlyCamAppState extends AbstractAppState {
 public class FlyCamAppState extends AbstractAppState {
 
 
@@ -47,15 +46,15 @@ public class FlyCamAppState extends AbstractAppState {
     private FlyByCamera flyCam;
     private FlyByCamera flyCam;
 
 
     public FlyCamAppState() {
     public FlyCamAppState() {
-    }    
+    }
 
 
     /**
     /**
-     *  This is called by SimpleApplication during initialize().
+     * This is called by SimpleApplication during initialize().
      */
      */
-    void setCamera( FlyByCamera cam ) {
+    void setCamera(FlyByCamera cam) {
         this.flyCam = cam;
         this.flyCam = cam;
     }
     }
-    
+
     public FlyByCamera getCamera() {
     public FlyByCamera getCamera() {
         return flyCam;
         return flyCam;
     }
     }
@@ -63,34 +62,31 @@ public class FlyCamAppState extends AbstractAppState {
     @Override
     @Override
     public void initialize(AppStateManager stateManager, Application app) {
     public void initialize(AppStateManager stateManager, Application app) {
         super.initialize(stateManager, app);
         super.initialize(stateManager, app);
-        
+
         this.app = app;
         this.app = app;
 
 
         if (app.getInputManager() != null) {
         if (app.getInputManager() != null) {
-        
+
             if (flyCam == null) {
             if (flyCam == null) {
                 flyCam = new FlyByCamera(app.getCamera());
                 flyCam = new FlyByCamera(app.getCamera());
             }
             }
-            
-            flyCam.registerWithInput(app.getInputManager());            
-        }               
+
+            flyCam.registerWithInput(app.getInputManager());
+        }
     }
     }
-            
+
     @Override
     @Override
     public void setEnabled(boolean enabled) {
     public void setEnabled(boolean enabled) {
         super.setEnabled(enabled);
         super.setEnabled(enabled);
-        
         flyCam.setEnabled(enabled);
         flyCam.setEnabled(enabled);
     }
     }
-    
+
     @Override
     @Override
     public void cleanup() {
     public void cleanup() {
         super.cleanup();
         super.cleanup();
 
 
-        if (app.getInputManager() != null) {        
+        if (app.getInputManager() != null) {
             flyCam.unregisterInput();
             flyCam.unregisterInput();
-        }        
+        }
     }
     }
-
-
 }
 }

+ 69 - 68
jme3-core/src/main/java/com/jme3/app/LegacyApplication.java

@@ -102,7 +102,7 @@ public class LegacyApplication implements Application, SystemListener {
      * Create a new instance of <code>LegacyApplication</code>.
      * Create a new instance of <code>LegacyApplication</code>.
      */
      */
     public LegacyApplication() {
     public LegacyApplication() {
-        this((AppState[])null);
+        this((AppState[]) null);
     }
     }
 
 
     /**
     /**
@@ -111,7 +111,7 @@ public class LegacyApplication implements Application, SystemListener {
      *
      *
      * @param initialStates app states to pre-attach, or null for none
      * @param initialStates app states to pre-attach, or null for none
      */
      */
-    public LegacyApplication( AppState... initialStates ) {
+    public LegacyApplication(AppState... initialStates) {
         initStateManager();
         initStateManager();
 
 
         if (initialStates != null) {
         if (initialStates != null) {
@@ -187,20 +187,20 @@ public class LegacyApplication implements Application, SystemListener {
     }
     }
 
 
     @Deprecated
     @Deprecated
-    public void setAssetManager(AssetManager assetManager){
+    public void setAssetManager(AssetManager assetManager) {
         if (this.assetManager != null)
         if (this.assetManager != null)
             throw new IllegalStateException("Can only set asset manager"
             throw new IllegalStateException("Can only set asset manager"
-                                          + " before initialization.");
+                    + " before initialization.");
 
 
         this.assetManager = assetManager;
         this.assetManager = assetManager;
     }
     }
 
 
-    private void initAssetManager(){
+    private void initAssetManager() {
         URL assetCfgUrl = null;
         URL assetCfgUrl = null;
 
 
-        if (settings != null){
+        if (settings != null) {
             String assetCfg = settings.getString("AssetConfigURL");
             String assetCfg = settings.getString("AssetConfigURL");
-            if (assetCfg != null){
+            if (assetCfg != null) {
                 try {
                 try {
                     assetCfgUrl = new URL(assetCfg);
                     assetCfgUrl = new URL(assetCfg);
                 } catch (MalformedURLException ex) {
                 } catch (MalformedURLException ex) {
@@ -217,7 +217,7 @@ public class LegacyApplication implements Application, SystemListener {
         if (assetCfgUrl == null) {
         if (assetCfgUrl == null) {
             assetCfgUrl = JmeSystem.getPlatformAssetConfigURL();
             assetCfgUrl = JmeSystem.getPlatformAssetConfigURL();
         }
         }
-        if (assetManager == null){
+        if (assetManager == null) {
             assetManager = JmeSystem.newAssetManager(assetCfgUrl);
             assetManager = JmeSystem.newAssetManager(assetCfgUrl);
         }
         }
     }
     }
@@ -233,18 +233,18 @@ public class LegacyApplication implements Application, SystemListener {
      * @param settings The settings to set.
      * @param settings The settings to set.
      */
      */
     @Override
     @Override
-    public void setSettings(AppSettings settings){
+    public void setSettings(AppSettings settings) {
         this.settings = settings;
         this.settings = settings;
-        if (context != null && settings.useInput() != inputEnabled){
+        if (context != null && settings.useInput() != inputEnabled) {
             // may need to create or destroy input based
             // may need to create or destroy input based
             // on settings change
             // on settings change
             inputEnabled = !inputEnabled;
             inputEnabled = !inputEnabled;
-            if (inputEnabled){
+            if (inputEnabled) {
                 initInput();
                 initInput();
-            }else{
+            } else {
                 destroyInput();
                 destroyInput();
             }
             }
-        }else{
+        } else {
             inputEnabled = settings.useInput();
             inputEnabled = settings.useInput();
         }
         }
     }
     }
@@ -255,7 +255,7 @@ public class LegacyApplication implements Application, SystemListener {
      * by the current JmeContext implementation.
      * by the current JmeContext implementation.
      */
      */
     @Override
     @Override
-    public void setTimer(Timer timer){
+    public void setTimer(Timer timer) {
         this.timer = timer;
         this.timer = timer;
 
 
         if (timer != null) {
         if (timer != null) {
@@ -268,11 +268,11 @@ public class LegacyApplication implements Application, SystemListener {
     }
     }
 
 
     @Override
     @Override
-    public Timer getTimer(){
+    public Timer getTimer() {
         return timer;
         return timer;
     }
     }
 
 
-    private void initDisplay(){
+    private void initDisplay() {
         // acquire important objects
         // acquire important objects
         // from the context
         // from the context
         settings = context.getSettings();
         settings = context.getSettings();
@@ -285,8 +285,8 @@ public class LegacyApplication implements Application, SystemListener {
         renderer = context.getRenderer();
         renderer = context.getRenderer();
     }
     }
 
 
-    private void initAudio(){
-        if (settings.getAudioRenderer() != null && context.getType() != Type.Headless){
+    private void initAudio() {
+        if (settings.getAudioRenderer() != null && context.getType() != Type.Headless) {
             audioRenderer = JmeSystem.newAudioRenderer(settings);
             audioRenderer = JmeSystem.newAudioRenderer(settings);
             audioRenderer.initialize();
             audioRenderer.initialize();
             AudioContext.setAudioRenderer(audioRenderer);
             AudioContext.setAudioRenderer(audioRenderer);
@@ -301,10 +301,10 @@ public class LegacyApplication implements Application, SystemListener {
      * projection with 45° field of view, with near and far values 1 and 1000
      * projection with 45° field of view, with near and far values 1 and 1000
      * units respectively.
      * units respectively.
      */
      */
-    private void initCamera(){
+    private void initCamera() {
         cam = new Camera(settings.getWidth(), settings.getHeight());
         cam = new Camera(settings.getWidth(), settings.getHeight());
 
 
-        cam.setFrustumPerspective(45f, (float)cam.getWidth() / cam.getHeight(), 1f, 1000f);
+        cam.setFrustumPerspective(45f, (float) cam.getWidth() / cam.getHeight(), 1f, 1000f);
         cam.setLocation(new Vector3f(0f, 0f, 10f));
         cam.setLocation(new Vector3f(0f, 0f, 10f));
         cam.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y);
         cam.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y);
 
 
@@ -330,7 +330,7 @@ public class LegacyApplication implements Application, SystemListener {
      * initializes joystick input if joysticks are enabled in the
      * initializes joystick input if joysticks are enabled in the
      * AppSettings.
      * AppSettings.
      */
      */
-    private void initInput(){
+    private void initInput() {
         mouseInput = context.getMouseInput();
         mouseInput = context.getMouseInput();
         if (mouseInput != null)
         if (mouseInput != null)
             mouseInput.initialize();
             mouseInput.initialize();
@@ -343,7 +343,7 @@ public class LegacyApplication implements Application, SystemListener {
         if (touchInput != null)
         if (touchInput != null)
             touchInput.initialize();
             touchInput.initialize();
 
 
-        if (!settings.getBoolean("DisableJoysticks")){
+        if (!settings.getBoolean("DisableJoysticks")) {
             joyInput = context.getJoyInput();
             joyInput = context.getJoyInput();
             if (joyInput != null)
             if (joyInput != null)
                 joyInput.initialize();
                 joyInput.initialize();
@@ -352,7 +352,7 @@ public class LegacyApplication implements Application, SystemListener {
         inputManager = new InputManager(mouseInput, keyInput, joyInput, touchInput);
         inputManager = new InputManager(mouseInput, keyInput, joyInput, touchInput);
     }
     }
 
 
-    private void initStateManager(){
+    private void initStateManager() {
         stateManager = new AppStateManager(this);
         stateManager = new AppStateManager(this);
 
 
         // Always register a ResetStatsState to make sure
         // Always register a ResetStatsState to make sure
@@ -364,7 +364,7 @@ public class LegacyApplication implements Application, SystemListener {
      * @return The {@link AssetManager asset manager} for this application.
      * @return The {@link AssetManager asset manager} for this application.
      */
      */
     @Override
     @Override
-    public AssetManager getAssetManager(){
+    public AssetManager getAssetManager() {
         return assetManager;
         return assetManager;
     }
     }
 
 
@@ -372,7 +372,7 @@ public class LegacyApplication implements Application, SystemListener {
      * @return the {@link InputManager input manager}.
      * @return the {@link InputManager input manager}.
      */
      */
     @Override
     @Override
-    public InputManager getInputManager(){
+    public InputManager getInputManager() {
         return inputManager;
         return inputManager;
     }
     }
 
 
@@ -396,7 +396,7 @@ public class LegacyApplication implements Application, SystemListener {
      * @return The {@link Renderer renderer} for the application
      * @return The {@link Renderer renderer} for the application
      */
      */
     @Override
     @Override
-    public Renderer getRenderer(){
+    public Renderer getRenderer() {
         return renderer;
         return renderer;
     }
     }
 
 
@@ -420,7 +420,7 @@ public class LegacyApplication implements Application, SystemListener {
      * @return The {@link JmeContext display context} for the application
      * @return The {@link JmeContext display context} for the application
      */
      */
     @Override
     @Override
-    public JmeContext getContext(){
+    public JmeContext getContext() {
         return context;
         return context;
     }
     }
 
 
@@ -428,7 +428,7 @@ public class LegacyApplication implements Application, SystemListener {
      * @return The {@link Camera camera} for the application
      * @return The {@link Camera camera} for the application
      */
      */
     @Override
     @Override
-    public Camera getCamera(){
+    public Camera getCamera() {
         return cam;
         return cam;
     }
     }
 
 
@@ -438,7 +438,7 @@ public class LegacyApplication implements Application, SystemListener {
      * @see #start(com.jme3.system.JmeContext.Type)
      * @see #start(com.jme3.system.JmeContext.Type)
      */
      */
     @Override
     @Override
-    public void start(){
+    public void start() {
         start(JmeContext.Type.Display, false);
         start(JmeContext.Type.Display, false);
     }
     }
 
 
@@ -450,7 +450,7 @@ public class LegacyApplication implements Application, SystemListener {
      * @see #start(com.jme3.system.JmeContext.Type)
      * @see #start(com.jme3.system.JmeContext.Type)
      */
      */
     @Override
     @Override
-    public void start(boolean waitFor){
+    public void start(boolean waitFor) {
         start(JmeContext.Type.Display, waitFor);
         start(JmeContext.Type.Display, waitFor);
     }
     }
 
 
@@ -474,13 +474,13 @@ public class LegacyApplication implements Application, SystemListener {
      * @param waitFor true&rarr;wait for the context to be initialized,
      * @param waitFor true&rarr;wait for the context to be initialized,
      * false&rarr;don't wait
      * false&rarr;don't wait
      */
      */
-    public void start(JmeContext.Type contextType, boolean waitFor){
-        if (context != null && context.isCreated()){
+    public void start(JmeContext.Type contextType, boolean waitFor) {
+        if (context != null && context.isCreated()) {
             logger.warning("start() called when application already created!");
             logger.warning("start() called when application already created!");
             return;
             return;
         }
         }
 
 
-        if (settings == null){
+        if (settings == null) {
             settings = new AppSettings(true);
             settings = new AppSettings(true);
         }
         }
 
 
@@ -494,7 +494,7 @@ public class LegacyApplication implements Application, SystemListener {
      * Sets an AppProfiler hook that will be called back for
      * Sets an AppProfiler hook that will be called back for
      * specific steps within a single update frame.  Value defaults
      * specific steps within a single update frame.  Value defaults
      * to null.
      * to null.
-     * 
+     *
      * @param prof the profiler to use (alias created) or null for none
      * @param prof the profiler to use (alias created) or null for none
      */
      */
     @Override
     @Override
@@ -527,13 +527,13 @@ public class LegacyApplication implements Application, SystemListener {
      *
      *
      * @see Type#Canvas
      * @see Type#Canvas
      */
      */
-    public void createCanvas(){
-        if (context != null && context.isCreated()){
+    public void createCanvas() {
+        if (context != null && context.isCreated()) {
             logger.warning("createCanvas() called when application already created!");
             logger.warning("createCanvas() called when application already created!");
             return;
             return;
         }
         }
 
 
-        if (settings == null){
+        if (settings == null) {
             settings = new AppSettings(true);
             settings = new AppSettings(true);
         }
         }
 
 
@@ -551,7 +551,7 @@ public class LegacyApplication implements Application, SystemListener {
      *
      *
      * @see #startCanvas(boolean)
      * @see #startCanvas(boolean)
      */
      */
-    public void startCanvas(){
+    public void startCanvas() {
         startCanvas(false);
         startCanvas(false);
     }
     }
 
 
@@ -564,7 +564,7 @@ public class LegacyApplication implements Application, SystemListener {
      * @param waitFor If true, the current thread will block until the
      * @param waitFor If true, the current thread will block until the
      * rendering thread is running
      * rendering thread is running
      */
      */
-    public void startCanvas(boolean waitFor){
+    public void startCanvas(boolean waitFor) {
         context.create(waitFor);
         context.create(waitFor);
     }
     }
 
 
@@ -572,7 +572,7 @@ public class LegacyApplication implements Application, SystemListener {
      * Internal use only.
      * Internal use only.
      */
      */
     @Override
     @Override
-    public void reshape(int w, int h){
+    public void reshape(int w, int h) {
         if (renderManager != null) {
         if (renderManager != null) {
             renderManager.notifyReshape(w, h);
             renderManager.notifyReshape(w, h);
         }
         }
@@ -586,7 +586,7 @@ public class LegacyApplication implements Application, SystemListener {
      * to restart, applying the new settings.
      * to restart, applying the new settings.
      */
      */
     @Override
     @Override
-    public void restart(){
+    public void restart() {
         context.setSettings(settings);
         context.setSettings(settings);
         context.restart();
         context.restart();
     }
     }
@@ -600,7 +600,7 @@ public class LegacyApplication implements Application, SystemListener {
      * @see #stop(boolean)
      * @see #stop(boolean)
      */
      */
     @Override
     @Override
-    public void stop(){
+    public void stop() {
         stop(false);
         stop(false);
     }
     }
 
 
@@ -613,7 +613,7 @@ public class LegacyApplication implements Application, SystemListener {
      * true&rarr;don't wait
      * true&rarr;don't wait
      */
      */
     @Override
     @Override
-    public void stop(boolean waitFor){
+    public void stop(boolean waitFor) {
         logger.log(Level.FINE, "Closing application: {0}", getClass().getName());
         logger.log(Level.FINE, "Closing application: {0}", getClass().getName());
         context.destroy(waitFor);
         context.destroy(waitFor);
     }
     }
@@ -629,15 +629,15 @@ public class LegacyApplication implements Application, SystemListener {
      * and far values 1 and 1000 units respectively.
      * and far values 1 and 1000 units respectively.
      */
      */
     @Override
     @Override
-    public void initialize(){
-        if (assetManager == null){
+    public void initialize() {
+        if (assetManager == null) {
             initAssetManager();
             initAssetManager();
         }
         }
 
 
         initDisplay();
         initDisplay();
         initCamera();
         initCamera();
 
 
-        if (inputEnabled){
+        if (inputEnabled) {
             initInput();
             initInput();
         }
         }
         initAudio();
         initAudio();
@@ -653,14 +653,14 @@ public class LegacyApplication implements Application, SystemListener {
      * Internal use only.
      * Internal use only.
      */
      */
     @Override
     @Override
-    public void handleError(String errMsg, Throwable t){
+    public void handleError(String errMsg, Throwable t) {
         // Print error to log.
         // Print error to log.
         logger.log(Level.SEVERE, errMsg, t);
         logger.log(Level.SEVERE, errMsg, t);
         // Display error message on screen if not in headless mode
         // Display error message on screen if not in headless mode
         if (context.getType() != JmeContext.Type.Headless) {
         if (context.getType() != JmeContext.Type.Headless) {
             if (t != null) {
             if (t != null) {
-                JmeSystem.showErrorDialog(errMsg + "\n" + t.getClass().getSimpleName() +
-                        (t.getMessage() != null ? ": " +  t.getMessage() : ""));
+                JmeSystem.showErrorDialog(errMsg + "\n" + t.getClass().getSimpleName()
+                        + (t.getMessage() != null ? ": " + t.getMessage() : ""));
             } else {
             } else {
                 JmeSystem.showErrorDialog(errMsg);
                 JmeSystem.showErrorDialog(errMsg);
             }
             }
@@ -673,7 +673,7 @@ public class LegacyApplication implements Application, SystemListener {
      * Internal use only.
      * Internal use only.
      */
      */
     @Override
     @Override
-    public void gainFocus(){
+    public void gainFocus() {
         if (lostFocusBehavior != LostFocusBehavior.Disabled) {
         if (lostFocusBehavior != LostFocusBehavior.Disabled) {
             if (lostFocusBehavior == LostFocusBehavior.PauseOnLostFocus) {
             if (lostFocusBehavior == LostFocusBehavior.PauseOnLostFocus) {
                 paused = false;
                 paused = false;
@@ -689,8 +689,8 @@ public class LegacyApplication implements Application, SystemListener {
      * Internal use only.
      * Internal use only.
      */
      */
     @Override
     @Override
-    public void loseFocus(){
-        if (lostFocusBehavior != LostFocusBehavior.Disabled){
+    public void loseFocus() {
+        if (lostFocusBehavior != LostFocusBehavior.Disabled) {
             if (lostFocusBehavior == LostFocusBehavior.PauseOnLostFocus) {
             if (lostFocusBehavior == LostFocusBehavior.PauseOnLostFocus) {
                 paused = true;
                 paused = true;
             }
             }
@@ -702,7 +702,7 @@ public class LegacyApplication implements Application, SystemListener {
      * Internal use only.
      * Internal use only.
      */
      */
     @Override
     @Override
-    public void requestClose(boolean esc){
+    public void requestClose(boolean esc) {
         context.destroy(false);
         context.destroy(false);
     }
     }
 
 
@@ -737,7 +737,7 @@ public class LegacyApplication implements Application, SystemListener {
      */
      */
     @Override
     @Override
     @SuppressWarnings("unchecked")
     @SuppressWarnings("unchecked")
-    public void enqueue(Runnable runnable){
+    public void enqueue(Runnable runnable) {
         enqueue(new RunnableWrapper(runnable));
         enqueue(new RunnableWrapper(runnable));
     }
     }
 
 
@@ -746,7 +746,7 @@ public class LegacyApplication implements Application, SystemListener {
      */
      */
     protected void runQueuedTasks() {
     protected void runQueuedTasks() {
         AppTask<?> task;
         AppTask<?> task;
-        while( (task = taskQueue.poll()) != null ) {
+        while ((task = taskQueue.poll()) != null) {
             if (!task.isCancelled()) {
             if (!task.isCancelled()) {
                 task.invoke();
                 task.invoke();
             }
             }
@@ -758,11 +758,12 @@ public class LegacyApplication implements Application, SystemListener {
      * Callback from ContextListener.
      * Callback from ContextListener.
      */
      */
     @Override
     @Override
-    public void update(){
+    public void update() {
         // Make sure the audio renderer is available to callables
         // Make sure the audio renderer is available to callables
         AudioContext.setAudioRenderer(audioRenderer);
         AudioContext.setAudioRenderer(audioRenderer);
 
 
-        if (prof!=null) prof.appStep(AppStep.QueuedTasks);
+        if (prof != null)
+            prof.appStep(AppStep.QueuedTasks);
         runQueuedTasks();
         runQueuedTasks();
 
 
         if (speed == 0 || paused)
         if (speed == 0 || paused)
@@ -770,20 +771,22 @@ public class LegacyApplication implements Application, SystemListener {
 
 
         timer.update();
         timer.update();
 
 
-        if (inputEnabled){
-            if (prof!=null) prof.appStep(AppStep.ProcessInput);
+        if (inputEnabled) {
+            if (prof != null)
+                prof.appStep(AppStep.ProcessInput);
             inputManager.update(timer.getTimePerFrame());
             inputManager.update(timer.getTimePerFrame());
         }
         }
 
 
-        if (audioRenderer != null){
-            if (prof!=null) prof.appStep(AppStep.ProcessAudio);
+        if (audioRenderer != null) {
+            if (prof != null)
+                prof.appStep(AppStep.ProcessAudio);
             audioRenderer.update(timer.getTimePerFrame());
             audioRenderer.update(timer.getTimePerFrame());
         }
         }
 
 
         // user code here
         // user code here
     }
     }
 
 
-    protected void destroyInput(){
+    protected void destroyInput() {
         if (mouseInput != null)
         if (mouseInput != null)
             mouseInput.destroy();
             mouseInput.destroy();
 
 
@@ -804,7 +807,7 @@ public class LegacyApplication implements Application, SystemListener {
      * Callback from ContextListener.
      * Callback from ContextListener.
      */
      */
     @Override
     @Override
-    public void destroy(){
+    public void destroy() {
         stateManager.cleanup();
         stateManager.cleanup();
 
 
         destroyInput();
         destroyInput();
@@ -828,19 +831,17 @@ public class LegacyApplication implements Application, SystemListener {
         return viewPort;
         return viewPort;
     }
     }
 
 
-    private class RunnableWrapper implements Callable{
+    private class RunnableWrapper implements Callable {
         private final Runnable runnable;
         private final Runnable runnable;
 
 
-        public RunnableWrapper(Runnable runnable){
+        public RunnableWrapper(Runnable runnable) {
             this.runnable = runnable;
             this.runnable = runnable;
         }
         }
 
 
         @Override
         @Override
-        public Object call(){
+        public Object call() {
             runnable.run();
             runnable.run();
             return null;
             return null;
         }
         }
-
     }
     }
-
 }
 }

+ 20 - 14
jme3-core/src/main/java/com/jme3/app/SimpleApplication.java

@@ -61,7 +61,7 @@ import com.jme3.system.JmeSystem;
  *  M - Display memory usage in the console.<br>
  *  M - Display memory usage in the console.<br>
  *
  *
  * A {@link com.jme3.app.FlyCamAppState} is by default attached as well and can
  * A {@link com.jme3.app.FlyCamAppState} is by default attached as well and can
- * be removed by calling <code>stateManager.detach( stateManager.getState(FlyCamAppState.class) );</code>
+ * be removed by calling <code>stateManager.detach(stateManager.getState(FlyCamAppState.class));</code>
  */
  */
 public abstract class SimpleApplication extends LegacyApplication {
 public abstract class SimpleApplication extends LegacyApplication {
 
 
@@ -88,7 +88,7 @@ public abstract class SimpleApplication extends LegacyApplication {
 
 
             if (name.equals(INPUT_MAPPING_EXIT)) {
             if (name.equals(INPUT_MAPPING_EXIT)) {
                 stop();
                 stop();
-            }else if (name.equals(INPUT_MAPPING_HIDE_STATS)){
+            } else if (name.equals(INPUT_MAPPING_HIDE_STATS)) {
                 if (stateManager.getState(StatsAppState.class) != null) {
                 if (stateManager.getState(StatsAppState.class) != null) {
                     stateManager.getState(StatsAppState.class).toggleStats();
                     stateManager.getState(StatsAppState.class).toggleStats();
                 }
                 }
@@ -98,10 +98,10 @@ public abstract class SimpleApplication extends LegacyApplication {
 
 
     public SimpleApplication() {
     public SimpleApplication() {
         this(new StatsAppState(), new FlyCamAppState(), new AudioListenerState(), new DebugKeysAppState(),
         this(new StatsAppState(), new FlyCamAppState(), new AudioListenerState(), new DebugKeysAppState(),
-             new ConstantVerifierState());
+                new ConstantVerifierState());
     }
     }
 
 
-    public SimpleApplication( AppState... initialStates ) {
+    public SimpleApplication(AppState... initialStates) {
         super(initialStates);
         super(initialStates);
     }
     }
 
 
@@ -125,7 +125,7 @@ public abstract class SimpleApplication extends LegacyApplication {
         setSettings(settings);
         setSettings(settings);
         super.start();
         super.start();
     }
     }
-        
+
     /**
     /**
      * Returns the applications speed.
      * Returns the applications speed.
      *
      *
@@ -134,7 +134,7 @@ public abstract class SimpleApplication extends LegacyApplication {
     public float getSpeed() {
     public float getSpeed() {
         return speed;
         return speed;
     }
     }
-    
+
     /**
     /**
      * Changes the application speed. 0.0f prevents the application from updating.
      * Changes the application speed. 0.0f prevents the application from updating.
      * @param speed The speed to set.
      * @param speed The speed to set.
@@ -186,7 +186,7 @@ public abstract class SimpleApplication extends LegacyApplication {
     /**
     /**
      *  Creates the font that will be set to the guiFont field
      *  Creates the font that will be set to the guiFont field
      *  and subsequently set as the font for the stats text.
      *  and subsequently set as the font for the stats text.
-     * 
+     *
      * @return the loaded BitmapFont
      * @return the loaded BitmapFont
      */
      */
     protected BitmapFont loadGuiFont() {
     protected BitmapFont loadGuiFont() {
@@ -214,7 +214,7 @@ public abstract class SimpleApplication extends LegacyApplication {
             if (stateManager.getState(FlyCamAppState.class) != null) {
             if (stateManager.getState(FlyCamAppState.class) != null) {
                 flyCam = new FlyByCamera(cam);
                 flyCam = new FlyByCamera(cam);
                 flyCam.setMoveSpeed(1f); // odd to set this here but it did it before
                 flyCam.setMoveSpeed(1f); // odd to set this here but it did it before
-                stateManager.getState(FlyCamAppState.class).setCamera( flyCam );
+                stateManager.getState(FlyCamAppState.class).setCamera(flyCam);
             }
             }
 
 
             if (context.getType() == Type.Display) {
             if (context.getType() == Type.Display) {
@@ -242,7 +242,8 @@ public abstract class SimpleApplication extends LegacyApplication {
 
 
     @Override
     @Override
     public void update() {
     public void update() {
-        if (prof!=null) prof.appStep(AppStep.BeginFrame);
+        if (prof != null)
+            prof.appStep(AppStep.BeginFrame);
 
 
         super.update(); // makes sure to execute AppTasks
         super.update(); // makes sure to execute AppTasks
         if (speed == 0 || paused) {
         if (speed == 0 || paused) {
@@ -252,13 +253,15 @@ public abstract class SimpleApplication extends LegacyApplication {
         float tpf = timer.getTimePerFrame() * speed;
         float tpf = timer.getTimePerFrame() * speed;
 
 
         // update states
         // update states
-        if (prof!=null) prof.appStep(AppStep.StateManagerUpdate);
+        if (prof != null)
+            prof.appStep(AppStep.StateManagerUpdate);
         stateManager.update(tpf);
         stateManager.update(tpf);
 
 
         // simple update and root node
         // simple update and root node
         simpleUpdate(tpf);
         simpleUpdate(tpf);
 
 
-        if (prof!=null) prof.appStep(AppStep.SpatialUpdate);
+        if (prof != null)
+            prof.appStep(AppStep.SpatialUpdate);
         rootNode.updateLogicalState(tpf);
         rootNode.updateLogicalState(tpf);
         guiNode.updateLogicalState(tpf);
         guiNode.updateLogicalState(tpf);
 
 
@@ -266,15 +269,18 @@ public abstract class SimpleApplication extends LegacyApplication {
         guiNode.updateGeometricState();
         guiNode.updateGeometricState();
 
 
         // render states
         // render states
-        if (prof!=null) prof.appStep(AppStep.StateManagerRender);
+        if (prof != null)
+            prof.appStep(AppStep.StateManagerRender);
         stateManager.render(renderManager);
         stateManager.render(renderManager);
 
 
-        if (prof!=null) prof.appStep(AppStep.RenderFrame);
+        if (prof != null)
+            prof.appStep(AppStep.RenderFrame);
         renderManager.render(tpf, context.isRenderable());
         renderManager.render(tpf, context.isRenderable());
         simpleRender(renderManager);
         simpleRender(renderManager);
         stateManager.postRender();
         stateManager.postRender();
 
 
-        if (prof!=null) prof.appStep(AppStep.EndFrame);
+        if (prof != null)
+            prof.appStep(AppStep.EndFrame);
     }
     }
 
 
     public void setDisplayFps(boolean show) {
     public void setDisplayFps(boolean show) {

+ 14 - 17
jme3-core/src/main/java/com/jme3/app/StatsAppState.java

@@ -43,12 +43,11 @@ import com.jme3.scene.Node;
 import com.jme3.scene.Spatial.CullHint;
 import com.jme3.scene.Spatial.CullHint;
 import com.jme3.scene.shape.Quad;
 import com.jme3.scene.shape.Quad;
 
 
-
 /**
 /**
  *  Displays stats in SimpleApplication's GUI node or
  *  Displays stats in SimpleApplication's GUI node or
  *  using the node and font parameters provided.
  *  using the node and font parameters provided.
  *
  *
- *  @author    Paul Speed
+ * @author Paul Speed
  */
  */
 public class StatsAppState extends AbstractAppState {
 public class StatsAppState extends AbstractAppState {
 
 
@@ -70,7 +69,7 @@ public class StatsAppState extends AbstractAppState {
     public StatsAppState() {
     public StatsAppState() {
     }
     }
 
 
-    public StatsAppState( Node guiNode, BitmapFont guiFont ) {
+    public StatsAppState(Node guiNode, BitmapFont guiFont) {
         this.guiNode = guiNode;
         this.guiNode = guiNode;
         this.guiFont = guiFont;
         this.guiFont = guiFont;
     }
     }
@@ -80,10 +79,10 @@ public class StatsAppState extends AbstractAppState {
      *  so that the fpsText can be created before init.  This
      *  so that the fpsText can be created before init.  This
      *  is because several applications expect to directly access
      *  is because several applications expect to directly access
      *  fpsText... unfortunately.
      *  fpsText... unfortunately.
-     * 
+     *
      * @param guiFont the desired font (not null, alias created)
      * @param guiFont the desired font (not null, alias created)
      */
      */
-    public void setFont( BitmapFont guiFont ) {
+    public void setFont(BitmapFont guiFont) {
         this.guiFont = guiFont;
         this.guiFont = guiFont;
         this.fpsText = new BitmapText(guiFont);
         this.fpsText = new BitmapText(guiFont);
     }
     }
@@ -101,8 +100,8 @@ public class StatsAppState extends AbstractAppState {
     }
     }
 
 
     public void toggleStats() {
     public void toggleStats() {
-        setDisplayFps( !showFps );
-        setDisplayStatView( !showStats );
+        setDisplayFps(!showFps);
+        setDisplayStatView(!showStats);
     }
     }
 
 
     public void setDisplayFps(boolean show) {
     public void setDisplayFps(boolean show) {
@@ -118,7 +117,7 @@ public class StatsAppState extends AbstractAppState {
 
 
     public void setDisplayStatView(boolean show) {
     public void setDisplayStatView(boolean show) {
         showStats = show;
         showStats = show;
-        if (statsView != null ) {
+        if (statsView != null) {
             statsView.setEnabled(show);
             statsView.setEnabled(show);
             statsView.setCullHint(show ? CullHint.Never : CullHint.Always);
             statsView.setCullHint(show ? CullHint.Never : CullHint.Always);
             if (darkenStats != null) {
             if (darkenStats != null) {
@@ -142,17 +141,17 @@ public class StatsAppState extends AbstractAppState {
         this.app = app;
         this.app = app;
 
 
         if (app instanceof SimpleApplication) {
         if (app instanceof SimpleApplication) {
-            SimpleApplication simpleApp = (SimpleApplication)app;
+            SimpleApplication simpleApp = (SimpleApplication) app;
             if (guiNode == null) {
             if (guiNode == null) {
                 guiNode = simpleApp.guiNode;
                 guiNode = simpleApp.guiNode;
             }
             }
-            if (guiFont == null ) {
+            if (guiFont == null) {
                 guiFont = simpleApp.guiFont;
                 guiFont = simpleApp.guiFont;
             }
             }
         }
         }
 
 
         if (guiNode == null) {
         if (guiNode == null) {
-            throw new RuntimeException( "No guiNode specific and cannot be automatically determined." );
+            throw new RuntimeException("No guiNode specific and cannot be automatically determined.");
         }
         }
 
 
         if (guiFont == null) {
         if (guiFont == null) {
@@ -187,8 +186,8 @@ public class StatsAppState extends AbstractAppState {
      */
      */
     public void loadStatsView() {
     public void loadStatsView() {
         statsView = new StatsView("Statistics View",
         statsView = new StatsView("Statistics View",
-                                  app.getAssetManager(),
-                                  app.getRenderer().getStatistics());
+                app.getAssetManager(),
+                app.getRenderer().getStatistics());
         // move it up so it appears above fps text
         // move it up so it appears above fps text
         statsView.setLocalTranslation(0, fpsText.getLineHeight(), 0);
         statsView.setLocalTranslation(0, fpsText.getLineHeight(), 0);
         statsView.setEnabled(showStats);
         statsView.setEnabled(showStats);
@@ -198,7 +197,7 @@ public class StatsAppState extends AbstractAppState {
 
 
     public void loadDarken() {
     public void loadDarken() {
         Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
         Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
-        mat.setColor("Color", new ColorRGBA(0,0,0,0.5f));
+        mat.setColor("Color", new ColorRGBA(0, 0, 0, 0.5f));
         mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
         mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
 
 
         darkenFps = new Geometry("StatsDarken", new Quad(200, fpsText.getLineHeight()));
         darkenFps = new Geometry("StatsDarken", new Quad(200, fpsText.getLineHeight()));
@@ -237,7 +236,7 @@ public class StatsAppState extends AbstractAppState {
     public void update(float tpf) {
     public void update(float tpf) {
         if (showFps) {
         if (showFps) {
             secondCounter += app.getTimer().getTimePerFrame();
             secondCounter += app.getTimer().getTimePerFrame();
-            frameCounter ++;
+            frameCounter++;
             if (secondCounter >= 1.0f) {
             if (secondCounter >= 1.0f) {
                 int fps = (int) (frameCounter / secondCounter);
                 int fps = (int) (frameCounter / secondCounter);
                 fpsText.setText("Frames per second: " + fps);
                 fpsText.setText("Frames per second: " + fps);
@@ -256,6 +255,4 @@ public class StatsAppState extends AbstractAppState {
         guiNode.detachChild(darkenFps);
         guiNode.detachChild(darkenFps);
         guiNode.detachChild(darkenStats);
         guiNode.detachChild(darkenStats);
     }
     }
-
-
 }
 }

+ 3 - 6
jme3-core/src/main/java/com/jme3/app/StatsView.java

@@ -60,7 +60,6 @@ import com.jme3.util.clone.JmeCloneable;
  * </pre>
  * </pre>
  */
  */
 public class StatsView extends Node implements Control, JmeCloneable {
 public class StatsView extends Node implements Control, JmeCloneable {
-
     final private BitmapText statText;
     final private BitmapText statText;
     final private Statistics statistics;
     final private Statistics statistics;
 
 
@@ -71,7 +70,7 @@ public class StatsView extends Node implements Control, JmeCloneable {
 
 
     private final StringBuilder stringBuilder = new StringBuilder();
     private final StringBuilder stringBuilder = new StringBuilder();
 
 
-    public StatsView(String name, AssetManager manager, Statistics stats){
+    public StatsView(String name, AssetManager manager, Statistics stats) {
         super(name);
         super(name);
 
 
         setQueueBucket(Bucket.Gui);
         setQueueBucket(Bucket.Gui);
@@ -97,7 +96,6 @@ public class StatsView extends Node implements Control, JmeCloneable {
 
 
     @Override
     @Override
     public void update(float tpf) {
     public void update(float tpf) {
-
         if (!isEnabled())
         if (!isEnabled())
             return;
             return;
 
 
@@ -122,14 +120,14 @@ public class StatsView extends Node implements Control, JmeCloneable {
     public Control cloneForSpatial(Spatial spatial) {
     public Control cloneForSpatial(Spatial spatial) {
         throw new UnsupportedOperationException();
         throw new UnsupportedOperationException();
     }
     }
-    
+
     @Override
     @Override
     public StatsView jmeClone() {
     public StatsView jmeClone() {
         throw new UnsupportedOperationException("Not yet implemented.");
         throw new UnsupportedOperationException("Not yet implemented.");
     }
     }
 
 
     @Override
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         throw new UnsupportedOperationException("Not yet implemented.");
         throw new UnsupportedOperationException("Not yet implemented.");
     }
     }
 
 
@@ -149,5 +147,4 @@ public class StatsView extends Node implements Control, JmeCloneable {
     @Override
     @Override
     public void render(RenderManager rm, ViewPort vp) {
     public void render(RenderManager rm, ViewPort vp) {
     }
     }
-
 }
 }

+ 7 - 8
jme3-core/src/main/java/com/jme3/app/state/AbstractAppState.java

@@ -51,11 +51,11 @@ public abstract class AbstractAppState implements AppState {
     protected boolean initialized = false;
     protected boolean initialized = false;
     private boolean enabled = true;
     private boolean enabled = true;
     private String id;
     private String id;
-    
-    protected AbstractAppState() {    
+
+    protected AbstractAppState() {
     }
     }
-    
-    protected AbstractAppState( String id ) {
+
+    protected AbstractAppState(String id) {
         this.id = id;
         this.id = id;
     }
     }
 
 
@@ -76,7 +76,7 @@ public abstract class AbstractAppState implements AppState {
      *
      *
      * @param id the desired ID
      * @param id the desired ID
      */
      */
-    protected void setId( String id ) {
+    protected void setId(String id) {
         this.id = id;
         this.id = id;
     }
     }
 
 
@@ -89,7 +89,7 @@ public abstract class AbstractAppState implements AppState {
     public void setEnabled(boolean enabled) {
     public void setEnabled(boolean enabled) {
         this.enabled = enabled;
         this.enabled = enabled;
     }
     }
-    
+
     @Override
     @Override
     public boolean isEnabled() {
     public boolean isEnabled() {
         return enabled;
         return enabled;
@@ -112,12 +112,11 @@ public abstract class AbstractAppState implements AppState {
     }
     }
 
 
     @Override
     @Override
-    public void postRender(){
+    public void postRender() {
     }
     }
 
 
     @Override
     @Override
     public void cleanup() {
     public void cleanup() {
         initialized = false;
         initialized = false;
     }
     }
-
 }
 }

+ 93 - 94
jme3-core/src/main/java/com/jme3/app/state/AppStateManager.java

@@ -30,7 +30,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
  */
 package com.jme3.app.state;
 package com.jme3.app.state;
- 
+
 import com.jme3.app.Application;
 import com.jme3.app.Application;
 import com.jme3.renderer.RenderManager;
 import com.jme3.renderer.RenderManager;
 import com.jme3.util.SafeArrayList;
 import com.jme3.util.SafeArrayList;
@@ -58,29 +58,28 @@ import java.util.concurrent.ConcurrentHashMap;
  *                       render thread and it is not necessarily safe to modify
  *                       render thread and it is not necessarily safe to modify
  *                       the scene graph, etc..
  *                       the scene graph, etc..
  * <li>cleanup() : called ONCE on the render thread at the beginning of the next update
  * <li>cleanup() : called ONCE on the render thread at the beginning of the next update
- *                 after the state has been detached or when the application is 
- *                 terminating.  
- * </ul> 
+ *                 after the state has been detached or when the application is
+ *                 terminating.
+ * </ul>
  *
  *
  * @author Kirill Vainer, Paul Speed
  * @author Kirill Vainer, Paul Speed
  */
  */
 public class AppStateManager {
 public class AppStateManager {
-
     /**
     /**
      *  List holding the attached app states that are pending
      *  List holding the attached app states that are pending
      *  initialization.  Once initialized they will be added to
      *  initialization.  Once initialized they will be added to
-     *  the running app states.  
+     *  the running app states.
      */
      */
     private final SafeArrayList<AppState> initializing = new SafeArrayList<>(AppState.class);
     private final SafeArrayList<AppState> initializing = new SafeArrayList<>(AppState.class);
-    
+
     /**
     /**
-     *  Holds the active states once they are initialized.  
+     * Holds the active states once they are initialized.
      */
      */
     private final SafeArrayList<AppState> states = new SafeArrayList<>(AppState.class);
     private final SafeArrayList<AppState> states = new SafeArrayList<>(AppState.class);
-    
+
     /**
     /**
      *  List holding the detached app states that are pending
      *  List holding the detached app states that are pending
-     *  cleanup.  
+     *  cleanup.
      */
      */
     private final SafeArrayList<AppState> terminating = new SafeArrayList<>(AppState.class);
     private final SafeArrayList<AppState> terminating = new SafeArrayList<>(AppState.class);
 
 
@@ -89,20 +88,20 @@ public class AppStateManager {
      *  an ID.
      *  an ID.
      */
      */
     private final ConcurrentMap<String, AppState> stateIndex = new ConcurrentHashMap<>();
     private final ConcurrentMap<String, AppState> stateIndex = new ConcurrentHashMap<>();
- 
+
     // All of the above lists need to be thread-safe, but access will be
     // All of the above lists need to be thread-safe, but access will be
     // synchronized separately.... but always on the states list.  This
     // synchronized separately.... but always on the states list.  This
     // is to avoid deadlocking. Anyway, the most common use case
     // is to avoid deadlocking. Anyway, the most common use case
     // is that they are all modified from the same thread.
     // is that they are all modified from the same thread.
-    
+
     private final Application app;
     private final Application app;
 
 
-    public AppStateManager(Application app){
+    public AppStateManager(Application app) {
         this.app = app;
         this.app = app;
     }
     }
 
 
     /**
     /**
-     *  Returns the Application to which this AppStateManager belongs.
+     * Returns the Application to which this AppStateManager belongs.
      *
      *
      * @return the pre-existing instance
      * @return the pre-existing instance
      */
      */
@@ -110,41 +109,41 @@ public class AppStateManager {
         return app;
         return app;
     }
     }
 
 
-    protected AppState[] getInitializing() { 
-        synchronized (states){
+    protected AppState[] getInitializing() {
+        synchronized (states) {
             return initializing.getArray();
             return initializing.getArray();
         }
         }
-    } 
+    }
 
 
-    protected AppState[] getTerminating() { 
-        synchronized (states){
+    protected AppState[] getTerminating() {
+        synchronized (states) {
             return terminating.getArray();
             return terminating.getArray();
         }
         }
-    } 
+    }
 
 
-    protected AppState[] getStates(){
-        synchronized (states){
+    protected AppState[] getStates() {
+        synchronized (states) {
             return states.getArray();
             return states.getArray();
         }
         }
     }
     }
 
 
     /**
     /**
      * Attach a state to the AppStateManager, the same state cannot be attached
      * Attach a state to the AppStateManager, the same state cannot be attached
-     * twice.  Throws an IllegalArgumentException if the state has an ID and that
-     * ID has already been associated with another AppState.                
+     * twice. Throws an IllegalArgumentException if the state has an ID and that
+     * ID has already been associated with another AppState.
      *
      *
      * @param state The state to attach
      * @param state The state to attach
      * @return True if the state was successfully attached, false if the state
      * @return True if the state was successfully attached, false if the state
      * was already attached.
      * was already attached.
      */
      */
-    public boolean attach(AppState state){
-        synchronized (states){
-            if( state.getId() != null && stateIndex.putIfAbsent(state.getId(), state) != null ) {
-                throw new IllegalArgumentException("ID:" + state.getId() 
-                        + " is already being used by another state:" 
+    public boolean attach(AppState state) {
+        synchronized (states) {
+            if (state.getId() != null && stateIndex.putIfAbsent(state.getId(), state) != null) {
+                throw new IllegalArgumentException("ID:" + state.getId()
+                        + " is already being used by another state:"
                         + stateIndex.get(state.getId()));
                         + stateIndex.get(state.getId()));
             }
             }
-            if (!states.contains(state) && !initializing.contains(state)){
+            if (!states.contains(state) && !initializing.contains(state)) {
                 state.stateAttached(this);
                 state.stateAttached(this);
                 initializing.add(state);
                 initializing.add(state);
                 return true;
                 return true;
@@ -161,7 +160,7 @@ public class AppStateManager {
      *
      *
      * @param states The states to attach
      * @param states The states to attach
      */
      */
-    public void attachAll(AppState... states){
+    public void attachAll(AppState... states) {
         attachAll(Arrays.asList(states));
         attachAll(Arrays.asList(states));
     }
     }
 
 
@@ -172,39 +171,39 @@ public class AppStateManager {
      *
      *
      * @param states The states to attach
      * @param states The states to attach
      */
      */
-    public void attachAll(Iterable<AppState> states){
-        synchronized (this.states){
-            for( AppState state : states ) {
+    public void attachAll(Iterable<AppState> states) {
+        synchronized (this.states) {
+            for (AppState state : states) {
                 attach(state);
                 attach(state);
             }
             }
         }
         }
     }
     }
 
 
     /**
     /**
-     * Detaches the state from the AppStateManager. 
+     * Detaches the state from the AppStateManager.
      *
      *
      * @param state The state to detach
      * @param state The state to detach
      * @return True if the state was detached successfully, false
      * @return True if the state was detached successfully, false
-     * if the state was not attached in the first place.
+     *     if the state was not attached in the first place.
      */
      */
-    public boolean detach(AppState state){
-        synchronized (states){
-        
+    public boolean detach(AppState state) {
+        synchronized (states) {
+
             // Remove it from the index if it exists.
             // Remove it from the index if it exists.
             // Note: we remove it directly from the values() in case
             // Note: we remove it directly from the values() in case
             // the state has changed its ID since registered.
             // the state has changed its ID since registered.
             stateIndex.values().remove(state);
             stateIndex.values().remove(state);
-        
-            if (states.contains(state)){
+
+            if (states.contains(state)) {
                 state.stateDetached(this);
                 state.stateDetached(this);
                 states.remove(state);
                 states.remove(state);
                 terminating.add(state);
                 terminating.add(state);
                 return true;
                 return true;
-            } else if(initializing.contains(state)){
+            } else if (initializing.contains(state)) {
                 state.stateDetached(this);
                 state.stateDetached(this);
                 initializing.remove(state);
                 initializing.remove(state);
                 return true;
                 return true;
-            }else{
+            } else {
                 return false;
                 return false;
             }
             }
         }
         }
@@ -215,11 +214,11 @@ public class AppStateManager {
      *
      *
      * @param state The state to check
      * @param state The state to check
      * @return True if the state is currently attached to this AppStateManager.
      * @return True if the state is currently attached to this AppStateManager.
-     * 
+     *
      * @see AppStateManager#attach(com.jme3.app.state.AppState)
      * @see AppStateManager#attach(com.jme3.app.state.AppState)
      */
      */
-    public boolean hasState(AppState state){
-        synchronized (states){
+    public boolean hasState(AppState state) {
+        synchronized (states) {
             return states.contains(state) || initializing.contains(state);
             return states.contains(state) || initializing.contains(state);
         }
         }
     }
     }
@@ -231,140 +230,140 @@ public class AppStateManager {
      * @param stateClass the desired type of AppState
      * @param stateClass the desired type of AppState
      * @return First attached state that is an instance of stateClass
      * @return First attached state that is an instance of stateClass
      */
      */
-    public <T extends AppState> T getState(Class<T> stateClass){
+    public <T extends AppState> T getState(Class<T> stateClass) {
         return getState(stateClass, false);
         return getState(stateClass, false);
     }
     }
-    
+
     /**
     /**
      * Returns the first state that is an instance of subclass of the specified class.
      * Returns the first state that is an instance of subclass of the specified class.
      *
      *
      * @param <T> the desired type of AppState
      * @param <T> the desired type of AppState
      * @param stateClass the desired type of AppState
      * @param stateClass the desired type of AppState
      * @param failOnMiss true to throw an exception, false to return null
      * @param failOnMiss true to throw an exception, false to return null
-     * @return First attached state that is an instance of stateClass. If failOnMiss is true 
-     * then an IllegalArgumentException is thrown if the state is not attached.
+     * @return First attached state that is an instance of stateClass. If failOnMiss is true
+     *     then an IllegalArgumentException is thrown if the state is not attached.
      */
      */
     @SuppressWarnings("unchecked")
     @SuppressWarnings("unchecked")
-    public <T extends AppState> T getState(Class<T> stateClass, boolean failOnMiss){
-        synchronized (states){
+    public <T extends AppState> T getState(Class<T> stateClass, boolean failOnMiss) {
+        synchronized (states) {
             AppState[] array = getStates();
             AppState[] array = getStates();
             for (AppState state : array) {
             for (AppState state : array) {
-                if (stateClass.isAssignableFrom(state.getClass())){
+                if (stateClass.isAssignableFrom(state.getClass())) {
                     return (T) state;
                     return (T) state;
                 }
                 }
             }
             }
-            
+
             // This may be more trouble than it's worth, but I think
             // This may be more trouble than it's worth, but I think
             // it's necessary for proper decoupling of states and provides
             // it's necessary for proper decoupling of states and provides
             // similar behavior to before where a state could be looked
             // similar behavior to before where a state could be looked
             // up even if it wasn't initialized. -pspeed
             // up even if it wasn't initialized. -pspeed
             array = getInitializing();
             array = getInitializing();
             for (AppState state : array) {
             for (AppState state : array) {
-                if (stateClass.isAssignableFrom(state.getClass())){
+                if (stateClass.isAssignableFrom(state.getClass())) {
                     return (T) state;
                     return (T) state;
                 }
                 }
             }
             }
         }
         }
-        
-        if(failOnMiss) {
+
+        if (failOnMiss) {
             throw new IllegalArgumentException("State not found for:" + stateClass);
             throw new IllegalArgumentException("State not found for:" + stateClass);
-        }    
+        }
         return null;
         return null;
     }
     }
 
 
     /**
     /**
-     *  Returns the state associated with the specified ID at the time it was
-     *  attached or null if not state was attached with that ID.
+     * Returns the state associated with the specified ID at the time it was
+     * attached or null if not state was attached with that ID.
      *
      *
      * @param <T> the desired type of AppState
      * @param <T> the desired type of AppState
      * @param id the AppState ID
      * @param id the AppState ID
      * @param stateClass the desired type of AppState
      * @param stateClass the desired type of AppState
      * @return the pre-existing instance, or null if not found
      * @return the pre-existing instance, or null if not found
      */
      */
-    public <T extends AppState> T getState( String id, Class<T> stateClass ) {
+    public <T extends AppState> T getState(String id, Class<T> stateClass) {
         return stateClass.cast(stateIndex.get(id));
         return stateClass.cast(stateIndex.get(id));
     }
     }
-    
+
     /**
     /**
-     *  Returns true if there is currently a state associated with the specified
-     *  ID.
+     * Returns true if there is currently a state associated with the specified
+     * ID.
      *
      *
      * @param id the AppState ID
      * @param id the AppState ID
      * @return true if found, otherwise false
      * @return true if found, otherwise false
      */
      */
-    public boolean hasState( String id ) {
+    public boolean hasState(String id) {
         return stateIndex.containsKey(id);
         return stateIndex.containsKey(id);
     }
     }
- 
+
     /**
     /**
      *  Returns the state associated with the specified ID at the time it
      *  Returns the state associated with the specified ID at the time it
-     *  was attached or throws an IllegalArgumentException if the ID was 
+     *  was attached or throws an IllegalArgumentException if the ID was
      *  not found.
      *  not found.
      *
      *
      * @param <T> the desired type of AppState
      * @param <T> the desired type of AppState
      * @param id the AppState ID
      * @param id the AppState ID
      * @param stateClass the desired type of AppState
      * @param stateClass the desired type of AppState
      * @return the pre-existing instance (not null)
      * @return the pre-existing instance (not null)
-     */   
-    public <T extends AppState> T stateForId( String id, Class<T> stateClass ) {
+     */
+    public <T extends AppState> T stateForId(String id, Class<T> stateClass) {
         T result = getState(id, stateClass);
         T result = getState(id, stateClass);
-        if( result == null ) {
+        if (result == null) {
             throw new IllegalArgumentException("State not found for:" + id);
             throw new IllegalArgumentException("State not found for:" + id);
         }
         }
         return stateClass.cast(result);
         return stateClass.cast(result);
-    } 
+    }
 
 
-    protected void initializePending(){
+    protected void initializePending() {
         AppState[] array = getInitializing();
         AppState[] array = getInitializing();
         if (array.length == 0)
         if (array.length == 0)
             return;
             return;
-            
-        synchronized( states ) {
+
+        synchronized (states) {
             // Move the states that will be initialized
             // Move the states that will be initialized
             // into the active array.  In all but one case the
             // into the active array.  In all but one case the
             // order doesn't matter but if we do this here then
             // order doesn't matter but if we do this here then
             // a state can detach itself in initialize().  If we
             // a state can detach itself in initialize().  If we
             // did it after then it couldn't.
             // did it after then it couldn't.
-            List<AppState> transfer = Arrays.asList(array);         
+            List<AppState> transfer = Arrays.asList(array);
             states.addAll(transfer);
             states.addAll(transfer);
             initializing.removeAll(transfer);
             initializing.removeAll(transfer);
-        }        
+        }
         for (AppState state : array) {
         for (AppState state : array) {
             state.initialize(this, app);
             state.initialize(this, app);
         }
         }
     }
     }
-    
-    protected void terminatePending(){
+
+    protected void terminatePending() {
         AppState[] array = getTerminating();
         AppState[] array = getTerminating();
         if (array.length == 0)
         if (array.length == 0)
             return;
             return;
-            
+
         for (AppState state : array) {
         for (AppState state : array) {
             state.cleanup();
             state.cleanup();
-        }        
-        synchronized( states ) {
+        }
+        synchronized (states) {
             // Remove just the states that were terminated...
             // Remove just the states that were terminated...
             // which might now be a subset of the total terminating
             // which might now be a subset of the total terminating
             // list.
             // list.
-            terminating.removeAll(Arrays.asList(array));         
+            terminating.removeAll(Arrays.asList(array));
         }
         }
-    }    
+    }
 
 
     /**
     /**
      * Calls update for attached states, do not call directly.
      * Calls update for attached states, do not call directly.
      * @param tpf Time per frame.
      * @param tpf Time per frame.
      */
      */
-    public void update(float tpf){
-    
+    public void update(float tpf) {
+
         // Cleanup any states pending
         // Cleanup any states pending
         terminatePending();
         terminatePending();
 
 
         // Initialize any states pending
         // Initialize any states pending
         initializePending();
         initializePending();
 
 
-        // Update enabled states    
+        // Update enabled states
         AppState[] array = getStates();
         AppState[] array = getStates();
-        for (AppState state : array){
+        for (AppState state : array) {
             if (state.isEnabled()) {
             if (state.isEnabled()) {
                 if (app.getAppProfiler() != null) {
                 if (app.getAppProfiler() != null) {
                     app.getAppProfiler().appSubStep(state.getClass().getSimpleName());
                     app.getAppProfiler().appSubStep(state.getClass().getSimpleName());
@@ -378,9 +377,9 @@ public class AppStateManager {
      * Calls render for all attached and initialized states, do not call directly.
      * Calls render for all attached and initialized states, do not call directly.
      * @param rm The RenderManager
      * @param rm The RenderManager
      */
      */
-    public void render(RenderManager rm){
+    public void render(RenderManager rm) {
         AppState[] array = getStates();
         AppState[] array = getStates();
-        for (AppState state : array){
+        for (AppState state : array) {
             if (state.isEnabled()) {
             if (state.isEnabled()) {
                 if (app.getAppProfiler() != null) {
                 if (app.getAppProfiler() != null) {
                     app.getAppProfiler().appSubStep(state.getClass().getSimpleName());
                     app.getAppProfiler().appSubStep(state.getClass().getSimpleName());
@@ -393,9 +392,9 @@ public class AppStateManager {
     /**
     /**
      * Calls render for all attached and initialized states, do not call directly.
      * Calls render for all attached and initialized states, do not call directly.
      */
      */
-    public void postRender(){
+    public void postRender() {
         AppState[] array = getStates();
         AppState[] array = getStates();
-        for (AppState state : array){
+        for (AppState state : array) {
             if (state.isEnabled()) {
             if (state.isEnabled()) {
                 if (app.getAppProfiler() != null) {
                 if (app.getAppProfiler() != null) {
                     app.getAppProfiler().appSubStep(state.getClass().getSimpleName());
                     app.getAppProfiler().appSubStep(state.getClass().getSimpleName());
@@ -408,10 +407,10 @@ public class AppStateManager {
     /**
     /**
      * Calls cleanup on attached states, do not call directly.
      * Calls cleanup on attached states, do not call directly.
      */
      */
-    public void cleanup(){
+    public void cleanup() {
         AppState[] array = getStates();
         AppState[] array = getStates();
-        for (AppState state : array){
+        for (AppState state : array) {
             state.cleanup();
             state.cleanup();
         }
         }
-    }    
+    }
 }
 }

+ 34 - 38
jme3-core/src/main/java/com/jme3/app/state/BaseAppState.java

@@ -29,7 +29,7 @@
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
  */
- 
+
 package com.jme3.app.state;
 package com.jme3.app.state;
 
 
 import com.jme3.app.Application;
 import com.jme3.app.Application;
@@ -37,8 +37,6 @@ import com.jme3.renderer.RenderManager;
 import java.util.logging.Level;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import java.util.logging.Logger;
 
 
-
-
 /**
 /**
  *  A base app state implementation the provides more built-in
  *  A base app state implementation the provides more built-in
  *  management convenience than AbstractAppState, including methods
  *  management convenience than AbstractAppState, including methods
@@ -46,9 +44,9 @@ import java.util.logging.Logger;
  *  The abstract onEnable() and onDisable() methods are called
  *  The abstract onEnable() and onDisable() methods are called
  *  appropriately during initialize(), cleanup(), or setEnabled()
  *  appropriately during initialize(), cleanup(), or setEnabled()
  *  depending on the mutual state of "initialized" and "enabled".
  *  depending on the mutual state of "initialized" and "enabled".
- *  
+ *
  *  <p>initialize() and cleanup() can be used by subclasses to
  *  <p>initialize() and cleanup() can be used by subclasses to
- *  manage resources that should exist the entire time that the 
+ *  manage resources that should exist the entire time that the
  *  app state is attached.  This is useful for resources that might
  *  app state is attached.  This is useful for resources that might
  *  be expensive to create or load.</p>
  *  be expensive to create or load.</p>
  *
  *
@@ -61,7 +59,7 @@ import java.util.logging.Logger;
  *  will always be called after initialize() if the state is enable().
  *  will always be called after initialize() if the state is enable().
  *  onEnable()/onDisable() are also called appropriate when setEnabled()
  *  onEnable()/onDisable() are also called appropriate when setEnabled()
  *  is called that changes the enabled state AND if the state is attached.
  *  is called that changes the enabled state AND if the state is attached.
- *  In other words, onEnable()/onDisable() are only ever called on an already 
+ *  In other words, onEnable()/onDisable() are only ever called on an already
  *  attached state.</p>
  *  attached state.</p>
  *
  *
  *  <p>It is technically safe to do all initialization and cleanup in
  *  <p>It is technically safe to do all initialization and cleanup in
@@ -72,7 +70,6 @@ import java.util.logging.Logger;
  *  @author    Paul Speed
  *  @author    Paul Speed
  */
  */
 public abstract class BaseAppState implements AppState {
 public abstract class BaseAppState implements AppState {
-
     private static final Logger log = Logger.getLogger(BaseAppState.class.getName());
     private static final Logger log = Logger.getLogger(BaseAppState.class.getName());
 
 
     private Application app;
     private Application app;
@@ -82,8 +79,8 @@ public abstract class BaseAppState implements AppState {
 
 
     protected BaseAppState() {
     protected BaseAppState() {
     }
     }
-    
-    protected BaseAppState( String id ) {
+
+    protected BaseAppState(String id) {
         this.id = id;
         this.id = id;
     }
     }
 
 
@@ -92,8 +89,8 @@ public abstract class BaseAppState implements AppState {
      *  attached and before onEnable() is called.
      *  attached and before onEnable() is called.
      * @param app the application
      * @param app the application
      */
      */
-    protected abstract void initialize( Application app );
-    
+    protected abstract void initialize(Application app);
+
     /**
     /**
      *  Called after the app state is detached or during
      *  Called after the app state is detached or during
      *  application shutdown if the state is still attached.
      *  application shutdown if the state is still attached.
@@ -101,15 +98,15 @@ public abstract class BaseAppState implements AppState {
      *  the state is enabled at the time of cleanup.
      *  the state is enabled at the time of cleanup.
      * @param app the application
      * @param app the application
      */
      */
-    protected abstract void cleanup( Application app );
-    
+    protected abstract void cleanup(Application app);
+
     /**
     /**
      *  Called when the state is fully enabled, ie: is attached
      *  Called when the state is fully enabled, ie: is attached
      *  and isEnabled() is true or when the setEnabled() status
      *  and isEnabled() is true or when the setEnabled() status
      *  changes after the state is attached.
      *  changes after the state is attached.
      */
      */
     protected abstract void onEnable();
     protected abstract void onEnable();
-    
+
     /**
     /**
      *  Called when the state was previously enabled but is
      *  Called when the state was previously enabled but is
      *  now disabled either because setEnabled(false) was called
      *  now disabled either because setEnabled(false) was called
@@ -118,19 +115,19 @@ public abstract class BaseAppState implements AppState {
     protected abstract void onDisable();
     protected abstract void onDisable();
 
 
     /**
     /**
-     *  Do not call directly: Called by the state manager to initialize this 
+     *  Do not call directly: Called by the state manager to initialize this
      *  state post-attachment.
      *  state post-attachment.
      *  This implementation calls initialize(app) and then onEnable() if the
      *  This implementation calls initialize(app) and then onEnable() if the
      *  state is enabled.
      *  state is enabled.
      */
      */
     @Override
     @Override
-    public final void initialize( AppStateManager stateManager, Application app ) {
+    public final void initialize(AppStateManager stateManager, Application app) {
         log.log(Level.FINEST, "initialize():{0}", this);
         log.log(Level.FINEST, "initialize():{0}", this);
 
 
         this.app = app;
         this.app = app;
         initialized = true;
         initialized = true;
         initialize(app);
         initialize(app);
-        if( isEnabled() ) {
+        if (isEnabled()) {
             log.log(Level.FINEST, "onEnable():{0}", this);
             log.log(Level.FINEST, "onEnable():{0}", this);
             onEnable();
             onEnable();
         }
         }
@@ -148,7 +145,7 @@ public abstract class BaseAppState implements AppState {
      *
      *
      * @param id the desired ID
      * @param id the desired ID
      */
      */
-    protected void setId( String id ) {
+    protected void setId(String id) {
         this.id = id;
         this.id = id;
     }
     }
 
 
@@ -165,34 +162,33 @@ public abstract class BaseAppState implements AppState {
         return app.getStateManager();
         return app.getStateManager();
     }
     }
 
 
-    public final <T extends AppState> T getState( Class<T> type ) {
-        return getState( type, false );
+    public final <T extends AppState> T getState(Class<T> type) {
+        return getState(type, false);
     }
     }
-    
-    public final <T extends AppState> T getState( Class<T> type, boolean failOnMiss ) {
-        return getStateManager().getState( type, failOnMiss );
+
+    public final <T extends AppState> T getState(Class<T> type, boolean failOnMiss) {
+        return getStateManager().getState(type, failOnMiss);
     }
     }
 
 
-    public final <T extends AppState> T getState( String id, Class<T> type ) {
+    public final <T extends AppState> T getState(String id, Class<T> type) {
         return getState(id, type, false);
         return getState(id, type, false);
     }
     }
-    
-    public final <T extends AppState> T getState( String id, Class<T> type, boolean failOnMiss ) {
-        if( failOnMiss ) {
+
+    public final <T extends AppState> T getState(String id, Class<T> type, boolean failOnMiss) {
+        if (failOnMiss) {
             return getStateManager().stateForId(id, type);
             return getStateManager().stateForId(id, type);
         }
         }
         return getStateManager().getState(id, type);
         return getStateManager().getState(id, type);
     }
     }
 
 
     @Override
     @Override
-    public final void setEnabled( boolean enabled )
-    {
-        if( this.enabled == enabled )
+    public final void setEnabled(boolean enabled) {
+        if (this.enabled == enabled)
             return;
             return;
         this.enabled = enabled;
         this.enabled = enabled;
-        if( !isInitialized() )
+        if (!isInitialized())
             return;
             return;
-        if( enabled ) {
+        if (enabled) {
             log.log(Level.FINEST, "onEnable():{0}", this);
             log.log(Level.FINEST, "onEnable():{0}", this);
             onEnable();
             onEnable();
         } else {
         } else {
@@ -207,19 +203,19 @@ public abstract class BaseAppState implements AppState {
     }
     }
 
 
     @Override
     @Override
-    public void stateAttached( AppStateManager stateManager ) {
+    public void stateAttached(AppStateManager stateManager) {
     }
     }
 
 
     @Override
     @Override
-    public void stateDetached( AppStateManager stateManager ) {
+    public void stateDetached(AppStateManager stateManager) {
     }
     }
 
 
     @Override
     @Override
-    public void update( float tpf ) {
+    public void update(float tpf) {
     }
     }
 
 
     @Override
     @Override
-    public void render( RenderManager rm ) {
+    public void render(RenderManager rm) {
     }
     }
 
 
     @Override
     @Override
@@ -227,7 +223,7 @@ public abstract class BaseAppState implements AppState {
     }
     }
 
 
     /**
     /**
-     *  Do not call directly: Called by the state manager to terminate this 
+     *  Do not call directly: Called by the state manager to terminate this
      *  state post-detachment or during state manager termination.
      *  state post-detachment or during state manager termination.
      *  This implementation calls onDisable() if the state is enabled and
      *  This implementation calls onDisable() if the state is enabled and
      *  then cleanup(app).
      *  then cleanup(app).
@@ -236,7 +232,7 @@ public abstract class BaseAppState implements AppState {
     public final void cleanup() {
     public final void cleanup() {
         log.log(Level.FINEST, "cleanup():{0}", this);
         log.log(Level.FINEST, "cleanup():{0}", this);
 
 
-        if( isEnabled() ) {
+        if (isEnabled()) {
             log.log(Level.FINEST, "onDisable():{0}", this);
             log.log(Level.FINEST, "onDisable():{0}", this);
             onDisable();
             onDisable();
         }
         }

+ 45 - 39
jme3-core/src/main/java/com/jme3/app/state/ConstantVerifierState.java

@@ -29,7 +29,7 @@
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
  */
- 
+
 package com.jme3.app.state;
 package com.jme3.app.state;
 
 
 import java.util.Arrays;
 import java.util.Arrays;
@@ -64,10 +64,13 @@ public class ConstantVerifierState extends BaseAppState {
             new Checker(Vector3f.UNIT_Y, new Vector3f(0, 1, 0)),
             new Checker(Vector3f.UNIT_Y, new Vector3f(0, 1, 0)),
             new Checker(Vector3f.UNIT_Z, new Vector3f(0, 0, 1)),
             new Checker(Vector3f.UNIT_Z, new Vector3f(0, 0, 1)),
             new Checker(Vector3f.UNIT_XYZ, new Vector3f(1, 1, 1)),
             new Checker(Vector3f.UNIT_XYZ, new Vector3f(1, 1, 1)),
-            new Checker(Vector3f.POSITIVE_INFINITY, new Vector3f(POSITIVE_INFINITY, POSITIVE_INFINITY, POSITIVE_INFINITY)),
-            new Checker(Vector3f.NEGATIVE_INFINITY, new Vector3f(NEGATIVE_INFINITY, NEGATIVE_INFINITY, NEGATIVE_INFINITY)),
+            new Checker(Vector3f.POSITIVE_INFINITY,
+                    new Vector3f(POSITIVE_INFINITY, POSITIVE_INFINITY, POSITIVE_INFINITY)),
+            new Checker(Vector3f.NEGATIVE_INFINITY,
+                    new Vector3f(NEGATIVE_INFINITY, NEGATIVE_INFINITY, NEGATIVE_INFINITY)),
             new Checker(Quaternion.IDENTITY, new Quaternion()),
             new Checker(Quaternion.IDENTITY, new Quaternion()),
-            new Checker(Quaternion.DIRECTION_Z, new Quaternion().fromAxes(Vector3f.UNIT_X, Vector3f.UNIT_Y, Vector3f.UNIT_Z)),
+            new Checker(Quaternion.DIRECTION_Z,
+                    new Quaternion().fromAxes(Vector3f.UNIT_X, Vector3f.UNIT_Y, Vector3f.UNIT_Z)),
             new Checker(Quaternion.ZERO, new Quaternion(0, 0, 0, 0)),
             new Checker(Quaternion.ZERO, new Quaternion(0, 0, 0, 0)),
             new Checker(Vector2f.ZERO, new Vector2f(0f, 0f)),
             new Checker(Vector2f.ZERO, new Vector2f(0f, 0f)),
             new Checker(Vector2f.UNIT_XY, new Vector2f(1f, 1f)),
             new Checker(Vector2f.UNIT_XY, new Vector2f(1f, 1f)),
@@ -78,8 +81,10 @@ public class ConstantVerifierState extends BaseAppState {
             new Checker(Vector4f.UNIT_Z, new Vector4f(0, 0, 1, 0)),
             new Checker(Vector4f.UNIT_Z, new Vector4f(0, 0, 1, 0)),
             new Checker(Vector4f.UNIT_W, new Vector4f(0, 0, 0, 1)),
             new Checker(Vector4f.UNIT_W, new Vector4f(0, 0, 0, 1)),
             new Checker(Vector4f.UNIT_XYZW, new Vector4f(1, 1, 1, 1)),
             new Checker(Vector4f.UNIT_XYZW, new Vector4f(1, 1, 1, 1)),
-            new Checker(Vector4f.POSITIVE_INFINITY, new Vector4f(POSITIVE_INFINITY, POSITIVE_INFINITY, POSITIVE_INFINITY, POSITIVE_INFINITY)),
-            new Checker(Vector4f.NEGATIVE_INFINITY, new Vector4f(NEGATIVE_INFINITY, NEGATIVE_INFINITY, NEGATIVE_INFINITY, NEGATIVE_INFINITY)), 
+            new Checker(Vector4f.POSITIVE_INFINITY,
+                    new Vector4f(POSITIVE_INFINITY, POSITIVE_INFINITY, POSITIVE_INFINITY, POSITIVE_INFINITY)),
+            new Checker(Vector4f.NEGATIVE_INFINITY,
+                    new Vector4f(NEGATIVE_INFINITY, NEGATIVE_INFINITY, NEGATIVE_INFINITY, NEGATIVE_INFINITY)),
             new Checker(Matrix3f.ZERO, new Matrix3f(0, 0, 0, 0, 0, 0, 0, 0, 0)),
             new Checker(Matrix3f.ZERO, new Matrix3f(0, 0, 0, 0, 0, 0, 0, 0, 0)),
             new Checker(Matrix3f.IDENTITY, new Matrix3f()),
             new Checker(Matrix3f.IDENTITY, new Matrix3f()),
             new Checker(Matrix4f.ZERO, new Matrix4f(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)),
             new Checker(Matrix4f.ZERO, new Matrix4f(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)),
@@ -96,112 +101,113 @@ public class ConstantVerifierState extends BaseAppState {
      *  constant checks using asserts.
      *  constant checks using asserts.
      */
      */
     public ConstantVerifierState() {
     public ConstantVerifierState() {
-        this(ErrorType.Assert);        
+        this(ErrorType.Assert);
     }
     }
-    
+
     /**
     /**
      *  Creates a verifier app state that will check all of the default
      *  Creates a verifier app state that will check all of the default
      *  constant checks using the specified error reporting mechanism.
      *  constant checks using the specified error reporting mechanism.
-     * 
+     *
      * @param errorType the mechanism to use
      * @param errorType the mechanism to use
      */
      */
-    public ConstantVerifierState( ErrorType errorType ) {
+    public ConstantVerifierState(ErrorType errorType) {
         this(errorType, DEFAULT_CHECKS);
         this(errorType, DEFAULT_CHECKS);
     }
     }
 
 
     /**
     /**
      *  Creates a verifier app state that will check all of the specified
      *  Creates a verifier app state that will check all of the specified
      *  checks and report errors using the specified error type.
      *  checks and report errors using the specified error type.
-     * 
+     *
      * @param errorType the mechanism to use
      * @param errorType the mechanism to use
      * @param checkers which checks to perform
      * @param checkers which checks to perform
      */
      */
-    private ConstantVerifierState( ErrorType errorType, Checker... checkers ) {
+    private ConstantVerifierState(ErrorType errorType, Checker... checkers) {
         this.errorType = errorType;
         this.errorType = errorType;
         this.checkers.addAll(Arrays.asList(checkers));
         this.checkers.addAll(Arrays.asList(checkers));
     }
     }
- 
-    public void addChecker( Object constant, Object goodValue ) {
+
+    public void addChecker(Object constant, Object goodValue) {
         checkers.add(new Checker(constant, goodValue));
         checkers.add(new Checker(constant, goodValue));
     }
     }
-    
-    public void setErrorType( ErrorType errorType ) {
+
+    public void setErrorType(ErrorType errorType) {
         this.errorType = errorType;
         this.errorType = errorType;
     }
     }
-    
+
     public ErrorType getErrorType() {
     public ErrorType getErrorType() {
         return errorType;
         return errorType;
     }
     }
-    
+
     @Override
     @Override
-    protected void initialize( Application app ) {
+    protected void initialize(Application app) {
     }
     }
-    
+
     @Override
     @Override
-    protected void cleanup( Application app ) {
+    protected void cleanup(Application app) {
     }
     }
-    
+
     @Override
     @Override
     protected void onEnable() {
     protected void onEnable() {
     }
     }
-    
+
     @Override
     @Override
     protected void onDisable() {
     protected void onDisable() {
     }
     }
-    
+
     @Override
     @Override
     public void postRender() {
     public void postRender() {
         // Check as late in the frame as possible.  Subclasses can check earlier
         // Check as late in the frame as possible.  Subclasses can check earlier
         // if they like.
         // if they like.
         checkValues();
         checkValues();
     }
     }
-    
+
     protected void checkValues() {
     protected void checkValues() {
-        for( Checker checker : checkers.getArray() ) {
-            switch( errorType ) {
+        for (Checker checker : checkers.getArray()) {
+            switch (errorType) {
                 default:
                 default:
                 case Assert:
                 case Assert:
                     assert checker.isValid() : checker.toString();
                     assert checker.isValid() : checker.toString();
                     break;
                     break;
                 case Exception:
                 case Exception:
-                    if( !checker.isValid() ) {
+                    if (!checker.isValid()) {
                         throw new RuntimeException("Constant has changed, " + checker.toString());
                         throw new RuntimeException("Constant has changed, " + checker.toString());
                     }
                     }
                     break;
                     break;
                 case Log:
                 case Log:
-                    if( !checker.isValid() ) {
+                    if (!checker.isValid()) {
                         log.severe("Constant has changed, " + checker.toString());
                         log.severe("Constant has changed, " + checker.toString());
                     }
                     }
                     break;
                     break;
             }
             }
         }
         }
     }
     }
- 
+
     /**
     /**
      *  Checks the specified 'constant' value against its known good
      *  Checks the specified 'constant' value against its known good
      *  value.  These should obviously be different instances for this to
      *  value.  These should obviously be different instances for this to
      *  mean anything.
      *  mean anything.
-     */   
+     */
     private static class Checker {
     private static class Checker {
         private Object constant;
         private Object constant;
         private Object goodValue;
         private Object goodValue;
-        
-        public Checker( Object constant, Object goodValue ) {
-            if( constant == null ) {
+
+        public Checker(Object constant, Object goodValue) {
+            if (constant == null) {
                 throw new IllegalArgumentException("Constant cannot be null");
                 throw new IllegalArgumentException("Constant cannot be null");
             }
             }
-            if( !constant.equals(goodValue) ) {
-                throw new IllegalArgumentException("Constant value:" + constant + " does not match value:" + goodValue);
+            if (!constant.equals(goodValue)) {
+                throw new IllegalArgumentException(
+                        "Constant value:" + constant + " does not match value:" + goodValue);
             }
             }
             this.constant = constant;
             this.constant = constant;
             this.goodValue = goodValue;
             this.goodValue = goodValue;
         }
         }
-          
+
         public boolean isValid() {
         public boolean isValid() {
             return constant.equals(goodValue);
             return constant.equals(goodValue);
         }
         }
- 
-        @Override       
+
+        @Override
         public String toString() {
         public String toString() {
             return "Constant:" + constant + ", correct value:" + goodValue + ", type:" + goodValue.getClass();
             return "Constant:" + constant + ", correct value:" + goodValue + ", type:" + goodValue.getClass();
         }
         }

+ 5 - 5
jme3-core/src/main/java/com/jme3/app/state/RootNodeAppState.java

@@ -93,7 +93,7 @@ public class RootNodeAppState extends AbstractAppState {
      * @param viewPort An existing ViewPort
      * @param viewPort An existing ViewPort
      * @param rootNode An existing root Node
      * @param rootNode An existing root Node
      */
      */
-    public RootNodeAppState( String id, ViewPort viewPort, Node rootNode ) {
+    public RootNodeAppState(String id, ViewPort viewPort, Node rootNode) {
         super(id);
         super(id);
         this.viewPort = viewPort;
         this.viewPort = viewPort;
         this.rootNode = rootNode;
         this.rootNode = rootNode;
@@ -115,12 +115,12 @@ public class RootNodeAppState extends AbstractAppState {
     public void update(float tpf) {
     public void update(float tpf) {
         super.update(tpf);
         super.update(tpf);
         rootNode.updateLogicalState(tpf);
         rootNode.updateLogicalState(tpf);
-        
+
         // FIXME: I'm 99% sure that updateGeometricState() should be
         // FIXME: I'm 99% sure that updateGeometricState() should be
         // called in render() so that it is done as late as possible.
         // called in render() so that it is done as late as possible.
-        // In complicated app state setups, cross-state chatter could 
-        // cause nodes (or their children) to be updated after this 
-        // app state's update has been called.  -pspeed:2019-09-15 
+        // In complicated app state setups, cross-state chatter could
+        // cause nodes (or their children) to be updated after this
+        // app state's update has been called.  -pspeed:2019-09-15
         rootNode.updateGeometricState();
         rootNode.updateGeometricState();
     }
     }
 
 

+ 11 - 11
jme3-core/src/main/java/com/jme3/app/state/ScreenshotAppState.java

@@ -116,7 +116,7 @@ public class ScreenshotAppState extends AbstractAppState implements ActionListen
      * default storage folder.
      * default storage folder.
      * @param filePath The screenshot file path to use. Include the separator at the end of the path.
      * @param filePath The screenshot file path to use. Include the separator at the end of the path.
      * @param shotIndex The base index for screenshots.  The first screenshot will have
      * @param shotIndex The base index for screenshots.  The first screenshot will have
-     *                  shotIndex + 1 appended, the next shotIndex + 2, and so on.
+     *     shotIndex + 1 appended, the next shotIndex + 2, and so on.
      */
      */
     public ScreenshotAppState(String filePath, long shotIndex) {
     public ScreenshotAppState(String filePath, long shotIndex) {
         this.filePath = filePath;
         this.filePath = filePath;
@@ -132,14 +132,14 @@ public class ScreenshotAppState extends AbstractAppState implements ActionListen
      * @param filePath The screenshot file path to use. Include the separator at the end of the path.
      * @param filePath The screenshot file path to use. Include the separator at the end of the path.
      * @param fileName The name of the file to save the screenshot as.
      * @param fileName The name of the file to save the screenshot as.
      * @param shotIndex The base index for screenshots.  The first screenshot will have
      * @param shotIndex The base index for screenshots.  The first screenshot will have
-     *                  shotIndex + 1 appended, the next shotIndex + 2, and so on.
+     *     shotIndex + 1 appended, the next shotIndex + 2, and so on.
      */
      */
     public ScreenshotAppState(String filePath, String fileName, long shotIndex) {
     public ScreenshotAppState(String filePath, String fileName, long shotIndex) {
         this.filePath = filePath;
         this.filePath = filePath;
         this.shotName = fileName;
         this.shotName = fileName;
         this.shotIndex = shotIndex;
         this.shotIndex = shotIndex;
     }
     }
-    
+
     /**
     /**
      * Set the file path to store the screenshot.
      * Set the file path to store the screenshot.
      * Include the separator at the end of the path.
      * Include the separator at the end of the path.
@@ -169,7 +169,7 @@ public class ScreenshotAppState extends AbstractAppState implements ActionListen
     }
     }
 
 
     /**
     /**
-     * Sets if the filename should be appended with a number representing the 
+     * Sets if the filename should be appended with a number representing the
      * current sequence.
      * current sequence.
      * @param numberedWanted If numbering is wanted.
      * @param numberedWanted If numbering is wanted.
      */
      */
@@ -234,7 +234,7 @@ public class ScreenshotAppState extends AbstractAppState implements ActionListen
 
 
     @Override
     @Override
     public void onAction(String name, boolean value, float tpf) {
     public void onAction(String name, boolean value, float tpf) {
-        if (value){
+        if (value) {
             capture = true;
             capture = true;
         }
         }
     }
     }
@@ -274,7 +274,7 @@ public class ScreenshotAppState extends AbstractAppState implements ActionListen
 
 
     @Override
     @Override
     public void postFrame(FrameBuffer out) {
     public void postFrame(FrameBuffer out) {
-        if (capture){
+        if (capture) {
             capture = false;
             capture = false;
 
 
             Camera curCamera = rm.getCurrentCamera();
             Camera curCamera = rm.getCurrentCamera();
@@ -310,7 +310,7 @@ public class ScreenshotAppState extends AbstractAppState implements ActionListen
                 writeImageFile(file);
                 writeImageFile(file);
             } catch (IOException ex) {
             } catch (IOException ex) {
                 logger.log(Level.SEVERE, "Error while saving screenshot", ex);
                 logger.log(Level.SEVERE, "Error while saving screenshot", ex);
-            }                
+            }
         }
         }
     }
     }
 
 
@@ -320,17 +320,17 @@ public class ScreenshotAppState extends AbstractAppState implements ActionListen
     }
     }
 
 
     /**
     /**
-     *  Called by postFrame() once the screen has been captured to outBuf.
-     * 
+     * Called by postFrame() once the screen has been captured to outBuf.
+     *
      * @param file the output file
      * @param file the output file
      * @throws IOException if an I/O error occurs
      * @throws IOException if an I/O error occurs
      */
      */
-    protected void writeImageFile( File file ) throws IOException {
+    protected void writeImageFile(File file) throws IOException {
         OutputStream outStream = new FileOutputStream(file);
         OutputStream outStream = new FileOutputStream(file);
         try {
         try {
             JmeSystem.writeImageFile(outStream, "png", outBuf, width, height);
             JmeSystem.writeImageFile(outStream, "png", outBuf, width, height);
         } finally {
         } finally {
             outStream.close();
             outStream.close();
         }
         }
-    } 
+    }
 }
 }

+ 11 - 10
jme3-core/src/main/java/com/jme3/asset/AssetConfig.java

@@ -54,9 +54,9 @@ import java.util.logging.Logger;
 public final class AssetConfig {
 public final class AssetConfig {
 
 
     private static final Logger logger = Logger.getLogger(AssetConfig.class.getName());
     private static final Logger logger = Logger.getLogger(AssetConfig.class.getName());
-    
+
     private AssetConfig() { }
     private AssetConfig() { }
-    
+
     private static Class acquireClass(String name) {
     private static Class acquireClass(String name) {
         try {
         try {
             return Class.forName(name);
             return Class.forName(name);
@@ -64,24 +64,24 @@ public final class AssetConfig {
             return null;
             return null;
         }
         }
     }
     }
-    
+
     @SuppressWarnings("unchecked")
     @SuppressWarnings("unchecked")
-    public static void loadText(AssetManager assetManager, URL configUrl) throws IOException{
+    public static void loadText(AssetManager assetManager, URL configUrl) throws IOException {
         InputStream in = configUrl.openStream();
         InputStream in = configUrl.openStream();
         try {
         try {
             Scanner scan = new Scanner(in, "UTF-8");
             Scanner scan = new Scanner(in, "UTF-8");
             scan.useLocale(Locale.US); // Fix commas / periods ??
             scan.useLocale(Locale.US); // Fix commas / periods ??
-            while (scan.hasNext()){
+            while (scan.hasNext()) {
                 String cmd = scan.next();
                 String cmd = scan.next();
-                if (cmd.equals("LOADER")){
+                if (cmd.equals("LOADER")) {
                     String loaderClass = scan.next();
                     String loaderClass = scan.next();
                     String colon = scan.next();
                     String colon = scan.next();
-                    if (!colon.equals(":")){
-                        throw new IOException("Expected ':', got '"+colon+"'");
+                    if (!colon.equals(":")) {
+                        throw new IOException("Expected ':', got '" + colon + "'");
                     }
                     }
                     String extensionsList = scan.nextLine();
                     String extensionsList = scan.nextLine();
                     String[] extensions = extensionsList.split(",");
                     String[] extensions = extensionsList.split(",");
-                    for (int i = 0; i < extensions.length; i++){
+                    for (int i = 0; i < extensions.length; i++) {
                         extensions[i] = extensions[i].trim();
                         extensions[i] = extensions[i].trim();
                     }
                     }
                     Class clazz = acquireClass(loaderClass);
                     Class clazz = acquireClass(loaderClass);
@@ -115,7 +115,8 @@ public final class AssetConfig {
                 }
                 }
             }
             }
         } finally {
         } finally {
-            if (in != null) in.close();
+            if (in != null)
+                in.close();
         }
         }
     }
     }
 }
 }

+ 2 - 3
jme3-core/src/main/java/com/jme3/asset/AssetInfo.java

@@ -58,7 +58,7 @@ public abstract class AssetInfo {
     }
     }
 
 
     @Override
     @Override
-    public String toString(){
+    public String toString() {
         return getClass().getName() + "[" + "key=" + key + "]";
         return getClass().getName() + "[" + "key=" + key + "]";
     }
     }
 
 
@@ -68,9 +68,8 @@ public abstract class AssetInfo {
      * <p>
      * <p>
      * Each invocation of this method should return a new stream to the
      * Each invocation of this method should return a new stream to the
      * asset data, starting at the beginning of the file.
      * asset data, starting at the beginning of the file.
-     * 
+     *
      * @return The asset data.
      * @return The asset data.
      */
      */
     public abstract InputStream openStream();
     public abstract InputStream openStream();
-
 }
 }

+ 20 - 20
jme3-core/src/main/java/com/jme3/asset/AssetKey.java

@@ -41,7 +41,7 @@ import java.util.logging.Logger;
 
 
 /**
 /**
  * <code>AssetKey</code> is a key that is used to
  * <code>AssetKey</code> is a key that is used to
- * look up a resource from a cache. 
+ * look up a resource from a cache.
  * This class should be immutable.
  * This class should be immutable.
  */
  */
 public class AssetKey<T> implements Savable, Cloneable {
 public class AssetKey<T> implements Savable, Cloneable {
@@ -49,13 +49,13 @@ public class AssetKey<T> implements Savable, Cloneable {
     protected String name;
     protected String name;
     protected transient String folder;
     protected transient String folder;
     protected transient String extension;
     protected transient String extension;
-    
-    public AssetKey(String name){
+
+    public AssetKey(String name) {
         this.name = reducePath(name);
         this.name = reducePath(name);
         this.extension = getExtension(this.name);
         this.extension = getExtension(this.name);
     }
     }
 
 
-    public AssetKey(){
+    public AssetKey() {
     }
     }
 
 
     @Override
     @Override
@@ -67,7 +67,7 @@ public class AssetKey<T> implements Savable, Cloneable {
             throw new AssertionError();
             throw new AssertionError();
         }
         }
     }
     }
-    
+
     protected static String getExtension(String name) {
     protected static String getExtension(String name) {
         int idx = name.lastIndexOf('.');
         int idx = name.lastIndexOf('.');
         //workaround for filenames ending with xml and another dot ending before that (my.mesh.xml)
         //workaround for filenames ending with xml and another dot ending before that (my.mesh.xml)
@@ -110,13 +110,13 @@ public class AssetKey<T> implements Savable, Cloneable {
 
 
     /**
     /**
      * @return The folder in which the asset is located in.
      * @return The folder in which the asset is located in.
-     * E.g. if the {@link #getName() name} is "Models/MyModel/MyModel.j3o" 
+     * E.g. if the {@link #getName() name} is "Models/MyModel/MyModel.j3o"
      * then "Models/MyModel/" is returned.
      * then "Models/MyModel/" is returned.
      */
      */
-    public String getFolder(){
+    public String getFolder() {
         if (folder == null)
         if (folder == null)
             folder = getFolder(name);
             folder = getFolder(name);
-        
+
         return folder;
         return folder;
     }
     }
 
 
@@ -125,18 +125,18 @@ public class AssetKey<T> implements Savable, Cloneable {
      * if caching is to be disabled. By default, the
      * if caching is to be disabled. By default, the
      * {@link SimpleAssetCache} is returned.
      * {@link SimpleAssetCache} is returned.
      */
      */
-    public Class<? extends AssetCache> getCacheType(){
+    public Class<? extends AssetCache> getCacheType() {
         return SimpleAssetCache.class;
         return SimpleAssetCache.class;
     }
     }
-    
+
     /**
     /**
      * @return The preferred processor type for this asset type. Specify "null"
      * @return The preferred processor type for this asset type. Specify "null"
      * if no processing is required.
      * if no processing is required.
      */
      */
-    public Class<? extends AssetProcessor> getProcessorType(){
+    public Class<? extends AssetProcessor> getProcessorType() {
         return null;
         return null;
     }
     }
-    
+
     /**
     /**
      * Removes all relative elements of a path (A/B/../C.png and A/./C.png).
      * Removes all relative elements of a path (A/B/../C.png and A/./C.png).
      * @param path The path containing relative elements
      * @param path The path containing relative elements
@@ -157,7 +157,8 @@ public class AssetKey<T> implements Savable, Cloneable {
                     list.removeLast();
                     list.removeLast();
                 } else {
                 } else {
                     list.add("..");
                     list.add("..");
-                    Logger.getLogger(AssetKey.class.getName()).log(Level.SEVERE, "Asset path \"{0}\" is outside the asset manager root", path);
+                    Logger.getLogger(AssetKey.class.getName())
+                            .log(Level.SEVERE, "Asset path \"{0}\" is outside the asset manager root", path);
                 }
                 }
             } else {
             } else {
                 list.add(string);
                 list.add(string);
@@ -173,22 +174,22 @@ public class AssetKey<T> implements Savable, Cloneable {
         }
         }
         return builder.toString();
         return builder.toString();
     }
     }
-    
+
     @Override
     @Override
-    public boolean equals(Object other){
-        if (!(other instanceof AssetKey)){
+    public boolean equals(Object other) {
+        if (!(other instanceof AssetKey)) {
             return false;
             return false;
         }
         }
-        return name.equals(((AssetKey)other).name);
+        return name.equals(((AssetKey) other).name);
     }
     }
 
 
     @Override
     @Override
-    public int hashCode(){
+    public int hashCode() {
         return name.hashCode();
         return name.hashCode();
     }
     }
 
 
     @Override
     @Override
-    public String toString(){
+    public String toString() {
         return name;
         return name;
     }
     }
 
 
@@ -204,5 +205,4 @@ public class AssetKey<T> implements Savable, Cloneable {
         name = reducePath(ic.readString("name", null));
         name = reducePath(ic.readString("name", null));
         extension = getExtension(name);
         extension = getExtension(name);
     }
     }
-
 }
 }

+ 3 - 2
jme3-core/src/main/java/com/jme3/asset/AssetLoadException.java

@@ -39,10 +39,11 @@ package com.jme3.asset;
  * @author Kirill Vainer
  * @author Kirill Vainer
  */
  */
 public class AssetLoadException extends RuntimeException {
 public class AssetLoadException extends RuntimeException {
-    public AssetLoadException(String message){
+    public AssetLoadException(String message) {
         super(message);
         super(message);
     }
     }
-    public AssetLoadException(String message, Throwable cause){
+
+    public AssetLoadException(String message, Throwable cause) {
         super(message, cause);
         super(message, cause);
     }
     }
 }
 }

+ 3 - 2
jme3-core/src/main/java/com/jme3/asset/AssetNotFoundException.java

@@ -39,10 +39,11 @@ package com.jme3.asset;
  * @author Kirill Vainer
  * @author Kirill Vainer
  */
  */
 public class AssetNotFoundException extends RuntimeException {
 public class AssetNotFoundException extends RuntimeException {
-    public AssetNotFoundException(String message){
+    public AssetNotFoundException(String message) {
         super(message);
         super(message);
     }
     }
-    public AssetNotFoundException(String message, Exception ex){
+
+    public AssetNotFoundException(String message, Exception ex) {
         super(message, ex);
         super(message, ex);
     }
     }
 }
 }

+ 85 - 87
jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java

@@ -67,27 +67,27 @@ public class DesktopAssetManager implements AssetManager {
 
 
     private static final Logger logger = Logger.getLogger(AssetManager.class.getName());
     private static final Logger logger = Logger.getLogger(AssetManager.class.getName());
     private ShaderGenerator shaderGenerator;
     private ShaderGenerator shaderGenerator;
-    
+
     private final ImplHandler handler = new ImplHandler(this);
     private final ImplHandler handler = new ImplHandler(this);
 
 
-    final private CopyOnWriteArrayList<AssetEventListener> eventListeners = 
+    final private CopyOnWriteArrayList<AssetEventListener> eventListeners =
             new CopyOnWriteArrayList<>();
             new CopyOnWriteArrayList<>();
-    
+
     final private List<ClassLoader> classLoaders =
     final private List<ClassLoader> classLoaders =
             Collections.synchronizedList(new ArrayList<>());
             Collections.synchronizedList(new ArrayList<>());
 
 
-    public DesktopAssetManager(){
+    public DesktopAssetManager() {
         this(null);
         this(null);
     }
     }
-    
-    public DesktopAssetManager(boolean usePlatformConfig){
+
+    public DesktopAssetManager(boolean usePlatformConfig) {
         this(usePlatformConfig ? JmeSystem.getPlatformAssetConfigURL() : null);
         this(usePlatformConfig ? JmeSystem.getPlatformAssetConfigURL() : null);
     }
     }
 
 
-    public DesktopAssetManager(URL configFile){
-        if (configFile != null){
+    public DesktopAssetManager(URL configFile) {
+        if (configFile != null) {
             loadConfigFile(configFile);
             loadConfigFile(configFile);
-        }        
+        }
         logger.fine("DesktopAssetManager created.");
         logger.fine("DesktopAssetManager created.");
     }
     }
 
 
@@ -98,22 +98,22 @@ public class DesktopAssetManager implements AssetManager {
             logger.log(Level.SEVERE, "Failed to load asset config", ex);
             logger.log(Level.SEVERE, "Failed to load asset config", ex);
         }
         }
     }
     }
-    
+
     @Override
     @Override
     public void addClassLoader(ClassLoader loader) {
     public void addClassLoader(ClassLoader loader) {
         classLoaders.add(loader);
         classLoaders.add(loader);
     }
     }
-    
+
     @Override
     @Override
     public void removeClassLoader(ClassLoader loader) {
     public void removeClassLoader(ClassLoader loader) {
         classLoaders.remove(loader);
         classLoaders.remove(loader);
     }
     }
 
 
     @Override
     @Override
-    public List<ClassLoader> getClassLoaders(){
+    public List<ClassLoader> getClassLoaders() {
         return Collections.unmodifiableList(classLoaders);
         return Collections.unmodifiableList(classLoaders);
     }
     }
-    
+
     @Override
     @Override
     public void addAssetEventListener(AssetEventListener listener) {
     public void addAssetEventListener(AssetEventListener listener) {
         eventListeners.add(listener);
         eventListeners.add(listener);
@@ -128,85 +128,85 @@ public class DesktopAssetManager implements AssetManager {
     public void clearAssetEventListeners() {
     public void clearAssetEventListeners() {
         eventListeners.clear();
         eventListeners.clear();
     }
     }
-    
-    public void setAssetEventListener(AssetEventListener listener){
+
+    public void setAssetEventListener(AssetEventListener listener) {
         eventListeners.clear();
         eventListeners.clear();
         eventListeners.add(listener);
         eventListeners.add(listener);
     }
     }
 
 
     @Override
     @Override
-    public void registerLoader(Class<? extends AssetLoader> loader, String ... extensions){
+    public void registerLoader(Class<? extends AssetLoader> loader, String ... extensions) {
         handler.addLoader(loader, extensions);
         handler.addLoader(loader, extensions);
-        if (logger.isLoggable(Level.FINER)){
+        if (logger.isLoggable(Level.FINER)) {
             logger.log(Level.FINER, "Registered loader: {0} for extensions {1}",
             logger.log(Level.FINER, "Registered loader: {0} for extensions {1}",
-              new Object[]{loader.getSimpleName(), Arrays.toString(extensions)});
+                    new Object[]{loader.getSimpleName(), Arrays.toString(extensions)});
         }
         }
     }
     }
 
 
     @SuppressWarnings("unchecked")
     @SuppressWarnings("unchecked")
-    public void registerLoader(String clsName, String ... extensions){
+    public void registerLoader(String clsName, String ... extensions) {
         Class<? extends AssetLoader> clazz = null;
         Class<? extends AssetLoader> clazz = null;
-        try{
+        try {
             clazz = (Class<? extends AssetLoader>) Class.forName(clsName);
             clazz = (Class<? extends AssetLoader>) Class.forName(clsName);
         } catch (ClassNotFoundException | NoClassDefFoundError ex) {
         } catch (ClassNotFoundException | NoClassDefFoundError ex) {
-            logger.log(Level.WARNING, "Failed to find loader: "+clsName, ex);
+            logger.log(Level.WARNING, "Failed to find loader: " + clsName, ex);
         }
         }
-        if (clazz != null){
+        if (clazz != null) {
             registerLoader(clazz, extensions);
             registerLoader(clazz, extensions);
         }
         }
     }
     }
-    
+
     @Override
     @Override
     public void unregisterLoader(Class<? extends AssetLoader> loaderClass) {
     public void unregisterLoader(Class<? extends AssetLoader> loaderClass) {
         handler.removeLoader(loaderClass);
         handler.removeLoader(loaderClass);
-        if (logger.isLoggable(Level.FINER)){
+        if (logger.isLoggable(Level.FINER)) {
             logger.log(Level.FINER, "Unregistered loader: {0}",
             logger.log(Level.FINER, "Unregistered loader: {0}",
                     loaderClass.getSimpleName());
                     loaderClass.getSimpleName());
         }
         }
     }
     }
 
 
     @Override
     @Override
-    public void registerLocator(String rootPath, Class<? extends AssetLocator> locatorClass){
+    public void registerLocator(String rootPath, Class<? extends AssetLocator> locatorClass) {
         handler.addLocator(locatorClass, rootPath);
         handler.addLocator(locatorClass, rootPath);
-        if (logger.isLoggable(Level.FINER)){
+        if (logger.isLoggable(Level.FINER)) {
             logger.log(Level.FINER, "Registered locator: {0}",
             logger.log(Level.FINER, "Registered locator: {0}",
                     locatorClass.getSimpleName());
                     locatorClass.getSimpleName());
         }
         }
     }
     }
 
 
     @SuppressWarnings("unchecked")
     @SuppressWarnings("unchecked")
-    public void registerLocator(String rootPath, String clsName){
+    public void registerLocator(String rootPath, String clsName) {
         Class<? extends AssetLocator> clazz = null;
         Class<? extends AssetLocator> clazz = null;
-        try{
+        try {
             clazz = (Class<? extends AssetLocator>) Class.forName(clsName);
             clazz = (Class<? extends AssetLocator>) Class.forName(clsName);
-        }catch (ClassNotFoundException ex){
-            logger.log(Level.WARNING, "Failed to find locator: "+clsName, ex);
-        }catch (NoClassDefFoundError ex){
-            logger.log(Level.WARNING, "Failed to find loader: "+clsName, ex);
+        } catch (ClassNotFoundException ex) {
+            logger.log(Level.WARNING, "Failed to find locator: " + clsName, ex);
+        } catch (NoClassDefFoundError ex) {
+            logger.log(Level.WARNING, "Failed to find loader: " + clsName, ex);
         }
         }
-        if (clazz != null){
+        if (clazz != null) {
             registerLocator(rootPath, clazz);
             registerLocator(rootPath, clazz);
         }
         }
     }
     }
-    
+
     @Override
     @Override
-    public void unregisterLocator(String rootPath, Class<? extends AssetLocator> clazz){
+    public void unregisterLocator(String rootPath, Class<? extends AssetLocator> clazz) {
         handler.removeLocator(clazz, rootPath);
         handler.removeLocator(clazz, rootPath);
-        if (logger.isLoggable(Level.FINER)){
+        if (logger.isLoggable(Level.FINER)) {
             logger.log(Level.FINER, "Unregistered locator: {0}",
             logger.log(Level.FINER, "Unregistered locator: {0}",
                     clazz.getSimpleName());
                     clazz.getSimpleName());
         }
         }
     }
     }
-    
+
     @Override
     @Override
-    public AssetInfo locateAsset(AssetKey<?> key){
+    public AssetInfo locateAsset(AssetKey<?> key) {
         AssetInfo info = handler.tryLocate(key);
         AssetInfo info = handler.tryLocate(key);
-        if (info == null){
+        if (info == null) {
             logger.log(Level.WARNING, "Cannot locate resource: {0}", key);
             logger.log(Level.WARNING, "Cannot locate resource: {0}", key);
         }
         }
         return info;
         return info;
     }
     }
-    
+
     @Override
     @Override
     public <T> T getFromCache(AssetKey<T> key) {
     public <T> T getFromCache(AssetKey<T> key) {
         AssetCache cache = handler.getCache(key.getCacheType());
         AssetCache cache = handler.getCache(key.getCacheType());
@@ -221,7 +221,7 @@ public class DesktopAssetManager implements AssetManager {
             throw new IllegalArgumentException("Key " + key + " specifies no cache.");
             throw new IllegalArgumentException("Key " + key + " specifies no cache.");
         }
         }
     }
     }
-    
+
     @Override
     @Override
     public <T> void addToCache(AssetKey<T> key, T asset) {
     public <T> void addToCache(AssetKey<T> key, T asset) {
         AssetCache cache = handler.getCache(key.getCacheType());
         AssetCache cache = handler.getCache(key.getCacheType());
@@ -232,7 +232,7 @@ public class DesktopAssetManager implements AssetManager {
             throw new IllegalArgumentException("Key " + key + " specifies no cache.");
             throw new IllegalArgumentException("Key " + key + " specifies no cache.");
         }
         }
     }
     }
-    
+
     @Override
     @Override
     public <T> boolean deleteFromCache(AssetKey<T> key) {
     public <T> boolean deleteFromCache(AssetKey<T> key) {
         AssetCache cache = handler.getCache(key.getCacheType());
         AssetCache cache = handler.getCache(key.getCacheType());
@@ -242,11 +242,11 @@ public class DesktopAssetManager implements AssetManager {
             throw new IllegalArgumentException("Key " + key + " specifies no cache.");
             throw new IllegalArgumentException("Key " + key + " specifies no cache.");
         }
         }
     }
     }
-    
+
     @Override
     @Override
-    public void clearCache(){
+    public void clearCache() {
         handler.clearCache();
         handler.clearCache();
-        if (logger.isLoggable(Level.FINER)){
+        if (logger.isLoggable(Level.FINER)) {
             logger.log(Level.FINER, "All asset caches cleared.");
             logger.log(Level.FINER, "All asset caches cleared.");
         }
         }
     }
     }
@@ -259,7 +259,7 @@ public class DesktopAssetManager implements AssetManager {
      * @param proc AssetProcessor to use, or null to disable processing
      * @param proc AssetProcessor to use, or null to disable processing
      * @param cache The cache to store the asset in, or null to disable caching
      * @param cache The cache to store the asset in, or null to disable caching
      * @return The loaded asset
      * @return The loaded asset
-     * 
+     *
      * @throws AssetLoadException If failed to load asset due to exception or
      * @throws AssetLoadException If failed to load asset due to exception or
      * other error.
      * other error.
      */
      */
@@ -301,22 +301,22 @@ public class DesktopAssetManager implements AssetManager {
             return (T) obj;
             return (T) obj;
         }
         }
     }
     }
-    
+
     /**
     /**
      * Clones the asset using the given processor and registers the clone
      * Clones the asset using the given processor and registers the clone
      * with the cache.
      * with the cache.
-     * 
+     *
      * @param <T> The asset type
      * @param <T> The asset type
      * @param key The asset key
      * @param key The asset key
-     * @param obj The asset to clone / register, must implement 
-     * {@link CloneableSmartAsset}.
+     * @param obj The asset to clone / register, must implement
+     *     {@link CloneableSmartAsset}.
      * @param proc The processor which will generate the clone, cannot be null
      * @param proc The processor which will generate the clone, cannot be null
      * @param cache The cache to register the clone with, cannot be null.
      * @param cache The cache to register the clone with, cannot be null.
      * @return The cloned asset, cannot be the same as the given asset since
      * @return The cloned asset, cannot be the same as the given asset since
-     * it is a clone.
-     * 
-     * @throws IllegalStateException If asset does not implement 
-     * {@link CloneableSmartAsset}, if the cache is null, or if the 
+     *     it is a clone.
+     *
+     * @throws IllegalStateException If asset does not implement
+     * {@link CloneableSmartAsset}, if the cache is null, or if the
      * processor did not clone the asset.
      * processor did not clone the asset.
      */
      */
     @SuppressWarnings("unchecked")
     @SuppressWarnings("unchecked")
@@ -339,118 +339,118 @@ public class DesktopAssetManager implements AssetManager {
             return clone;
             return clone;
         }
         }
     }
     }
-    
+
     @Override
     @Override
     public <T> T loadAssetFromStream(AssetKey<T> key, InputStream inputStream) {
     public <T> T loadAssetFromStream(AssetKey<T> key, InputStream inputStream) {
         if (key == null) {
         if (key == null) {
             throw new IllegalArgumentException("key cannot be null");
             throw new IllegalArgumentException("key cannot be null");
         }
         }
-        
-        for (AssetEventListener listener : eventListeners){
+
+        for (AssetEventListener listener : eventListeners) {
             listener.assetRequested(key);
             listener.assetRequested(key);
         }
         }
-        
+
         AssetProcessor proc = handler.getProcessor(key.getProcessorType());
         AssetProcessor proc = handler.getProcessor(key.getProcessorType());
         StreamAssetInfo info = new StreamAssetInfo(this, key, inputStream);
         StreamAssetInfo info = new StreamAssetInfo(this, key, inputStream);
         return loadLocatedAsset(key, info, proc, null);
         return loadLocatedAsset(key, info, proc, null);
     }
     }
-    
+
     @Override
     @Override
     @SuppressWarnings("unchecked")
     @SuppressWarnings("unchecked")
-    public <T> T loadAsset(AssetKey<T> key){
+    public <T> T loadAsset(AssetKey<T> key) {
         if (key == null)
         if (key == null)
             throw new IllegalArgumentException("key cannot be null");
             throw new IllegalArgumentException("key cannot be null");
-        
-        for (AssetEventListener listener : eventListeners){
+
+        for (AssetEventListener listener : eventListeners) {
             listener.assetRequested(key);
             listener.assetRequested(key);
         }
         }
-        
+
         AssetCache cache = handler.getCache(key.getCacheType());
         AssetCache cache = handler.getCache(key.getCacheType());
         AssetProcessor proc = handler.getProcessor(key.getProcessorType());
         AssetProcessor proc = handler.getProcessor(key.getProcessorType());
-        
+
         Object obj = cache != null ? cache.getFromCache(key) : null;
         Object obj = cache != null ? cache.getFromCache(key) : null;
-        if (obj == null){
+        if (obj == null) {
             // Asset not in cache, load it from file system.
             // Asset not in cache, load it from file system.
             AssetInfo info = handler.tryLocate(key);
             AssetInfo info = handler.tryLocate(key);
-            if (info == null){
-                if (handler.getParentKey() != null){
+            if (info == null) {
+                if (handler.getParentKey() != null) {
                     // Inform event listener that an asset has failed to load.
                     // Inform event listener that an asset has failed to load.
                     // If the parent AssetLoader chooses not to propagate
                     // If the parent AssetLoader chooses not to propagate
                     // the exception, this is the only means of finding
                     // the exception, this is the only means of finding
                     // that something went wrong.
                     // that something went wrong.
-                    for (AssetEventListener listener : eventListeners){
+                    for (AssetEventListener listener : eventListeners) {
                         listener.assetDependencyNotFound(handler.getParentKey(), key);
                         listener.assetDependencyNotFound(handler.getParentKey(), key);
                     }
                     }
                 }
                 }
                 throw new AssetNotFoundException(key.toString());
                 throw new AssetNotFoundException(key.toString());
             }
             }
-            
+
             obj = loadLocatedAsset(key, info, proc, cache);
             obj = loadLocatedAsset(key, info, proc, cache);
         }
         }
 
 
         T clone = (T) obj;
         T clone = (T) obj;
-        
+
         if (obj instanceof CloneableSmartAsset) {
         if (obj instanceof CloneableSmartAsset) {
             clone = registerAndCloneSmartAsset(key, clone, proc, cache);
             clone = registerAndCloneSmartAsset(key, clone, proc, cache);
         }
         }
-        
+
         return clone;
         return clone;
     }
     }
 
 
     @Override
     @Override
-    public Object loadAsset(String name){
+    public Object loadAsset(String name) {
         return loadAsset(new AssetKey<>(name));
         return loadAsset(new AssetKey<>(name));
     }
     }
 
 
     @Override
     @Override
-    public Texture loadTexture(TextureKey key){                
+    public Texture loadTexture(TextureKey key) {
         return loadAsset(key);
         return loadAsset(key);
     }
     }
 
 
     @Override
     @Override
-    public Material loadMaterial(String name){
+    public Material loadMaterial(String name) {
         return loadAsset(new MaterialKey(name));
         return loadAsset(new MaterialKey(name));
     }
     }
 
 
     @Override
     @Override
-    public Texture loadTexture(String name){
+    public Texture loadTexture(String name) {
         TextureKey key = new TextureKey(name, true);
         TextureKey key = new TextureKey(name, true);
         key.setGenerateMips(true);
         key.setGenerateMips(true);
         return loadTexture(key);
         return loadTexture(key);
     }
     }
 
 
     @Override
     @Override
-    public AudioData loadAudio(AudioKey key){
+    public AudioData loadAudio(AudioKey key) {
         return loadAsset(key);
         return loadAsset(key);
     }
     }
 
 
     @Override
     @Override
-    public AudioData loadAudio(String name){
+    public AudioData loadAudio(String name) {
         return loadAudio(new AudioKey(name, false));
         return loadAudio(new AudioKey(name, false));
     }
     }
 
 
     @Override
     @Override
-    public BitmapFont loadFont(String name){
+    public BitmapFont loadFont(String name) {
         return loadAsset(new AssetKey<BitmapFont>(name));
         return loadAsset(new AssetKey<BitmapFont>(name));
     }
     }
 
 
     @Override
     @Override
-    public Spatial loadModel(ModelKey key){
+    public Spatial loadModel(ModelKey key) {
         return loadAsset(key);
         return loadAsset(key);
     }
     }
 
 
     @Override
     @Override
-    public Spatial loadModel(String name){
+    public Spatial loadModel(String name) {
         return loadModel(new ModelKey(name));
         return loadModel(new ModelKey(name));
     }
     }
 
 
     @Override
     @Override
-    public FilterPostProcessor loadFilter(FilterKey key){
+    public FilterPostProcessor loadFilter(FilterKey key) {
         return loadAsset(key);
         return loadAsset(key);
     }
     }
 
 
     @Override
     @Override
-    public FilterPostProcessor loadFilter(String name){
+    public FilterPostProcessor loadFilter(String name) {
         return loadFilter(new FilterKey(name));
         return loadFilter(new FilterKey(name));
     }
     }
 
 
@@ -460,11 +460,11 @@ public class DesktopAssetManager implements AssetManager {
     @Override
     @Override
     public ShaderGenerator getShaderGenerator(EnumSet<Caps> caps) {
     public ShaderGenerator getShaderGenerator(EnumSet<Caps> caps) {
         if (shaderGenerator == null) {
         if (shaderGenerator == null) {
-            if(caps.contains(Caps.OpenGLES30) && caps.contains(Caps.GLSL300)){
+            if (caps.contains(Caps.OpenGLES30) && caps.contains(Caps.GLSL300)) {
                 shaderGenerator = new Glsl300ShaderGenerator(this);
                 shaderGenerator = new Glsl300ShaderGenerator(this);
-            }else if(caps.contains(Caps.GLSL150)) {
+            } else if (caps.contains(Caps.GLSL150)) {
                 shaderGenerator = new Glsl150ShaderGenerator(this);
                 shaderGenerator = new Glsl150ShaderGenerator(this);
-            }else{
+            } else {
                 shaderGenerator = new Glsl100ShaderGenerator(this);
                 shaderGenerator = new Glsl100ShaderGenerator(this);
             }
             }
         }
         }
@@ -478,6 +478,4 @@ public class DesktopAssetManager implements AssetManager {
     public void setShaderGenerator(ShaderGenerator shaderGenerator) {
     public void setShaderGenerator(ShaderGenerator shaderGenerator) {
         this.shaderGenerator = shaderGenerator;
         this.shaderGenerator = shaderGenerator;
     }
     }
-
-    
 }
 }

+ 2 - 2
jme3-core/src/main/java/com/jme3/asset/FilterKey.java

@@ -36,7 +36,7 @@ import com.jme3.post.FilterPostProcessor;
 
 
 /**
 /**
  * Used to load FilterPostProcessors which are not cached.
  * Used to load FilterPostProcessors which are not cached.
- * 
+ *
  * @author Andrew Wason
  * @author Andrew Wason
  */
  */
 public class FilterKey extends AssetKey<FilterPostProcessor> {
 public class FilterKey extends AssetKey<FilterPostProcessor> {
@@ -50,7 +50,7 @@ public class FilterKey extends AssetKey<FilterPostProcessor> {
     }
     }
 
 
     @Override
     @Override
-    public Class<? extends AssetCache> getCacheType(){
+    public Class<? extends AssetCache> getCacheType() {
         // Do not cache filter processors
         // Do not cache filter processors
         return null;
         return null;
     }
     }

+ 77 - 77
jme3-core/src/main/java/com/jme3/asset/ImplHandler.java

@@ -53,26 +53,26 @@ final class ImplHandler {
     private static final Logger logger = Logger.getLogger(ImplHandler.class.getName());
     private static final Logger logger = Logger.getLogger(ImplHandler.class.getName());
 
 
     private final AssetManager assetManager;
     private final AssetManager assetManager;
-    
-    private final ThreadLocal<AssetKey> parentAssetKey 
+
+    private final ThreadLocal<AssetKey> parentAssetKey
             = new ThreadLocal<>();
             = new ThreadLocal<>();
-    
+
     private final CopyOnWriteArrayList<ImplThreadLocal<AssetLocator>> locatorsList =
     private final CopyOnWriteArrayList<ImplThreadLocal<AssetLocator>> locatorsList =
-                new CopyOnWriteArrayList<>();
-    
-    private final HashMap<Class<?>, ImplThreadLocal<AssetLoader>> classToLoaderMap = 
-                new HashMap<>();
+            new CopyOnWriteArrayList<>();
+
+    private final HashMap<Class<?>, ImplThreadLocal<AssetLoader>> classToLoaderMap =
+            new HashMap<>();
 
 
     private final ConcurrentHashMap<String, ImplThreadLocal<AssetLoader>> extensionToLoaderMap =
     private final ConcurrentHashMap<String, ImplThreadLocal<AssetLoader>> extensionToLoaderMap =
-                new ConcurrentHashMap<>();
-    
+            new ConcurrentHashMap<>();
+
     private final ConcurrentHashMap<Class<? extends AssetProcessor>, AssetProcessor> classToProcMap =
     private final ConcurrentHashMap<Class<? extends AssetProcessor>, AssetProcessor> classToProcMap =
-                new ConcurrentHashMap<>();
-    
+            new ConcurrentHashMap<>();
+
     private final ConcurrentHashMap<Class<? extends AssetCache>, AssetCache> classToCacheMap =
     private final ConcurrentHashMap<Class<? extends AssetCache>, AssetCache> classToCacheMap =
-                new ConcurrentHashMap<>();
+            new ConcurrentHashMap<>();
 
 
-    public ImplHandler(AssetManager assetManager){
+    public ImplHandler(AssetManager assetManager) {
         this.assetManager = assetManager;
         this.assetManager = assetManager;
     }
     }
 
 
@@ -82,48 +82,48 @@ final class ImplHandler {
         private final String path;
         private final String path;
         private final String[] extensions;
         private final String[] extensions;
 
 
-        public ImplThreadLocal(Class<T> type, String[] extensions){
+        public ImplThreadLocal(Class<T> type, String[] extensions) {
             this.type = type;
             this.type = type;
             this.extensions = extensions.clone();
             this.extensions = extensions.clone();
             this.path = null;
             this.path = null;
         }
         }
 
 
-        public ImplThreadLocal(Class<T> type, String path){
+        public ImplThreadLocal(Class<T> type, String path) {
             this.type = type;
             this.type = type;
             this.path = path;
             this.path = path;
             this.extensions = null;
             this.extensions = null;
         }
         }
 
 
-        public ImplThreadLocal(Class<T> type){
+        public ImplThreadLocal(Class<T> type) {
             this.type = type;
             this.type = type;
             this.path = null;
             this.path = null;
             this.extensions = null;
             this.extensions = null;
         }
         }
-        
+
         public String getPath() {
         public String getPath() {
             return path;
             return path;
         }
         }
-        
-        public String[] getExtensions(){
+
+        public String[] getExtensions() {
             return extensions;
             return extensions;
         }
         }
-        
-        public Class<?> getTypeClass(){
+
+        public Class<?> getTypeClass() {
             return type;
             return type;
         }
         }
 
 
         @Override
         @Override
-        protected T initialValue(){
+        protected T initialValue() {
             try {
             try {
                 T obj = type.newInstance();
                 T obj = type.newInstance();
                 if (path != null) {
                 if (path != null) {
-                    ((AssetLocator)obj).setRootPath(path);
+                    ((AssetLocator) obj).setRootPath(path);
                 }
                 }
                 return obj;
                 return obj;
             } catch (InstantiationException | IllegalAccessException ex) {
             } catch (InstantiationException | IllegalAccessException ex) {
-                logger.log(Level.SEVERE,"Cannot create locator of type {0}, does"
-                            + " the class have an empty and publicly accessible"+
-                              " constructor?", type.getName());
+                logger.log(Level.SEVERE, "Cannot create locator of type {0}, does"
+                        + " the class have an empty and publicly accessible"
+                        + " constructor?", type.getName());
                 logger.throwing(type.getName(), "<init>", ex);
                 logger.throwing(type.getName(), "<init>", ex);
             }
             }
             return null;
             return null;
@@ -135,51 +135,51 @@ final class ImplHandler {
      * that have failed to load. When set, the {@link DesktopAssetManager}
      * that have failed to load. When set, the {@link DesktopAssetManager}
      * gets a hint that it should suppress {@link AssetNotFoundException}s
      * gets a hint that it should suppress {@link AssetNotFoundException}s
      * and instead call the listener callback (if set).
      * and instead call the listener callback (if set).
-     * 
-     * @param parentKey The parent key  
+     *
+     * @param parentKey The parent key
      */
      */
-    public void establishParentKey(AssetKey parentKey){
-        if (parentAssetKey.get() == null){
+    public void establishParentKey(AssetKey parentKey) {
+        if (parentAssetKey.get() == null) {
             parentAssetKey.set(parentKey);
             parentAssetKey.set(parentKey);
         }
         }
     }
     }
-    
-    public void releaseParentKey(AssetKey parentKey){
-        if (parentAssetKey.get() == parentKey){
+
+    public void releaseParentKey(AssetKey parentKey) {
+        if (parentAssetKey.get() == parentKey) {
             parentAssetKey.set(null);
             parentAssetKey.set(null);
         }
         }
     }
     }
-    
-    public AssetKey getParentKey(){
+
+    public AssetKey getParentKey() {
         return parentAssetKey.get();
         return parentAssetKey.get();
     }
     }
-    
+
     /**
     /**
      * Attempts to locate the given resource name.
      * Attempts to locate the given resource name.
      * @param key The full name of the resource.
      * @param key The full name of the resource.
      * @return The AssetInfo containing resource information required for
      * @return The AssetInfo containing resource information required for
      * access, or null if not found.
      * access, or null if not found.
      */
      */
-    public AssetInfo tryLocate(AssetKey key){
-        if (locatorsList.isEmpty()){
-            logger.warning("There are no locators currently"+
-                            " registered. Use AssetManager."+
-                            "registerLocator() to register a"+
-                            " locator.");
+    public AssetInfo tryLocate(AssetKey key) {
+        if (locatorsList.isEmpty()) {
+            logger.warning("There are no locators currently"
+                    + " registered. Use AssetManager."
+                    + "registerLocator() to register a"
+                    + " locator.");
             return null;
             return null;
         }
         }
-        
-        for (ImplThreadLocal<AssetLocator> local : locatorsList){
+
+        for (ImplThreadLocal<AssetLocator> local : locatorsList) {
             AssetInfo info = local.get().locate(assetManager, key);
             AssetInfo info = local.get().locate(assetManager, key);
             if (info != null) {
             if (info != null) {
                 return info;
                 return info;
             }
             }
         }
         }
-        
+
         return null;
         return null;
     }
     }
 
 
-    public int getLocatorCount(){
+    public int getLocatorCount() {
         return locatorsList.size();
         return locatorsList.size();
     }
     }
 
 
@@ -188,32 +188,32 @@ final class ImplHandler {
      * of the current thread.
      * of the current thread.
      * @return AssetLoader registered with addLoader.
      * @return AssetLoader registered with addLoader.
      */
      */
-    public AssetLoader aquireLoader(AssetKey key){
+    public AssetLoader aquireLoader(AssetKey key) {
         // No need to synchronize() against map, its concurrent
         // No need to synchronize() against map, its concurrent
         ImplThreadLocal local = extensionToLoaderMap.get(key.getExtension());
         ImplThreadLocal local = extensionToLoaderMap.get(key.getExtension());
-        if (local == null){
-            throw new AssetLoadException("No loader registered for type \"" +
-                                         key.getExtension() + "\"");
+        if (local == null) {
+            throw new AssetLoadException("No loader registered for type \""
+                    + key.getExtension() + "\"");
 
 
         }
         }
         return (AssetLoader) local.get();
         return (AssetLoader) local.get();
     }
     }
-    
-    public void clearCache(){
+
+    public void clearCache() {
         // The iterator over the values collection is thread-safe.
         // The iterator over the values collection is thread-safe.
         synchronized (classToCacheMap) {
         synchronized (classToCacheMap) {
-            for (AssetCache cache : classToCacheMap.values()){
+            for (AssetCache cache : classToCacheMap.values()) {
                 cache.clearCache();
                 cache.clearCache();
             }
             }
         }
         }
     }
     }
-    
+
     @SuppressWarnings("unchecked")
     @SuppressWarnings("unchecked")
     public <T extends AssetCache> T getCache(Class<T> cacheClass) {
     public <T extends AssetCache> T getCache(Class<T> cacheClass) {
         if (cacheClass == null) {
         if (cacheClass == null) {
             return null;
             return null;
         }
         }
-        
+
         T cache = (T) classToCacheMap.get(cacheClass);
         T cache = (T) classToCacheMap.get(cacheClass);
         if (cache == null) {
         if (cache == null) {
             synchronized (classToCacheMap) {
             synchronized (classToCacheMap) {
@@ -234,15 +234,15 @@ final class ImplHandler {
         }
         }
         return cache;
         return cache;
     }
     }
-    
+
     @SuppressWarnings("unchecked")
     @SuppressWarnings("unchecked")
-    public <T extends AssetProcessor> T getProcessor(Class<T> procClass){
+    public <T extends AssetProcessor> T getProcessor(Class<T> procClass) {
         if (procClass == null)
         if (procClass == null)
             return null;
             return null;
-        
+
         T proc = (T) classToProcMap.get(procClass);
         T proc = (T) classToProcMap.get(procClass);
-        if (proc == null){
-            synchronized(classToProcMap){
+        if (proc == null) {
+            synchronized (classToProcMap) {
                 proc = (T) classToProcMap.get(procClass);
                 proc = (T) classToProcMap.get(procClass);
                 if (proc == null) {
                 if (proc == null) {
                     try {
                     try {
@@ -260,55 +260,55 @@ final class ImplHandler {
         }
         }
         return proc;
         return proc;
     }
     }
-    
+
     @SuppressWarnings("unchecked")
     @SuppressWarnings("unchecked")
-    public void addLoader(final Class<? extends AssetLoader> loaderType, String ... extensions){
+    public void addLoader(final Class<? extends AssetLoader> loaderType, String ... extensions) {
         // Synchronized access must be used for any ops on classToLoaderMap
         // Synchronized access must be used for any ops on classToLoaderMap
         ImplThreadLocal local = new ImplThreadLocal(loaderType, extensions);
         ImplThreadLocal local = new ImplThreadLocal(loaderType, extensions);
-        for (String extension : extensions){
+        for (String extension : extensions) {
             extension = extension.toLowerCase();
             extension = extension.toLowerCase();
-            synchronized (classToLoaderMap){
+            synchronized (classToLoaderMap) {
                 classToLoaderMap.put(loaderType, local);
                 classToLoaderMap.put(loaderType, local);
                 extensionToLoaderMap.put(extension, local);
                 extensionToLoaderMap.put(extension, local);
             }
             }
         }
         }
     }
     }
 
 
-    public void removeLoader(final Class<? extends AssetLoader> loaderType){
+    public void removeLoader(final Class<? extends AssetLoader> loaderType) {
         // Synchronized access must be used for any ops on classToLoaderMap
         // Synchronized access must be used for any ops on classToLoaderMap
         // Find the loader ImplThreadLocal for this class
         // Find the loader ImplThreadLocal for this class
-        synchronized (classToLoaderMap){
+        synchronized (classToLoaderMap) {
             // Remove it from the class->loader map
             // Remove it from the class->loader map
             ImplThreadLocal local = classToLoaderMap.remove(loaderType);
             ImplThreadLocal local = classToLoaderMap.remove(loaderType);
-            if (local == null) return;
+            if (local == null)
+                return;
             // Remove it from the extension->loader map
             // Remove it from the extension->loader map
-            for (String extension : local.getExtensions()){
+            for (String extension : local.getExtensions()) {
                 extensionToLoaderMap.remove(extension);
                 extensionToLoaderMap.remove(extension);
             }
             }
         }
         }
     }
     }
-    
+
     @SuppressWarnings("unchecked")
     @SuppressWarnings("unchecked")
-    public void addLocator(final Class<? extends AssetLocator> locatorType, String rootPath){
+    public void addLocator(final Class<? extends AssetLocator> locatorType, String rootPath) {
         locatorsList.add(new ImplThreadLocal(locatorType, rootPath));
         locatorsList.add(new ImplThreadLocal(locatorType, rootPath));
     }
     }
 
 
-    public void removeLocator(final Class<? extends AssetLocator> locatorType, String rootPath){
+    public void removeLocator(final Class<? extends AssetLocator> locatorType, String rootPath) {
         ArrayList<ImplThreadLocal<AssetLocator>> locatorsToRemove = new ArrayList<>();
         ArrayList<ImplThreadLocal<AssetLocator>> locatorsToRemove = new ArrayList<>();
         Iterator<ImplThreadLocal<AssetLocator>> it = locatorsList.iterator();
         Iterator<ImplThreadLocal<AssetLocator>> it = locatorsList.iterator();
-       
-        while (it.hasNext()){
+
+        while (it.hasNext()) {
             ImplThreadLocal<AssetLocator> locator = it.next();
             ImplThreadLocal<AssetLocator> locator = it.next();
-            if (locator.getPath().equals(rootPath) &&
-                locator.getTypeClass().equals(locatorType)){
+            if (locator.getPath().equals(rootPath)
+                    && locator.getTypeClass().equals(locatorType)) {
                 //it.remove();
                 //it.remove();
                 // copy on write list doesn't support iterator remove,
                 // copy on write list doesn't support iterator remove,
                 // must use temporary list
                 // must use temporary list
                 locatorsToRemove.add(locator);
                 locatorsToRemove.add(locator);
             }
             }
         }
         }
-        
+
         locatorsList.removeAll(locatorsToRemove);
         locatorsList.removeAll(locatorsToRemove);
     }
     }
-
 }
 }

+ 6 - 6
jme3-core/src/main/java/com/jme3/asset/ModelKey.java

@@ -39,9 +39,9 @@ import com.jme3.scene.Spatial;
  * Used to load model files, such as OBJ or Blender models.
  * Used to load model files, such as OBJ or Blender models.
  * This uses cloneable smart asset management, so that when all clones of
  * This uses cloneable smart asset management, so that when all clones of
  * this model become unreachable, the original asset is purged from the cache,
  * this model become unreachable, the original asset is purged from the cache,
- * allowing textures, materials, shaders, etc referenced by the model to 
+ * allowing textures, materials, shaders, etc referenced by the model to
  * become collected.
  * become collected.
- * 
+ *
  * @author Kirill Vainer
  * @author Kirill Vainer
  */
  */
 public class ModelKey extends AssetKey<Spatial> {
 public class ModelKey extends AssetKey<Spatial> {
@@ -53,14 +53,14 @@ public class ModelKey extends AssetKey<Spatial> {
     public ModelKey() {
     public ModelKey() {
         super();
         super();
     }
     }
-    
+
     @Override
     @Override
-    public Class<? extends AssetCache> getCacheType(){
+    public Class<? extends AssetCache> getCacheType() {
         return WeakRefCloneAssetCache.class;
         return WeakRefCloneAssetCache.class;
     }
     }
-    
+
     @Override
     @Override
-    public Class<? extends AssetProcessor> getProcessorType(){
+    public Class<? extends AssetProcessor> getProcessorType() {
         return CloneableAssetProcessor.class;
         return CloneableAssetProcessor.class;
     }
     }
 }
 }

+ 15 - 15
jme3-core/src/main/java/com/jme3/asset/TextureKey.java

@@ -44,14 +44,14 @@ import com.jme3.texture.TextureProcessor;
 import java.io.IOException;
 import java.io.IOException;
 
 
 /**
 /**
- * Used to load textures from image files such as JPG or PNG. 
+ * Used to load textures from image files such as JPG or PNG.
  * Note that texture loaders actually load the asset as an {@link Image}
  * Note that texture loaders actually load the asset as an {@link Image}
- * object, which is then converted to a {@link Texture} in the 
- * {@link TextureProcessor#postProcess(com.jme3.asset.AssetKey, java.lang.Object) }
+ * object, which is then converted to a {@link Texture} in the
+ * {@link TextureProcessor#postProcess(com.jme3.asset.AssetKey, java.lang.Object)}
  * method. Since textures are cloneable smart assets, the texture stored
  * method. Since textures are cloneable smart assets, the texture stored
  * in the cache will be collected when all clones of the texture become
  * in the cache will be collected when all clones of the texture become
  * unreachable.
  * unreachable.
- * 
+ *
  * @author Kirill Vainer
  * @author Kirill Vainer
  */
  */
 public class TextureKey extends AssetKey<Texture> {
 public class TextureKey extends AssetKey<Texture> {
@@ -96,17 +96,17 @@ public class TextureKey extends AssetKey<Texture> {
         }
         }
         return name + (flipY ? " (Flipped)" : "") + type + (generateMips ? " (Mipmapped)" : "");
         return name + (flipY ? " (Flipped)" : "") + type + (generateMips ? " (Mipmapped)" : "");
     }
     }
-    
+
     @Override
     @Override
-    public Class<? extends AssetCache> getCacheType(){
+    public Class<? extends AssetCache> getCacheType() {
         return WeakRefCloneAssetCache.class;
         return WeakRefCloneAssetCache.class;
     }
     }
 
 
     @Override
     @Override
-    public Class<? extends AssetProcessor> getProcessorType(){
+    public Class<? extends AssetProcessor> getProcessorType() {
         return TextureProcessor.class;
         return TextureProcessor.class;
     }
     }
-    
+
     public boolean isFlipY() {
     public boolean isFlipY() {
         return flipY;
         return flipY;
     }
     }
@@ -114,7 +114,7 @@ public class TextureKey extends AssetKey<Texture> {
     public void setFlipY(boolean flipY) {
     public void setFlipY(boolean flipY) {
         this.flipY = flipY;
         this.flipY = flipY;
     }
     }
-    
+
     public int getAnisotropy() {
     public int getAnisotropy() {
         return anisotropy;
         return anisotropy;
     }
     }
@@ -133,7 +133,7 @@ public class TextureKey extends AssetKey<Texture> {
 
 
     /**
     /**
      * The type of texture expected to be returned.
      * The type of texture expected to be returned.
-     * 
+     *
      * @return type of texture expected to be returned.
      * @return type of texture expected to be returned.
      */
      */
     public Type getTextureTypeHint() {
     public Type getTextureTypeHint() {
@@ -142,13 +142,13 @@ public class TextureKey extends AssetKey<Texture> {
 
 
     /**
     /**
      * Hints the loader as to which type of texture is expected.
      * Hints the loader as to which type of texture is expected.
-     * 
+     *
      * @param textureTypeHint The type of texture expected to be loaded.
      * @param textureTypeHint The type of texture expected to be loaded.
      */
      */
     public void setTextureTypeHint(Type textureTypeHint) {
     public void setTextureTypeHint(Type textureTypeHint) {
         this.textureTypeHint = textureTypeHint;
         this.textureTypeHint = textureTypeHint;
     }
     }
-    
+
     @Override
     @Override
     public boolean equals(Object obj) {
     public boolean equals(Object obj) {
         if (obj == null) {
         if (obj == null) {
@@ -186,7 +186,7 @@ public class TextureKey extends AssetKey<Texture> {
         hash = 17 * hash + (this.textureTypeHint != null ? this.textureTypeHint.hashCode() : 0);
         hash = 17 * hash + (this.textureTypeHint != null ? this.textureTypeHint.hashCode() : 0);
         return hash;
         return hash;
     }
     }
-    
+
     @Override
     @Override
     public void write(JmeExporter ex) throws IOException {
     public void write(JmeExporter ex) throws IOException {
         super.write(ex);
         super.write(ex);
@@ -195,7 +195,7 @@ public class TextureKey extends AssetKey<Texture> {
         oc.write(generateMips, "generate_mips", false);
         oc.write(generateMips, "generate_mips", false);
         oc.write(anisotropy, "anisotropy", 0);
         oc.write(anisotropy, "anisotropy", 0);
         oc.write(textureTypeHint, "tex_type", Type.TwoDimensional);
         oc.write(textureTypeHint, "tex_type", Type.TwoDimensional);
-        
+
         // Backwards compat
         // Backwards compat
         oc.write(textureTypeHint == Type.CubeMap, "as_cubemap", false);
         oc.write(textureTypeHint == Type.CubeMap, "as_cubemap", false);
     }
     }
@@ -208,7 +208,7 @@ public class TextureKey extends AssetKey<Texture> {
         generateMips = ic.readBoolean("generate_mips", false);
         generateMips = ic.readBoolean("generate_mips", false);
         anisotropy = ic.readInt("anisotropy", 0);
         anisotropy = ic.readInt("anisotropy", 0);
         boolean asCube = ic.readBoolean("as_cubemap", false);
         boolean asCube = ic.readBoolean("as_cubemap", false);
-        
+
         if (asCube) {
         if (asCube) {
             // Backwards compat
             // Backwards compat
             textureTypeHint = Type.CubeMap;
             textureTypeHint = Type.CubeMap;

+ 4 - 6
jme3-core/src/main/java/com/jme3/asset/ThreadingManager.java

@@ -37,18 +37,18 @@ import java.util.concurrent.*;
  * <code>ThreadingManager</code> manages the threads used to load content
  * <code>ThreadingManager</code> manages the threads used to load content
  * within the Content Manager system. A pool of threads and a task queue
  * within the Content Manager system. A pool of threads and a task queue
  * is used to load resource data and perform I/O while the application's
  * is used to load resource data and perform I/O while the application's
- * render thread is active. 
+ * render thread is active.
  */
  */
 public class ThreadingManager {
 public class ThreadingManager {
 
 
     protected final ExecutorService executor =
     protected final ExecutorService executor =
-            Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(), 
-                                         new LoadingThreadFactory());
+            Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(),
+                    new LoadingThreadFactory());
 
 
     protected final AssetManager owner;
     protected final AssetManager owner;
     protected int nextThreadId = 0;
     protected int nextThreadId = 0;
 
 
-    public ThreadingManager(AssetManager owner){
+    public ThreadingManager(AssetManager owner) {
         this.owner = owner;
         this.owner = owner;
     }
     }
 
 
@@ -83,6 +83,4 @@ public class ThreadingManager {
     public static boolean isLoadingThread() {
     public static boolean isLoadingThread() {
         return Thread.currentThread().getName().startsWith("jME3-threadpool");
         return Thread.currentThread().getName().startsWith("jME3-threadpool");
     }
     }
-
-
 }
 }

+ 23 - 22
jme3-core/src/main/java/com/jme3/asset/cache/WeakRefAssetCache.java

@@ -42,52 +42,53 @@ import java.util.logging.Logger;
 /**
 /**
  * A garbage collector bound asset cache that handles non-cloneable objects.
  * A garbage collector bound asset cache that handles non-cloneable objects.
  * This cache assumes that the asset given to the user is the same asset
  * This cache assumes that the asset given to the user is the same asset
- * that has been stored in the cache, in other words, 
+ * that has been stored in the cache, in other words,
  * {@link AssetProcessor#createClone(java.lang.Object) } for that asset
  * {@link AssetProcessor#createClone(java.lang.Object) } for that asset
  * returns the same object as the argument.
  * returns the same object as the argument.
- * This implementation will remove the asset from the cache 
+ * This implementation will remove the asset from the cache
  * once the asset is no longer referenced in user code and memory is low,
  * once the asset is no longer referenced in user code and memory is low,
  * e.g. the VM feels like purging the weak references for that asset.
  * e.g. the VM feels like purging the weak references for that asset.
- * 
+ *
  * @author Kirill Vainer
  * @author Kirill Vainer
  */
  */
 public class WeakRefAssetCache implements AssetCache {
 public class WeakRefAssetCache implements AssetCache {
 
 
     private static final Logger logger = Logger.getLogger(WeakRefAssetCache.class.getName());
     private static final Logger logger = Logger.getLogger(WeakRefAssetCache.class.getName());
-    
+
     private final ReferenceQueue<Object> refQueue = new ReferenceQueue<>();
     private final ReferenceQueue<Object> refQueue = new ReferenceQueue<>();
-    
-    private final ConcurrentHashMap<AssetKey, AssetRef> assetCache 
+
+    private final ConcurrentHashMap<AssetKey, AssetRef> assetCache
             = new ConcurrentHashMap<>();
             = new ConcurrentHashMap<>();
 
 
     private static class AssetRef extends WeakReference<Object> {
     private static class AssetRef extends WeakReference<Object> {
-        
+
         private final AssetKey assetKey;
         private final AssetKey assetKey;
-        
-        public AssetRef(AssetKey assetKey, Object originalAsset, ReferenceQueue<Object> refQueue){
+
+        public AssetRef(AssetKey assetKey, Object originalAsset, ReferenceQueue<Object> refQueue) {
             super(originalAsset, refQueue);
             super(originalAsset, refQueue);
             this.assetKey = assetKey;
             this.assetKey = assetKey;
         }
         }
     }
     }
-    
-    private void removeCollectedAssets(){
+
+    private void removeCollectedAssets() {
         int removedAssets = 0;
         int removedAssets = 0;
-        for (AssetRef ref; (ref = (AssetRef)refQueue.poll()) != null;){
-            // Asset was collected, note that at this point the asset cache 
+        for (AssetRef ref; (ref = (AssetRef) refQueue.poll()) != null;) {
+            // Asset was collected, note that at this point the asset cache
             // might not even have this asset anymore, it is OK.
             // might not even have this asset anymore, it is OK.
-            if (assetCache.remove(ref.assetKey) != null){
-                removedAssets ++;
+            if (assetCache.remove(ref.assetKey) != null) {
+                removedAssets++;
             }
             }
         }
         }
         if (removedAssets >= 1) {
         if (removedAssets >= 1) {
-            logger.log(Level.FINE, "WeakRefAssetCache: {0} assets were purged from the cache.", removedAssets);
+            logger.log(Level.FINE,
+                    "WeakRefAssetCache: {0} assets were purged from the cache.", removedAssets);
         }
         }
     }
     }
-    
+
     @Override
     @Override
     public <T> void addToCache(AssetKey<T> key, T obj) {
     public <T> void addToCache(AssetKey<T> key, T obj) {
         removeCollectedAssets();
         removeCollectedAssets();
-        
+
         // NOTE: Some thread issues can happen if another
         // NOTE: Some thread issues can happen if another
         // thread is loading an asset with the same key.
         // thread is loading an asset with the same key.
         AssetRef ref = new AssetRef(key, obj, refQueue);
         AssetRef ref = new AssetRef(key, obj, refQueue);
@@ -98,9 +99,9 @@ public class WeakRefAssetCache implements AssetCache {
     @SuppressWarnings("unchecked")
     @SuppressWarnings("unchecked")
     public <T> T getFromCache(AssetKey<T> key) {
     public <T> T getFromCache(AssetKey<T> key) {
         AssetRef ref = assetCache.get(key);
         AssetRef ref = assetCache.get(key);
-        if (ref != null){
+        if (ref != null) {
             return (T) ref.get();
             return (T) ref.get();
-        }else{
+        } else {
             return null;
             return null;
         }
         }
     }
     }
@@ -114,11 +115,11 @@ public class WeakRefAssetCache implements AssetCache {
     public void clearCache() {
     public void clearCache() {
         assetCache.clear();
         assetCache.clear();
     }
     }
-    
+
     @Override
     @Override
     public <T> void registerAssetClone(AssetKey<T> key, T clone) {
     public <T> void registerAssetClone(AssetKey<T> key, T clone) {
     }
     }
-    
+
     @Override
     @Override
     public void notifyNoAssetClone() {
     public void notifyNoAssetClone() {
     }
     }

+ 44 - 43
jme3-core/src/main/java/com/jme3/asset/cache/WeakRefCloneAssetCache.java

@@ -45,39 +45,39 @@ import java.util.logging.Logger;
  * <code>WeakRefCloneAssetCache</code> caches cloneable assets in a weak-key
  * <code>WeakRefCloneAssetCache</code> caches cloneable assets in a weak-key
  * cache, allowing them to be collected when memory is low.
  * cache, allowing them to be collected when memory is low.
  * The cache stores weak references to the asset keys, so that
  * The cache stores weak references to the asset keys, so that
- * when all clones of the original asset are collected, will cause the 
+ * when all clones of the original asset are collected, will cause the
  * asset to be automatically removed from the cache.
  * asset to be automatically removed from the cache.
- * 
-* @author Kirill Vainer
+ *
+ * @author Kirill Vainer
  */
  */
 public class WeakRefCloneAssetCache implements AssetCache {
 public class WeakRefCloneAssetCache implements AssetCache {
 
 
     private static final Logger logger = Logger.getLogger(WeakRefAssetCache.class.getName());
     private static final Logger logger = Logger.getLogger(WeakRefAssetCache.class.getName());
-    
+
     private final ReferenceQueue<AssetKey> refQueue = new ReferenceQueue<>();
     private final ReferenceQueue<AssetKey> refQueue = new ReferenceQueue<>();
-    
+
     /**
     /**
-     * Maps cloned key to AssetRef which has a weak ref to the original 
+     * Maps cloned key to AssetRef which has a weak ref to the original
      * key and a strong ref to the original asset.
      * key and a strong ref to the original asset.
      */
      */
-    private final ConcurrentHashMap<AssetKey, AssetRef> smartCache 
+    private final ConcurrentHashMap<AssetKey, AssetRef> smartCache
             = new ConcurrentHashMap<>();
             = new ConcurrentHashMap<>();
-    
+
     /**
     /**
      * Stored in the ReferenceQueue to find out when originalKey is collected
      * Stored in the ReferenceQueue to find out when originalKey is collected
      * by GC. Once collected, the clonedKey is used to remove the asset
      * by GC. Once collected, the clonedKey is used to remove the asset
      * from the cache.
      * from the cache.
      */
      */
     private static final class KeyRef extends PhantomReference<AssetKey> {
     private static final class KeyRef extends PhantomReference<AssetKey> {
-        
+
         AssetKey clonedKey;
         AssetKey clonedKey;
-        
+
         public KeyRef(AssetKey originalKey, ReferenceQueue<AssetKey> refQueue) {
         public KeyRef(AssetKey originalKey, ReferenceQueue<AssetKey> refQueue) {
             super(originalKey, refQueue);
             super(originalKey, refQueue);
             clonedKey = originalKey.clone();
             clonedKey = originalKey.clone();
         }
         }
     }
     }
-    
+
     /**
     /**
      * Stores the original key and original asset.
      * Stores the original key and original asset.
      * The asset info contains a cloneable asset (e.g. the original, from
      * The asset info contains a cloneable asset (e.g. the original, from
@@ -94,50 +94,51 @@ public class WeakRefCloneAssetCache implements AssetCache {
         }
         }
     }
     }
 
 
-    private final ThreadLocal<ArrayList<AssetKey>> assetLoadStack 
+    private final ThreadLocal<ArrayList<AssetKey>> assetLoadStack
             = new ThreadLocal<ArrayList<AssetKey>>() {
             = new ThreadLocal<ArrayList<AssetKey>>() {
         @Override
         @Override
         protected ArrayList<AssetKey> initialValue() {
         protected ArrayList<AssetKey> initialValue() {
             return new ArrayList<>();
             return new ArrayList<>();
         }
         }
     };
     };
-    
-    private void removeCollectedAssets(){
+
+    private void removeCollectedAssets() {
         int removedAssets = 0;
         int removedAssets = 0;
-        for (KeyRef ref; (ref = (KeyRef)refQueue.poll()) != null;){
+        for (KeyRef ref; (ref = (KeyRef) refQueue.poll()) != null;) {
             // (Cannot use ref.get() since it was just collected by GC!)
             // (Cannot use ref.get() since it was just collected by GC!)
             AssetKey key = ref.clonedKey;
             AssetKey key = ref.clonedKey;
-            
-            // Asset was collected, note that at this point the asset cache 
+
+            // Asset was collected, note that at this point the asset cache
             // might not even have this asset anymore, it is OK.
             // might not even have this asset anymore, it is OK.
-            if (smartCache.remove(key) != null){
-                removedAssets ++;
+            if (smartCache.remove(key) != null) {
+                removedAssets++;
             }
             }
         }
         }
         if (removedAssets >= 1) {
         if (removedAssets >= 1) {
-            logger.log(Level.FINE, "WeakRefCloneAssetCache: {0} assets were purged from the cache.", removedAssets);
+            logger.log(Level.FINE,
+                    "WeakRefCloneAssetCache: {0} assets were purged from the cache.", removedAssets);
         }
         }
     }
     }
-    
+
     @Override
     @Override
     public <T> void addToCache(AssetKey<T> originalKey, T obj) {
     public <T> void addToCache(AssetKey<T> originalKey, T obj) {
         // Make room for new asset
         // Make room for new asset
         removeCollectedAssets();
         removeCollectedAssets();
-        
+
         CloneableSmartAsset asset = (CloneableSmartAsset) obj;
         CloneableSmartAsset asset = (CloneableSmartAsset) obj;
-        
-        // No circular references, since the original asset is 
+
+        // No circular references, since the original asset is
         // strongly referenced, we don't want the key strongly referenced.
         // strongly referenced, we don't want the key strongly referenced.
-        asset.setKey(null); 
-        
+        asset.setKey(null);
+
         // Start tracking the collection of originalKey
         // Start tracking the collection of originalKey
         // (this adds the KeyRef to the ReferenceQueue)
         // (this adds the KeyRef to the ReferenceQueue)
         KeyRef ref = new KeyRef(originalKey, refQueue);
         KeyRef ref = new KeyRef(originalKey, refQueue);
-        
-        // Place the asset in the cache, but use a clone of 
+
+        // Place the asset in the cache, but use a clone of
         // the original key.
         // the original key.
         smartCache.put(ref.clonedKey, new AssetRef(asset, originalKey));
         smartCache.put(ref.clonedKey, new AssetRef(asset, originalKey));
-        
+
         // Push the original key used to load the asset
         // Push the original key used to load the asset
         // so that it can be set on the clone later
         // so that it can be set on the clone later
         ArrayList<AssetKey> loadStack = assetLoadStack.get();
         ArrayList<AssetKey> loadStack = assetLoadStack.get();
@@ -147,9 +148,9 @@ public class WeakRefCloneAssetCache implements AssetCache {
     @Override
     @Override
     public <T> void registerAssetClone(AssetKey<T> key, T clone) {
     public <T> void registerAssetClone(AssetKey<T> key, T clone) {
         ArrayList<AssetKey> loadStack = assetLoadStack.get();
         ArrayList<AssetKey> loadStack = assetLoadStack.get();
-        ((CloneableSmartAsset)clone).setKey(loadStack.remove(loadStack.size() - 1));
+        ((CloneableSmartAsset) clone).setKey(loadStack.remove(loadStack.size() - 1));
     }
     }
-    
+
     @Override
     @Override
     public void notifyNoAssetClone() {
     public void notifyNoAssetClone() {
         ArrayList<AssetKey> loadStack = assetLoadStack.get();
         ArrayList<AssetKey> loadStack = assetLoadStack.get();
@@ -167,17 +168,17 @@ public class WeakRefCloneAssetCache implements AssetCache {
             // can check this and determine that the asset clone
             // can check this and determine that the asset clone
             // belongs to the asset retrieved here.
             // belongs to the asset retrieved here.
             AssetKey keyForTheClone = smartInfo.get();
             AssetKey keyForTheClone = smartInfo.get();
-            if (keyForTheClone == null){
+            if (keyForTheClone == null) {
                 // The asset was JUST collected by GC
                 // The asset was JUST collected by GC
                 // (between here and smartCache.get)
                 // (between here and smartCache.get)
                 return null;
                 return null;
             }
             }
-            
+
             // Prevent original key from getting collected
             // Prevent original key from getting collected
             // while an asset is loaded for it.
             // while an asset is loaded for it.
             ArrayList<AssetKey> loadStack = assetLoadStack.get();
             ArrayList<AssetKey> loadStack = assetLoadStack.get();
             loadStack.add(keyForTheClone);
             loadStack.add(keyForTheClone);
-            
+
             return (T) smartInfo.asset;
             return (T) smartInfo.asset;
         }
         }
     }
     }
@@ -185,24 +186,24 @@ public class WeakRefCloneAssetCache implements AssetCache {
     @Override
     @Override
     public boolean deleteFromCache(AssetKey key) {
     public boolean deleteFromCache(AssetKey key) {
         ArrayList<AssetKey> loadStack = assetLoadStack.get();
         ArrayList<AssetKey> loadStack = assetLoadStack.get();
-        
-        if (!loadStack.isEmpty()){
+
+        if (!loadStack.isEmpty()) {
             throw new UnsupportedOperationException("Cache cannot be modified"
             throw new UnsupportedOperationException("Cache cannot be modified"
-                                                  + "while assets are being loaded");
+                    + "while assets are being loaded");
         }
         }
-        
+
         return smartCache.remove(key) != null;
         return smartCache.remove(key) != null;
     }
     }
-    
+
     @Override
     @Override
     public void clearCache() {
     public void clearCache() {
         ArrayList<AssetKey> loadStack = assetLoadStack.get();
         ArrayList<AssetKey> loadStack = assetLoadStack.get();
-        
-        if (!loadStack.isEmpty()){
+
+        if (!loadStack.isEmpty()) {
             throw new UnsupportedOperationException("Cache cannot be modified"
             throw new UnsupportedOperationException("Cache cannot be modified"
-                                                  + "while assets are being loaded");
+                    + "while assets are being loaded");
         }
         }
-        
+
         smartCache.clear();
         smartCache.clear();
     }
     }
 }
 }

+ 13 - 13
jme3-core/src/main/java/com/jme3/audio/AudioBuffer.java

@@ -51,11 +51,11 @@ public class AudioBuffer extends AudioData {
      */
      */
     protected ByteBuffer audioData;
     protected ByteBuffer audioData;
 
 
-    public AudioBuffer(){
+    public AudioBuffer() {
         super();
         super();
     }
     }
-    
-    protected AudioBuffer(int id){
+
+    protected AudioBuffer(int id) {
         super(id);
         super(id);
     }
     }
 
 
@@ -69,7 +69,7 @@ public class AudioBuffer extends AudioData {
      * that audio is uncompressed.
      * that audio is uncompressed.
      */
      */
     @Override
     @Override
-    public float getDuration(){
+    public float getDuration() {
         int bytesPerSec = (bitsPerSample / 8) * channels * sampleRate;
         int bytesPerSec = (bitsPerSample / 8) * channels * sampleRate;
         if (audioData != null)
         if (audioData != null)
             return (float) audioData.limit() / bytesPerSec;
             return (float) audioData.limit() / bytesPerSec;
@@ -78,10 +78,10 @@ public class AudioBuffer extends AudioData {
     }
     }
 
 
     @Override
     @Override
-    public String toString(){
-        return getClass().getSimpleName() +
-               "[id="+id+", ch="+channels+", bits="+bitsPerSample +
-               ", rate="+sampleRate+", duration="+getDuration()+"]";
+    public String toString() {
+        return getClass().getSimpleName()
+                + "[id=" + id + ", ch=" + channels + ", bits=" + bitsPerSample
+                + ", rate=" + sampleRate + ", duration=" + getDuration() + "]";
     }
     }
 
 
     /**
     /**
@@ -90,7 +90,7 @@ public class AudioBuffer extends AudioData {
      * @param data the audio data provided (not null, direct, alias created)
      * @param data the audio data provided (not null, direct, alias created)
      * @throws IllegalArgumentException if the provided buffer is not a direct buffer
      * @throws IllegalArgumentException if the provided buffer is not a direct buffer
      */
      */
-    public void updateData(ByteBuffer data){
+    public void updateData(ByteBuffer data) {
         if (!data.isDirect()) {
         if (!data.isDirect()) {
             throw new IllegalArgumentException(
             throw new IllegalArgumentException(
                     "Currently only direct buffers are allowed");
                     "Currently only direct buffers are allowed");
@@ -103,7 +103,7 @@ public class AudioBuffer extends AudioData {
     /**
     /**
      * @return The buffered audio data.
      * @return The buffered audio data.
      */
      */
-    public ByteBuffer getData(){
+    public ByteBuffer getData() {
         return audioData;
         return audioData;
     }
     }
 
 
@@ -119,10 +119,10 @@ public class AudioBuffer extends AudioData {
             BufferUtils.destroyDirectBuffer(audioData);
             BufferUtils.destroyDirectBuffer(audioData);
         }
         }
     }
     }
-    
+
     @Override
     @Override
     public void deleteObject(Object rendererObject) {
     public void deleteObject(Object rendererObject) {
-        ((AudioRenderer)rendererObject).deleteAudioData(this);
+        ((AudioRenderer) rendererObject).deleteAudioData(this);
     }
     }
 
 
     @Override
     @Override
@@ -132,6 +132,6 @@ public class AudioBuffer extends AudioData {
 
 
     @Override
     @Override
     public long getUniqueId() {
     public long getUniqueId() {
-        return ((long)OBJTYPE_AUDIOBUFFER << 32) | ((long)id);
+        return ((long) OBJTYPE_AUDIOBUFFER << 32) | ((long) id);
     }
     }
 }
 }

+ 4 - 4
jme3-core/src/main/java/com/jme3/audio/AudioContext.java

@@ -39,17 +39,17 @@ package com.jme3.audio;
 public class AudioContext {
 public class AudioContext {
 
 
     final private static ThreadLocal<AudioRenderer> audioRenderer = new ThreadLocal<AudioRenderer>();
     final private static ThreadLocal<AudioRenderer> audioRenderer = new ThreadLocal<AudioRenderer>();
- 
+
     /**
     /**
      * A private constructor to inhibit instantiation of this class.
      * A private constructor to inhibit instantiation of this class.
      */
      */
     private AudioContext() {
     private AudioContext() {
     }
     }
 
 
-    public static void setAudioRenderer( AudioRenderer ar ) {
-        audioRenderer.set(ar);       
+    public static void setAudioRenderer(AudioRenderer ar) {
+        audioRenderer.set(ar);
     }
     }
-    
+
     public static AudioRenderer getAudioRenderer() {
     public static AudioRenderer getAudioRenderer() {
         return audioRenderer.get();
         return audioRenderer.get();
     }
     }

+ 6 - 6
jme3-core/src/main/java/com/jme3/audio/AudioData.java

@@ -51,15 +51,15 @@ public abstract class AudioData extends NativeObject {
         Buffer,
         Buffer,
         Stream
         Stream
     }
     }
-    
-    public AudioData(){
+
+    public AudioData() {
         super();
         super();
     }
     }
 
 
-    protected AudioData(int id){
+    protected AudioData(int id) {
         super(id);
         super(id);
     }
     }
-    
+
     /**
     /**
      * @return The data type, either <code>Buffer</code> or <code>Stream</code>.
      * @return The data type, either <code>Buffer</code> or <code>Stream</code>.
      */
      */
@@ -69,7 +69,7 @@ public abstract class AudioData extends NativeObject {
      * @return the duration in seconds of the audio clip.
      * @return the duration in seconds of the audio clip.
      */
      */
     public abstract float getDuration();
     public abstract float getDuration();
-    
+
     /**
     /**
      * @return Bits per single sample from a channel.
      * @return Bits per single sample from a channel.
      */
      */
@@ -97,7 +97,7 @@ public abstract class AudioData extends NativeObject {
      * @param bitsPerSample Bits per sample, e.g 8 bits, 16 bits.
      * @param bitsPerSample Bits per sample, e.g 8 bits, 16 bits.
      * @param sampleRate Sample rate, 44100, 22050, etc.
      * @param sampleRate Sample rate, 44100, 22050, etc.
      */
      */
-    public void setupFormat(int channels, int bitsPerSample, int sampleRate){
+    public void setupFormat(int channels, int bitsPerSample, int sampleRate) {
         if (id != -1)
         if (id != -1)
             throw new IllegalStateException("Already set up");
             throw new IllegalStateException("Already set up");
 
 

+ 21 - 24
jme3-core/src/main/java/com/jme3/audio/AudioKey.java

@@ -53,20 +53,20 @@ public class AudioKey extends AssetKey<AudioData> {
 
 
     /**
     /**
      * Create a new AudioKey.
      * Create a new AudioKey.
-     * 
+     *
      * @param name Name of the asset
      * @param name Name of the asset
      * @param stream If true, the audio will be streamed.
      * @param stream If true, the audio will be streamed.
      *     Otherwise, it will be buffered entirely and then played.
      *     Otherwise, it will be buffered entirely and then played.
      * @param streamCache If stream is true, then this specifies if
      * @param streamCache If stream is true, then this specifies if
      * the stream cache is used. When enabled, the audio stream will
      * the stream cache is used. When enabled, the audio stream will
-     * be read entirely but not decoded, allowing features such as 
+     * be read entirely but not decoded, allowing features such as
      * seeking, determining duration and looping.
      * seeking, determining duration and looping.
      */
      */
-    public AudioKey(String name, boolean stream, boolean streamCache){
+    public AudioKey(String name, boolean stream, boolean streamCache) {
         this(name, stream);
         this(name, stream);
         this.streamCache = streamCache;
         this.streamCache = streamCache;
     }
     }
-    
+
     /**
     /**
      * Create a new AudioKey
      * Create a new AudioKey
      *
      *
@@ -74,26 +74,24 @@ public class AudioKey extends AssetKey<AudioData> {
      * @param stream If true, the audio will be streamed.
      * @param stream If true, the audio will be streamed.
      *     Otherwise, it will be buffered entirely and then played.
      *     Otherwise, it will be buffered entirely and then played.
      */
      */
-    public AudioKey(String name, boolean stream){
+    public AudioKey(String name, boolean stream) {
         super(name);
         super(name);
         this.stream = stream;
         this.stream = stream;
     }
     }
 
 
-    public AudioKey(String name){
+    public AudioKey(String name) {
         super(name);
         super(name);
         this.stream = false;
         this.stream = false;
     }
     }
 
 
-    public AudioKey(){
+    public AudioKey() {
     }
     }
 
 
     @Override
     @Override
-    public String toString(){
-        return name + (stream ? 
-                          (streamCache ? 
-                            " (Stream/Cache)" : 
-                            " (Stream)") : 
-                         " (Buffer)");
+    public String toString() {
+        return name + (stream
+                ? (streamCache ? " (Stream/Cache)" : " (Stream)")
+                : " (Buffer)");
     }
     }
 
 
     /**
     /**
@@ -103,17 +101,17 @@ public class AudioKey extends AssetKey<AudioData> {
     public boolean isStream() {
     public boolean isStream() {
         return stream;
         return stream;
     }
     }
-    
+
     /**
     /**
-     * Specifies if the stream cache is used. 
-     * 
+     * Specifies if the stream cache is used.
+     *
      * When enabled, the audio stream will
      * When enabled, the audio stream will
-     * be read entirely but not decoded, allowing features such as 
+     * be read entirely but not decoded, allowing features such as
      * seeking, looping and determining duration.
      * seeking, looping and determining duration.
-     * 
+     *
      * @return true if stream cache is in use, otherwise false
      * @return true if stream cache is in use, otherwise false
      */
      */
-    public boolean useStreamCache(){
+    public boolean useStreamCache() {
         return streamCache;
         return streamCache;
     }
     }
 
 
@@ -157,14 +155,14 @@ public class AudioKey extends AssetKey<AudioData> {
         hash = 67 * hash + (this.streamCache ? 1 : 0);
         hash = 67 * hash + (this.streamCache ? 1 : 0);
         return hash;
         return hash;
     }
     }
-    
+
     @Override
     @Override
     public Class<? extends AssetProcessor> getProcessorType() {
     public Class<? extends AssetProcessor> getProcessorType() {
         return null;
         return null;
     }
     }
-    
+
     @Override
     @Override
-    public void write(JmeExporter ex) throws IOException{
+    public void write(JmeExporter ex) throws IOException {
         super.write(ex);
         super.write(ex);
         OutputCapsule oc = ex.getCapsule(this);
         OutputCapsule oc = ex.getCapsule(this);
         oc.write(stream, "do_stream", false);
         oc.write(stream, "do_stream", false);
@@ -172,11 +170,10 @@ public class AudioKey extends AssetKey<AudioData> {
     }
     }
 
 
     @Override
     @Override
-    public void read(JmeImporter im) throws IOException{
+    public void read(JmeImporter im) throws IOException {
         super.read(im);
         super.read(im);
         InputCapsule ic = im.getCapsule(this);
         InputCapsule ic = im.getCapsule(this);
         stream = ic.readBoolean("do_stream", false);
         stream = ic.readBoolean("do_stream", false);
         streamCache = ic.readBoolean("use_stream_cache", false);
         streamCache = ic.readBoolean("use_stream_cache", false);
     }
     }
-
 }
 }

+ 41 - 33
jme3-core/src/main/java/com/jme3/audio/AudioNode.java

@@ -60,14 +60,14 @@ import java.util.logging.Logger;
  * play stereo assets.
  * play stereo assets.
  *
  *
  * The "positional" property of an AudioNode can be set via
  * The "positional" property of an AudioNode can be set via
- * {@link AudioNode#setPositional(boolean) }.
+ * {@link AudioNode#setPositional(boolean)}.
  *
  *
  * @author normenhansen
  * @author normenhansen
  * @author Kirill Vainer
  * @author Kirill Vainer
  */
  */
 public class AudioNode extends Node implements AudioSource {
 public class AudioNode extends Node implements AudioSource {
 
 
-    //Version #1 : AudioKey is now stored into "audio_key" instead of "key"
+    // Version #1 : AudioKey is now stored into "audio_key" instead of "key"
     public static final int SAVABLE_VERSION = 1;
     public static final int SAVABLE_VERSION = 1;
     protected boolean loop = false;
     protected boolean loop = false;
     protected float volume = 1;
     protected float volume = 1;
@@ -137,8 +137,9 @@ public class AudioNode extends Node implements AudioSource {
      * Creates a new <code>AudioNode</code> with the given audio file.
      * Creates a new <code>AudioNode</code> with the given audio file.
      * @param assetManager The asset manager to use to load the audio file
      * @param assetManager The asset manager to use to load the audio file
      * @param name The filename of the audio file
      * @param name The filename of the audio file
-     * @param type The type. If <code>{@link com.jme3.audio.AudioData.DataType}.Stream</code>, the audio will be streamed gradually from disk,
-     *             otherwise it will be buffered (<code>{@link com.jme3.audio.AudioData.DataType}.Buffer</code>)
+     * @param type The type. If <code>{@link com.jme3.audio.AudioData.DataType}.Stream</code>,
+     *     the audio will be streamed gradually from disk,
+     *     otherwise it will be buffered (<code>{@link com.jme3.audio.AudioData.DataType}.Buffer</code>)
      */
      */
     public AudioNode(AssetManager assetManager, String name, DataType type) {
     public AudioNode(AssetManager assetManager, String name, DataType type) {
         this(assetManager, name, type == DataType.Stream, true);
         this(assetManager, name, type == DataType.Stream, true);
@@ -150,13 +151,14 @@ public class AudioNode extends Node implements AudioSource {
      * @param assetManager The asset manager to use to load the audio file
      * @param assetManager The asset manager to use to load the audio file
      * @param name The filename of the audio file
      * @param name The filename of the audio file
      * @param stream If true, the audio will be streamed gradually from disk,
      * @param stream If true, the audio will be streamed gradually from disk,
-     *               otherwise, it will be buffered.
+     *     otherwise, it will be buffered.
      * @param streamCache If stream is also true, then this specifies if
      * @param streamCache If stream is also true, then this specifies if
-     * the stream cache is used. When enabled, the audio stream will
-     * be read entirely but not decoded, allowing features such as
-     * seeking, looping and determining duration.
+     *     the stream cache is used. When enabled, the audio stream will
+     *     be read entirely but not decoded, allowing features such as
+     *     seeking, looping and determining duration.
      *
      *
-     * @deprecated Use {@link AudioNode#AudioNode(com.jme3.asset.AssetManager, java.lang.String, com.jme3.audio.AudioData.DataType)} instead
+     * @deprecated Use {@link AudioNode#AudioNode(com.jme3.asset.AssetManager, java.lang.String,
+     *     com.jme3.audio.AudioData.DataType)} instead
      */
      */
     @Deprecated
     @Deprecated
     public AudioNode(AssetManager assetManager, String name, boolean stream, boolean streamCache) {
     public AudioNode(AssetManager assetManager, String name, boolean stream, boolean streamCache) {
@@ -170,9 +172,10 @@ public class AudioNode extends Node implements AudioSource {
      * @param assetManager The asset manager to use to load the audio file
      * @param assetManager The asset manager to use to load the audio file
      * @param name The filename of the audio file
      * @param name The filename of the audio file
      * @param stream If true, the audio will be streamed gradually from disk,
      * @param stream If true, the audio will be streamed gradually from disk,
-     *               otherwise, it will be buffered.
+     *     otherwise, it will be buffered.
      *
      *
-     * @deprecated Use {@link AudioNode#AudioNode(com.jme3.asset.AssetManager, java.lang.String, com.jme3.audio.AudioData.DataType)} instead
+     * @deprecated Use {@link AudioNode#AudioNode(com.jme3.asset.AssetManager, java.lang.String,
+     *     com.jme3.audio.AudioData.DataType)} instead
      */
      */
     @Deprecated
     @Deprecated
     public AudioNode(AssetManager assetManager, String name, boolean stream) {
     public AudioNode(AssetManager assetManager, String name, boolean stream) {
@@ -198,7 +201,8 @@ public class AudioNode extends Node implements AudioSource {
      *
      *
      * @param assetManager The asset manager to use to load the audio file
      * @param assetManager The asset manager to use to load the audio file
      * @param name The filename of the audio file
      * @param name The filename of the audio file
-     * @deprecated Use {@link AudioNode#AudioNode(com.jme3.asset.AssetManager, java.lang.String, com.jme3.audio.AudioData.DataType) } instead
+     * @deprecated Use {@link AudioNode#AudioNode(com.jme3.asset.AssetManager, java.lang.String,
+     *     com.jme3.audio.AudioData.DataType) } instead
      */
      */
     @Deprecated
     @Deprecated
     public AudioNode(AssetManager assetManager, String name) {
     public AudioNode(AssetManager assetManager, String name) {
@@ -207,15 +211,16 @@ public class AudioNode extends Node implements AudioSource {
 
 
     protected AudioRenderer getRenderer() {
     protected AudioRenderer getRenderer() {
         AudioRenderer result = AudioContext.getAudioRenderer();
         AudioRenderer result = AudioContext.getAudioRenderer();
-        if( result == null )
-            throw new IllegalStateException( "No audio renderer available, make sure call is being performed on render thread." );
+        if (result == null)
+            throw new IllegalStateException(
+                    "No audio renderer available, make sure call is being performed on render thread.");
         return result;
         return result;
     }
     }
 
 
     /**
     /**
      * Start playing the audio.
      * Start playing the audio.
      */
      */
-    public void play(){
+    public void play() {
         if (positional && data.getChannels() > 1) {
         if (positional && data.getChannels() > 1) {
             throw new IllegalStateException("Only mono audio is supported for positional audio nodes");
             throw new IllegalStateException("Only mono audio is supported for positional audio nodes");
         }
         }
@@ -228,7 +233,7 @@ public class AudioNode extends Node implements AudioSource {
      * that changes to the parameters of this AudioNode will not affect the
      * that changes to the parameters of this AudioNode will not affect the
      * instances already playing.
      * instances already playing.
      */
      */
-    public void playInstance(){
+    public void playInstance() {
         if (positional && data.getChannels() > 1) {
         if (positional && data.getChannels() > 1) {
             throw new IllegalStateException("Only mono audio is supported for positional audio nodes");
             throw new IllegalStateException("Only mono audio is supported for positional audio nodes");
         }
         }
@@ -238,14 +243,14 @@ public class AudioNode extends Node implements AudioSource {
     /**
     /**
      * Stop playing the audio that was started with {@link AudioNode#play() }.
      * Stop playing the audio that was started with {@link AudioNode#play() }.
      */
      */
-    public void stop(){
+    public void stop() {
         getRenderer().stopSource(this);
         getRenderer().stopSource(this);
     }
     }
 
 
     /**
     /**
      * Pause the audio that was started with {@link AudioNode#play() }.
      * Pause the audio that was started with {@link AudioNode#play() }.
      */
      */
-    public void pause(){
+    public void pause() {
         getRenderer().pauseSource(this);
         getRenderer().pauseSource(this);
     }
     }
 
 
@@ -454,7 +459,7 @@ public class AudioNode extends Node implements AudioSource {
         this.timeOffset = timeOffset;
         this.timeOffset = timeOffset;
         if (data instanceof AudioStream) {
         if (data instanceof AudioStream) {
             ((AudioStream) data).setTime(timeOffset);
             ((AudioStream) data).setTime(timeOffset);
-        }else if(status == AudioSource.Status.Playing){
+        } else if (status == AudioSource.Status.Playing) {
             stop();
             stop();
             play();
             play();
         }
         }
@@ -602,7 +607,7 @@ public class AudioNode extends Node implements AudioSource {
      * audio node will be exactly half of its volume.
      * audio node will be exactly half of its volume.
      *
      *
      * @param refDistance The reference playing distance.
      * @param refDistance The reference playing distance.
-     * @throws  IllegalArgumentException If refDistance is negative
+     * @throws IllegalArgumentException If refDistance is negative
      */
      */
     public void setRefDistance(float refDistance) {
     public void setRefDistance(float refDistance) {
         if (refDistance < 0) {
         if (refDistance < 0) {
@@ -749,12 +754,14 @@ public class AudioNode extends Node implements AudioSource {
     @Override
     @Override
     public void updateGeometricState() {
     public void updateGeometricState() {
         super.updateGeometricState();
         super.updateGeometricState();
-        if (channel < 0) return;
+        if (channel < 0)
+            return;
         Vector3f currentWorldTranslation = worldTransform.getTranslation();
         Vector3f currentWorldTranslation = worldTransform.getTranslation();
         if (!previousWorldTranslation.equals(currentWorldTranslation)) {
         if (!previousWorldTranslation.equals(currentWorldTranslation)) {
             getRenderer().updateSourceParam(this, AudioParam.Position);
             getRenderer().updateSourceParam(this, AudioParam.Position);
             if (velocityFromTranslation && !Float.isNaN(previousWorldTranslation.x)) {
             if (velocityFromTranslation && !Float.isNaN(previousWorldTranslation.x)) {
-                velocity.set(currentWorldTranslation).subtractLocal(previousWorldTranslation).multLocal(1f / lastTpf);
+                velocity.set(currentWorldTranslation)
+                        .subtractLocal(previousWorldTranslation).multLocal(1f / lastTpf);
                 getRenderer().updateSourceParam(this, AudioParam.Velocity);
                 getRenderer().updateSourceParam(this, AudioParam.Velocity);
             }
             }
             previousWorldTranslation.set(currentWorldTranslation);
             previousWorldTranslation.set(currentWorldTranslation);
@@ -762,21 +769,21 @@ public class AudioNode extends Node implements AudioSource {
     }
     }
 
 
     @Override
     @Override
-    public AudioNode clone(){
+    public AudioNode clone() {
         AudioNode clone = (AudioNode) super.clone();
         AudioNode clone = (AudioNode) super.clone();
         return clone;
         return clone;
     }
     }
 
 
     /**
     /**
-     *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
+     * Called internally by com.jme3.util.clone.Cloner. Do not call directly.
      */
      */
     @Override
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
-        super.cloneFields(cloner, original); 
+    public void cloneFields(Cloner cloner, Object original) {
+        super.cloneFields(cloner, original);
 
 
-        this.direction=cloner.clone(direction);
-        this.velocity=velocityFromTranslation?new Vector3f():cloner.clone(velocity);      
-        this.previousWorldTranslation=Vector3f.NAN.clone();
+        this.direction = cloner.clone(direction);
+        this.velocity = velocityFromTranslation ? new Vector3f() : cloner.clone(velocity);
+        this.previousWorldTranslation = Vector3f.NAN.clone();
 
 
         // Change in behavior: the filters were not cloned before meaning
         // Change in behavior: the filters were not cloned before meaning
         // that two cloned audio nodes would share the same filter instance.
         // that two cloned audio nodes would share the same filter instance.
@@ -826,9 +833,9 @@ public class AudioNode extends Node implements AudioSource {
         // NOTE: In previous versions of jME3, audioKey was actually
         // NOTE: In previous versions of jME3, audioKey was actually
         // written with the name "key". This has been changed
         // written with the name "key". This has been changed
         // to "audio_key" in case Spatial's key will be written as "key".
         // to "audio_key" in case Spatial's key will be written as "key".
-        if (ic.getSavableVersion(AudioNode.class) == 0){
+        if (ic.getSavableVersion(AudioNode.class) == 0) {
             audioKey = (AudioKey) ic.readSavable("key", null);
             audioKey = (AudioKey) ic.readSavable("key", null);
-        }else{
+        } else {
             audioKey = (AudioKey) ic.readSavable("audio_key", null);
             audioKey = (AudioKey) ic.readSavable("audio_key", null);
         }
         }
 
 
@@ -855,8 +862,9 @@ public class AudioNode extends Node implements AudioSource {
         if (audioKey != null) {
         if (audioKey != null) {
             try {
             try {
                 data = im.getAssetManager().loadAsset(audioKey);
                 data = im.getAssetManager().loadAsset(audioKey);
-            } catch (AssetNotFoundException ex){
-                Logger.getLogger(AudioNode.class.getName()).log(Level.FINE, "Cannot locate {0} for audio node {1}", new Object[]{audioKey, key});
+            } catch (AssetNotFoundException ex) {
+                Logger.getLogger(AudioNode.class.getName())
+                        .log(Level.FINE, "Cannot locate {0} for audio node {1}", new Object[]{audioKey, key});
                 data = PlaceholderAssets.getPlaceholderAudio();
                 data = PlaceholderAssets.getPlaceholderAudio();
             }
             }
         }
         }

+ 4 - 4
jme3-core/src/main/java/com/jme3/audio/Environment.java

@@ -69,12 +69,12 @@ public class Environment {
         Closet = new Environment(1, 1, 1, 1, .15f, 1, .6f, .0025f, .5f, .0006f);
         Closet = new Environment(1, 1, 1, 1, .15f, 1, .6f, .0025f, .5f, .0006f);
     }
     }
 
 
-    private static float eaxDbToAmp(float eaxDb){
+    private static float eaxDbToAmp(float eaxDb) {
         float dB = eaxDb / 2000f;
         float dB = eaxDb / 2000f;
         return FastMath.pow(10f, dB);
         return FastMath.pow(10f, dB);
     }
     }
 
 
-    public Environment(){
+    public Environment() {
     }
     }
 
 
     public Environment(Environment source) {
     public Environment(Environment source) {
@@ -95,7 +95,7 @@ public class Environment {
 
 
     public Environment(float density, float diffusion, float gain, float gainHf,
     public Environment(float density, float diffusion, float gain, float gainHf,
                        float decayTime, float decayHf, float reflGain,
                        float decayTime, float decayHf, float reflGain,
-                       float reflDelay, float lateGain, float lateDelay){
+                       float reflDelay, float lateGain, float lateDelay) {
         this.decayTime = decayTime;
         this.decayTime = decayTime;
         this.decayHFRatio = decayHf;
         this.decayHFRatio = decayHf;
         this.density = density;
         this.density = density;
@@ -108,7 +108,7 @@ public class Environment {
         this.reflectGain = reflGain;
         this.reflectGain = reflGain;
     }
     }
 
 
-    public Environment(float[] e){
+    public Environment(float[] e) {
         if (e.length != 28)
         if (e.length != 28)
             throw new IllegalArgumentException("Not an EAX preset");
             throw new IllegalArgumentException("Not an EAX preset");
 
 

+ 5 - 5
jme3-core/src/main/java/com/jme3/audio/Filter.java

@@ -39,14 +39,14 @@ import java.io.IOException;
 
 
 public abstract class Filter extends NativeObject implements Savable {
 public abstract class Filter extends NativeObject implements Savable {
 
 
-    public Filter(){
+    public Filter() {
         super();
         super();
     }
     }
-    
-    protected Filter(int id){
+
+    protected Filter(int id) {
         super(id);
         super(id);
     }
     }
-    
+
     @Override
     @Override
     public void write(JmeExporter ex) throws IOException {
     public void write(JmeExporter ex) throws IOException {
         // nothing to save
         // nothing to save
@@ -65,7 +65,7 @@ public abstract class Filter extends NativeObject implements Savable {
 
 
     @Override
     @Override
     public void deleteObject(Object rendererObject) {
     public void deleteObject(Object rendererObject) {
-        ((AudioRenderer)rendererObject).deleteFilter(this);
+        ((AudioRenderer) rendererObject).deleteFilter(this);
     }
     }
 
 
     @Override
     @Override

+ 9 - 9
jme3-core/src/main/java/com/jme3/audio/Listener.java

@@ -42,20 +42,20 @@ public class Listener {
     private float volume = 1;
     private float volume = 1;
     private AudioRenderer renderer;
     private AudioRenderer renderer;
 
 
-    public Listener(){
+    public Listener() {
         location = new Vector3f();
         location = new Vector3f();
         velocity = new Vector3f();
         velocity = new Vector3f();
         rotation = new Quaternion();
         rotation = new Quaternion();
     }
     }
-    
-    public Listener(Listener source){
+
+    public Listener(Listener source) {
         location = source.location.clone();
         location = source.location.clone();
         velocity = source.velocity.clone();
         velocity = source.velocity.clone();
         rotation = source.rotation.clone();
         rotation = source.rotation.clone();
         volume = source.volume;
         volume = source.volume;
     }
     }
 
 
-    public void setRenderer(AudioRenderer renderer){
+    public void setRenderer(AudioRenderer renderer) {
         this.renderer = renderer;
         this.renderer = renderer;
     }
     }
 
 
@@ -68,7 +68,7 @@ public class Listener {
         if (renderer != null)
         if (renderer != null)
             renderer.updateListenerParam(this, ListenerParam.Volume);
             renderer.updateListenerParam(this, ListenerParam.Volume);
     }
     }
-    
+
     public Vector3f getLocation() {
     public Vector3f getLocation() {
         return location;
         return location;
     }
     }
@@ -81,18 +81,18 @@ public class Listener {
         return velocity;
         return velocity;
     }
     }
 
 
-    public Vector3f getLeft(){
+    public Vector3f getLeft() {
         return rotation.getRotationColumn(0);
         return rotation.getRotationColumn(0);
     }
     }
 
 
-    public Vector3f getUp(){
+    public Vector3f getUp() {
         return rotation.getRotationColumn(1);
         return rotation.getRotationColumn(1);
     }
     }
 
 
-    public Vector3f getDirection(){
+    public Vector3f getDirection() {
         return rotation.getRotationColumn(2);
         return rotation.getRotationColumn(2);
     }
     }
-    
+
     public void setLocation(Vector3f location) {
     public void setLocation(Vector3f location) {
         this.location.set(location);
         this.location.set(location);
         if (renderer != null)
         if (renderer != null)

+ 6 - 6
jme3-core/src/main/java/com/jme3/audio/LowPassFilter.java

@@ -47,8 +47,8 @@ public class LowPassFilter extends Filter {
         setVolume(volume);
         setVolume(volume);
         setHighFreqVolume(highFreqVolume);
         setHighFreqVolume(highFreqVolume);
     }
     }
-    
-    protected LowPassFilter(int id){
+
+    protected LowPassFilter(int id) {
         super(id);
         super(id);
     }
     }
 
 
@@ -71,13 +71,13 @@ public class LowPassFilter extends Filter {
     public void setVolume(float volume) {
     public void setVolume(float volume) {
         if (volume < 0 || volume > 1)
         if (volume < 0 || volume > 1)
             throw new IllegalArgumentException("Volume must be between 0 and 1");
             throw new IllegalArgumentException("Volume must be between 0 and 1");
-        
+
         this.volume = volume;
         this.volume = volume;
         this.updateNeeded = true;
         this.updateNeeded = true;
     }
     }
 
 
     @Override
     @Override
-    public void write(JmeExporter ex) throws IOException{
+    public void write(JmeExporter ex) throws IOException {
         super.write(ex);
         super.write(ex);
         OutputCapsule oc = ex.getCapsule(this);
         OutputCapsule oc = ex.getCapsule(this);
         oc.write(volume, "volume", 0);
         oc.write(volume, "volume", 0);
@@ -85,7 +85,7 @@ public class LowPassFilter extends Filter {
     }
     }
 
 
     @Override
     @Override
-    public void read(JmeImporter im) throws IOException{
+    public void read(JmeImporter im) throws IOException {
         super.read(im);
         super.read(im);
         InputCapsule ic = im.getCapsule(this);
         InputCapsule ic = im.getCapsule(this);
         volume = ic.readFloat("volume", 0);
         volume = ic.readFloat("volume", 0);
@@ -99,6 +99,6 @@ public class LowPassFilter extends Filter {
 
 
     @Override
     @Override
     public long getUniqueId() {
     public long getUniqueId() {
-        return ((long)OBJTYPE_FILTER << 32) | ((long)id);
+        return ((long) OBJTYPE_FILTER << 32) | ((long) id);
     }
     }
 }
 }

+ 76 - 76
jme3-core/src/main/java/com/jme3/audio/openal/ALAudioRenderer.java

@@ -47,9 +47,9 @@ import java.util.logging.Logger;
 public class ALAudioRenderer implements AudioRenderer, Runnable {
 public class ALAudioRenderer implements AudioRenderer, Runnable {
 
 
     private static final Logger logger = Logger.getLogger(ALAudioRenderer.class.getName());
     private static final Logger logger = Logger.getLogger(ALAudioRenderer.class.getName());
-    
+
     private static final String THREAD_NAME = "jME3 Audio Decoder";
     private static final String THREAD_NAME = "jME3 Audio Decoder";
-    
+
     private final NativeObjectManager objManager = new NativeObjectManager();
     private final NativeObjectManager objManager = new NativeObjectManager();
     // When multiplied by STREAMING_BUFFER_COUNT, will equal 44100 * 2 * 2
     // When multiplied by STREAMING_BUFFER_COUNT, will equal 44100 * 2 * 2
     // which is exactly 1 second of audio.
     // which is exactly 1 second of audio.
@@ -72,7 +72,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
     private int auxSends = 0;
     private int auxSends = 0;
     private int reverbFx = -1;
     private int reverbFx = -1;
     private int reverbFxSlot = -1;
     private int reverbFxSlot = -1;
-    
+
     // Fill streaming sources every 50 ms
     // Fill streaming sources every 50 ms
     private static final float UPDATE_RATE = 0.05f;
     private static final float UPDATE_RATE = 0.05f;
     private final Thread decoderThread = new Thread(this, THREAD_NAME);
     private final Thread decoderThread = new Thread(this, THREAD_NAME);
@@ -81,13 +81,13 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
     private final AL al;
     private final AL al;
     private final ALC alc;
     private final ALC alc;
     private final EFX efx;
     private final EFX efx;
-    
+
     public ALAudioRenderer(AL al, ALC alc, EFX efx) {
     public ALAudioRenderer(AL al, ALC alc, EFX efx) {
         this.al = al;
         this.al = al;
         this.alc = alc;
         this.alc = alc;
         this.efx = efx;
         this.efx = efx;
     }
     }
-    
+
     private void initOpenAL() {
     private void initOpenAL() {
         try {
         try {
             if (!alc.isCreated()) {
             if (!alc.isCreated()) {
@@ -120,15 +120,15 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
 
 
         final String deviceName = alc.alcGetString(ALC.ALC_DEVICE_SPECIFIER);
         final String deviceName = alc.alcGetString(ALC.ALC_DEVICE_SPECIFIER);
 
 
-        logger.log(Level.INFO, "Audio Renderer Information\n" +
-                        " * Device: {0}\n" +
-                        " * Vendor: {1}\n" +
-                        " * Renderer: {2}\n" +
-                        " * Version: {3}\n" +
-                        " * Supported channels: {4}\n" +
-                        " * ALC extensions: {5}\n" +
-                        " * AL extensions: {6}",
-                new Object[]{
+        logger.log(Level.INFO, "Audio Renderer Information\n"
+                + " * Device: {0}\n"
+                + " * Vendor: {1}\n"
+                + " * Renderer: {2}\n"
+                + " * Version: {3}\n"
+                + " * Supported channels: {4}\n"
+                + " * ALC extensions: {5}\n"
+                + " * AL extensions: {6}",
+                new Object[] {
                         deviceName,
                         deviceName,
                         al.alGetString(AL_VENDOR),
                         al.alGetString(AL_VENDOR),
                         al.alGetString(AL_RENDERER),
                         al.alGetString(AL_RENDERER),
@@ -181,7 +181,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
             logger.log(Level.WARNING, "OpenAL EFX not available! Audio effects won't work.");
             logger.log(Level.WARNING, "OpenAL EFX not available! Audio effects won't work.");
         }
         }
     }
     }
-    
+
     private void destroyOpenAL() {
     private void destroyOpenAL() {
         if (audioDisabled) {
         if (audioDisabled) {
             alc.destroyALC();
             alc.destroyALC();
@@ -224,7 +224,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
         if (decoderThread.isAlive()) {
         if (decoderThread.isAlive()) {
             throw new IllegalStateException("Initialize already called");
             throw new IllegalStateException("Initialize already called");
         }
         }
-        
+
         // Initialize OpenAL context.
         // Initialize OpenAL context.
         initOpenAL();
         initOpenAL();
 
 
@@ -279,13 +279,13 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
         if (!decoderThread.isAlive()) {
         if (!decoderThread.isAlive()) {
             return;
             return;
         }
         }
-        
+
         decoderThread.interrupt();
         decoderThread.interrupt();
         try {
         try {
             decoderThread.join();
             decoderThread.join();
         } catch (InterruptedException ex) {
         } catch (InterruptedException ex) {
         }
         }
-        
+
         // destroy OpenAL context
         // destroy OpenAL context
         destroyOpenAL();
         destroyOpenAL();
     }
     }
@@ -321,51 +321,51 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
             if (audioDisabled) {
             if (audioDisabled) {
                 return 0;
                 return 0;
             }
             }
-            
+
             // See comment in updateSourceParam().
             // See comment in updateSourceParam().
             if (src.getChannel() < 0) {
             if (src.getChannel() < 0) {
                 return 0;
                 return 0;
             }
             }
-            
+
             int id = channels[src.getChannel()];
             int id = channels[src.getChannel()];
             AudioData data = src.getAudioData();
             AudioData data = src.getAudioData();
             int playbackOffsetBytes = 0;
             int playbackOffsetBytes = 0;
-            
+
             if (data instanceof AudioStream) {
             if (data instanceof AudioStream) {
-                // Because audio streams are processed in buffer chunks, 
+                // Because audio streams are processed in buffer chunks,
                 // we have to compute the amount of time the stream was already
                 // we have to compute the amount of time the stream was already
                 // been playing based on the number of buffers that were processed.
                 // been playing based on the number of buffers that were processed.
                 AudioStream stream = (AudioStream) data;
                 AudioStream stream = (AudioStream) data;
-                
+
                 // NOTE: the assumption is that all enqueued buffers are the same size.
                 // NOTE: the assumption is that all enqueued buffers are the same size.
                 //       this is currently enforced by fillBuffer().
                 //       this is currently enforced by fillBuffer().
-                
+
                 // The number of unenqueued bytes that the decoder thread
                 // The number of unenqueued bytes that the decoder thread
                 // keeps track of.
                 // keeps track of.
                 int unqueuedBytes = stream.getUnqueuedBufferBytes();
                 int unqueuedBytes = stream.getUnqueuedBufferBytes();
-                
+
                 // Additional processed buffers that the decoder thread
                 // Additional processed buffers that the decoder thread
                 // did not unenqueue yet (it only updates 20 times per second).
                 // did not unenqueue yet (it only updates 20 times per second).
                 int unqueuedBytesExtra = al.alGetSourcei(id, AL_BUFFERS_PROCESSED) * BUFFER_SIZE;
                 int unqueuedBytesExtra = al.alGetSourcei(id, AL_BUFFERS_PROCESSED) * BUFFER_SIZE;
-                
+
                 // Total additional bytes that need to be considered.
                 // Total additional bytes that need to be considered.
                 playbackOffsetBytes = unqueuedBytes; // + unqueuedBytesExtra;
                 playbackOffsetBytes = unqueuedBytes; // + unqueuedBytesExtra;
             }
             }
-            
+
             // Add byte offset from source (for both streams and buffers)
             // Add byte offset from source (for both streams and buffers)
             playbackOffsetBytes += al.alGetSourcei(id, AL_BYTE_OFFSET);
             playbackOffsetBytes += al.alGetSourcei(id, AL_BYTE_OFFSET);
-            
+
             // Compute time value from bytes
             // Compute time value from bytes
             // E.g. for 44100 source with 2 channels and 16 bits per sample:
             // E.g. for 44100 source with 2 channels and 16 bits per sample:
             //    (44100 * 2 * 16 / 8) = 176400
             //    (44100 * 2 * 16 / 8) = 176400
-            int bytesPerSecond = (data.getSampleRate() * 
-                                  data.getChannels() * 
-                                  data.getBitsPerSample() / 8);
-            
-            return (float)playbackOffsetBytes / bytesPerSecond;
+            int bytesPerSecond = (data.getSampleRate()
+                    * data.getChannels()
+                    * data.getBitsPerSample() / 8);
+
+            return (float) playbackOffsetBytes / bytesPerSecond;
         }
         }
     }
     }
-    
+
     @Override
     @Override
     public void updateSourceParam(AudioSource src, AudioParam param) {
     public void updateSourceParam(AudioSource src, AudioParam param) {
         checkDead();
         checkDead();
@@ -381,7 +381,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
             // still has a channel value but the audio thread may
             // still has a channel value but the audio thread may
             // clear that channel before setVolume() gets to call
             // clear that channel before setVolume() gets to call
             // updateSourceParam() (because the audio stopped playing
             // updateSourceParam() (because the audio stopped playing
-            // on its own right as the volume was set).  In this case, 
+            // on its own right as the volume was set).  In this case,
             // it should be safe to just ignore the update.
             // it should be safe to just ignore the update.
             if (src.getChannel() < 0) {
             if (src.getChannel() < 0) {
                 return;
                 return;
@@ -453,7 +453,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
                         al.alSourcei(id, AL_SOURCE_RELATIVE, AL_TRUE);
                         al.alSourcei(id, AL_SOURCE_RELATIVE, AL_TRUE);
                         al.alSource3f(id, AL_POSITION, 0, 0, 0);
                         al.alSource3f(id, AL_POSITION, 0, 0, 0);
                         al.alSource3f(id, AL_VELOCITY, 0, 0, 0);
                         al.alSource3f(id, AL_VELOCITY, 0, 0, 0);
-                        
+
                         // Disable reverb
                         // Disable reverb
                         al.alSource3i(id, EFX.AL_AUXILIARY_SEND_FILTER, 0, 0, EFX.AL_FILTER_NULL);
                         al.alSource3i(id, EFX.AL_AUXILIARY_SEND_FILTER, 0, 0, EFX.AL_FILTER_NULL);
                     } else {
                     } else {
@@ -717,34 +717,34 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
         boolean success = false;
         boolean success = false;
         int processed = al.alGetSourcei(sourceId, AL_BUFFERS_PROCESSED);
         int processed = al.alGetSourcei(sourceId, AL_BUFFERS_PROCESSED);
         int unqueuedBufferBytes = 0;
         int unqueuedBufferBytes = 0;
-        
+
         for (int i = 0; i < processed; i++) {
         for (int i = 0; i < processed; i++) {
             int buffer;
             int buffer;
 
 
             ib.position(0).limit(1);
             ib.position(0).limit(1);
             al.alSourceUnqueueBuffers(sourceId, 1, ib);
             al.alSourceUnqueueBuffers(sourceId, 1, ib);
             buffer = ib.get(0);
             buffer = ib.get(0);
-            
-            // XXX: assume that reading from AudioStream always 
+
+            // XXX: assume that reading from AudioStream always
             // gives BUFFER_SIZE amount of bytes! This might not always
             // gives BUFFER_SIZE amount of bytes! This might not always
             // be the case...
             // be the case...
             unqueuedBufferBytes += BUFFER_SIZE;
             unqueuedBufferBytes += BUFFER_SIZE;
-            
+
             boolean active = fillBuffer(stream, buffer);
             boolean active = fillBuffer(stream, buffer);
-            
+
             if (!active && !stream.isEOF()) {
             if (!active && !stream.isEOF()) {
                 throw new AssertionError();
                 throw new AssertionError();
             }
             }
-            
+
             if (!active && looping) {
             if (!active && looping) {
                 stream.setTime(0);
                 stream.setTime(0);
                 active = fillBuffer(stream, buffer);
                 active = fillBuffer(stream, buffer);
                 if (!active) {
                 if (!active) {
-                    throw new IllegalStateException("Looping streaming source " +
-                            "was rewound but could not be filled");
+                    throw new IllegalStateException("Looping streaming source "
+                            + "was rewound but could not be filled");
                 }
                 }
             }
             }
-            
+
             if (active) {
             if (active) {
                 ib.position(0).limit(1);
                 ib.position(0).limit(1);
                 ib.put(0, buffer);
                 ib.put(0, buffer);
@@ -756,7 +756,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
                 break;
                 break;
             }
             }
         }
         }
-        
+
         stream.setUnqueuedBufferBytes(stream.getUnqueuedBufferBytes() + unqueuedBufferBytes);
         stream.setUnqueuedBufferBytes(stream.getUnqueuedBufferBytes() + unqueuedBufferBytes);
 
 
         return success;
         return success;
@@ -764,15 +764,15 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
 
 
     private void attachStreamToSource(int sourceId, AudioStream stream, boolean looping) {
     private void attachStreamToSource(int sourceId, AudioStream stream, boolean looping) {
         boolean success = false;
         boolean success = false;
-        
-        // Reset the stream. Typically happens if it finished playing on 
-        // its own and got reclaimed. 
+
+        // Reset the stream. Typically happens if it finished playing on
+        // its own and got reclaimed.
         // Note that AudioNode.stop() already resets the stream
         // Note that AudioNode.stop() already resets the stream
         // since it might not be at the EOF when stopped.
         // since it might not be at the EOF when stopped.
         if (stream.isEOF()) {
         if (stream.isEOF()) {
             stream.setTime(0);
             stream.setTime(0);
         }
         }
-        
+
         for (int id : stream.getIds()) {
         for (int id : stream.getIds()) {
             boolean active = fillBuffer(stream, id);
             boolean active = fillBuffer(stream, id);
             if (!active && !stream.isEOF()) {
             if (!active && !stream.isEOF()) {
@@ -782,8 +782,8 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
                 stream.setTime(0);
                 stream.setTime(0);
                 active = fillBuffer(stream, id);
                 active = fillBuffer(stream, id);
                 if (!active) {
                 if (!active) {
-                    throw new IllegalStateException("Looping streaming source " +
-                            "was rewound but could not be filled");
+                    throw new IllegalStateException("Looping streaming source "
+                            + "was rewound but could not be filled");
                 }
                 }
             }
             }
             if (active) {
             if (active) {
@@ -793,7 +793,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
                 success = true;
                 success = true;
             }
             }
         }
         }
-        
+
         if (!success) {
         if (!success) {
             // should never happen
             // should never happen
             throw new IllegalStateException("No valid data could be read from stream");
             throw new IllegalStateException("No valid data could be read from stream");
@@ -822,7 +822,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
 
 
             int sourceId = channels[index];
             int sourceId = channels[index];
             al.alSourceStop(sourceId);
             al.alSourceStop(sourceId);
-            
+
             // For streaming sources, this will clear all queued buffers.
             // For streaming sources, this will clear all queued buffers.
             al.alSourcei(sourceId, AL_BUFFER, 0);
             al.alSourcei(sourceId, AL_BUFFER, 0);
 
 
@@ -840,7 +840,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
             chanSrcs[index] = null;
             chanSrcs[index] = null;
         }
         }
     }
     }
-    
+
     private AudioSource.Status convertStatus(int oalStatus) {
     private AudioSource.Status convertStatus(int oalStatus) {
         switch (oalStatus) {
         switch (oalStatus) {
             case AL_INITIAL:
             case AL_INITIAL:
@@ -889,10 +889,10 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
         if (audioDisabled) {
         if (audioDisabled) {
             return;
             return;
         }
         }
-        
+
         for (int i = 0; i < channels.length; i++) {
         for (int i = 0; i < channels.length; i++) {
             AudioSource src = chanSrcs[i];
             AudioSource src = chanSrcs[i];
-            
+
             if (src == null) {
             if (src == null) {
                 continue;
                 continue;
             }
             }
@@ -900,11 +900,11 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
             int sourceId = channels[i];
             int sourceId = channels[i];
             boolean boundSource = i == src.getChannel();
             boolean boundSource = i == src.getChannel();
             boolean reclaimChannel = false;
             boolean reclaimChannel = false;
-            
+
             Status oalStatus = convertStatus(al.alGetSourcei(sourceId, AL_SOURCE_STATE));
             Status oalStatus = convertStatus(al.alGetSourcei(sourceId, AL_SOURCE_STATE));
-            
+
             if (!boundSource) {
             if (!boundSource) {
-                // Rules for instanced playback vary significantly. 
+                // Rules for instanced playback vary significantly.
                 // Handle it here.
                 // Handle it here.
                 if (oalStatus == Status.Stopped) {
                 if (oalStatus == Status.Stopped) {
                     // Instanced audio stopped playing. Reclaim channel.
                     // Instanced audio stopped playing. Reclaim channel.
@@ -913,26 +913,26 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
                 } else if (oalStatus == Status.Paused) {
                 } else if (oalStatus == Status.Paused) {
                     throw new AssertionError("Instanced audio cannot be paused");
                     throw new AssertionError("Instanced audio cannot be paused");
                 }
                 }
-                
+
                 continue;
                 continue;
             }
             }
-            
+
             Status jmeStatus = src.getStatus();
             Status jmeStatus = src.getStatus();
-            
+
             // Check if we need to sync JME status with OAL status.
             // Check if we need to sync JME status with OAL status.
             if (oalStatus != jmeStatus) {
             if (oalStatus != jmeStatus) {
                 if (oalStatus == Status.Stopped && jmeStatus == Status.Playing) {
                 if (oalStatus == Status.Stopped && jmeStatus == Status.Playing) {
                     // Maybe we need to reclaim the channel.
                     // Maybe we need to reclaim the channel.
                     if (src.getAudioData() instanceof AudioStream) {
                     if (src.getAudioData() instanceof AudioStream) {
                         AudioStream stream = (AudioStream) src.getAudioData();
                         AudioStream stream = (AudioStream) src.getAudioData();
-                        
+
                         if (stream.isEOF() && !src.isLooping()) {
                         if (stream.isEOF() && !src.isLooping()) {
                             // Stream finished playing
                             // Stream finished playing
                             reclaimChannel = true;
                             reclaimChannel = true;
                         } else {
                         } else {
-                            // Stream still has data. 
+                            // Stream still has data.
                             // Buffer starvation occurred.
                             // Buffer starvation occurred.
-                            // Audio decoder thread will fill the data 
+                            // Audio decoder thread will fill the data
                             // and start the channel again.
                             // and start the channel again.
                         }
                         }
                     } else {
                     } else {
@@ -945,7 +945,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
 
 
                         reclaimChannel = true;
                         reclaimChannel = true;
                     }
                     }
-                    
+
                     if (reclaimChannel) {
                     if (reclaimChannel) {
                         src.setStatus(Status.Stopped);
                         src.setStatus(Status.Stopped);
                         src.setChannel(-1);
                         src.setChannel(-1);
@@ -956,7 +956,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
                     // jME3 state does not match OAL state.
                     // jME3 state does not match OAL state.
                     // This is only relevant for bound sources.
                     // This is only relevant for bound sources.
                     throw new AssertionError("Unexpected sound status. "
                     throw new AssertionError("Unexpected sound status. "
-                                            + "OAL: " + oalStatus 
+                                            + "OAL: " + oalStatus
                                             + ", JME: " + jmeStatus);
                                             + ", JME: " + jmeStatus);
                 }
                 }
             } else {
             } else {
@@ -967,7 +967,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
             }
             }
         }
         }
     }
     }
-    
+
     public void updateInDecoderThread(float tpf) {
     public void updateInDecoderThread(float tpf) {
         if (audioDisabled) {
         if (audioDisabled) {
             return;
             return;
@@ -975,7 +975,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
 
 
         for (int i = 0; i < channels.length; i++) {
         for (int i = 0; i < channels.length; i++) {
             AudioSource src = chanSrcs[i];
             AudioSource src = chanSrcs[i];
-            
+
             if (src == null || !(src.getAudioData() instanceof AudioStream)) {
             if (src == null || !(src.getAudioData() instanceof AudioStream)) {
                 continue;
                 continue;
             }
             }
@@ -1030,13 +1030,13 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
             setListenerParams(listener);
             setListenerParams(listener);
         }
         }
     }
     }
-    
+
     @Override
     @Override
     public void pauseAll() {
     public void pauseAll() {
         if (!supportPauseDevice) {
         if (!supportPauseDevice) {
             throw new UnsupportedOperationException("Pause device is NOT supported!");
             throw new UnsupportedOperationException("Pause device is NOT supported!");
         }
         }
-        
+
         alc.alcDevicePauseSOFT();
         alc.alcDevicePauseSOFT();
     }
     }
 
 
@@ -1045,7 +1045,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
         if (!supportPauseDevice) {
         if (!supportPauseDevice) {
             throw new UnsupportedOperationException("Pause device is NOT supported!");
             throw new UnsupportedOperationException("Pause device is NOT supported!");
         }
         }
-        
+
         alc.alcDeviceResumeSOFT();
         alc.alcDeviceResumeSOFT();
     }
     }
 
 
@@ -1101,7 +1101,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
                 // Assertion removed because it seems it's not possible to have
                 // Assertion removed because it seems it's not possible to have
                 // something different from -1 when first playing an AudioNode.
                 // something different from -1 when first playing an AudioNode.
                 // assert src.getChannel() != -1;
                 // assert src.getChannel() != -1;
-                
+
                 // allocate channel to this source
                 // allocate channel to this source
                 int index = newChannel();
                 int index = newChannel();
                 if (index == -1) {
                 if (index == -1) {
@@ -1158,11 +1158,11 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
                 src.setChannel(-1);
                 src.setChannel(-1);
                 clearChannel(chan);
                 clearChannel(chan);
                 freeChannel(chan);
                 freeChannel(chan);
-                
+
                 if (src.getAudioData() instanceof AudioStream) {
                 if (src.getAudioData() instanceof AudioStream) {
                     // If the stream is seekable, then rewind it.
                     // If the stream is seekable, then rewind it.
                     // Otherwise, close it, as it is no longer valid.
                     // Otherwise, close it, as it is no longer valid.
-                    AudioStream stream = (AudioStream)src.getAudioData();
+                    AudioStream stream = (AudioStream) src.getAudioData();
                     if (stream.isSeekable()) {
                     if (stream.isSeekable()) {
                         stream.setTime(0);
                         stream.setTime(0);
                     } else {
                     } else {

+ 67 - 68
jme3-core/src/main/java/com/jme3/bounding/BoundingSphere.java

@@ -177,9 +177,9 @@ public class BoundingSphere extends BoundingVolume {
      * Calculates a minimum bounding sphere for the set of points. The algorithm
      * Calculates a minimum bounding sphere for the set of points. The algorithm
      * was originally found in C++ at <br>
      * was originally found in C++ at <br>
      * <a href="http://flipcode.com/archives/Smallest_Enclosing_Spheres.shtml">
      * <a href="http://flipcode.com/archives/Smallest_Enclosing_Spheres.shtml">
-     * http://flipcode.com/archives/Smallest_Enclosing_Spheres.shtml</a> <br> 
+     * http://flipcode.com/archives/Smallest_Enclosing_Spheres.shtml</a> <br>
      * and translated to java by Cep21
      * and translated to java by Cep21
-     *  
+     *
      * @param points
      * @param points
      *            The points to calculate the minimum bounds from.
      *            The points to calculate the minimum bounds from.
      */
      */
@@ -812,39 +812,39 @@ public class BoundingSphere extends BoundingVolume {
         }
         }
         return 1;
         return 1;
     }
     }
-    
+
     private int collideWithTri(Triangle tri, CollisionResults results) {
     private int collideWithTri(Triangle tri, CollisionResults results) {
         TempVars tvars = TempVars.get();
         TempVars tvars = TempVars.get();
         try {
         try {
-        
+
             // Much of this is based on adaptation from this algorithm:
             // Much of this is based on adaptation from this algorithm:
             // http://realtimecollisiondetection.net/blog/?p=103
             // http://realtimecollisiondetection.net/blog/?p=103
             // ...mostly the stuff about eliminating sqrts wherever
             // ...mostly the stuff about eliminating sqrts wherever
             // possible.
             // possible.
-    
+
             // Math is done in center-relative space.
             // Math is done in center-relative space.
             Vector3f a = tri.get1().subtract(center, tvars.vect1);
             Vector3f a = tri.get1().subtract(center, tvars.vect1);
             Vector3f b = tri.get2().subtract(center, tvars.vect2);
             Vector3f b = tri.get2().subtract(center, tvars.vect2);
             Vector3f c = tri.get3().subtract(center, tvars.vect3);
             Vector3f c = tri.get3().subtract(center, tvars.vect3);
-            
+
             Vector3f ab = b.subtract(a, tvars.vect4);
             Vector3f ab = b.subtract(a, tvars.vect4);
             Vector3f ac = c.subtract(a, tvars.vect5);
             Vector3f ac = c.subtract(a, tvars.vect5);
-            
+
             // Check the plane... if it doesn't intersect the plane
             // Check the plane... if it doesn't intersect the plane
             // then it doesn't intersect the triangle.
             // then it doesn't intersect the triangle.
             Vector3f n = ab.cross(ac, tvars.vect6);
             Vector3f n = ab.cross(ac, tvars.vect6);
             float d = a.dot(n);
             float d = a.dot(n);
-            float e = n.dot(n);                        
-            if( d * d > radius * radius * e ) {
+            float e = n.dot(n);
+            if (d * d > radius * radius * e) {
                 // Can't possibly intersect
                 // Can't possibly intersect
                 return 0;
                 return 0;
             }
             }
-                
+
             // We intersect the verts, or the edges, or the face...
             // We intersect the verts, or the edges, or the face...
-    
+
             // First check against the face since it's the most
             // First check against the face since it's the most
             // specific.
             // specific.
-    
+
             // Calculate the barycentric coordinates of the
             // Calculate the barycentric coordinates of the
             // sphere center
             // sphere center
             Vector3f v0 = ac;
             Vector3f v0 = ac;
@@ -852,163 +852,163 @@ public class BoundingSphere extends BoundingVolume {
             // a was P relative, so p.subtract(a) is just -a
             // a was P relative, so p.subtract(a) is just -a
             // instead of wasting a vector we'll just negate the
             // instead of wasting a vector we'll just negate the
             // dot products below... it's all v2 is used for.
             // dot products below... it's all v2 is used for.
-            Vector3f v2 = a; 
-            
+            Vector3f v2 = a;
+
             float dot00 = v0.dot(v0);
             float dot00 = v0.dot(v0);
             float dot01 = v0.dot(v1);
             float dot01 = v0.dot(v1);
             float dot02 = -v0.dot(v2);
             float dot02 = -v0.dot(v2);
             float dot11 = v1.dot(v1);
             float dot11 = v1.dot(v1);
             float dot12 = -v1.dot(v2);
             float dot12 = -v1.dot(v2);
-            
+
             float invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
             float invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
             float u = (dot11 * dot02 - dot01 * dot12) * invDenom;
             float u = (dot11 * dot02 - dot01 * dot12) * invDenom;
             float v = (dot00 * dot12 - dot01 * dot02) * invDenom;
             float v = (dot00 * dot12 - dot01 * dot02) * invDenom;
-            
-            if( u >= 0 && v >= 0 && (u + v) <= 1 ) {
+
+            if (u >= 0 && v >= 0 && (u + v) <= 1) {
                 // We intersect... and we even know where
                 // We intersect... and we even know where
                 Vector3f part1 = ac;
                 Vector3f part1 = ac;
                 Vector3f part2 = ab;
                 Vector3f part2 = ab;
-                Vector3f p = center.add(a.add(part1.mult(u)).addLocal(part2.mult(v))); 
-    
+                Vector3f p = center.add(a.add(part1.mult(u)).addLocal(part2.mult(v)));
+
                 CollisionResult r = new CollisionResult();
                 CollisionResult r = new CollisionResult();
-                Vector3f normal = n.normalize();                                               
+                Vector3f normal = n.normalize();
                 float dist = -normal.dot(a);  // a is center relative, so -a points to center
                 float dist = -normal.dot(a);  // a is center relative, so -a points to center
                 dist = dist - radius;
                 dist = dist - radius;
-                
+
                 r.setDistance(dist);
                 r.setDistance(dist);
                 r.setContactNormal(normal);
                 r.setContactNormal(normal);
                 r.setContactPoint(p);
                 r.setContactPoint(p);
                 results.addCollision(r);
                 results.addCollision(r);
                 return 1;
                 return 1;
             }
             }
-    
+
             // Check the edges looking for the nearest point
             // Check the edges looking for the nearest point
             // that is also less than the radius.  We don't care
             // that is also less than the radius.  We don't care
             // about points that are farther away than that.
             // about points that are farther away than that.
             Vector3f nearestPt = null;
             Vector3f nearestPt = null;
-            float nearestDist = radius * radius; 
-            
+            float nearestDist = radius * radius;
+
             Vector3f base;
             Vector3f base;
             Vector3f edge;
             Vector3f edge;
             float t;
             float t;
-            
+
             // Edge AB
             // Edge AB
             base = a;
             base = a;
-            edge = ab;        
-    
+            edge = ab;
+
             t = -edge.dot(base) / edge.dot(edge);
             t = -edge.dot(base) / edge.dot(edge);
-            if( t >= 0 && t <= 1 ) {
+            if (t >= 0 && t <= 1) {
                 Vector3f Q = base.add(edge.mult(t, tvars.vect7), tvars.vect8);
                 Vector3f Q = base.add(edge.mult(t, tvars.vect7), tvars.vect8);
                 float distSq = Q.dot(Q); // distance squared to origin
                 float distSq = Q.dot(Q); // distance squared to origin
-                if( distSq < nearestDist ) {
+                if (distSq < nearestDist) {
                     nearestPt = Q;
                     nearestPt = Q;
                     nearestDist = distSq;
                     nearestDist = distSq;
                 }
                 }
             }
             }
-            
+
             // Edge AC
             // Edge AC
             base = a;
             base = a;
             edge = ac;
             edge = ac;
-    
+
             t = -edge.dot(base) / edge.dot(edge);
             t = -edge.dot(base) / edge.dot(edge);
-            if( t >= 0 && t <= 1 ) {
+            if (t >= 0 && t <= 1) {
                 Vector3f Q = base.add(edge.mult(t, tvars.vect7), tvars.vect9);
                 Vector3f Q = base.add(edge.mult(t, tvars.vect7), tvars.vect9);
                 float distSq = Q.dot(Q); // distance squared to origin
                 float distSq = Q.dot(Q); // distance squared to origin
-                if( distSq < nearestDist ) {
+                if (distSq < nearestDist) {
                     nearestPt = Q;
                     nearestPt = Q;
                     nearestDist = distSq;
                     nearestDist = distSq;
                 }
                 }
             }
             }
-            
+
             // Edge BC
             // Edge BC
             base = b;
             base = b;
-            Vector3f bc = c.subtract(b); 
-            edge = bc; 
-    
+            Vector3f bc = c.subtract(b);
+            edge = bc;
+
             t = -edge.dot(base) / edge.dot(edge);
             t = -edge.dot(base) / edge.dot(edge);
-            if( t >= 0 && t <= 1 ) {
+            if (t >= 0 && t <= 1) {
                 Vector3f Q = base.add(edge.mult(t, tvars.vect7), tvars.vect10);
                 Vector3f Q = base.add(edge.mult(t, tvars.vect7), tvars.vect10);
                 float distSq = Q.dot(Q); // distance squared to origin
                 float distSq = Q.dot(Q); // distance squared to origin
-                if( distSq < nearestDist ) {
+                if (distSq < nearestDist) {
                     nearestPt = Q;
                     nearestPt = Q;
                     nearestDist = distSq;
                     nearestDist = distSq;
                 }
                 }
             }
             }
-    
+
             // If we have a point at all then it is going to be
             // If we have a point at all then it is going to be
             // closer than any vertex to center distance... so we're
             // closer than any vertex to center distance... so we're
-            // done.       
-            if( nearestPt != null ) {
+            // done.
+            if (nearestPt != null) {
                 // We have a hit
                 // We have a hit
                 float dist = FastMath.sqrt(nearestDist);
                 float dist = FastMath.sqrt(nearestDist);
                 Vector3f cn = nearestPt.divide(-dist);
                 Vector3f cn = nearestPt.divide(-dist);
-                
-                CollisionResult r = new CollisionResult();                                
+
+                CollisionResult r = new CollisionResult();
                 r.setDistance(dist - radius);
                 r.setDistance(dist - radius);
                 r.setContactNormal(cn);
                 r.setContactNormal(cn);
                 r.setContactPoint(nearestPt.add(center));
                 r.setContactPoint(nearestPt.add(center));
                 results.addCollision(r);
                 results.addCollision(r);
-                
-                return 1;              
+
+                return 1;
             }
             }
- 
+
             // Finally, check each of the triangle corners.
             // Finally, check each of the triangle corners.
-            
+
             // Vert A
             // Vert A
             base = a;
             base = a;
             t = base.dot(base); // distance squared to origin
             t = base.dot(base); // distance squared to origin
-            if( t < nearestDist ) {
+            if (t < nearestDist) {
                 nearestDist = t;
                 nearestDist = t;
                 nearestPt = base;
                 nearestPt = base;
             }
             }
-            
+
             // Vert B
             // Vert B
             base = b;
             base = b;
             t = base.dot(base); // distance squared to origin
             t = base.dot(base); // distance squared to origin
-            if( t < nearestDist ) {
+            if (t < nearestDist) {
                 nearestDist = t;
                 nearestDist = t;
                 nearestPt = base;
                 nearestPt = base;
             }
             }
-    
+
             // Vert C
             // Vert C
             base = c;
             base = c;
             t = base.dot(base); // distance squared to origin
             t = base.dot(base); // distance squared to origin
-            if( t < nearestDist ) {
+            if (t < nearestDist) {
                 nearestDist = t;
                 nearestDist = t;
                 nearestPt = base;
                 nearestPt = base;
             }
             }
-    
-            if( nearestPt != null ) {
+
+            if (nearestPt != null) {
                 // We have a hit
                 // We have a hit
                 float dist = FastMath.sqrt(nearestDist);
                 float dist = FastMath.sqrt(nearestDist);
                 Vector3f cn = nearestPt.divide(-dist);
                 Vector3f cn = nearestPt.divide(-dist);
-                
-                CollisionResult r = new CollisionResult();                                
+
+                CollisionResult r = new CollisionResult();
                 r.setDistance(dist - radius);
                 r.setDistance(dist - radius);
                 r.setContactNormal(cn);
                 r.setContactNormal(cn);
                 r.setContactPoint(nearestPt.add(center));
                 r.setContactPoint(nearestPt.add(center));
                 results.addCollision(r);
                 results.addCollision(r);
-                
-                return 1;              
+
+                return 1;
             }
             }
-            
-            // Nothing hit... oh, well 
+
+            // Nothing hit... oh, well
             return 0;
             return 0;
         } finally {
         } finally {
             tvars.release();
             tvars.release();
         }
         }
     }
     }
-    
+
     @Override
     @Override
     public int collideWith(Collidable other, CollisionResults results) {
     public int collideWith(Collidable other, CollisionResults results) {
         if (other instanceof Ray) {
         if (other instanceof Ray) {
             Ray ray = (Ray) other;
             Ray ray = (Ray) other;
             return collideWithRay(ray, results);
             return collideWithRay(ray, results);
-        } else if (other instanceof Triangle){
+        } else if (other instanceof Triangle) {
             Triangle t = (Triangle) other;
             Triangle t = (Triangle) other;
             return collideWithTri(t, results);
             return collideWithTri(t, results);
         } else if (other instanceof BoundingVolume) {
         } else if (other instanceof BoundingVolume) {
-            if (intersects((BoundingVolume)other)) {
+            if (intersects((BoundingVolume) other)) {
                 CollisionResult result = new CollisionResult();
                 CollisionResult result = new CollisionResult();
                 results.addCollision(result);
                 results.addCollision(result);
                 return 1;
                 return 1;
@@ -1026,16 +1026,15 @@ public class BoundingSphere extends BoundingVolume {
         if (other instanceof Ray) {
         if (other instanceof Ray) {
             Ray ray = (Ray) other;
             Ray ray = (Ray) other;
             return collideWithRay(ray);
             return collideWithRay(ray);
-        } else if (other instanceof Triangle){
+        } else if (other instanceof Triangle) {
             return super.collideWith(other);
             return super.collideWith(other);
         } else if (other instanceof BoundingVolume) {
         } else if (other instanceof BoundingVolume) {
-            return intersects((BoundingVolume)other) ? 1 : 0;
+            return intersects((BoundingVolume) other) ? 1 : 0;
         } else {
         } else {
             throw new UnsupportedCollisionException();
             throw new UnsupportedCollisionException();
         }
         }
     }
     }
 
 
-    
     @Override
     @Override
     public boolean contains(Vector3f point) {
     public boolean contains(Vector3f point) {
         return center.distanceSquared(point) < (getRadius() * getRadius());
         return center.distanceSquared(point) < (getRadius() * getRadius());
@@ -1075,4 +1074,4 @@ public class BoundingSphere extends BoundingVolume {
     public float getVolume() {
     public float getVolume() {
         return 4 * FastMath.ONE_THIRD * FastMath.PI * radius * radius * radius;
         return 4 * FastMath.ONE_THIRD * FastMath.PI * radius * radius * radius;
     }
     }
-}
+}

+ 24 - 24
jme3-core/src/main/java/com/jme3/bounding/Intersection.java

@@ -42,7 +42,7 @@ import static java.lang.Math.min;
 /**
 /**
  * This class includes some utility methods for computing intersection
  * This class includes some utility methods for computing intersection
  * between bounding volumes and triangles.
  * between bounding volumes and triangles.
- * 
+ *
  * @author Kirill
  * @author Kirill
  */
  */
 public final class Intersection {
 public final class Intersection {
@@ -62,36 +62,40 @@ public final class Intersection {
             vars.release();
             vars.release();
         }
         }
     }
     }
-    
+
     public static boolean intersect(BoundingBox bbox, Vector3f center, float radius) {
     public static boolean intersect(BoundingBox bbox, Vector3f center, float radius) {
         assert Vector3f.isValidVector(center) && Vector3f.isValidVector(bbox.center);
         assert Vector3f.isValidVector(center) && Vector3f.isValidVector(bbox.center);
 
 
-        // Arvo's algorithm 
+        // Arvo's algorithm
         float distSqr = radius * radius;
         float distSqr = radius * radius;
-        
+
         float minX = bbox.center.x - bbox.xExtent;
         float minX = bbox.center.x - bbox.xExtent;
         float maxX = bbox.center.x + bbox.xExtent;
         float maxX = bbox.center.x + bbox.xExtent;
-        
+
         float minY = bbox.center.y - bbox.yExtent;
         float minY = bbox.center.y - bbox.yExtent;
         float maxY = bbox.center.y + bbox.yExtent;
         float maxY = bbox.center.y + bbox.yExtent;
-        
+
         float minZ = bbox.center.z - bbox.zExtent;
         float minZ = bbox.center.z - bbox.zExtent;
         float maxZ = bbox.center.z + bbox.zExtent;
         float maxZ = bbox.center.z + bbox.zExtent;
-        
-        if      (center.x < minX) distSqr -= FastMath.sqr(center.x - minX);
-        else if (center.x > maxX) distSqr -= FastMath.sqr(center.x - maxX);
-        
-        
-        if      (center.y < minY) distSqr -= FastMath.sqr(center.y - minY);
-        else if (center.y > maxY) distSqr -= FastMath.sqr(center.y - maxY);
-        
-        
-        if      (center.z < minZ) distSqr -= FastMath.sqr(center.z - minZ);
-        else if (center.z > maxZ) distSqr -= FastMath.sqr(center.z - maxZ);
-        
+
+        if (center.x < minX)
+            distSqr -= FastMath.sqr(center.x - minX);
+        else if (center.x > maxX)
+            distSqr -= FastMath.sqr(center.x - maxX);
+
+        if (center.y < minY)
+            distSqr -= FastMath.sqr(center.y - minY);
+        else if (center.y > maxY)
+            distSqr -= FastMath.sqr(center.y - maxY);
+
+        if (center.z < minZ)
+            distSqr -= FastMath.sqr(center.z - minZ);
+        else if (center.z > maxZ)
+            distSqr -= FastMath.sqr(center.z - maxZ);
+
         return distSqr > 0;
         return distSqr > 0;
     }
     }
-    
+
     private static final void findMinMax(float x0, float x1, float x2, Vector3f minMax) {
     private static final void findMinMax(float x0, float x1, float x2, Vector3f minMax) {
         minMax.set(x0, x0, 0);
         minMax.set(x0, x0, 0);
         if (x1 < minMax.x) {
         if (x1 < minMax.x) {
@@ -108,7 +112,7 @@ public final class Intersection {
         }
         }
     }
     }
 
 
-    public static boolean intersect(Camera camera, Vector3f center,float radius){
+    public static boolean intersect(Camera camera, Vector3f center, float radius) {
         for (int i = 5; i >= 0; i--) {
         for (int i = 5; i >= 0; i--) {
             if (camera.getWorldPlane(i).pseudoDistance(center) <= -radius) {
             if (camera.getWorldPlane(i).pseudoDistance(center) <= -radius) {
                 return false;
                 return false;
@@ -145,7 +149,6 @@ public final class Intersection {
 
 
         TempVars vars = TempVars.get();
         TempVars vars = TempVars.get();
 
 
-
         Vector3f tmp0 = vars.vect1,
         Vector3f tmp0 = vars.vect1,
                 tmp1 = vars.vect2,
                 tmp1 = vars.vect2,
                 tmp2 = vars.vect3;
                 tmp2 = vars.vect3;
@@ -179,8 +182,6 @@ public final class Intersection {
         float fey = FastMath.abs(e0.y);
         float fey = FastMath.abs(e0.y);
         float fez = FastMath.abs(e0.z);
         float fez = FastMath.abs(e0.z);
 
 
-
-
         //AXISTEST_X01(e0[Z], e0[Y], fez, fey);
         //AXISTEST_X01(e0[Z], e0[Y], fez, fey);
         p0 = e0.z * tmp0.y - e0.y * tmp0.z;
         p0 = e0.z * tmp0.y - e0.y * tmp0.z;
         p2 = e0.z * tmp2.y - e0.y * tmp2.z;
         p2 = e0.z * tmp2.y - e0.y * tmp2.z;
@@ -294,7 +295,6 @@ public final class Intersection {
         //  that direction -- this is equivalent to testing a minimal AABB around
         //  that direction -- this is equivalent to testing a minimal AABB around
         //  the triangle against the AABB
         //  the triangle against the AABB
 
 
-
         Vector3f minMax = vars.vect7;
         Vector3f minMax = vars.vect7;
 
 
         // test in X-direction
         // test in X-direction

+ 6 - 6
jme3-core/src/main/java/com/jme3/cinematic/Cinematic.java

@@ -277,8 +277,8 @@ public class Cinematic extends AbstractCinematicEvent implements AppState {
         for (CinematicEvent cinematicEvent : cinematicEvents) {
         for (CinematicEvent cinematicEvent : cinematicEvents) {
             cinematicEvent.initEvent(app, this);
             cinematicEvent.initEvent(app, this);
         }
         }
-        if(!cameras.isEmpty()){
-            for(CameraNode n : cameras.values()){
+        if (!cameras.isEmpty()) {
+            for (CameraNode n : cameras.values()) {
                 n.setCamera(app.getCamera());
                 n.setCamera(app.getCamera());
             }
             }
         }
         }
@@ -302,7 +302,7 @@ public class Cinematic extends AbstractCinematicEvent implements AppState {
      *
      *
      * @param id the desired ID
      * @param id the desired ID
      */
      */
-    protected void setId( String id ) {
+    protected void setId(String id) {
         this.id = id;
         this.id = id;
     }
     }
 
 
@@ -405,7 +405,7 @@ public class Cinematic extends AbstractCinematicEvent implements AppState {
         super.setTime(time);
         super.setTime(time);
 
 
         int keyFrameIndex = timeLine.getKeyFrameIndexFromTime(time);
         int keyFrameIndex = timeLine.getKeyFrameIndexFromTime(time);
-        //triggering all the event from start to "time" 
+        //triggering all the event from start to "time"
         //then computing timeOffset for each event
         //then computing timeOffset for each event
         for (int i = 0; i <= keyFrameIndex; i++) {
         for (int i = 0; i <= keyFrameIndex; i++) {
             KeyFrame keyFrame = timeLine.get(i);
             KeyFrame keyFrame = timeLine.get(i);
@@ -697,8 +697,8 @@ public class Cinematic extends AbstractCinematicEvent implements AppState {
      */
      */
     public void setScene(Node scene) {
     public void setScene(Node scene) {
         this.scene = scene;
         this.scene = scene;
-        if(!cameras.isEmpty()){
-            for(CameraNode n : cameras.values()){
+        if (!cameras.isEmpty()) {
+            for (CameraNode n : cameras.values()) {
                 this.scene.attachChild(n);
                 this.scene.attachChild(n);
             }
             }
         }
         }

+ 5 - 8
jme3-core/src/main/java/com/jme3/cinematic/KeyFrame.java

@@ -43,10 +43,9 @@ import java.util.List;
  */
  */
 public class KeyFrame implements Savable {
 public class KeyFrame implements Savable {
 
 
-    public KeyFrame(){
-        
+    public KeyFrame() {
     }
     }
-    
+
     List<CinematicEvent> cinematicEvents = new ArrayList<>();
     List<CinematicEvent> cinematicEvents = new ArrayList<>();
     private int index;
     private int index;
 
 
@@ -64,8 +63,8 @@ public class KeyFrame implements Savable {
         }
         }
         return cinematicEvents;
         return cinematicEvents;
     }
     }
-    
-    public boolean isEmpty(){
+
+    public boolean isEmpty() {
         return cinematicEvents.isEmpty();
         return cinematicEvents.isEmpty();
     }
     }
 
 
@@ -81,7 +80,7 @@ public class KeyFrame implements Savable {
     public void read(JmeImporter im) throws IOException {
     public void read(JmeImporter im) throws IOException {
         InputCapsule ic = im.getCapsule(this);
         InputCapsule ic = im.getCapsule(this);
         cinematicEvents = ic.readSavableArrayList("cinematicEvents", null);
         cinematicEvents = ic.readSavableArrayList("cinematicEvents", null);
-        index=ic.readInt("index", 0);
+        index = ic.readInt("index", 0);
     }
     }
 
 
     public int getIndex() {
     public int getIndex() {
@@ -91,6 +90,4 @@ public class KeyFrame implements Savable {
     public void setIndex(int index) {
     public void setIndex(int index) {
         this.index = index;
         this.index = index;
     }
     }
-
-
 }
 }

+ 4 - 5
jme3-core/src/main/java/com/jme3/cinematic/MotionPath.java

@@ -69,7 +69,7 @@ public class MotionPath implements Savable {
     }
     }
 
 
     /**
     /**
-     * interpolate the path giving the time since the beginning and the motionControl     
+     * interpolate the path giving the time since the beginning and the motionControl
      * this methods sets the new localTranslation to the spatial of the MotionEvent control.
      * this methods sets the new localTranslation to the spatial of the MotionEvent control.
      * @param time the time since the animation started
      * @param time the time since the animation started
      * @param control the control over the moving spatial
      * @param control the control over the moving spatial
@@ -87,7 +87,7 @@ public class MotionPath implements Savable {
         traveledDistance = time * (getLength() / control.getInitialDuration());
         traveledDistance = time * (getLength() / control.getInitialDuration());
 
 
         //getting waypoint index and current value from new traveled distance
         //getting waypoint index and current value from new traveled distance
-        v = getWayPointIndexForDistance(traveledDistance,v);
+        v = getWayPointIndexForDistance(traveledDistance, v);
 
 
         //setting values
         //setting values
         control.setCurrentWayPoint((int) v.x);
         control.setCurrentWayPoint((int) v.x);
@@ -108,7 +108,7 @@ public class MotionPath implements Savable {
 
 
     public void checkWayPoint(MotionEvent control, float tpf) {
     public void checkWayPoint(MotionEvent control, float tpf) {
         //Epsilon varies with the tpf to avoid missing a waypoint on low framerate.
         //Epsilon varies with the tpf to avoid missing a waypoint on low framerate.
-        float epsilon =  tpf * 4f;
+        float epsilon = tpf * 4f;
         if (control.getCurrentWayPoint() != prevWayPoint) {
         if (control.getCurrentWayPoint() != prevWayPoint) {
             if (control.getCurrentValue() >= 0f && control.getCurrentValue() < epsilon) {
             if (control.getCurrentValue() >= 0f && control.getCurrentValue() < epsilon) {
                 triggerWayPointReach(control.getCurrentWayPoint(), control);
                 triggerWayPointReach(control.getCurrentWayPoint(), control);
@@ -175,7 +175,6 @@ public class MotionPath implements Savable {
     public void read(JmeImporter im) throws IOException {
     public void read(JmeImporter im) throws IOException {
         InputCapsule in = im.getCapsule(this);
         InputCapsule in = im.getCapsule(this);
         spline = (Spline) in.readSavable("spline", null);
         spline = (Spline) in.readSavable("spline", null);
-
     }
     }
 
 
     /**
     /**
@@ -187,7 +186,7 @@ public class MotionPath implements Savable {
      */
      */
     public Vector2f getWayPointIndexForDistance(float distance, Vector2f store) {
     public Vector2f getWayPointIndexForDistance(float distance, Vector2f store) {
         float sum = 0;
         float sum = 0;
-        if(spline.getTotalLength() == 0){
+        if (spline.getTotalLength() == 0) {
             store.set(0, 0);
             store.set(0, 0);
             return store;
             return store;
         }
         }

+ 2 - 4
jme3-core/src/main/java/com/jme3/cinematic/TimeLine.java

@@ -81,8 +81,6 @@ public class TimeLine extends HashMap<Integer, KeyFrame> implements Savable {
             }
             }
         }
         }
     }
     }
-    
-    
 
 
     public void removeKeyFrame(float time) {
     public void removeKeyFrame(float time) {
         removeKeyFrame(getKeyFrameIndexFromTime(time));
         removeKeyFrame(getKeyFrameIndexFromTime(time));
@@ -91,9 +89,9 @@ public class TimeLine extends HashMap<Integer, KeyFrame> implements Savable {
     public int getKeyFrameIndexFromTime(float time) {
     public int getKeyFrameIndexFromTime(float time) {
         return Math.round(time * keyFramesPerSeconds);
         return Math.round(time * keyFramesPerSeconds);
     }
     }
-    
+
     public float getKeyFrameTime(KeyFrame keyFrame) {
     public float getKeyFrameTime(KeyFrame keyFrame) {
-        return keyFrame.getIndex()/(float)keyFramesPerSeconds;
+        return keyFrame.getIndex() / (float) keyFramesPerSeconds;
     }
     }
 
 
     public Collection<KeyFrame> getAllKeyFrames() {
     public Collection<KeyFrame> getAllKeyFrames() {

+ 18 - 20
jme3-core/src/main/java/com/jme3/cinematic/events/AbstractCinematicEvent.java

@@ -47,8 +47,8 @@ import java.util.List;
 /**
 /**
  * This call contains the basic behavior of a cinematic event.
  * This call contains the basic behavior of a cinematic event.
  * Every cinematic event must extend this class.
  * Every cinematic event must extend this class.
- * 
- * A cinematic event must be given an initial duration in seconds 
+ *
+ * A cinematic event must be given an initial duration in seconds
  * (duration of the event at speed = 1). Default is 10 sec.
  * (duration of the event at speed = 1). Default is 10 sec.
  * @author Nehon
  * @author Nehon
  */
  */
@@ -60,7 +60,7 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
     protected float speed = 1;
     protected float speed = 1;
     protected float time = 0;
     protected float time = 0;
     protected boolean resuming = false;
     protected boolean resuming = false;
-    
+
     /**
     /**
      * The list of listeners.
      * The list of listeners.
      */
      */
@@ -100,15 +100,15 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
         this.initialDuration = initialDuration;
         this.initialDuration = initialDuration;
         this.loopMode = loopMode;
         this.loopMode = loopMode;
     }
     }
-    
+
     /**
     /**
-     * Implement this method if the event needs different handling when 
+     * Implement this method if the event needs different handling when
      * stopped naturally (when the event reach its end),
      * stopped naturally (when the event reach its end),
      * or when it was force-stopped during playback.
      * or when it was force-stopped during playback.
      * By default, this method just calls regular stop().
      * By default, this method just calls regular stop().
      */
      */
     @Override
     @Override
-    public void forceStop(){
+    public void forceStop() {
         stop();
         stop();
     }
     }
 
 
@@ -117,7 +117,7 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
      */
      */
     @Override
     @Override
     public void play() {
     public void play() {
-        onPlay();        
+        onPlay();
         playState = PlayState.Playing;
         playState = PlayState.Playing;
         if (listeners != null) {
         if (listeners != null) {
             for (int i = 0; i < listeners.size(); i++) {
             for (int i = 0; i < listeners.size(); i++) {
@@ -139,17 +139,17 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
     @Override
     @Override
     public void internalUpdate(float tpf) {
     public void internalUpdate(float tpf) {
         if (playState == PlayState.Playing) {
         if (playState == PlayState.Playing) {
-            time = time + (tpf * speed);         
+            time = time + (tpf * speed);
             onUpdate(tpf);
             onUpdate(tpf);
             if (time >= initialDuration && loopMode == LoopMode.DontLoop) {
             if (time >= initialDuration && loopMode == LoopMode.DontLoop) {
                 stop();
                 stop();
-            } else if(time >= initialDuration && loopMode == LoopMode.Loop){
+            } else if (time >= initialDuration && loopMode == LoopMode.Loop) {
                 setTime(0);
                 setTime(0);
-            }else{
+            } else {
                 time = AnimationUtils.clampWrapTime(time, initialDuration, loopMode);
                 time = AnimationUtils.clampWrapTime(time, initialDuration, loopMode);
-                if(time<0){
-                    speed = - speed;
-                    time = - time;
+                if (time < 0) {
+                    speed = -speed;
+                    time = -time;
                 }
                 }
             }
             }
         }
         }
@@ -157,14 +157,14 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
     }
     }
 
 
     /**
     /**
-     * Implement this method with the code that you want to execute on update 
+     * Implement this method with the code that you want to execute on update
      * (only called when the event is playing).
      * (only called when the event is playing).
      * @param tpf time per frame
      * @param tpf time per frame
      */
      */
     protected abstract void onUpdate(float tpf);
     protected abstract void onUpdate(float tpf);
 
 
     /**
     /**
-     * Stops the animation. 
+     * Stops the animation.
      * Next time when play() is called, the animation starts from the beginning.
      * Next time when play() is called, the animation starts from the beginning.
      */
      */
     @Override
     @Override
@@ -322,7 +322,7 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
 
 
     /**
     /**
      * Returns the list of CinematicEventListeners added to this event.
      * Returns the list of CinematicEventListeners added to this event.
-     * @return 
+     * @return
      */
      */
     private List<CinematicEventListener> getListeners() {
     private List<CinematicEventListener> getListeners() {
         if (listeners == null) {
         if (listeners == null) {
@@ -356,7 +356,7 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
      */
      */
     @Override
     @Override
     public void setTime(float time) {
     public void setTime(float time) {
-        this.time = time ;
+        this.time = time;
     }
     }
 
 
     /**
     /**
@@ -368,8 +368,6 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
     }
     }
 
 
     @Override
     @Override
-    public void dispose() {    
+    public void dispose() {
     }
     }
-    
-    
 }
 }

+ 18 - 20
jme3-core/src/main/java/com/jme3/cinematic/events/AnimationEvent.java

@@ -56,7 +56,7 @@ import java.util.logging.Logger;
 @Deprecated
 @Deprecated
 public class AnimationEvent extends AbstractCinematicEvent {
 public class AnimationEvent extends AbstractCinematicEvent {
 
 
-    // Version #2: directly keeping track on the model instead of trying to retrieve 
+    // Version #2: directly keeping track on the model instead of trying to retrieve
     //it from the scene according to its name, because the name is not supposed to be unique
     //it from the scene according to its name, because the name is not supposed to be unique
     //For backward compatibility, if the model is null it's looked up into the scene
     //For backward compatibility, if the model is null it's looked up into the scene
     public static final int SAVABLE_VERSION = 2;
     public static final int SAVABLE_VERSION = 2;
@@ -79,7 +79,7 @@ public class AnimationEvent extends AbstractCinematicEvent {
     protected AnimationEvent() {
     protected AnimationEvent() {
         super();
         super();
     }
     }
-    
+
     /**
     /**
      * creates an animation event
      * creates an animation event
      *
      *
@@ -202,7 +202,7 @@ public class AnimationEvent extends AbstractCinematicEvent {
      * @param loopMode the loopMode
      * @param loopMode the loopMode
      * @see LoopMode
      * @see LoopMode
      * @param channelIndex the index of the channel default is 0. Events on the
      * @param channelIndex the index of the channel default is 0. Events on the
-     * same channelIndex will use the same channel.
+     *     same channelIndex will use the same channel.
      */
      */
     public AnimationEvent(Spatial model, String animationName, LoopMode loopMode, int channelIndex) {
     public AnimationEvent(Spatial model, String animationName, LoopMode loopMode, int channelIndex) {
         super(loopMode);
         super(loopMode);
@@ -219,7 +219,7 @@ public class AnimationEvent extends AbstractCinematicEvent {
      * @param model the model on which the animation will be played
      * @param model the model on which the animation will be played
      * @param animationName the name of the animation to play
      * @param animationName the name of the animation to play
      * @param channelIndex the index of the channel default is 0. Events on the
      * @param channelIndex the index of the channel default is 0. Events on the
-     * same channelIndex will use the same channel.
+     *     same channelIndex will use the same channel.
      */
      */
     public AnimationEvent(Spatial model, String animationName, int channelIndex) {
     public AnimationEvent(Spatial model, String animationName, int channelIndex) {
         this.model = model;
         this.model = model;
@@ -228,7 +228,7 @@ public class AnimationEvent extends AbstractCinematicEvent {
         initialDuration = model.getControl(AnimControl.class).getAnimationLength(animationName);
         initialDuration = model.getControl(AnimControl.class).getAnimationLength(animationName);
         this.channelIndex = channelIndex;
         this.channelIndex = channelIndex;
     }
     }
-    
+
     /**
     /**
      * creates an animation event
      * creates an animation event
      *
      *
@@ -237,7 +237,7 @@ public class AnimationEvent extends AbstractCinematicEvent {
      * @param loopMode the desired mode (Loop/DontLoop/Cycle)
      * @param loopMode the desired mode (Loop/DontLoop/Cycle)
      * @param channelIndex the index of the channel default is 0. Events on the
      * @param channelIndex the index of the channel default is 0. Events on the
      * @param blendTime the time interval during which the animation will be blended
      * @param blendTime the time interval during which the animation will be blended
-     * same channelIndex will use the same channel.
+     *     same channelIndex will use the same channel.
      */
      */
     public AnimationEvent(Spatial model, String animationName, LoopMode loopMode, int channelIndex, float blendTime) {
     public AnimationEvent(Spatial model, String animationName, LoopMode loopMode, int channelIndex, float blendTime) {
         this.model = model;
         this.model = model;
@@ -256,7 +256,7 @@ public class AnimationEvent extends AbstractCinematicEvent {
      * @param animationName the name of the animation to play
      * @param animationName the name of the animation to play
      * @param initialDuration the initial duration of the event
      * @param initialDuration the initial duration of the event
      * @param channelIndex the index of the channel default is 0. Events on the
      * @param channelIndex the index of the channel default is 0. Events on the
-     * same channelIndex will use the same channel.
+     *     same channelIndex will use the same channel.
      */
      */
     public AnimationEvent(Spatial model, String animationName, float initialDuration, int channelIndex) {
     public AnimationEvent(Spatial model, String animationName, float initialDuration, int channelIndex) {
         super(initialDuration);
         super(initialDuration);
@@ -275,7 +275,7 @@ public class AnimationEvent extends AbstractCinematicEvent {
      * @param loopMode the loopMode
      * @param loopMode the loopMode
      * @see LoopMode
      * @see LoopMode
      * @param channelIndex the index of the channel default is 0. Events on the
      * @param channelIndex the index of the channel default is 0. Events on the
-     * same channelIndex will use the same channel.
+     *     same channelIndex will use the same channel.
      */
      */
     public AnimationEvent(Spatial model, String animationName, float initialDuration, LoopMode loopMode, int channelIndex) {
     public AnimationEvent(Spatial model, String animationName, float initialDuration, LoopMode loopMode, int channelIndex) {
         super(initialDuration, loopMode);
         super(initialDuration, loopMode);
@@ -295,8 +295,9 @@ public class AnimationEvent extends AbstractCinematicEvent {
             if (s == null) {
             if (s == null) {
                 s = new HashMap<Integer, AnimChannel>();
                 s = new HashMap<Integer, AnimChannel>();
                 int numChannels = model.getControl(AnimControl.class).getNumChannels();
                 int numChannels = model.getControl(AnimControl.class).getNumChannels();
-                for(int i = 0; i < numChannels; i++){
-                    ((HashMap<Integer, AnimChannel>)s).put(i, model.getControl(AnimControl.class).getChannel(i));
+                for (int i = 0; i < numChannels; i++) {
+                    ((HashMap<Integer, AnimChannel>) s)
+                            .put(i, model.getControl(AnimControl.class).getChannel(i));
                 }
                 }
                 cinematic.putEventData(MODEL_CHANNELS, model, s);
                 cinematic.putEventData(MODEL_CHANNELS, model, s);
             }
             }
@@ -311,9 +312,9 @@ public class AnimationEvent extends AbstractCinematicEvent {
                     model = cinematic.getScene().getChild(modelName);
                     model = cinematic.getScene().getChild(modelName);
                 }
                 }
                 if (model != null) {
                 if (model != null) {
-                    if(cinematic.getScene() != null){
+                    if (cinematic.getScene() != null) {
                         Spatial sceneModel = cinematic.getScene().getChild(model.getName());
                         Spatial sceneModel = cinematic.getScene().getChild(model.getName());
-                        if(sceneModel != null){
+                        if (sceneModel != null) {
                             Node parent = sceneModel.getParent();
                             Node parent = sceneModel.getParent();
                             parent.detachChild(sceneModel);
                             parent.detachChild(sceneModel);
                             sceneModel = model;
                             sceneModel = model;
@@ -322,15 +323,14 @@ public class AnimationEvent extends AbstractCinematicEvent {
                             cinematic.getScene().attachChild(model);
                             cinematic.getScene().attachChild(model);
                         }
                         }
                     }
                     }
-                    
+
                     channel = model.getControl(AnimControl.class).createChannel();
                     channel = model.getControl(AnimControl.class).createChannel();
                     map.put(channelIndex, channel);
                     map.put(channelIndex, channel);
                 } else {
                 } else {
                     //it's an error
                     //it's an error
                     throw new UnsupportedOperationException("model should not be null");
                     throw new UnsupportedOperationException("model should not be null");
                 }
                 }
-            } 
-
+            }
         }
         }
     }
     }
 
 
@@ -365,7 +365,6 @@ public class AnimationEvent extends AbstractCinematicEvent {
             channel.setTime(t);
             channel.setTime(t);
             channel.getControl().update(0);
             channel.getControl().update(0);
         }
         }
-
     }
     }
 
 
     @Override
     @Override
@@ -429,7 +428,6 @@ public class AnimationEvent extends AbstractCinematicEvent {
         oc.write(animationName, "animationName", "");
         oc.write(animationName, "animationName", "");
         oc.write(blendTime, "blendTime", 0f);
         oc.write(blendTime, "blendTime", 0f);
         oc.write(channelIndex, "channelIndex", 0);
         oc.write(channelIndex, "channelIndex", 0);
-
     }
     }
 
 
     @Override
     @Override
@@ -437,14 +435,14 @@ public class AnimationEvent extends AbstractCinematicEvent {
         super.read(im);
         super.read(im);
         InputCapsule ic = im.getCapsule(this);
         InputCapsule ic = im.getCapsule(this);
 //        if (im.getFormatVersion() == 0) {
 //        if (im.getFormatVersion() == 0) {
-            modelName = ic.readString("modelName", "");
+        modelName = ic.readString("modelName", "");
 //        }
 //        }
         //FIXME always the same issue, because of the cloning of assets, this won't work
         //FIXME always the same issue, because of the cloning of assets, this won't work
-        //we have to somehow store userdata in the spatial and then recurse the 
+        //we have to somehow store userdata in the spatial and then recurse the
         //scene sub scenegraph to find the correct instance of the model
         //scene sub scenegraph to find the correct instance of the model
         //This brings a reflection about the cinematic being an appstate,
         //This brings a reflection about the cinematic being an appstate,
         //shouldn't it be a control over the scene
         //shouldn't it be a control over the scene
-        // this would allow to use the cloneForSpatial method and automatically 
+        // this would allow to use the cloneForSpatial method and automatically
         //rebind cloned references of original objects.
         //rebind cloned references of original objects.
         //for now as nobody probably ever saved a cinematic, this is not a critical issue
         //for now as nobody probably ever saved a cinematic, this is not a critical issue
         model = (Spatial) ic.readSavable("model", null);
         model = (Spatial) ic.readSavable("model", null);

+ 9 - 12
jme3-core/src/main/java/com/jme3/cinematic/events/CameraEvent.java

@@ -43,7 +43,7 @@ import java.io.IOException;
  *
  *
  * @author Rickard (neph1 @ github)
  * @author Rickard (neph1 @ github)
  */
  */
-public class CameraEvent extends AbstractCinematicEvent{
+public class CameraEvent extends AbstractCinematicEvent {
 
 
     private String cameraName;
     private String cameraName;
     private Cinematic cinematic;
     private Cinematic cinematic;
@@ -56,27 +56,26 @@ public class CameraEvent extends AbstractCinematicEvent{
         this.cameraName = cameraName;
         this.cameraName = cameraName;
     }
     }
 
 
-    public CameraEvent(){
-        
+    public CameraEvent() {
     }
     }
-    
-    public CameraEvent(Cinematic parentEvent, String cameraName){
+
+    public CameraEvent(Cinematic parentEvent, String cameraName) {
         this.cinematic = parentEvent;
         this.cinematic = parentEvent;
         this.cameraName = cameraName;
         this.cameraName = cameraName;
     }
     }
-    
-     @Override
+
+    @Override
     public void initEvent(Application app, Cinematic cinematic) {
     public void initEvent(Application app, Cinematic cinematic) {
         super.initEvent(app, cinematic);
         super.initEvent(app, cinematic);
         this.cinematic = cinematic;
         this.cinematic = cinematic;
     }
     }
-    
+
     @Override
     @Override
     public void play() {
     public void play() {
         super.play();
         super.play();
         stop();
         stop();
     }
     }
-    
+
     @Override
     @Override
     public void onPlay() {
     public void onPlay() {
         cinematic.setActiveCamera(cameraName);
         cinematic.setActiveCamera(cameraName);
@@ -110,9 +109,7 @@ public class CameraEvent extends AbstractCinematicEvent{
     public void setCinematic(Cinematic cinematic) {
     public void setCinematic(Cinematic cinematic) {
         this.cinematic = cinematic;
         this.cinematic = cinematic;
     }
     }
-    
-    
-    
+
     /**
     /**
      * used internally for serialization
      * used internally for serialization
      *
      *

+ 15 - 15
jme3-core/src/main/java/com/jme3/cinematic/events/MotionEvent.java

@@ -111,7 +111,7 @@ public class MotionEvent extends AbstractCinematicEvent implements Control, JmeC
     public MotionEvent() {
     public MotionEvent() {
         super();
         super();
     }
     }
-    
+
     /**
     /**
      * Creates a MotionPath for the given spatial on the given motion path.
      * Creates a MotionPath for the given spatial on the given motion path.
      *
      *
@@ -179,7 +179,7 @@ public class MotionEvent extends AbstractCinematicEvent implements Control, JmeC
             time = time + (tpf * speed);
             time = time + (tpf * speed);
             if (loopMode == LoopMode.Loop && time < 0) {
             if (loopMode == LoopMode.Loop && time < 0) {
                 time = initialDuration;
                 time = initialDuration;
-            }            
+            }
             if ((time >= initialDuration || time < 0) && loopMode == LoopMode.DontLoop) {
             if ((time >= initialDuration || time < 0) && loopMode == LoopMode.DontLoop) {
                 if (time >= initialDuration) {
                 if (time >= initialDuration) {
                     path.triggerWayPointReach(path.getNbWayPoints() - 1, this);
                     path.triggerWayPointReach(path.getNbWayPoints() - 1, this);
@@ -187,9 +187,9 @@ public class MotionEvent extends AbstractCinematicEvent implements Control, JmeC
                 stop();
                 stop();
             } else {
             } else {
                 time = AnimationUtils.clampWrapTime(time, initialDuration, loopMode);
                 time = AnimationUtils.clampWrapTime(time, initialDuration, loopMode);
-                if(time<0){
-                    speed = - speed;
-                    time = - time;
+                if (time < 0) {
+                    speed = -speed;
+                    time = -time;
                 }
                 }
                 onUpdate(tpf);
                 onUpdate(tpf);
             }
             }
@@ -290,7 +290,7 @@ public class MotionEvent extends AbstractCinematicEvent implements Control, JmeC
         throw new UnsupportedOperationException();
         throw new UnsupportedOperationException();
     }
     }
 
 
-    @Override   
+    @Override
     public Object jmeClone() {
     public Object jmeClone() {
         MotionEvent control = new MotionEvent();
         MotionEvent control = new MotionEvent();
         control.path = path;
         control.path = path;
@@ -308,13 +308,13 @@ public class MotionEvent extends AbstractCinematicEvent implements Control, JmeC
         control.spatial = spatial;
         control.spatial = spatial;
 
 
         return control;
         return control;
-    }     
+    }
 
 
-    @Override   
-    public void cloneFields( Cloner cloner, Object original ) { 
+    @Override
+    public void cloneFields(Cloner cloner, Object original) {
         this.spatial = cloner.clone(spatial);
         this.spatial = cloner.clone(spatial);
     }
     }
-         
+
     @Override
     @Override
     public void onPlay() {
     public void onPlay() {
         traveledDistance = 0;
         traveledDistance = 0;
@@ -373,16 +373,16 @@ public class MotionEvent extends AbstractCinematicEvent implements Control, JmeC
 
 
     /**
     /**
      * Sets the direction of the spatial, using the Y axis as the up vector.
      * Sets the direction of the spatial, using the Y axis as the up vector.
-     * Use MotionEvent#setDirection((Vector3f direction,Vector3f upVector) if 
+     * Use MotionEvent#setDirection((Vector3f direction,Vector3f upVector) if
      * you want a custom up vector.
      * you want a custom up vector.
      * This method is used by the motion path.
      * This method is used by the motion path.
      *
      *
      * @param direction the desired forward direction (not null, unaffected)
      * @param direction the desired forward direction (not null, unaffected)
      */
      */
     public void setDirection(Vector3f direction) {
     public void setDirection(Vector3f direction) {
-        setDirection(direction, Vector3f.UNIT_Y); 
-   }
-    
+        setDirection(direction, Vector3f.UNIT_Y);
+    }
+
     /**
     /**
      * Sets the direction of the spatial with the given up vector.
      * Sets the direction of the spatial with the given up vector.
      * This method is used by the motion path.
      * This method is used by the motion path.
@@ -390,7 +390,7 @@ public class MotionEvent extends AbstractCinematicEvent implements Control, JmeC
      * @param direction the desired forward direction (not null, unaffected)
      * @param direction the desired forward direction (not null, unaffected)
      * @param upVector the up vector to consider for this direction.
      * @param upVector the up vector to consider for this direction.
      */
      */
-    public void setDirection(Vector3f direction,Vector3f upVector) {
+    public void setDirection(Vector3f direction, Vector3f upVector) {
         this.direction.set(direction);
         this.direction.set(direction);
         this.upVector.set(upVector);
         this.upVector.set(upVector);
     }
     }

+ 14 - 16
jme3-core/src/main/java/com/jme3/cinematic/events/SoundEvent.java

@@ -86,7 +86,7 @@ public class SoundEvent extends AbstractCinematicEvent {
      * creates a sound track from the given resource path
      * creates a sound track from the given resource path
      * @param path the path to an audio file (ie : "Sounds/mySound.wav")
      * @param path the path to an audio file (ie : "Sounds/mySound.wav")
      * @param stream true to make the audio data streamed
      * @param stream true to make the audio data streamed
-     * @param loopMode the loopMode 
+     * @param loopMode the loopMode
      * @see LoopMode
      * @see LoopMode
      */
      */
     public SoundEvent(String path, boolean stream, LoopMode loopMode) {
     public SoundEvent(String path, boolean stream, LoopMode loopMode) {
@@ -95,12 +95,12 @@ public class SoundEvent extends AbstractCinematicEvent {
         this.stream = stream;
         this.stream = stream;
     }
     }
 
 
-     /**
+    /**
      * creates a sound track from the given resource path
      * creates a sound track from the given resource path
      * @param path the path to an audio file (ie : "Sounds/mySound.wav")
      * @param path the path to an audio file (ie : "Sounds/mySound.wav")
      * @param stream true to make the audio data streamed
      * @param stream true to make the audio data streamed
      * @param initialDuration the initial duration of the event
      * @param initialDuration the initial duration of the event
-     * @param loopMode the loopMode 
+     * @param loopMode the loopMode
      * @see LoopMode
      * @see LoopMode
      */
      */
     public SoundEvent(String path, boolean stream, float initialDuration, LoopMode loopMode) {
     public SoundEvent(String path, boolean stream, float initialDuration, LoopMode loopMode) {
@@ -109,9 +109,9 @@ public class SoundEvent extends AbstractCinematicEvent {
         this.stream = stream;
         this.stream = stream;
     }
     }
 
 
-     /**
+    /**
      * creates a sound track from the given resource path
      * creates a sound track from the given resource path
-     * @param path the path to an audio file (ie : "Sounds/mySound.wav")    
+     * @param path the path to an audio file (ie : "Sounds/mySound.wav")
      * @param initialDuration the initial duration of the event
      * @param initialDuration the initial duration of the event
      */
      */
     public SoundEvent(String path, float initialDuration) {
     public SoundEvent(String path, float initialDuration) {
@@ -119,10 +119,10 @@ public class SoundEvent extends AbstractCinematicEvent {
         this.path = path;
         this.path = path;
     }
     }
 
 
-     /**
+    /**
      * creates a sound track from the given resource path
      * creates a sound track from the given resource path
-     * @param path the path to an audio file (ie : "Sounds/mySound.wav")   
-     * @param loopMode the loopMode 
+     * @param path the path to an audio file (ie : "Sounds/mySound.wav")
+     * @param loopMode the loopMode
      * @see LoopMode
      * @see LoopMode
      */
      */
     public SoundEvent(String path, LoopMode loopMode) {
     public SoundEvent(String path, LoopMode loopMode) {
@@ -130,11 +130,11 @@ public class SoundEvent extends AbstractCinematicEvent {
         this.path = path;
         this.path = path;
     }
     }
 
 
-     /**
+    /**
      * creates a sound track from the given resource path
      * creates a sound track from the given resource path
-     * @param path the path to an audio file (ie : "Sounds/mySound.wav")    
+     * @param path the path to an audio file (ie : "Sounds/mySound.wav")
      * @param initialDuration the initial duration of the event
      * @param initialDuration the initial duration of the event
-     * @param loopMode the loopMode 
+     * @param loopMode the loopMode
      * @see LoopMode
      * @see LoopMode
      */
      */
     public SoundEvent(String path, float initialDuration, LoopMode loopMode) {
     public SoundEvent(String path, float initialDuration, LoopMode loopMode) {
@@ -162,9 +162,9 @@ public class SoundEvent extends AbstractCinematicEvent {
     public void setTime(float time) {
     public void setTime(float time) {
         super.setTime(time);
         super.setTime(time);
         //can occur on rewind
         //can occur on rewind
-        if (time < 0f) {            
+        if (time < 0f) {
             stop();
             stop();
-        }else{
+        } else {
             audioNode.setTimeOffset(time);
             audioNode.setTimeOffset(time);
         }
         }
     }
     }
@@ -177,7 +177,6 @@ public class SoundEvent extends AbstractCinematicEvent {
     @Override
     @Override
     public void onStop() {
     public void onStop() {
         audioNode.stop();
         audioNode.stop();
-
     }
     }
 
 
     @Override
     @Override
@@ -193,7 +192,7 @@ public class SoundEvent extends AbstractCinematicEvent {
     }
     }
 
 
     /**
     /**
-     *  Returns the underlying audio node of this sound track
+     * Returns the underlying audio node of this sound track
      * @return the pre-existing instance
      * @return the pre-existing instance
      */
      */
     public AudioNode getAudioNode() {
     public AudioNode getAudioNode() {
@@ -225,6 +224,5 @@ public class SoundEvent extends AbstractCinematicEvent {
         InputCapsule ic = im.getCapsule(this);
         InputCapsule ic = im.getCapsule(this);
         path = ic.readString("path", "");
         path = ic.readString("path", "");
         stream = ic.readBoolean("stream", false);
         stream = ic.readBoolean("stream", false);
-
     }
     }
 }
 }

+ 9 - 9
jme3-core/src/main/java/com/jme3/collision/CollisionResult.java

@@ -63,30 +63,30 @@ public class CollisionResult implements Comparable<CollisionResult> {
         this.distance = distance;
         this.distance = distance;
     }
     }
 
 
-    public CollisionResult(){
+    public CollisionResult() {
     }
     }
 
 
-    public void setGeometry(Geometry geom){
+    public void setGeometry(Geometry geom) {
         this.geometry = geom;
         this.geometry = geom;
     }
     }
 
 
-    public void setContactNormal(Vector3f norm){
+    public void setContactNormal(Vector3f norm) {
         this.contactNormal = norm;
         this.contactNormal = norm;
     }
     }
 
 
-    public void setContactPoint(Vector3f point){
+    public void setContactPoint(Vector3f point) {
         this.contactPoint = point;
         this.contactPoint = point;
     }
     }
 
 
-    public void setDistance(float dist){
+    public void setDistance(float dist) {
         this.distance = dist;
         this.distance = dist;
     }
     }
 
 
-    public void setTriangleIndex(int index){
+    public void setTriangleIndex(int index) {
         this.triangleIndex = index;
         this.triangleIndex = index;
     }
     }
 
 
-    public Triangle getTriangle(Triangle store){
+    public Triangle getTriangle(Triangle store) {
         if (store == null)
         if (store == null)
             store = new Triangle();
             store = new Triangle();
 
 
@@ -104,8 +104,8 @@ public class CollisionResult implements Comparable<CollisionResult> {
 
 
     @Override
     @Override
     public boolean equals(Object obj) {
     public boolean equals(Object obj) {
-        if(obj instanceof CollisionResult){
-            return ((CollisionResult)obj).compareTo(this) == 0;
+        if (obj instanceof CollisionResult) {
+            return ((CollisionResult) obj).compareTo(this) == 0;
         }
         }
         return super.equals(obj);
         return super.equals(obj);
     }
     }

+ 22 - 23
jme3-core/src/main/java/com/jme3/collision/CollisionResults.java

@@ -37,9 +37,9 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
- * <code>CollisionResults</code> is a collection returned as a result of a 
+ * <code>CollisionResults</code> is a collection returned as a result of a
  * collision detection operation done by {@link Collidable}.
  * collision detection operation done by {@link Collidable}.
- * 
+ *
  * @author Kirill Vainer
  * @author Kirill Vainer
  */
  */
 public class CollisionResults implements Iterable<CollisionResult> {
 public class CollisionResults implements Iterable<CollisionResult> {
@@ -50,7 +50,7 @@ public class CollisionResults implements Iterable<CollisionResult> {
     /**
     /**
      * Clears all collision results added to this list
      * Clears all collision results added to this list
      */
      */
-    public void clear(){
+    public void clear() {
         if (results != null) {
         if (results != null) {
             results.clear();
             results.clear();
         }
         }
@@ -58,17 +58,17 @@ public class CollisionResults implements Iterable<CollisionResult> {
 
 
     /**
     /**
      * Iterator for iterating over the collision results.
      * Iterator for iterating over the collision results.
-     * 
+     *
      * @return the iterator
      * @return the iterator
      */
      */
     @Override
     @Override
     public Iterator<CollisionResult> iterator() {
     public Iterator<CollisionResult> iterator() {
         if (results == null) {
         if (results == null) {
-            List<CollisionResult> dumbCompiler = Collections.emptyList();            
+            List<CollisionResult> dumbCompiler = Collections.emptyList();
             return dumbCompiler.iterator();
             return dumbCompiler.iterator();
         }
         }
-        
-        if (!sorted){
+
+        if (!sorted) {
             Collections.sort(results);
             Collections.sort(results);
             sorted = true;
             sorted = true;
         }
         }
@@ -76,7 +76,7 @@ public class CollisionResults implements Iterable<CollisionResult> {
         return results.iterator();
         return results.iterator();
     }
     }
 
 
-    public void addCollision(CollisionResult result){
+    public void addCollision(CollisionResult result) {
         if (results == null) {
         if (results == null) {
             results = new ArrayList<CollisionResult>();
             results = new ArrayList<CollisionResult>();
         }
         }
@@ -84,18 +84,18 @@ public class CollisionResults implements Iterable<CollisionResult> {
         sorted = false;
         sorted = false;
     }
     }
 
 
-    public int size(){
+    public int size() {
         if (results == null) {
         if (results == null) {
             return 0;
             return 0;
         }
         }
         return results.size();
         return results.size();
     }
     }
 
 
-    public CollisionResult getClosestCollision(){
+    public CollisionResult getClosestCollision() {
         if (results == null || size() == 0)
         if (results == null || size() == 0)
             return null;
             return null;
 
 
-        if (!sorted){
+        if (!sorted) {
             Collections.sort(results);
             Collections.sort(results);
             sorted = true;
             sorted = true;
         }
         }
@@ -103,24 +103,24 @@ public class CollisionResults implements Iterable<CollisionResult> {
         return results.get(0);
         return results.get(0);
     }
     }
 
 
-    public CollisionResult getFarthestCollision(){
+    public CollisionResult getFarthestCollision() {
         if (results == null || size() == 0)
         if (results == null || size() == 0)
             return null;
             return null;
 
 
-        if (!sorted){
+        if (!sorted) {
             Collections.sort(results);
             Collections.sort(results);
             sorted = true;
             sorted = true;
         }
         }
 
 
-        return results.get(size()-1);
+        return results.get(size() - 1);
     }
     }
 
 
-    public CollisionResult getCollision(int index){
+    public CollisionResult getCollision(int index) {
         if (results == null) {
         if (results == null) {
             throw new IndexOutOfBoundsException("Index: " + index + ", Size: 0");
             throw new IndexOutOfBoundsException("Index: " + index + ", Size: 0");
         }
         }
-        
-        if (!sorted){
+
+        if (!sorted) {
             Collections.sort(results);
             Collections.sort(results);
             sorted = true;
             sorted = true;
         }
         }
@@ -134,7 +134,7 @@ public class CollisionResults implements Iterable<CollisionResult> {
      * @param index the zero-based index of the desired result
      * @param index the zero-based index of the desired result
      * @return the pre-existing instance
      * @return the pre-existing instance
      */
      */
-    public CollisionResult getCollisionDirect(int index){
+    public CollisionResult getCollisionDirect(int index) {
         if (results == null) {
         if (results == null) {
             throw new IndexOutOfBoundsException("Index: " + index + ", Size: 0");
             throw new IndexOutOfBoundsException("Index: " + index + ", Size: 0");
         }
         }
@@ -142,19 +142,18 @@ public class CollisionResults implements Iterable<CollisionResult> {
     }
     }
 
 
     @Override
     @Override
-    public String toString(){
+    public String toString() {
         StringBuilder sb = new StringBuilder();
         StringBuilder sb = new StringBuilder();
         sb.append("CollisionResults[");
         sb.append("CollisionResults[");
         if (results != null) {
         if (results != null) {
-            for (CollisionResult result : results){
+            for (CollisionResult result : results) {
                 sb.append(result).append(", ");
                 sb.append(result).append(", ");
             }
             }
             if (results.size() > 0)
             if (results.size() > 0)
-                sb.setLength(sb.length()-2);
-        }                
+                sb.setLength(sb.length() - 2);
+        }
 
 
         sb.append("]");
         sb.append("]");
         return sb.toString();
         return sb.toString();
     }
     }
-
 }
 }

+ 71 - 71
jme3-core/src/main/java/com/jme3/collision/SweepSphere.java

@@ -68,17 +68,17 @@ class SweepSphere implements Collidable {
 
 
     public void setDimension(Vector3f dimension) {
     public void setDimension(Vector3f dimension) {
         this.dimension.set(dimension);
         this.dimension.set(dimension);
-        this.invDim.set(1,1,1).divideLocal(dimension);
+        this.invDim.set(1, 1, 1).divideLocal(dimension);
     }
     }
 
 
-    public void setDimension(float x, float y, float z){
-        this.dimension.set(x,y,z);
-        this.invDim.set(1,1,1).divideLocal(dimension);
+    public void setDimension(float x, float y, float z) {
+        this.dimension.set(x, y, z);
+        this.invDim.set(1, 1, 1).divideLocal(dimension);
     }
     }
 
 
-    public void setDimension(float dim){
+    public void setDimension(float dim) {
         this.dimension.set(dim, dim, dim);
         this.dimension.set(dim, dim, dim);
-        this.invDim.set(1,1,1).divideLocal(dimension);
+        this.invDim.set(1, 1, 1).divideLocal(dimension);
     }
     }
 
 
     public Vector3f getVelocity() {
     public Vector3f getVelocity() {
@@ -106,16 +106,17 @@ class SweepSphere implements Collidable {
     }
     }
 
 
     private boolean isPointInTriangle(Vector3f point, AbstractTriangle tri) {
     private boolean isPointInTriangle(Vector3f point, AbstractTriangle tri) {
-            if (pointsOnSameSide(point, tri.get1(), tri.get2(), tri.get3())
-             && pointsOnSameSide(point, tri.get2(), tri.get1(), tri.get3())
-             && pointsOnSameSide(point, tri.get3(), tri.get1(), tri.get2()))
-                    return true;
-            return false;
+        if (pointsOnSameSide(point, tri.get1(), tri.get2(), tri.get3())
+                && pointsOnSameSide(point, tri.get2(), tri.get1(), tri.get3())
+                && pointsOnSameSide(point, tri.get3(), tri.get1(), tri.get2())) {
+            return true;
+        }
+        return false;
     }
     }
 
 
     private static float getLowestRoot(float a, float b, float c, float maxR) {
     private static float getLowestRoot(float a, float b, float c, float maxR) {
         float determinant = b * b - 4f * a * c;
         float determinant = b * b - 4f * a * c;
-        if (determinant < 0){
+        if (determinant < 0) {
             return Float.NaN;
             return Float.NaN;
         }
         }
 
 
@@ -123,17 +124,17 @@ class SweepSphere implements Collidable {
         float r1 = (-b - sqrtDet) / (2f * a);
         float r1 = (-b - sqrtDet) / (2f * a);
         float r2 = (-b + sqrtDet) / (2f * a);
         float r2 = (-b + sqrtDet) / (2f * a);
 
 
-        if (r1 > r2){
+        if (r1 > r2) {
             float temp = r2;
             float temp = r2;
             r2 = r1;
             r2 = r1;
             r1 = temp;
             r1 = temp;
         }
         }
 
 
-        if (r1 > 0 && r1 < maxR){
+        if (r1 > 0 && r1 < maxR) {
             return r1;
             return r1;
         }
         }
 
 
-        if (r2 > 0 && r2 < maxR){
+        if (r2 > 0 && r2 < maxR) {
             return r2;
             return r2;
         }
         }
 
 
@@ -159,7 +160,7 @@ class SweepSphere implements Collidable {
 //        float newT = getLowestRoot(A, B, C, Float.MAX_VALUE);
 //        float newT = getLowestRoot(A, B, C, Float.MAX_VALUE);
 //        if (newT > 1.0f)
 //        if (newT > 1.0f)
 //            newT = Float.NaN;
 //            newT = Float.NaN;
-        
+
         return newT;
         return newT;
     }
     }
 
 
@@ -184,9 +185,9 @@ class SweepSphere implements Collidable {
                 - (2f * EdotV * EdotB);
                 - (2f * EdotV * EdotB);
         float c = (edgeSquared * (1f - baseSquared)) + EdotB * EdotB;
         float c = (edgeSquared * (1f - baseSquared)) + EdotB * EdotB;
         float newT = getLowestRoot(a, b, c, t);
         float newT = getLowestRoot(a, b, c, t);
-        if (!Float.isNaN(newT)){
+        if (!Float.isNaN(newT)) {
             float f = (EdotV * newT - EdotB) / edgeSquared;
             float f = (EdotV * newT - EdotB) / edgeSquared;
-            if (f >= 0f && f < 1f){
+            if (f >= 0f && f < 1f) {
                 store.scaleAdd(f, edge, l1);
                 store.scaleAdd(f, edge, l1);
                 return newT;
                 return newT;
             }
             }
@@ -194,7 +195,7 @@ class SweepSphere implements Collidable {
         return Float.NaN;
         return Float.NaN;
     }
     }
 
 
-    private CollisionResult collideWithTriangle(AbstractTriangle tri){
+    private CollisionResult collideWithTriangle(AbstractTriangle tri) {
         // scale scaledTriangle based on dimension
         // scale scaledTriangle based on dimension
         scaledTri.get1().set(tri.get1()).multLocal(invDim);
         scaledTri.get1().set(tri.get1()).multLocal(invDim);
         scaledTri.get2().set(tri.get2()).multLocal(invDim);
         scaledTri.get2().set(tri.get2()).multLocal(invDim);
@@ -216,12 +217,12 @@ class SweepSphere implements Collidable {
         boolean embedded = false;
         boolean embedded = false;
 
 
         float signedDistanceToPlane = triPlane.pseudoDistance(sCenter);
         float signedDistanceToPlane = triPlane.pseudoDistance(sCenter);
-        if (normalDotVelocity == 0.0f){
+        if (normalDotVelocity == 0.0f) {
             // we are travelling exactly parallel to the plane
             // we are travelling exactly parallel to the plane
-            if (FastMath.abs(signedDistanceToPlane) >= 1.0f){
+            if (FastMath.abs(signedDistanceToPlane) >= 1.0f) {
                 // no collision possible
                 // no collision possible
                 return null;
                 return null;
-            }else{
+            } else {
                 // we are embedded
                 // we are embedded
                 t0 = 0;
                 t0 = 0;
                 t1 = 1;
                 t1 = 1;
@@ -229,17 +230,17 @@ class SweepSphere implements Collidable {
                 System.out.println("EMBEDDED");
                 System.out.println("EMBEDDED");
                 return null;
                 return null;
             }
             }
-        }else{
+        } else {
             t0 = (-1f - signedDistanceToPlane) / normalDotVelocity;
             t0 = (-1f - signedDistanceToPlane) / normalDotVelocity;
-            t1 = ( 1f - signedDistanceToPlane) / normalDotVelocity;
+            t1 = (1f - signedDistanceToPlane) / normalDotVelocity;
 
 
-            if (t0 > t1){
+            if (t0 > t1) {
                 float tf = t1;
                 float tf = t1;
                 t1 = t0;
                 t1 = t0;
                 t0 = tf;
                 t0 = tf;
             }
             }
 
 
-            if (t0 > 1.0f || t1 < 0.0f){
+            if (t0 > 1.0f || t1 < 0.0f) {
                 // collision is out of this sVelocity range
                 // collision is out of this sVelocity range
                 return null;
                 return null;
             }
             }
@@ -254,35 +255,35 @@ class SweepSphere implements Collidable {
 
 
         Vector3f contactPoint = new Vector3f();
         Vector3f contactPoint = new Vector3f();
         Vector3f contactNormal = new Vector3f();
         Vector3f contactNormal = new Vector3f();
-  
-//        if (!embedded){
-            // check against the inside of the scaledTriangle
-            // contactPoint = sCenter - p.normal + t0 * sVelocity
-            contactPoint.set(sVelocity);
-            contactPoint.multLocal(t0);
-            contactPoint.addLocal(sCenter);
-            contactPoint.subtractLocal(triPlane.getNormal());
 
 
-            // test to see if the collision is on a scaledTriangle interior
-            if (isPointInTriangle(contactPoint, scaledTri) && !embedded){
-                foundCollision = true;
+//        if (!embedded){
+        // check against the inside of the scaledTriangle
+        // contactPoint = sCenter - p.normal + t0 * sVelocity
+        contactPoint.set(sVelocity);
+        contactPoint.multLocal(t0);
+        contactPoint.addLocal(sCenter);
+        contactPoint.subtractLocal(triPlane.getNormal());
+
+        // test to see if the collision is on a scaledTriangle interior
+        if (isPointInTriangle(contactPoint, scaledTri) && !embedded) {
+            foundCollision = true;
 
 
-                minT = t0;
+            minT = t0;
 
 
-                // scale collision point back into R3
-                contactPoint.multLocal(dimension);
-                contactNormal.set(velocity).multLocal(t0);
-                contactNormal.addLocal(center);
-                contactNormal.subtractLocal(contactPoint).normalizeLocal();
+            // scale collision point back into R3
+            contactPoint.multLocal(dimension);
+            contactNormal.set(velocity).multLocal(t0);
+            contactNormal.addLocal(center);
+            contactNormal.subtractLocal(contactPoint).normalizeLocal();
 
 
 //                contactNormal.set(triPlane.getNormal());
 //                contactNormal.set(triPlane.getNormal());
-                
-                CollisionResult result = new CollisionResult();
-                result.setContactPoint(contactPoint);
-                result.setContactNormal(contactNormal);
-                result.setDistance(minT * velocity.length());
-                return result;
-            }
+
+            CollisionResult result = new CollisionResult();
+            result.setContactPoint(contactPoint);
+            result.setContactNormal(contactNormal);
+            result.setDistance(minT * velocity.length());
+            return result;
+        }
 //        }
 //        }
 
 
         float velocitySquared = sVelocity.lengthSquared();
         float velocitySquared = sVelocity.lengthSquared();
@@ -294,7 +295,7 @@ class SweepSphere implements Collidable {
         // vertex 1
         // vertex 1
         float newT;
         float newT;
         newT = collideWithVertex(sCenter, sVelocity, velocitySquared, v1, minT);
         newT = collideWithVertex(sCenter, sVelocity, velocitySquared, v1, minT);
-        if (!Float.isNaN(newT)){
+        if (!Float.isNaN(newT)) {
             minT = newT;
             minT = newT;
             contactPoint.set(v1);
             contactPoint.set(v1);
             foundCollision = true;
             foundCollision = true;
@@ -302,7 +303,7 @@ class SweepSphere implements Collidable {
 
 
         // vertex 2
         // vertex 2
         newT = collideWithVertex(sCenter, sVelocity, velocitySquared, v2, minT);
         newT = collideWithVertex(sCenter, sVelocity, velocitySquared, v2, minT);
-        if (!Float.isNaN(newT)){
+        if (!Float.isNaN(newT)) {
             minT = newT;
             minT = newT;
             contactPoint.set(v2);
             contactPoint.set(v2);
             foundCollision = true;
             foundCollision = true;
@@ -310,7 +311,7 @@ class SweepSphere implements Collidable {
 
 
         // vertex 3
         // vertex 3
         newT = collideWithVertex(sCenter, sVelocity, velocitySquared, v3, minT);
         newT = collideWithVertex(sCenter, sVelocity, velocitySquared, v3, minT);
-        if (!Float.isNaN(newT)){
+        if (!Float.isNaN(newT)) {
             minT = newT;
             minT = newT;
             contactPoint.set(v3);
             contactPoint.set(v3);
             foundCollision = true;
             foundCollision = true;
@@ -318,26 +319,26 @@ class SweepSphere implements Collidable {
 
 
         // edge 1-2
         // edge 1-2
         newT = collideWithSegment(sCenter, sVelocity, velocitySquared, v1, v2, minT, contactPoint);
         newT = collideWithSegment(sCenter, sVelocity, velocitySquared, v1, v2, minT, contactPoint);
-        if (!Float.isNaN(newT)){
+        if (!Float.isNaN(newT)) {
             minT = newT;
             minT = newT;
             foundCollision = true;
             foundCollision = true;
         }
         }
 
 
         // edge 2-3
         // edge 2-3
         newT = collideWithSegment(sCenter, sVelocity, velocitySquared, v2, v3, minT, contactPoint);
         newT = collideWithSegment(sCenter, sVelocity, velocitySquared, v2, v3, minT, contactPoint);
-        if (!Float.isNaN(newT)){
+        if (!Float.isNaN(newT)) {
             minT = newT;
             minT = newT;
             foundCollision = true;
             foundCollision = true;
         }
         }
 
 
         // edge 3-1
         // edge 3-1
         newT = collideWithSegment(sCenter, sVelocity, velocitySquared, v3, v1, minT, contactPoint);
         newT = collideWithSegment(sCenter, sVelocity, velocitySquared, v3, v1, minT, contactPoint);
-        if (!Float.isNaN(newT)){
+        if (!Float.isNaN(newT)) {
             minT = newT;
             minT = newT;
             foundCollision = true;
             foundCollision = true;
         }
         }
 
 
-        if (foundCollision){
+        if (foundCollision) {
             // compute contact normal based on minimum t
             // compute contact normal based on minimum t
             contactPoint.multLocal(dimension);
             contactPoint.multLocal(dimension);
             contactNormal.set(velocity).multLocal(t0);
             contactNormal.set(velocity).multLocal(t0);
@@ -350,12 +351,12 @@ class SweepSphere implements Collidable {
             result.setDistance(minT * velocity.length());
             result.setDistance(minT * velocity.length());
 
 
             return result;
             return result;
-        }else{
+        } else {
             return null;
             return null;
         }
         }
     }
     }
 
 
-    public CollisionResult collideWithSweepSphere(SweepSphere other){
+    public CollisionResult collideWithSweepSphere(SweepSphere other) {
         temp1.set(velocity).subtractLocal(other.velocity);
         temp1.set(velocity).subtractLocal(other.velocity);
         temp2.set(center).subtractLocal(other.center);
         temp2.set(center).subtractLocal(other.center);
         temp3.set(dimension).addLocal(other.dimension);
         temp3.set(dimension).addLocal(other.dimension);
@@ -387,11 +388,11 @@ class SweepSphere implements Collidable {
         // temp3 is contact point
         // temp3 is contact point
         temp3.set(temp2).multLocal(dimension).addLocal(temp1);
         temp3.set(temp2).multLocal(dimension).addLocal(temp1);
         result.setContactPoint(new Vector3f(temp3));
         result.setContactPoint(new Vector3f(temp3));
-        
+
         return result;
         return result;
     }
     }
 
 
-    public static void main(String[] args){
+    public static void main(String[] args) {
         SweepSphere ss = new SweepSphere();
         SweepSphere ss = new SweepSphere();
         ss.setCenter(Vector3f.ZERO);
         ss.setCenter(Vector3f.ZERO);
         ss.setDimension(1);
         ss.setDimension(1);
@@ -404,37 +405,36 @@ class SweepSphere implements Collidable {
 
 
         CollisionResults cr = new CollisionResults();
         CollisionResults cr = new CollisionResults();
         ss.collideWith(ss2, cr);
         ss.collideWith(ss2, cr);
-        if (cr.size() > 0){
+        if (cr.size() > 0) {
             CollisionResult c = cr.getClosestCollision();
             CollisionResult c = cr.getClosestCollision();
-            System.out.println("D = "+c.getDistance());
-            System.out.println("P = "+c.getContactPoint());
-            System.out.println("N = "+c.getContactNormal());
+            System.out.println("D = " + c.getDistance());
+            System.out.println("P = " + c.getContactPoint());
+            System.out.println("N = " + c.getContactNormal());
         }
         }
     }
     }
 
 
     @Override
     @Override
     public int collideWith(Collidable other, CollisionResults results)
     public int collideWith(Collidable other, CollisionResults results)
             throws UnsupportedCollisionException {
             throws UnsupportedCollisionException {
-        if (other instanceof AbstractTriangle){
+        if (other instanceof AbstractTriangle) {
             AbstractTriangle tri = (AbstractTriangle) other;
             AbstractTriangle tri = (AbstractTriangle) other;
             CollisionResult result = collideWithTriangle(tri);
             CollisionResult result = collideWithTriangle(tri);
-            if (result != null){
+            if (result != null) {
                 results.addCollision(result);
                 results.addCollision(result);
                 return 1;
                 return 1;
             }
             }
             return 0;
             return 0;
-        }else if (other instanceof SweepSphere){
+        } else if (other instanceof SweepSphere) {
             SweepSphere sph = (SweepSphere) other;
             SweepSphere sph = (SweepSphere) other;
 
 
             CollisionResult result = collideWithSweepSphere(sph);
             CollisionResult result = collideWithSweepSphere(sph);
-            if (result != null){
+            if (result != null) {
                 results.addCollision(result);
                 results.addCollision(result);
                 return 1;
                 return 1;
             }
             }
             return 0;
             return 0;
-        }else{
+        } else {
             throw new UnsupportedCollisionException();
             throw new UnsupportedCollisionException();
         }
         }
     }
     }
-
 }
 }

+ 12 - 12
jme3-core/src/main/java/com/jme3/collision/bih/BIHTree.java

@@ -68,10 +68,10 @@ public class BIHTree implements CollisionData {
     private int numTris;
     private int numTris;
     private float[] pointData;
     private float[] pointData;
     private int[] triIndices;
     private int[] triIndices;
-    
+
     // private transient CollisionResults boundResults = new CollisionResults();
     // private transient CollisionResults boundResults = new CollisionResults();
     private transient float[] bihSwapTmp;
     private transient float[] bihSwapTmp;
-    
+
     private void initTriList(FloatBuffer vb, IndexBuffer ib) {
     private void initTriList(FloatBuffer vb, IndexBuffer ib) {
         pointData = new float[numTris * 3 * 3];
         pointData = new float[numTris * 3 * 3];
         int p = 0;
         int p = 0;
@@ -112,12 +112,12 @@ public class BIHTree implements CollisionData {
         bihSwapTmp = new float[9];
         bihSwapTmp = new float[9];
 
 
         VertexBuffer vBuffer = mesh.getBuffer(Type.Position);
         VertexBuffer vBuffer = mesh.getBuffer(Type.Position);
-        if(vBuffer == null){
+        if (vBuffer == null) {
             throw new IllegalArgumentException("A mesh should at least contain a Position buffer");
             throw new IllegalArgumentException("A mesh should at least contain a Position buffer");
-        }        
+        }
         IndexBuffer ib = mesh.getIndexBuffer();
         IndexBuffer ib = mesh.getIndexBuffer();
         FloatBuffer vb = (FloatBuffer) vBuffer.getData();
         FloatBuffer vb = (FloatBuffer) vBuffer.getData();
-        
+
         if (ib == null) {
         if (ib == null) {
             ib = new VirtualIndexBuffer(mesh.getVertexCount(), mesh.getMode());
             ib = new VirtualIndexBuffer(mesh.getVertexCount(), mesh.getMode());
         } else if (mesh.getMode() != Mode.Triangles) {
         } else if (mesh.getMode() != Mode.Triangles) {
@@ -326,7 +326,7 @@ public class BIHTree implements CollisionData {
             pivot = (r + l) / 2;
             pivot = (r + l) / 2;
         }
         }
 
 
-        //If one of the partitions is empty, continue with recursion: same level but different bbox
+        // If one of the partitions is empty, continue with recursion: same level but different bbox
         if (pivot < l) {
         if (pivot < l) {
             //Only right
             //Only right
             BoundingBox rbbox = new BoundingBox(currentBox);
             BoundingBox rbbox = new BoundingBox(currentBox);
@@ -338,21 +338,21 @@ public class BIHTree implements CollisionData {
             setMinMax(lbbox, false, axis, split);
             setMinMax(lbbox, false, axis, split);
             return createNode(l, r, lbbox, depth + 1);
             return createNode(l, r, lbbox, depth + 1);
         } else {
         } else {
-            //Build the node
+            // Build the node
             BIHNode node = new BIHNode(axis);
             BIHNode node = new BIHNode(axis);
 
 
-            //Left child
+            // Left child
             BoundingBox lbbox = new BoundingBox(currentBox);
             BoundingBox lbbox = new BoundingBox(currentBox);
             setMinMax(lbbox, false, axis, split);
             setMinMax(lbbox, false, axis, split);
 
 
-            //The left node right border is the plane most right
+            // The left node right border is the plane most right
             node.setLeftPlane(getMinMax(createBox(l, max(l, pivot - 1)), false, axis));
             node.setLeftPlane(getMinMax(createBox(l, max(l, pivot - 1)), false, axis));
             node.setLeftChild(createNode(l, max(l, pivot - 1), lbbox, depth + 1)); //Recursive call
             node.setLeftChild(createNode(l, max(l, pivot - 1), lbbox, depth + 1)); //Recursive call
 
 
-            //Right Child
+            // Right Child
             BoundingBox rbbox = new BoundingBox(currentBox);
             BoundingBox rbbox = new BoundingBox(currentBox);
             setMinMax(rbbox, true, axis, split);
             setMinMax(rbbox, true, axis, split);
-            //The right node left border is the plane most left
+            // The right node left border is the plane most left
             node.setRightPlane(getMinMax(createBox(pivot, r), true, axis));
             node.setRightPlane(getMinMax(createBox(pivot, r), true, axis));
             node.setRightChild(createNode(pivot, r, rbbox, depth + 1)); //Recursive call
             node.setRightChild(createNode(pivot, r, rbbox, depth + 1)); //Recursive call
 
 
@@ -421,7 +421,7 @@ public class BIHTree implements CollisionData {
 
 
                 if (r.getLimit() < Float.POSITIVE_INFINITY) {
                 if (r.getLimit() < Float.POSITIVE_INFINITY) {
                     tMax = Math.min(tMax, r.getLimit());
                     tMax = Math.min(tMax, r.getLimit());
-                    if (tMin > tMax){
+                    if (tMin > tMax) {
                         return 0;
                         return 0;
                     }
                     }
                 }
                 }

+ 32 - 18
jme3-core/src/main/java/com/jme3/collision/bih/BIHTriangle.java

@@ -49,15 +49,15 @@ public final class BIHTriangle {
         center.addLocal(pointb).addLocal(pointc).multLocal(FastMath.ONE_THIRD);
         center.addLocal(pointb).addLocal(pointc).multLocal(FastMath.ONE_THIRD);
     }
     }
 
 
-    public Vector3f get1(){
+    public Vector3f get1() {
         return pointa;
         return pointa;
     }
     }
 
 
-    public Vector3f get2(){
+    public Vector3f get2() {
         return pointb;
         return pointb;
     }
     }
 
 
-    public Vector3f get3(){
+    public Vector3f get3() {
         return pointc;
         return pointc;
     }
     }
 
 
@@ -65,40 +65,55 @@ public final class BIHTriangle {
         return center;
         return center;
     }
     }
 
 
-    public Vector3f getNormal(){
+    public Vector3f getNormal() {
         Vector3f normal = new Vector3f(pointb);
         Vector3f normal = new Vector3f(pointb);
-        normal.subtractLocal(pointa).crossLocal(pointc.x-pointa.x, pointc.y-pointa.y, pointc.z-pointa.z);
+        normal.subtractLocal(pointa)
+                .crossLocal(pointc.x - pointa.x, pointc.y - pointa.y, pointc.z - pointa.z);
         normal.normalizeLocal();
         normal.normalizeLocal();
         return normal;
         return normal;
     }
     }
 
 
-    public float getExtreme(int axis, boolean left){
+    public float getExtreme(int axis, boolean left) {
         float v1, v2, v3;
         float v1, v2, v3;
-        switch (axis){
-            case 0: v1 = pointa.x; v2 = pointb.x; v3 = pointc.x; break;
-            case 1: v1 = pointa.y; v2 = pointb.y; v3 = pointc.y; break;
-            case 2: v1 = pointa.z; v2 = pointb.z; v3 = pointc.z; break;
-            default: assert false; return 0;
+        switch (axis) {
+            case 0:
+                v1 = pointa.x;
+                v2 = pointb.x;
+                v3 = pointc.x;
+                break;
+            case 1:
+                v1 = pointa.y;
+                v2 = pointb.y;
+                v3 = pointc.y;
+                break;
+            case 2:
+                v1 = pointa.z;
+                v2 = pointb.z;
+                v3 = pointc.z;
+                break;
+            default:
+                assert false;
+                return 0;
         }
         }
-        if (left){
-            if (v1 < v2){
+        if (left) {
+            if (v1 < v2) {
                 if (v1 < v3)
                 if (v1 < v3)
                     return v1;
                     return v1;
                 else
                 else
                     return v3;
                     return v3;
-            }else{
+            } else {
                 if (v2 < v3)
                 if (v2 < v3)
                     return v2;
                     return v2;
                 else
                 else
                     return v3;
                     return v3;
             }
             }
-        }else{
-            if (v1 > v2){
+        } else {
+            if (v1 > v2) {
                 if (v1 > v3)
                 if (v1 > v3)
                     return v1;
                     return v1;
                 else
                 else
                     return v3;
                     return v3;
-            }else{
+            } else {
                 if (v2 > v3)
                 if (v2 > v3)
                     return v2;
                     return v2;
                 else
                 else
@@ -106,5 +121,4 @@ public final class BIHTriangle {
             }
             }
         }
         }
     }
     }
-
 }
 }

+ 18 - 7
jme3-core/src/main/java/com/jme3/collision/bih/TriangleAxisComparator.java

@@ -38,7 +38,7 @@ public class TriangleAxisComparator implements Comparator<BIHTriangle> {
 
 
     private final int axis;
     private final int axis;
 
 
-    public TriangleAxisComparator(int axis){
+    public TriangleAxisComparator(int axis) {
         this.axis = axis;
         this.axis = axis;
     }
     }
 
 
@@ -47,11 +47,22 @@ public class TriangleAxisComparator implements Comparator<BIHTriangle> {
         float v1, v2;
         float v1, v2;
         Vector3f c1 = o1.getCenter();
         Vector3f c1 = o1.getCenter();
         Vector3f c2 = o2.getCenter();
         Vector3f c2 = o2.getCenter();
-        switch (axis){
-            case 0: v1 = c1.x; v2 = c2.x; break;
-            case 1: v1 = c1.y; v2 = c2.y; break;
-            case 2: v1 = c1.z; v2 = c2.z; break;
-            default: assert false; return 0;
+        switch (axis) {
+            case 0:
+                v1 = c1.x;
+                v2 = c2.x;
+                break;
+            case 1:
+                v1 = c1.y;
+                v2 = c2.y;
+                break;
+            case 2:
+                v1 = c1.z;
+                v2 = c2.z;
+                break;
+            default:
+                assert false;
+                return 0;
         }
         }
         if (v1 > v2)
         if (v1 > v2)
             return 1;
             return 1;
@@ -60,4 +71,4 @@ public class TriangleAxisComparator implements Comparator<BIHTriangle> {
         else
         else
             return 0;
             return 0;
     }
     }
-}
+}

+ 43 - 42
jme3-core/src/main/java/com/jme3/effect/ParticleEmitter.java

@@ -131,13 +131,13 @@ public class ParticleEmitter extends Geometry {
         public Object jmeClone() {
         public Object jmeClone() {
             try {
             try {
                 return super.clone();
                 return super.clone();
-            } catch( CloneNotSupportedException e ) {
+            } catch (CloneNotSupportedException e) {
                 throw new RuntimeException("Error cloning", e);
                 throw new RuntimeException("Error cloning", e);
             }
             }
         }
         }
 
 
         @Override
         @Override
-        public void cloneFields( Cloner cloner, Object original ) {
+        public void cloneFields(Cloner cloner, Object original) {
             this.parentEmitter = cloner.clone(parentEmitter);
             this.parentEmitter = cloner.clone(parentEmitter);
         }
         }
 
 
@@ -179,7 +179,7 @@ public class ParticleEmitter extends Geometry {
 
 
     @Override
     @Override
     public ParticleEmitter clone(boolean cloneMaterial) {
     public ParticleEmitter clone(boolean cloneMaterial) {
-        return (ParticleEmitter)super.clone(cloneMaterial);
+        return (ParticleEmitter) super.clone(cloneMaterial);
     }
     }
 
 
     /**
     /**
@@ -228,7 +228,7 @@ public class ParticleEmitter extends Geometry {
      *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
      *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
      */
      */
     @Override
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         super.cloneFields(cloner, original);
         super.cloneFields(cloner, original);
 
 
         this.shape = cloner.clone(shape);
         this.shape = cloner.clone(shape);
@@ -418,7 +418,7 @@ public class ParticleEmitter extends Geometry {
      * Calling this method many times is not recommended.
      * Calling this method many times is not recommended.
      *
      *
      * @param numParticles the maximum amount of particles that
      * @param numParticles the maximum amount of particles that
-     * can exist at the same time with this emitter.
+     *     can exist at the same time with this emitter.
      */
      */
     public final void setNumParticles(int numParticles) {
     public final void setNumParticles(int numParticles) {
         particles = new Particle[numParticles];
         particles = new Particle[numParticles];
@@ -513,7 +513,7 @@ public class ParticleEmitter extends Geometry {
      * should have a random facing angle.
      * should have a random facing angle.
      *
      *
      * @return true if every particle spawned
      * @return true if every particle spawned
-     * should have a random facing angle.
+     *     should have a random facing angle.
      *
      *
      * @see ParticleEmitter#setRandomAngle(boolean)
      * @see ParticleEmitter#setRandomAngle(boolean)
      */
      */
@@ -526,7 +526,7 @@ public class ParticleEmitter extends Geometry {
      * should have a random facing angle.
      * should have a random facing angle.
      *
      *
      * @param randomAngle if every particle spawned
      * @param randomAngle if every particle spawned
-     * should have a random facing angle.
+     *     should have a random facing angle.
      */
      */
     public void setRandomAngle(boolean randomAngle) {
     public void setRandomAngle(boolean randomAngle) {
         this.randomAngle = randomAngle;
         this.randomAngle = randomAngle;
@@ -537,7 +537,7 @@ public class ParticleEmitter extends Geometry {
      * image.
      * image.
      *
      *
      * @return True if every particle spawned should get a random
      * @return True if every particle spawned should get a random
-     * image.
+     *     image.
      *
      *
      * @see ParticleEmitter#setSelectRandomImage(boolean)
      * @see ParticleEmitter#setSelectRandomImage(boolean)
      */
      */
@@ -559,7 +559,7 @@ public class ParticleEmitter extends Geometry {
      * the particle reaches its end of life.
      * the particle reaches its end of life.
      *
      *
      * @param selectRandomImage True if every particle spawned should get a random
      * @param selectRandomImage True if every particle spawned should get a random
-     * image.
+     *     image.
      */
      */
     public void setSelectRandomImage(boolean selectRandomImage) {
     public void setSelectRandomImage(boolean selectRandomImage) {
         this.selectRandomImage = selectRandomImage;
         this.selectRandomImage = selectRandomImage;
@@ -772,7 +772,7 @@ public class ParticleEmitter extends Geometry {
      * second.
      * second.
      *
      *
      * @return the number of particles to spawn per
      * @return the number of particles to spawn per
-     * second.
+     *     second.
      *
      *
      * @see ParticleEmitter#setParticlesPerSec(float)
      * @see ParticleEmitter#setParticlesPerSec(float)
      */
      */
@@ -785,11 +785,12 @@ public class ParticleEmitter extends Geometry {
      * second.
      * second.
      *
      *
      * @param particlesPerSec the number of particles to spawn per
      * @param particlesPerSec the number of particles to spawn per
-     * second.
+     *     second.
      */
      */
     public void setParticlesPerSec(float particlesPerSec) {
     public void setParticlesPerSec(float particlesPerSec) {
         this.particlesPerSec = particlesPerSec;
         this.particlesPerSec = particlesPerSec;
-        timeDifference = Math.min(timeDifference,1f / particlesPerSec); //prevent large accumulated timeDifference from causing a huge number of particles to be emitted
+        timeDifference = Math.min(timeDifference, 1f / particlesPerSec);
+        //prevent large accumulated timeDifference from causing a huge number of particles to be emitted
     }
     }
 
 
     /**
     /**
@@ -842,7 +843,7 @@ public class ParticleEmitter extends Geometry {
 
 
     /**
     /**
      * @deprecated Use ParticleEmitter.getParticleInfluencer().getInitialVelocity() instead.
      * @deprecated Use ParticleEmitter.getParticleInfluencer().getInitialVelocity() instead.
-     * 
+     *
      * @return the pre-existing velocity vector
      * @return the pre-existing velocity vector
      */
      */
     @Deprecated
     @Deprecated
@@ -852,17 +853,17 @@ public class ParticleEmitter extends Geometry {
 
 
     /**
     /**
      * @param initialVelocity Set the initial velocity a particle is spawned with,
      * @param initialVelocity Set the initial velocity a particle is spawned with,
-     * the initial velocity given in the parameter will be varied according
-     * to the velocity variation set in {@link ParticleEmitter#setVelocityVariation(float) }.
-     * The particle will move with this velocity unless it is affected by
-     * gravity.
+     *     the initial velocity given in the parameter will be varied according
+     *     to the velocity variation set in {@link ParticleEmitter#setVelocityVariation(float) }.
+     *     The particle will move with this velocity unless it is affected by
+     *     gravity.
      *
      *
      * @deprecated
      * @deprecated
-     * This method is deprecated.
-     * Use ParticleEmitter.getParticleInfluencer().setInitialVelocity(initialVelocity); instead.
+     *     This method is deprecated.
+     *     Use ParticleEmitter.getParticleInfluencer().setInitialVelocity(initialVelocity); instead.
      *
      *
      * @see ParticleEmitter#setVelocityVariation(float)
      * @see ParticleEmitter#setVelocityVariation(float)
-     * @see #setGravity(com.jme3.math.Vector3f) 
+     * @see #setGravity(com.jme3.math.Vector3f)
      */
      */
     @Deprecated
     @Deprecated
     public void setInitialVelocity(Vector3f initialVelocity) {
     public void setInitialVelocity(Vector3f initialVelocity) {
@@ -871,8 +872,8 @@ public class ParticleEmitter extends Geometry {
 
 
     /**
     /**
      * @deprecated
      * @deprecated
-     * This method is deprecated.
-     * Use ParticleEmitter.getParticleInfluencer().getVelocityVariation(); instead.
+     *     This method is deprecated.
+     *     Use ParticleEmitter.getParticleInfluencer().getVelocityVariation(); instead.
      * @return the initial velocity variation factor
      * @return the initial velocity variation factor
      */
      */
     @Deprecated
     @Deprecated
@@ -882,15 +883,15 @@ public class ParticleEmitter extends Geometry {
 
 
     /**
     /**
      * @param variation Set the variation by which the initial velocity
      * @param variation Set the variation by which the initial velocity
-     * of the particle is determined. <code>variation</code> should be a value
-     * from 0 to 1, where 0 means particles are to spawn with exactly
-     * the velocity specified in 
-     * {@link com.jme3.effect.influencers.ParticleInfluencer#setInitialVelocity(com.jme3.math.Vector3f)},
-     * and 1 means particles are to spawn with a completely random velocity.
+     *     of the particle is determined. <code>variation</code> should be a value
+     *     from 0 to 1, where 0 means particles are to spawn with exactly
+     *     the velocity specified in
+     *     {@link com.jme3.effect.influencers.ParticleInfluencer#setInitialVelocity(com.jme3.math.Vector3f)},
+     *     and 1 means particles are to spawn with a completely random velocity.
      *
      *
      * @deprecated
      * @deprecated
-     * This method is deprecated.
-     * Use ParticleEmitter.getParticleInfluencer().setVelocityVariation(variation); instead.
+     *     This method is deprecated.
+     *     Use ParticleEmitter.getParticleInfluencer().setVelocityVariation(variation); instead.
      */
      */
     @Deprecated
     @Deprecated
     public void setVelocityVariation(float variation) {
     public void setVelocityVariation(float variation) {
@@ -905,7 +906,8 @@ public class ParticleEmitter extends Geometry {
 
 
         Particle p = particles[idx];
         Particle p = particles[idx];
         if (selectRandomImage) {
         if (selectRandomImage) {
-            p.imageIndex = FastMath.nextRandomInt(0, imagesY - 1) * imagesX + FastMath.nextRandomInt(0, imagesX - 1);
+            p.imageIndex = FastMath.nextRandomInt(0, imagesY - 1)
+                    * imagesX + FastMath.nextRandomInt(0, imagesX - 1);
         }
         }
 
 
         p.startlife = lowLife + FastMath.nextRandomFloat() * (highLife - lowLife);
         p.startlife = lowLife + FastMath.nextRandomFloat() * (highLife - lowLife);
@@ -946,7 +948,7 @@ public class ParticleEmitter extends Geometry {
 
 
     /**
     /**
      * Instantly emits available particles, up to num.
      * Instantly emits available particles, up to num.
-     * 
+     *
      * @param num the maximum number of particles to emit
      * @param num the maximum number of particles to emit
      */
      */
     public void emitParticles(int num) {
     public void emitParticles(int num) {
@@ -970,8 +972,9 @@ public class ParticleEmitter extends Geometry {
             max.set(Vector3f.NEGATIVE_INFINITY);
             max.set(Vector3f.NEGATIVE_INFINITY);
         }
         }
 
 
-        for(int i=0;i<num;i++) {
-            if( emitParticle(min, max) == null ) break;
+        for (int i = 0; i < num; i++) {
+            if (emitParticle(min, max) == null)
+                break;
         }
         }
 
 
         bbox.setMinMax(min, max);
         bbox.setMinMax(min, max);
@@ -998,7 +1001,7 @@ public class ParticleEmitter extends Geometry {
      * @param index The index of the particle to kill
      * @param index The index of the particle to kill
      * @see #getParticles()
      * @see #getParticles()
      */
      */
-    public void killParticle(int index){
+    public void killParticle(int index) {
         freeParticle(index);
         freeParticle(index);
     }
     }
 
 
@@ -1027,7 +1030,7 @@ public class ParticleEmitter extends Geometry {
         particles[idx2] = p1;
         particles[idx2] = p1;
     }
     }
 
 
-    protected void updateParticle(Particle p, float tpf, Vector3f min, Vector3f max){
+    protected void updateParticle(Particle p, float tpf, Vector3f min, Vector3f max) {
         // applying gravity
         // applying gravity
         p.velocity.x -= gravity.x * tpf;
         p.velocity.x -= gravity.x * tpf;
         p.velocity.y -= gravity.y * tpf;
         p.velocity.y -= gravity.y * tpf;
@@ -1089,17 +1092,17 @@ public class ParticleEmitter extends Geometry {
         float interval = 1f / particlesPerSec;
         float interval = 1f / particlesPerSec;
         float originalTpf = tpf;
         float originalTpf = tpf;
         tpf += timeDifference;
         tpf += timeDifference;
-        while (tpf > interval){
+        while (tpf > interval) {
             tpf -= interval;
             tpf -= interval;
             Particle p = emitParticle(min, max);
             Particle p = emitParticle(min, max);
-            if (p != null){
+            if (p != null) {
                 p.life -= tpf;
                 p.life -= tpf;
                 if (lastPos != null && isInWorldSpace()) {
                 if (lastPos != null && isInWorldSpace()) {
                     p.position.interpolateLocal(lastPos, 1 - tpf / originalTpf);
                     p.position.interpolateLocal(lastPos, 1 - tpf / originalTpf);
                 }
                 }
-                if (p.life <= 0){
+                if (p.life <= 0) {
                     freeParticle(lastUsed);
                     freeParticle(lastUsed);
-                }else{
+                } else {
                     updateParticle(p, tpf, min, max);
                     updateParticle(p, tpf, min, max);
                 }
                 }
             }
             }
@@ -1234,7 +1237,6 @@ public class ParticleEmitter extends Geometry {
         meshType = ic.readEnum("meshType", ParticleMesh.Type.class, ParticleMesh.Type.Triangle);
         meshType = ic.readEnum("meshType", ParticleMesh.Type.class, ParticleMesh.Type.Triangle);
         int numParticles = ic.readInt("numParticles", 0);
         int numParticles = ic.readInt("numParticles", 0);
 
 
-
         enabled = ic.readBoolean("enabled", true);
         enabled = ic.readBoolean("enabled", true);
         particlesPerSec = ic.readFloat("particlesPerSec", 0);
         particlesPerSec = ic.readFloat("particlesPerSec", 0);
         lowLife = ic.readFloat("lowLife", 0);
         lowLife = ic.readFloat("lowLife", 0);
@@ -1250,7 +1252,7 @@ public class ParticleEmitter extends Geometry {
         worldSpace = ic.readBoolean("worldSpace", false);
         worldSpace = ic.readBoolean("worldSpace", false);
         this.setIgnoreTransform(worldSpace);
         this.setIgnoreTransform(worldSpace);
         facingVelocity = ic.readBoolean("facingVelocity", false);
         facingVelocity = ic.readBoolean("facingVelocity", false);
-        faceNormal = (Vector3f)ic.readSavable("faceNormal", new Vector3f(Vector3f.NAN));
+        faceNormal = (Vector3f) ic.readSavable("faceNormal", new Vector3f(Vector3f.NAN));
         selectRandomImage = ic.readBoolean("selectRandomImage", false);
         selectRandomImage = ic.readBoolean("selectRandomImage", false);
         randomAngle = ic.readBoolean("randomAngle", false);
         randomAngle = ic.readBoolean("randomAngle", false);
         rotateSpeed = ic.readFloat("rotateSpeed", 0);
         rotateSpeed = ic.readFloat("rotateSpeed", 0);
@@ -1300,7 +1302,6 @@ public class ParticleEmitter extends Geometry {
             // loaded separately
             // loaded separately
             control = getControl(ParticleEmitterControl.class);
             control = getControl(ParticleEmitterControl.class);
             control.parentEmitter = this;
             control.parentEmitter = this;
-
         }
         }
     }
     }
 }
 }

+ 12 - 12
jme3-core/src/main/java/com/jme3/effect/ParticlePointMesh.java

@@ -61,8 +61,8 @@ public class ParticlePointMesh extends ParticleMesh {
 
 
         // set positions
         // set positions
         FloatBuffer pb = BufferUtils.createVector3Buffer(numParticles);
         FloatBuffer pb = BufferUtils.createVector3Buffer(numParticles);
-        
-        //if the buffer is already set only update the data
+
+        // if the buffer is already set only update the data
         VertexBuffer buf = getBuffer(VertexBuffer.Type.Position);
         VertexBuffer buf = getBuffer(VertexBuffer.Type.Position);
         if (buf != null) {
         if (buf != null) {
             buf.updateData(pb);
             buf.updateData(pb);
@@ -74,7 +74,7 @@ public class ParticlePointMesh extends ParticleMesh {
 
 
         // set colors
         // set colors
         ByteBuffer cb = BufferUtils.createByteBuffer(numParticles * 4);
         ByteBuffer cb = BufferUtils.createByteBuffer(numParticles * 4);
-        
+
         buf = getBuffer(VertexBuffer.Type.Color);
         buf = getBuffer(VertexBuffer.Type.Color);
         if (buf != null) {
         if (buf != null) {
             buf.updateData(cb);
             buf.updateData(cb);
@@ -87,7 +87,7 @@ public class ParticlePointMesh extends ParticleMesh {
 
 
         // set sizes
         // set sizes
         FloatBuffer sb = BufferUtils.createFloatBuffer(numParticles);
         FloatBuffer sb = BufferUtils.createFloatBuffer(numParticles);
-        
+
         buf = getBuffer(VertexBuffer.Type.Size);
         buf = getBuffer(VertexBuffer.Type.Size);
         if (buf != null) {
         if (buf != null) {
             buf.updateData(sb);
             buf.updateData(sb);
@@ -98,8 +98,8 @@ public class ParticlePointMesh extends ParticleMesh {
         }
         }
 
 
         // set UV-scale
         // set UV-scale
-        FloatBuffer tb = BufferUtils.createFloatBuffer(numParticles*4);
-        
+        FloatBuffer tb = BufferUtils.createFloatBuffer(numParticles * 4);
+
         buf = getBuffer(VertexBuffer.Type.TexCoord);
         buf = getBuffer(VertexBuffer.Type.TexCoord);
         if (buf != null) {
         if (buf != null) {
             buf.updateData(tb);
             buf.updateData(tb);
@@ -108,7 +108,7 @@ public class ParticlePointMesh extends ParticleMesh {
             tvb.setupData(Usage.Stream, 4, Format.Float, tb);
             tvb.setupData(Usage.Stream, 4, Format.Float, tb);
             setBuffer(tvb);
             setBuffer(tvb);
         }
         }
-        
+
         updateCounts();
         updateCounts();
     }
     }
 
 
@@ -133,9 +133,9 @@ public class ParticlePointMesh extends ParticleMesh {
         colors.rewind();
         colors.rewind();
         sizes.rewind();
         sizes.rewind();
         texcoords.rewind();
         texcoords.rewind();
-        for (int i = 0; i < particles.length; i++){
+        for (int i = 0; i < particles.length; i++) {
             Particle p = particles[i];
             Particle p = particles[i];
-            
+
             positions.put(p.position.x)
             positions.put(p.position.x)
                      .put(p.position.y)
                      .put(p.position.y)
                      .put(p.position.z);
                      .put(p.position.z);
@@ -144,12 +144,12 @@ public class ParticlePointMesh extends ParticleMesh {
             colors.putInt(p.color.asIntABGR());
             colors.putInt(p.color.asIntABGR());
 
 
             int imgX = p.imageIndex % imagesX;
             int imgX = p.imageIndex % imagesX;
-            int imgY = p.imageIndex/imagesX;
+            int imgY = p.imageIndex / imagesX;
 
 
             float startX = ((float) imgX) / imagesX;
             float startX = ((float) imgX) / imagesX;
             float startY = ((float) imgY) / imagesY;
             float startY = ((float) imgY) / imagesY;
-            float endX   = startX + (1f / imagesX);
-            float endY   = startY + (1f / imagesY);
+            float endX = startX + (1f / imagesX);
+            float endY = startY + (1f / imagesY);
 
 
             texcoords.put(startX).put(startY).put(endX).put(endY);
             texcoords.put(startX).put(startY).put(endX).put(endY);
         }
         }

+ 28 - 29
jme3-core/src/main/java/com/jme3/effect/ParticleTriMesh.java

@@ -72,7 +72,7 @@ public class ParticleTriMesh extends ParticleMesh {
             pvb.setupData(Usage.Stream, 3, Format.Float, pb);
             pvb.setupData(Usage.Stream, 3, Format.Float, pb);
             setBuffer(pvb);
             setBuffer(pvb);
         }
         }
-        
+
         // set colors
         // set colors
         ByteBuffer cb = BufferUtils.createByteBuffer(numParticles * 4 * 4);
         ByteBuffer cb = BufferUtils.createByteBuffer(numParticles * 4 * 4);
         buf = getBuffer(VertexBuffer.Type.Color);
         buf = getBuffer(VertexBuffer.Type.Color);
@@ -88,14 +88,14 @@ public class ParticleTriMesh extends ParticleMesh {
         // set texcoords
         // set texcoords
         FloatBuffer tb = BufferUtils.createVector2Buffer(numParticles * 4);
         FloatBuffer tb = BufferUtils.createVector2Buffer(numParticles * 4);
         uniqueTexCoords = false;
         uniqueTexCoords = false;
-        for (int i = 0; i < numParticles; i++){
+        for (int i = 0; i < numParticles; i++) {
             tb.put(0f).put(1f);
             tb.put(0f).put(1f);
             tb.put(1f).put(1f);
             tb.put(1f).put(1f);
             tb.put(0f).put(0f);
             tb.put(0f).put(0f);
             tb.put(1f).put(0f);
             tb.put(1f).put(0f);
         }
         }
         tb.flip();
         tb.flip();
-        
+
         buf = getBuffer(VertexBuffer.Type.TexCoord);
         buf = getBuffer(VertexBuffer.Type.TexCoord);
         if (buf != null) {
         if (buf != null) {
             buf.updateData(tb);
             buf.updateData(tb);
@@ -107,18 +107,18 @@ public class ParticleTriMesh extends ParticleMesh {
 
 
         // set indices
         // set indices
         ShortBuffer ib = BufferUtils.createShortBuffer(numParticles * 6);
         ShortBuffer ib = BufferUtils.createShortBuffer(numParticles * 6);
-        for (int i = 0; i < numParticles; i++){
+        for (int i = 0; i < numParticles; i++) {
             int startIdx = (i * 4);
             int startIdx = (i * 4);
 
 
             // triangle 1
             // triangle 1
-            ib.put((short)(startIdx + 1))
-              .put((short)(startIdx + 0))
-              .put((short)(startIdx + 2));
+            ib.put((short) (startIdx + 1))
+                    .put((short) (startIdx + 0))
+                    .put((short) (startIdx + 2));
 
 
             // triangle 2
             // triangle 2
-            ib.put((short)(startIdx + 1))
-              .put((short)(startIdx + 2))
-              .put((short)(startIdx + 3));
+            ib.put((short) (startIdx + 1))
+                    .put((short) (startIdx + 2))
+                    .put((short) (startIdx + 3));
         }
         }
         ib.flip();
         ib.flip();
 
 
@@ -130,15 +130,15 @@ public class ParticleTriMesh extends ParticleMesh {
             ivb.setupData(Usage.Static, 3, Format.UnsignedShort, ib);
             ivb.setupData(Usage.Static, 3, Format.UnsignedShort, ib);
             setBuffer(ivb);
             setBuffer(ivb);
         }
         }
-        
+
         updateCounts();
         updateCounts();
     }
     }
-    
+
     @Override
     @Override
     public void setImagesXY(int imagesX, int imagesY) {
     public void setImagesXY(int imagesX, int imagesY) {
         this.imagesX = imagesX;
         this.imagesX = imagesX;
         this.imagesY = imagesY;
         this.imagesY = imagesY;
-        if (imagesX != 1 || imagesY != 1){
+        if (imagesX != 1 || imagesY != 1) {
             uniqueTexCoords = true;
             uniqueTexCoords = true;
             getBuffer(VertexBuffer.Type.TexCoord).setUsage(Usage.Stream);
             getBuffer(VertexBuffer.Type.TexCoord).setUsage(Usage.Stream);
         }
         }
@@ -162,9 +162,9 @@ public class ParticleTriMesh extends ParticleMesh {
         VertexBuffer tvb = getBuffer(VertexBuffer.Type.TexCoord);
         VertexBuffer tvb = getBuffer(VertexBuffer.Type.TexCoord);
         FloatBuffer texcoords = (FloatBuffer) tvb.getData();
         FloatBuffer texcoords = (FloatBuffer) tvb.getData();
 
 
-        Vector3f camUp   = cam.getUp();
+        Vector3f camUp = cam.getUp();
         Vector3f camLeft = cam.getLeft();
         Vector3f camLeft = cam.getLeft();
-        Vector3f camDir  = cam.getDirection();
+        Vector3f camDir = cam.getDirection();
 
 
         inverseRotation.multLocal(camUp);
         inverseRotation.multLocal(camUp);
         inverseRotation.multLocal(camLeft);
         inverseRotation.multLocal(camLeft);
@@ -175,7 +175,7 @@ public class ParticleTriMesh extends ParticleMesh {
         Vector3f up = new Vector3f(),
         Vector3f up = new Vector3f(),
                  left = new Vector3f();
                  left = new Vector3f();
 
 
-        if (!facingVelocity){
+        if (!facingVelocity) {
             up.set(camUp);
             up.set(camUp);
             left.set(camLeft);
             left.set(camLeft);
         }
         }
@@ -185,24 +185,24 @@ public class ParticleTriMesh extends ParticleMesh {
         colors.clear();
         colors.clear();
         texcoords.clear();
         texcoords.clear();
         Vector3f faceNormal = emitter.getFaceNormal();
         Vector3f faceNormal = emitter.getFaceNormal();
-        
-        for (int i = 0; i < particles.length; i++){
+
+        for (int i = 0; i < particles.length; i++) {
             Particle p = particles[i];
             Particle p = particles[i];
             boolean dead = p.life == 0;
             boolean dead = p.life == 0;
-            if (dead){
+            if (dead) {
                 positions.put(0).put(0).put(0);
                 positions.put(0).put(0).put(0);
                 positions.put(0).put(0).put(0);
                 positions.put(0).put(0).put(0);
                 positions.put(0).put(0).put(0);
                 positions.put(0).put(0).put(0);
                 positions.put(0).put(0).put(0);
                 positions.put(0).put(0).put(0);
                 continue;
                 continue;
             }
             }
-            
-            if (facingVelocity){
+
+            if (facingVelocity) {
                 left.set(p.velocity).normalizeLocal();
                 left.set(p.velocity).normalizeLocal();
                 camDir.cross(left, up);
                 camDir.cross(left, up);
                 up.multLocal(p.size);
                 up.multLocal(p.size);
                 left.multLocal(p.size);
                 left.multLocal(p.size);
-            }else if (faceNormal != null){
+            } else if (faceNormal != null) {
                 up.set(faceNormal).crossLocal(Vector3f.UNIT_X);
                 up.set(faceNormal).crossLocal(Vector3f.UNIT_X);
                 faceNormal.cross(up, left);
                 faceNormal.cross(up, left);
                 up.multLocal(p.size);
                 up.multLocal(p.size);
@@ -215,7 +215,7 @@ public class ParticleTriMesh extends ParticleMesh {
                     vars.quat1.multLocal(up);
                     vars.quat1.multLocal(up);
                     vars.release();
                     vars.release();
                 }
                 }
-            }else if (p.angle != 0){
+            } else if (p.angle != 0) {
                 float cos = FastMath.cos(p.angle) * p.size;
                 float cos = FastMath.cos(p.angle) * p.size;
                 float sin = FastMath.sin(p.angle) * p.size;
                 float sin = FastMath.sin(p.angle) * p.size;
 
 
@@ -226,7 +226,7 @@ public class ParticleTriMesh extends ParticleMesh {
                 up.x = camLeft.x * -sin + camUp.x * cos;
                 up.x = camLeft.x * -sin + camUp.x * cos;
                 up.y = camLeft.y * -sin + camUp.y * cos;
                 up.y = camLeft.y * -sin + camUp.y * cos;
                 up.z = camLeft.z * -sin + camUp.z * cos;
                 up.z = camLeft.z * -sin + camUp.z * cos;
-            }else{
+            } else {
                 up.set(camUp);
                 up.set(camUp);
                 left.set(camLeft);
                 left.set(camLeft);
                 up.multLocal(p.size);
                 up.multLocal(p.size);
@@ -249,14 +249,14 @@ public class ParticleTriMesh extends ParticleMesh {
                      .put(p.position.y - left.y - up.y)
                      .put(p.position.y - left.y - up.y)
                      .put(p.position.z - left.z - up.z);
                      .put(p.position.z - left.z - up.z);
 
 
-            if (uniqueTexCoords){
+            if (uniqueTexCoords) {
                 int imgX = p.imageIndex % imagesX;
                 int imgX = p.imageIndex % imagesX;
                 int imgY = p.imageIndex / imagesX;
                 int imgY = p.imageIndex / imagesX;
 
 
                 float startX = ((float) imgX) / imagesX;
                 float startX = ((float) imgX) / imagesX;
                 float startY = ((float) imgY) / imagesY;
                 float startY = ((float) imgY) / imagesY;
-                float endX   = startX + (1f / imagesX);
-                float endY   = startY + (1f / imagesY);
+                float endX = startX + (1f / imagesX);
+                float endY = startY + (1f / imagesY);
 
 
                 texcoords.put(startX).put(endY);
                 texcoords.put(startX).put(endY);
                 texcoords.put(endX).put(endY);
                 texcoords.put(endX).put(endY);
@@ -275,7 +275,7 @@ public class ParticleTriMesh extends ParticleMesh {
         colors.clear();
         colors.clear();
         if (!uniqueTexCoords)
         if (!uniqueTexCoords)
             texcoords.clear();
             texcoords.clear();
-        else{
+        else {
             texcoords.clear();
             texcoords.clear();
             tvb.updateData(texcoords);
             tvb.updateData(texcoords);
         }
         }
@@ -284,5 +284,4 @@ public class ParticleTriMesh extends ParticleMesh {
         pvb.updateData(positions);
         pvb.updateData(positions);
         cvb.updateData(colors);
         cvb.updateData(colors);
     }
     }
-
 }
 }

+ 3 - 3
jme3-core/src/main/java/com/jme3/effect/influencers/DefaultParticleInfluencer.java

@@ -91,9 +91,9 @@ public class DefaultParticleInfluencer implements ParticleInfluencer {
     public void read(JmeImporter im) throws IOException {
     public void read(JmeImporter im) throws IOException {
         InputCapsule ic = im.getCapsule(this);
         InputCapsule ic = im.getCapsule(this);
         // NOTE: In previous versions of jME3, initialVelocity was called startVelocity
         // NOTE: In previous versions of jME3, initialVelocity was called startVelocity
-        if (ic.getSavableVersion(DefaultParticleInfluencer.class) == 0){
+        if (ic.getSavableVersion(DefaultParticleInfluencer.class) == 0) {
             initialVelocity = (Vector3f) ic.readSavable("startVelocity", Vector3f.ZERO.clone());
             initialVelocity = (Vector3f) ic.readSavable("startVelocity", Vector3f.ZERO.clone());
-        }else{
+        } else {
             initialVelocity = (Vector3f) ic.readSavable("initialVelocity", Vector3f.ZERO.clone());
             initialVelocity = (Vector3f) ic.readSavable("initialVelocity", Vector3f.ZERO.clone());
         }
         }
         velocityVariation = ic.readFloat("variation", 0.2f);
         velocityVariation = ic.readFloat("variation", 0.2f);
@@ -126,7 +126,7 @@ public class DefaultParticleInfluencer implements ParticleInfluencer {
      *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
      *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
      */
      */
     @Override
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         this.initialVelocity = cloner.clone(initialVelocity);
         this.initialVelocity = cloner.clone(initialVelocity);
 
 
         // Change in behavior: I'm cloning 'for real' the 'temp' field because
         // Change in behavior: I'm cloning 'for real' the 'temp' field because

+ 1 - 1
jme3-core/src/main/java/com/jme3/effect/influencers/EmptyParticleInfluencer.java

@@ -101,6 +101,6 @@ public class EmptyParticleInfluencer implements ParticleInfluencer {
      *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
      *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
      */
      */
     @Override
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
     }
     }
 }
 }

+ 1 - 2
jme3-core/src/main/java/com/jme3/effect/influencers/RadialParticleInfluencer.java

@@ -125,14 +125,13 @@ public class RadialParticleInfluencer extends DefaultParticleInfluencer {
      *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
      *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
      */
      */
     @Override
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         super.cloneFields(cloner, original);
         super.cloneFields(cloner, original);
 
 
         // Change in behavior: the old origin was not cloned -pspeed
         // Change in behavior: the old origin was not cloned -pspeed
         this.origin = cloner.clone(origin);
         this.origin = cloner.clone(origin);
     }
     }
 
 
-
     @Override
     @Override
     public void write(JmeExporter ex) throws IOException {
     public void write(JmeExporter ex) throws IOException {
         super.write(ex);
         super.write(ex);

+ 1 - 1
jme3-core/src/main/java/com/jme3/effect/shapes/EmitterBoxShape.java

@@ -103,7 +103,7 @@ public class EmitterBoxShape implements EmitterShape {
      *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
      *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
      */
      */
     @Override
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         this.min = cloner.clone(min);
         this.min = cloner.clone(min);
         this.len = cloner.clone(len);
         this.len = cloner.clone(len);
     }
     }

+ 2 - 2
jme3-core/src/main/java/com/jme3/effect/shapes/EmitterMeshVertexShape.java

@@ -185,7 +185,7 @@ public class EmitterMeshVertexShape implements EmitterShape {
      *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
      *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
      */
      */
     @Override
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         this.vertices = cloner.clone(vertices);
         this.vertices = cloner.clone(vertices);
         this.normals = cloner.clone(normals);
         this.normals = cloner.clone(normals);
     }
     }
@@ -204,7 +204,7 @@ public class EmitterMeshVertexShape implements EmitterShape {
         this.vertices = ic.readSavableArrayList("vertices", null);
         this.vertices = ic.readSavableArrayList("vertices", null);
 
 
         List<List<Vector3f>> tmpNormals = ic.readSavableArrayList("normals", null);
         List<List<Vector3f>> tmpNormals = ic.readSavableArrayList("normals", null);
-        if (tmpNormals != null){
+        if (tmpNormals != null) {
             this.normals = tmpNormals;
             this.normals = tmpNormals;
         }
         }
     }
     }

+ 1 - 1
jme3-core/src/main/java/com/jme3/effect/shapes/EmitterPointShape.java

@@ -76,7 +76,7 @@ public class EmitterPointShape implements EmitterShape {
      *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
      *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
      */
      */
     @Override
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         this.point = cloner.clone(point);
         this.point = cloner.clone(point);
     }
     }
 
 

+ 1 - 1
jme3-core/src/main/java/com/jme3/effect/shapes/EmitterSphereShape.java

@@ -88,7 +88,7 @@ public class EmitterSphereShape implements EmitterShape {
      *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
      *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
      */
      */
     @Override
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         this.center = cloner.clone(center);
         this.center = cloner.clone(center);
     }
     }
 
 

+ 4 - 4
jme3-core/src/main/java/com/jme3/environment/EnvironmentCamera.java

@@ -274,7 +274,7 @@ public class EnvironmentCamera extends BaseAppState {
      * Note that this will be null until after initialize() is called.
      * Note that this will be null until after initialize() is called.
      * @return array of ViewPorts
      * @return array of ViewPorts
      */
      */
-    public ViewPort[] getViewPorts(){
+    public ViewPort[] getViewPorts() {
         return viewports;
         return viewports;
     }
     }
 
 
@@ -310,7 +310,6 @@ public class EnvironmentCamera extends BaseAppState {
         }
         }
     }
     }
 
 
-
     @Override
     @Override
     protected void cleanup(Application app) {
     protected void cleanup(Application app) {
         this.backGroundColor = null;
         this.backGroundColor = null;
@@ -320,7 +319,7 @@ public class EnvironmentCamera extends BaseAppState {
         }
         }
 
 
         for (final Image image : images) {
         for (final Image image : images) {
-            if( image != null){
+            if (image != null) {
                 image.dispose();
                 image.dispose();
             }
             }
         }
         }
@@ -353,7 +352,8 @@ public class EnvironmentCamera extends BaseAppState {
      * @param axisZ tha z axis
      * @param axisZ tha z axis
      * @return a new instance
      * @return a new instance
      */
      */
-    protected Camera createOffCamera(final int mapSize, final Vector3f worldPos, final Vector3f axisX, final Vector3f axisY, final Vector3f axisZ) {
+    protected Camera createOffCamera(final int mapSize, final Vector3f worldPos,
+            final Vector3f axisX, final Vector3f axisY, final Vector3f axisZ) {
         final Camera offCamera = new Camera(mapSize, mapSize);
         final Camera offCamera = new Camera(mapSize, mapSize);
         offCamera.setLocation(worldPos);
         offCamera.setLocation(worldPos);
         offCamera.setAxes(axisX, axisY, axisZ);
         offCamera.setAxes(axisX, axisY, axisZ);

+ 4 - 9
jme3-core/src/main/java/com/jme3/environment/util/LightsDebugState.java

@@ -48,7 +48,7 @@ import java.util.Map;
 /**
 /**
  * A debug state that will display Light gizmos on screen.
  * A debug state that will display Light gizmos on screen.
  * Still a wip and for now it only displays light probes.
  * Still a wip and for now it only displays light probes.
- * 
+ *
  * @author nehon
  * @author nehon
  */
  */
 public class LightsDebugState extends BaseAppState {
 public class LightsDebugState extends BaseAppState {
@@ -78,7 +78,7 @@ public class LightsDebugState extends BaseAppState {
 
 
     @Override
     @Override
     public void update(float tpf) {
     public void update(float tpf) {
-        if(!isEnabled()){
+        if (!isEnabled()) {
             return;
             return;
         }
         }
         updateLights(scene);
         updateLights(scene);
@@ -115,7 +115,7 @@ public class LightsDebugState extends BaseAppState {
                     break;
                     break;
             }
             }
         }
         }
-        if( scene instanceof Node){
+        if (scene instanceof Node) {
             Node n = (Node)scene;
             Node n = (Node)scene;
             for (Spatial spatial : n.getChildren()) {
             for (Spatial spatial : n.getChildren()) {
                 updateLights(spatial);
                 updateLights(spatial);
@@ -149,13 +149,12 @@ public class LightsDebugState extends BaseAppState {
 
 
     @Override
     @Override
     public void render(RenderManager rm) {
     public void render(RenderManager rm) {
-        if(!isEnabled()){
+        if (!isEnabled()) {
             return;
             return;
         }
         }
         rm.renderScene(debugNode, getApplication().getViewPort());
         rm.renderScene(debugNode, getApplication().getViewPort());
     }
     }
 
 
-
     /**
     /**
      * returns the scale of the probe's debug sphere
      * returns the scale of the probe's debug sphere
      * @return the scale factor
      * @return the scale factor
@@ -175,17 +174,13 @@ public class LightsDebugState extends BaseAppState {
 
 
     @Override
     @Override
     protected void cleanup(Application app) {
     protected void cleanup(Application app) {
-
     }
     }
 
 
     @Override
     @Override
     protected void onEnable() {
     protected void onEnable() {
-
     }
     }
 
 
     @Override
     @Override
     protected void onDisable() {
     protected void onDisable() {
-
     }
     }
-
 }
 }

+ 4 - 4
jme3-core/src/main/java/com/jme3/export/FormatVersion.java

@@ -33,7 +33,7 @@ package com.jme3.export;
 
 
 /**
 /**
  * Specifies the version of the format for jME3 object (j3o) files.
  * Specifies the version of the format for jME3 object (j3o) files.
- * 
+ *
  * @author Kirill Vainer
  * @author Kirill Vainer
  */
  */
 public final class FormatVersion {
 public final class FormatVersion {
@@ -42,12 +42,12 @@ public final class FormatVersion {
      * Version number of the format
      * Version number of the format
      */
      */
     public static final int VERSION = 2;
     public static final int VERSION = 2;
-    
+
     /**
     /**
      * Signature of the format: currently, "JME3" as ASCII.
      * Signature of the format: currently, "JME3" as ASCII.
      */
      */
     public static final int SIGNATURE = 0x4A4D4533;
     public static final int SIGNATURE = 0x4A4D4533;
-    
-    private FormatVersion(){
+
+    private FormatVersion() {
     }
     }
 }
 }

+ 16 - 15
jme3-core/src/main/java/com/jme3/export/SavableClassUtil.java

@@ -59,7 +59,7 @@ public class SavableClassUtil {
 
 
     private final static HashMap<String, String> CLASS_REMAPPINGS = new HashMap<>();
     private final static HashMap<String, String> CLASS_REMAPPINGS = new HashMap<>();
 
 
-    private static void addRemapping(String oldClass, Class<? extends Savable> newClass){
+    private static void addRemapping(String oldClass, Class<? extends Savable> newClass) {
         CLASS_REMAPPINGS.put(oldClass, newClass.getName());
         CLASS_REMAPPINGS.put(oldClass, newClass.getName());
     }
     }
 
 
@@ -95,13 +95,13 @@ public class SavableClassUtil {
         }
         }
     }
     }
 
 
-    public static boolean isImplementingSavable(Class clazz){
+    public static boolean isImplementingSavable(Class clazz) {
         boolean result = Savable.class.isAssignableFrom(clazz);
         boolean result = Savable.class.isAssignableFrom(clazz);
         return result;
         return result;
     }
     }
 
 
     @SuppressWarnings("unchecked")
     @SuppressWarnings("unchecked")
-    public static int[] getSavableVersions(Class<? extends Savable> clazz) throws IOException{
+    public static int[] getSavableVersions(Class<? extends Savable> clazz) throws IOException {
         ArrayList<Integer> versionList = new ArrayList<>();
         ArrayList<Integer> versionList = new ArrayList<>();
         Class superclass = clazz;
         Class superclass = clazz;
         do {
         do {
@@ -110,20 +110,20 @@ public class SavableClassUtil {
         } while (superclass != null && SavableClassUtil.isImplementingSavable(superclass));
         } while (superclass != null && SavableClassUtil.isImplementingSavable(superclass));
 
 
         int[] versions = new int[versionList.size()];
         int[] versions = new int[versionList.size()];
-        for (int i = 0; i < versionList.size(); i++){
+        for (int i = 0; i < versionList.size(); i++) {
             versions[i] = versionList.get(i);
             versions[i] = versionList.get(i);
         }
         }
         return versions;
         return versions;
     }
     }
 
 
     @SuppressWarnings("unchecked")
     @SuppressWarnings("unchecked")
-    public static int getSavableVersion(Class<? extends Savable> clazz) throws IOException{
+    public static int getSavableVersion(Class<? extends Savable> clazz) throws IOException {
         try {
         try {
             Field field = clazz.getField("SAVABLE_VERSION");
             Field field = clazz.getField("SAVABLE_VERSION");
             Class<? extends Savable> declaringClass = (Class<? extends Savable>) field.getDeclaringClass();
             Class<? extends Savable> declaringClass = (Class<? extends Savable>) field.getDeclaringClass();
-            if (declaringClass == clazz){
+            if (declaringClass == clazz) {
                 return field.getInt(null);
                 return field.getInt(null);
-            }else{
+            } else {
                 return 0; // This class doesn't declare this field, e.g. version == 0
                 return 0; // This class doesn't declare this field, e.g. version == 0
             }
             }
         } catch (IllegalAccessException ex) {
         } catch (IllegalAccessException ex) {
@@ -137,27 +137,28 @@ public class SavableClassUtil {
         }
         }
     }
     }
 
 
-    public static int getSavedSavableVersion(Object savable, Class<? extends Savable> desiredClass, int[] versions, int formatVersion){
+    public static int getSavedSavableVersion(Object savable,
+            Class<? extends Savable> desiredClass, int[] versions, int formatVersion) {
         Class thisClass = savable.getClass();
         Class thisClass = savable.getClass();
         int count = 0;
         int count = 0;
 
 
         while (thisClass != desiredClass) {
         while (thisClass != desiredClass) {
             thisClass = thisClass.getSuperclass();
             thisClass = thisClass.getSuperclass();
-            if (thisClass != null && SavableClassUtil.isImplementingSavable(thisClass)){
-                count ++;
-            }else{
+            if (thisClass != null && SavableClassUtil.isImplementingSavable(thisClass)) {
+                count++;
+            } else {
                 break;
                 break;
             }
             }
         }
         }
 
 
-        if (thisClass == null){
+        if (thisClass == null) {
             throw new IllegalArgumentException(savable.getClass().getName() +
             throw new IllegalArgumentException(savable.getClass().getName() +
                                                " does not extend " +
                                                " does not extend " +
                                                desiredClass.getName() + "!");
                                                desiredClass.getName() + "!");
-        }else if (count >= versions.length){
-            if (formatVersion <= 1){
+        } else if (count >= versions.length) {
+            if (formatVersion <= 1) {
                 return 0; // for buggy versions of j3o
                 return 0; // for buggy versions of j3o
-            }else{
+            } else {
                 throw new IllegalArgumentException(savable.getClass().getName() +
                 throw new IllegalArgumentException(savable.getClass().getName() +
                                                    " cannot access version of " +
                                                    " cannot access version of " +
                                                    desiredClass.getName() +
                                                    desiredClass.getName() +

+ 8 - 8
jme3-core/src/main/java/com/jme3/font/BitmapCharacter.java

@@ -50,9 +50,9 @@ public class BitmapCharacter implements Savable, Cloneable {
     private int xAdvance;
     private int xAdvance;
     private IntMap<Integer> kerning = new IntMap<>();
     private IntMap<Integer> kerning = new IntMap<>();
     private int page;
     private int page;
-    
+
     public BitmapCharacter() {}
     public BitmapCharacter() {}
-    
+
     public BitmapCharacter(char c) {
     public BitmapCharacter(char c) {
         this.c = c;
         this.c = c;
     }
     }
@@ -131,20 +131,20 @@ public class BitmapCharacter implements Savable, Cloneable {
     public int getPage() {
     public int getPage() {
         return page;
         return page;
     }
     }
-    
+
     public char getChar() {
     public char getChar() {
         return c;
         return c;
     }
     }
-    
+
     public void setChar(char c) {
     public void setChar(char c) {
         this.c = c;
         this.c = c;
     }
     }
 
 
-    public void addKerning(int second, int amount){
+    public void addKerning(int second, int amount) {
         kerning.put(second, amount);
         kerning.put(second, amount);
     }
     }
 
 
-    public int getKerning(int second){
+    public int getKerning(int second) {
         Integer i = kerning.get(second);
         Integer i = kerning.get(second);
         if (i == null)
         if (i == null)
             return 0;
             return 0;
@@ -168,7 +168,7 @@ public class BitmapCharacter implements Savable, Cloneable {
         int[] amounts = new int[seconds.length];
         int[] amounts = new int[seconds.length];
 
 
         int i = 0;
         int i = 0;
-        for (Entry<Integer> entry : kerning){
+        for (Entry<Integer> entry : kerning) {
             seconds[i] = entry.getKey();
             seconds[i] = entry.getKey();
             amounts[i] = entry.getValue();
             amounts[i] = entry.getValue();
             i++;
             i++;
@@ -193,7 +193,7 @@ public class BitmapCharacter implements Savable, Cloneable {
         int[] seconds = ic.readIntArray("seconds", null);
         int[] seconds = ic.readIntArray("seconds", null);
         int[] amounts = ic.readIntArray("amounts", null);
         int[] amounts = ic.readIntArray("amounts", null);
 
 
-        for (int i = 0; i < seconds.length; i++){
+        for (int i = 0; i < seconds.length; i++) {
             kerning.put(seconds[i], amounts[i]);
             kerning.put(seconds[i], amounts[i]);
         }
         }
     }
     }

+ 8 - 8
jme3-core/src/main/java/com/jme3/font/BitmapCharacterSet.java

@@ -73,7 +73,7 @@ public class BitmapCharacterSet implements Savable {
         short[] indexes = new short[size];
         short[] indexes = new short[size];
         BitmapCharacter[] chars = new BitmapCharacter[size];
         BitmapCharacter[] chars = new BitmapCharacter[size];
         int i = 0;
         int i = 0;
-        for (Entry<BitmapCharacter> chr : charset){
+        for (Entry<BitmapCharacter> chr : charset) {
             indexes[i] = (short) chr.getKey();
             indexes[i] = (short) chr.getKey();
             chars[i] = chr.getValue();
             chars[i] = chr.getValue();
             i++;
             i++;
@@ -104,7 +104,7 @@ public class BitmapCharacterSet implements Savable {
         short[] indexes = ic.readShortArray("indexes"+style, null);
         short[] indexes = ic.readShortArray("indexes"+style, null);
         Savable[] chars = ic.readSavableArray("chars"+style, null);
         Savable[] chars = ic.readSavableArray("chars"+style, null);
 
 
-        for (int i = 0; i < indexes.length; i++){
+        for (int i = 0; i < indexes.length; i++) {
             int index = indexes[i] & 0xFFFF;
             int index = indexes[i] & 0xFFFF;
             BitmapCharacter chr = (BitmapCharacter) chars[i];
             BitmapCharacter chr = (BitmapCharacter) chars[i];
             charset.put(index, chr);
             charset.put(index, chr);
@@ -116,11 +116,11 @@ public class BitmapCharacterSet implements Savable {
         characters = new IntMap<IntMap<BitmapCharacter>>();
         characters = new IntMap<IntMap<BitmapCharacter>>();
     }
     }
 
 
-    public BitmapCharacter getCharacter(int index){
+    public BitmapCharacter getCharacter(int index) {
         return getCharacter(index, 0);
         return getCharacter(index, 0);
     }
     }
-    
-    public BitmapCharacter getCharacter(int index, int style){
+
+    public BitmapCharacter getCharacter(int index, int style) {
         IntMap<BitmapCharacter> map = getCharacterSet(style);
         IntMap<BitmapCharacter> map = getCharacterSet(style);
         return map.get(index);
         return map.get(index);
     }
     }
@@ -132,7 +132,7 @@ public class BitmapCharacterSet implements Savable {
         return characters.get(style);
         return characters.get(style);
     }
     }
 
 
-    public void addCharacter(int index, BitmapCharacter ch){
+    public void addCharacter(int index, BitmapCharacter ch) {
         getCharacterSet(0).put(index, ch);
         getCharacterSet(0).put(index, ch);
     }
     }
 
 
@@ -175,7 +175,7 @@ public class BitmapCharacterSet implements Savable {
     public void setHeight(int height) {
     public void setHeight(int height) {
         this.height = height;
         this.height = height;
     }
     }
-    
+
     /**
     /**
      * Merge two fonts.
      * Merge two fonts.
      * If two font have the same style, merge will fail.
      * If two font have the same style, merge will fail.
@@ -197,7 +197,7 @@ public class BitmapCharacterSet implements Savable {
             if (old != null) {
             if (old != null) {
                 throw new RuntimeException("Can't override old style");
                 throw new RuntimeException("Can't override old style");
             }
             }
-            
+
             for (Entry<BitmapCharacter> charEntry : charset) {
             for (Entry<BitmapCharacter> charEntry : charset) {
                 BitmapCharacter ch = charEntry.getValue();
                 BitmapCharacter ch = charEntry.getValue();
                 ch.setPage(ch.getPage() + this.pageSize);
                 ch.setPage(ch.getPage() + this.pageSize);

+ 29 - 30
jme3-core/src/main/java/com/jme3/font/BitmapFont.java

@@ -44,43 +44,43 @@ public class BitmapFont implements Savable {
 
 
     /**
     /**
      * Specifies horizontal alignment for text.
      * Specifies horizontal alignment for text.
-     * 
-     * @see BitmapText#setAlignment(com.jme3.font.BitmapFont.Align) 
+     *
+     * @see BitmapText#setAlignment(com.jme3.font.BitmapFont.Align)
      */
      */
     public enum Align {
     public enum Align {
-        
+
         /**
         /**
          * Align text on the left of the text block
          * Align text on the left of the text block
          */
          */
-        Left, 
-        
+        Left,
+
         /**
         /**
          * Align text in the center of the text block
          * Align text in the center of the text block
          */
          */
-        Center, 
-        
+        Center,
+
         /**
         /**
          * Align text on the right of the text block
          * Align text on the right of the text block
          */
          */
         Right
         Right
     }
     }
-    
+
     /**
     /**
      * Specifies vertical alignment for text.
      * Specifies vertical alignment for text.
-     * 
-     * @see BitmapText#setVerticalAlignment(com.jme3.font.BitmapFont.VAlign) 
+     *
+     * @see BitmapText#setVerticalAlignment(com.jme3.font.BitmapFont.VAlign)
      */
      */
     public enum VAlign {
     public enum VAlign {
         /**
         /**
          * Align text on the top of the text block
          * Align text on the top of the text block
          */
          */
-        Top, 
-        
+        Top,
+
         /**
         /**
          * Align text in the center of the text block
          * Align text in the center of the text block
          */
          */
-        Center, 
-        
+        Center,
+
         /**
         /**
          * Align text at the bottom of the text block
          * Align text at the bottom of the text block
          */
          */
@@ -114,14 +114,14 @@ public class BitmapFont implements Savable {
     public BitmapFont() {
     public BitmapFont() {
     }
     }
 
 
-    public BitmapText createLabel(String content){
+    public BitmapText createLabel(String content) {
         BitmapText label = new BitmapText(this);
         BitmapText label = new BitmapText(this);
         label.setSize(getCharSet().getRenderedSize());
         label.setSize(getCharSet().getRenderedSize());
         label.setText(content);
         label.setText(content);
         return label;
         return label;
     }
     }
 
 
-    public float getPreferredSize(){
+    public float getPreferredSize() {
         return getCharSet().getRenderedSize();
         return getCharSet().getRenderedSize();
     }
     }
 
 
@@ -175,7 +175,7 @@ public class BitmapFont implements Savable {
         return charSet.getLineHeight() * (sb.getSize() / charSet.getRenderedSize());
         return charSet.getLineHeight() * (sb.getSize() / charSet.getRenderedSize());
     }
     }
 
 
-    public float getCharacterAdvance(char curChar, char nextChar, float size){
+    public float getCharacterAdvance(char curChar, char nextChar, float size) {
         BitmapCharacter c = charSet.getCharacter(curChar);
         BitmapCharacter c = charSet.getCharacter(curChar);
         if (c == null)
         if (c == null)
             return 0f;
             return 0f;
@@ -212,8 +212,7 @@ public class BitmapFont implements Savable {
         glyphParser = (GlyphParser) ic.readSavable("glyphParser", null);
         glyphParser = (GlyphParser) ic.readSavable("glyphParser", null);
     }
     }
 
 
-    public float getLineWidth(CharSequence text){
-
+    public float getLineWidth(CharSequence text) {
         // This method will probably always be a bit of a maintenance
         // This method will probably always be a bit of a maintenance
         // nightmare since it bases its calculation on a different
         // nightmare since it bases its calculation on a different
         // routine than the Letters class.  The ideal situation would
         // routine than the Letters class.  The ideal situation would
@@ -224,8 +223,8 @@ public class BitmapFont implements Savable {
         // than Letters does with the same text then it might be better
         // than Letters does with the same text then it might be better
         // just to create a Letters object for the sole purpose of
         // just to create a Letters object for the sole purpose of
         // getting a text size.  It's less efficient but at least it
         // getting a text size.  It's less efficient but at least it
-        // would be accurate.  
-        
+        // would be accurate.
+
         // And here I am mucking around in here again...
         // And here I am mucking around in here again...
         //
         //
         // A font character has a few values that are pertinent to the
         // A font character has a few values that are pertinent to the
@@ -242,11 +241,11 @@ public class BitmapFont implements Savable {
         // So, a width should be calculated in a similar way.  Start with
         // So, a width should be calculated in a similar way.  Start with
         // -xOffset + xAdvance for the first character and then each subsequent
         // -xOffset + xAdvance for the first character and then each subsequent
         // character is just xAdvance more 'width'.
         // character is just xAdvance more 'width'.
-        // 
+        //
         // The kerning amount from one character to the next affects the
         // The kerning amount from one character to the next affects the
-        // cursor position of that next character and thus the ultimate width 
+        // cursor position of that next character and thus the ultimate width
         // and so must be factored in also.
         // and so must be factored in also.
-        
+
         float lineWidth = 0f;
         float lineWidth = 0f;
         float maxLineWidth = 0f;
         float maxLineWidth = 0f;
         char lastChar = 0;
         char lastChar = 0;
@@ -255,9 +254,9 @@ public class BitmapFont implements Savable {
         float sizeScale = 1f;
         float sizeScale = 1f;
         CharSequence characters = glyphParser != null ? glyphParser.parse(text) : text;
         CharSequence characters = glyphParser != null ? glyphParser.parse(text) : text;
 
 
-        for (int i = 0; i < characters.length(); i++){
+        for (int i = 0; i < characters.length(); i++) {
             char theChar = characters.charAt(i);
             char theChar = characters.charAt(i);
-            if (theChar == '\n'){
+            if (theChar == '\n') {
                 maxLineWidth = Math.max(maxLineWidth, lineWidth);
                 maxLineWidth = Math.max(maxLineWidth, lineWidth);
                 lineWidth = 0f;
                 lineWidth = 0f;
                 firstCharOfLine = true;
                 firstCharOfLine = true;
@@ -308,7 +307,7 @@ public class BitmapFont implements Savable {
                         // we just added by the appropriate amount.
                         // we just added by the appropriate amount.
                         lineWidth += c.getXOffset() * sizeScale;
                         lineWidth += c.getXOffset() * sizeScale;
                     }
                     }
-                } else {                 
+                } else {
                     lineWidth += xAdvance;
                     lineWidth += xAdvance;
                 }
                 }
             }
             }
@@ -327,13 +326,13 @@ public class BitmapFont implements Savable {
         charSet.merge(newFont.charSet);
         charSet.merge(newFont.charSet);
         final int size1 = this.pages.length;
         final int size1 = this.pages.length;
         final int size2 = newFont.pages.length;
         final int size2 = newFont.pages.length;
-        
+
         Material[] tmp = new Material[size1+size2];
         Material[] tmp = new Material[size1+size2];
         System.arraycopy(this.pages, 0, tmp, 0, size1);
         System.arraycopy(this.pages, 0, tmp, 0, size1);
         System.arraycopy(newFont.pages, 0, tmp, size1, size2);
         System.arraycopy(newFont.pages, 0, tmp, size1, size2);
-        
+
         this.pages = tmp;
         this.pages = tmp;
-        
+
 //        this.pages = Arrays.copyOf(this.pages, size1+size2);
 //        this.pages = Arrays.copyOf(this.pages, size1+size2);
 //        System.arraycopy(newFont.pages, 0, this.pages, size1, size2);
 //        System.arraycopy(newFont.pages, 0, this.pages, size1, size2);
     }
     }

+ 5 - 4
jme3-core/src/main/java/com/jme3/font/BitmapText.java

@@ -91,14 +91,14 @@ public class BitmapText extends Node {
      *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
      *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
      */
      */
     @Override
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         super.cloneFields(cloner, original);
         super.cloneFields(cloner, original);
 
 
         textPages = textPages.clone();
         textPages = textPages.clone();
-        for( int i = 0; i < textPages.length; i++ ) {
+        for (int i = 0; i < textPages.length; i++) {
             textPages[i] = cloner.clone(textPages[i]);
             textPages[i] = cloner.clone(textPages[i]);
         }
         }
-        
+
         // Cannot use the cloner to clone the StringBlock because it
         // Cannot use the cloner to clone the StringBlock because it
         // is package private... so we'll forgo the (probably unnecessary)
         // is package private... so we'll forgo the (probably unnecessary)
         // reference fixup in this case and just clone it directly.
         // reference fixup in this case and just clone it directly.
@@ -276,7 +276,8 @@ public class BitmapText extends Node {
         if (textBox != null) {
         if (textBox != null) {
             return Math.max(letters.getTotalWidth(), textBox.width);
             return Math.max(letters.getTotalWidth(), textBox.width);
         }
         }
-      //  Please note that BitmapText.getLineWidth() might differ from Font.getLineWidth() -->   scale it with Font.getPreferredSize()/BitmapText.getSize()
+        //  Please note that BitMaptext.getLineWidth() might differ from Font.getLineWidth()
+        // -->   scale it with Font.getPreferredSize()/BitMaptext.getSize()
         return letters.getTotalWidth();
         return letters.getTotalWidth();
     }
     }
 
 

+ 2 - 2
jme3-core/src/main/java/com/jme3/font/BitmapTextPage.java

@@ -128,7 +128,7 @@ class BitmapTextPage extends Geometry {
      *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
      *  Called internally by com.jme3.util.clone.Cloner.  Do not call directly.
      */
      */
     @Override
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         
         
         Mesh originalMesh = this.mesh;
         Mesh originalMesh = this.mesh;
     
     
@@ -138,7 +138,7 @@ class BitmapTextPage extends Geometry {
         // BitmapText instances will clobber one another.
         // BitmapText instances will clobber one another.
         // But if we were already deep cloning meshes then we don't
         // But if we were already deep cloning meshes then we don't
         // want to do it again... so we'll check first.
         // want to do it again... so we'll check first.
-        if( this.mesh == originalMesh ) {
+        if (this.mesh == originalMesh) {
             this.mesh = mesh.deepClone();
             this.mesh = mesh.deepClone();
         }        
         }        
     }        
     }        

+ 13 - 13
jme3-core/src/main/java/com/jme3/font/ColorTags.java

@@ -57,14 +57,14 @@ class ColorTags {
     ColorTags(String seq) {
     ColorTags(String seq) {
         setText(seq);
         setText(seq);
     }
     }
-    
+
     /**
     /**
      * @return text without color tags
      * @return text without color tags
      */
      */
     String getPlainText() {
     String getPlainText() {
         return text;
         return text;
     }
     }
-    
+
     LinkedList<Range> getTags() {
     LinkedList<Range> getTags() {
         return colors;
         return colors;
     }
     }
@@ -96,34 +96,34 @@ class ColorTags {
         }
         }
     }
     }
 
 
-    void setBaseAlpha( float alpha ) {
+    void setBaseAlpha(float alpha) {
         this.baseAlpha = alpha;
         this.baseAlpha = alpha;
-        if( alpha == -1 ) {
+        if (alpha == -1) {
             // Need to reinitialize from the original text
             // Need to reinitialize from the original text
             setText(original);
             setText(original);
             return;
             return;
         }
         }
-        
-        // Else set the alpha for all of them            
-        for( Range r : colors ) {
+
+        // Else set the alpha for all of them
+        for (Range r : colors) {
             r.color.a = alpha;
             r.color.a = alpha;
         }
         }
     }
     }
- 
+
     /**
     /**
      *  Sets the colors of all ranges, overriding any color tags
      *  Sets the colors of all ranges, overriding any color tags
      *  that were in the original text.
      *  that were in the original text.
-     */   
-    void setBaseColor( ColorRGBA color ) {
+     */
+    void setBaseColor(ColorRGBA color) {
         // There are times when the alpha is directly modified
         // There are times when the alpha is directly modified
         // and the caller may have passed a constant... so we
         // and the caller may have passed a constant... so we
         // should clone it.
         // should clone it.
         color = color.clone();
         color = color.clone();
-        for( Range r : colors ) {
+        for (Range r : colors) {
             r.color = color;
             r.color = color;
         }
         }
     }
     }
-    
+
     class Range {
     class Range {
         int start;
         int start;
         ColorRGBA color;
         ColorRGBA color;
@@ -140,7 +140,7 @@ class ColorTags {
                 }
                 }
                 else if (colorStr.length() == 8) {
                 else if (colorStr.length() == 8) {
                     color.a = Integer.parseInt(colorStr.subSequence(6,8).toString(), 16) / 255f;
                     color.a = Integer.parseInt(colorStr.subSequence(6,8).toString(), 16) / 255f;
-                } 
+                }
             } else {
             } else {
                 color.set(Integer.parseInt(Character.toString(colorStr.charAt(0)), 16) / 15f,
                 color.set(Integer.parseInt(Character.toString(colorStr.charAt(0)), 16) / 15f,
                           Integer.parseInt(Character.toString(colorStr.charAt(1)), 16) / 15f,
                           Integer.parseInt(Character.toString(colorStr.charAt(1)), 16) / 15f,

+ 41 - 41
jme3-core/src/main/java/com/jme3/font/LetterQuad.java

@@ -70,7 +70,7 @@ class LetterQuad {
     private float alignX;
     private float alignX;
     private float alignY;
     private float alignY;
     private float sizeScale = 1;
     private float sizeScale = 1;
-    
+
     /**
     /**
      * create head / tail
      * create head / tail
      * @param font
      * @param font
@@ -86,7 +86,7 @@ class LetterQuad {
 
 
     /**
     /**
      * create letter and append to previous LetterQuad
      * create letter and append to previous LetterQuad
-     * 
+     *
      * @param c
      * @param c
      * @param prev previous character
      * @param prev previous character
      */
      */
@@ -99,7 +99,7 @@ class LetterQuad {
         setBitmapChar(c);
         setBitmapChar(c);
         prev.insert(this);
         prev.insert(this);
     }
     }
-    
+
     LetterQuad addNextCharacter(char c) {
     LetterQuad addNextCharacter(char c) {
         LetterQuad n = new LetterQuad(c, this);
         LetterQuad n = new LetterQuad(c, this);
         return n;
         return n;
@@ -108,11 +108,11 @@ class LetterQuad {
     BitmapCharacter getBitmapChar() {
     BitmapCharacter getBitmapChar() {
         return bitmapChar;
         return bitmapChar;
     }
     }
-    
+
     char getChar() {
     char getChar() {
         return c;
         return c;
     }
     }
-    
+
     int getIndex() {
     int getIndex() {
         return index;
         return index;
     }
     }
@@ -147,11 +147,11 @@ class LetterQuad {
     float getV1() {
     float getV1() {
         return v1;
         return v1;
     }
     }
-    
-    boolean isRightToLeft(){
+
+    boolean isRightToLeft() {
         return rightToLeft;
         return rightToLeft;
     }
     }
-    
+
     boolean isInvalid() {
     boolean isInvalid() {
         return x0 == Integer.MIN_VALUE;
         return x0 == Integer.MIN_VALUE;
     }
     }
@@ -159,7 +159,7 @@ class LetterQuad {
     boolean isInvalid(StringBlock block) {
     boolean isInvalid(StringBlock block) {
         return isInvalid(block, 0);
         return isInvalid(block, 0);
     }
     }
-    
+
     boolean isInvalid(StringBlock block, float gap) {
     boolean isInvalid(StringBlock block, float gap) {
         if (isHead() || isTail())
         if (isHead() || isTail())
             return false;
             return false;
@@ -177,25 +177,25 @@ class LetterQuad {
             return x0 > 0 && bound.x+bound.width-gap < getX1();
             return x0 > 0 && bound.x+bound.width-gap < getX1();
         }
         }
     }
     }
-    
+
     void clip(StringBlock block) {
     void clip(StringBlock block) {
         Rectangle bound = block.getTextBox();
         Rectangle bound = block.getTextBox();
         if (bound == null)
         if (bound == null)
             return;
             return;
-            
+
         // Clip the right x position and texture coordinate
         // Clip the right x position and texture coordinate
         // to the string block
         // to the string block
         float x1 = Math.min(bound.x + bound.width, x0 + width);
         float x1 = Math.min(bound.x + bound.width, x0 + width);
         float newWidth = x1 - x0;
         float newWidth = x1 - x0;
         if (isRightToLeft()) newWidth = x1; // only the available space to the left
         if (isRightToLeft()) newWidth = x1; // only the available space to the left
-        if( newWidth == width )
+        if (newWidth == width)
             return;
             return;
-            
+
         float rescale = newWidth / width;
         float rescale = newWidth / width;
         u1 = u0 + (u1 - u0) * rescale;
         u1 = u0 + (u1 - u0) * rescale;
-        width = newWidth;  
+        width = newWidth;
     }
     }
-    
+
     float getX0() {
     float getX0() {
         return x0;
         return x0;
     }
     }
@@ -218,11 +218,11 @@ class LetterQuad {
     float getY1() {
     float getY1() {
         return y0-height;
         return y0-height;
     }
     }
-    
+
     float getWidth() {
     float getWidth() {
         return width;
         return width;
     }
     }
-    
+
     float getHeight() {
     float getHeight() {
         return height;
         return height;
     }
     }
@@ -234,7 +234,7 @@ class LetterQuad {
         ins.previous = this;
         ins.previous = this;
         n.previous = ins;
         n.previous = ins;
     }
     }
-    
+
     void invalidate() {
     void invalidate() {
         eol = isLineFeed();
         eol = isLineFeed();
         setBitmapChar(font.getCharSet().getCharacter(c, style));
         setBitmapChar(font.getCharSet().getCharacter(c, style));
@@ -260,20 +260,20 @@ class LetterQuad {
     void setPrevious(LetterQuad before) {
     void setPrevious(LetterQuad before) {
         this.previous = before;
         this.previous = before;
     }
     }
-    
+
     void setStyle(int style) {
     void setStyle(int style) {
         this.style = style;
         this.style = style;
         invalidate();
         invalidate();
     }
     }
-    
+
     void setColor(ColorRGBA color) {
     void setColor(ColorRGBA color) {
         this.colorInt = color.asIntRGBA();
         this.colorInt = color.asIntRGBA();
         invalidate();
         invalidate();
     }
     }
 
 
     void setAlpha(float alpha) {
     void setAlpha(float alpha) {
-        int i = (int)(alpha * 255) & 0xFF;
-        colorInt = (colorInt & 0xffffff00) | i; 
+        int i = (int) (alpha * 255) & 0xFF;
+        colorInt = (colorInt & 0xffffff00) | i;
         invalidate();
         invalidate();
     }
     }
 
 
@@ -282,7 +282,7 @@ class LetterQuad {
         BitmapCharacter bm = charSet.getCharacter(c, style);
         BitmapCharacter bm = charSet.getCharacter(c, style);
         setBitmapChar(bm);
         setBitmapChar(bm);
     }
     }
-    
+
     void setBitmapChar(BitmapCharacter bitmapChar) {
     void setBitmapChar(BitmapCharacter bitmapChar) {
         x0 = Integer.MIN_VALUE;
         x0 = Integer.MIN_VALUE;
         y0 = Integer.MIN_VALUE;
         y0 = Integer.MIN_VALUE;
@@ -290,7 +290,7 @@ class LetterQuad {
         height = Integer.MIN_VALUE;
         height = Integer.MIN_VALUE;
         alignX = 0;
         alignX = 0;
         alignY = 0;
         alignY = 0;
-        
+
         BitmapCharacterSet charSet = font.getCharSet();
         BitmapCharacterSet charSet = font.getCharSet();
         this.bitmapChar = bitmapChar;
         this.bitmapChar = bitmapChar;
         if (bitmapChar != null) {
         if (bitmapChar != null) {
@@ -425,22 +425,22 @@ class LetterQuad {
             xAdvance = bound.x-x0;
             xAdvance = bound.x-x0;
         }
         }
     }
     }
-    
+
     /**
     /**
      * add temporary linewrap indicator
      * add temporary linewrap indicator
      */
      */
     void setEndOfLine() {
     void setEndOfLine() {
         this.eol = true;
         this.eol = true;
     }
     }
-    
+
     boolean isEndOfLine() {
     boolean isEndOfLine() {
         return eol;
         return eol;
     }
     }
-    
+
     boolean isLineWrap() {
     boolean isLineWrap() {
         return !isHead() && !isTail() && bitmapChar == null && c == Character.MIN_VALUE;
         return !isHead() && !isTail() && bitmapChar == null && c == Character.MIN_VALUE;
     }
     }
-    
+
     private float computeLineY(StringBlock block) {
     private float computeLineY(StringBlock block) {
         if (isHead()) {
         if (isHead()) {
             return getBound(block).y;
             return getBound(block).y;
@@ -451,16 +451,16 @@ class LetterQuad {
         }
         }
     }
     }
 
 
-    
+
     boolean isLineStart() {
     boolean isLineStart() {
         return x0 == 0 || (previous != null && previous.eol);
         return x0 == 0 || (previous != null && previous.eol);
     }
     }
-    
+
     boolean isBlank() {
     boolean isBlank() {
         return c == ' ' || isTab();
         return c == ' ' || isTab();
     }
     }
-    
-    public void storeToArrays(float[] pos, float[] tc, short[] idx, byte[] colors, int quadIdx){
+
+    public void storeToArrays(float[] pos, float[] tc, short[] idx, byte[] colors, int quadIdx) {
         float x = x0+alignX;
         float x = x0+alignX;
         float y = y0-alignY;
         float y = y0-alignY;
         float xpw = x+width;
         float xpw = x+width;
@@ -495,8 +495,8 @@ class LetterQuad {
         idx[0] = i0; idx[1] = i1; idx[2] = i2;
         idx[0] = i0; idx[1] = i1; idx[2] = i2;
         idx[3] = i0; idx[4] = i2; idx[5] = i3;
         idx[3] = i0; idx[4] = i2; idx[5] = i3;
     }
     }
-    
-    public void appendPositions(FloatBuffer fb){
+
+    public void appendPositions(FloatBuffer fb) {
         float sx = x0+alignX;
         float sx = x0+alignX;
         float sy = y0-alignY;
         float sy = y0-alignY;
         float ex = sx+width;
         float ex = sx+width;
@@ -509,21 +509,21 @@ class LetterQuad {
         fb.put(ex).put(sy).put(0f);
         fb.put(ex).put(sy).put(0f);
     }
     }
 
 
-    public void appendPositions(ShortBuffer sb){
+    public void appendPositions(ShortBuffer sb) {
         final float x1 = getX1();
         final float x1 = getX1();
         final float y1 = getY1();
         final float y1 = getY1();
         short x = (short) x0;
         short x = (short) x0;
         short y = (short) y0;
         short y = (short) y0;
         short xpw = (short) (x1);
         short xpw = (short) (x1);
         short ymh = (short) (y1);
         short ymh = (short) (y1);
-        
+
         sb.put(x).put(y).put((short)0);
         sb.put(x).put(y).put((short)0);
         sb.put(x).put(ymh).put((short)0);
         sb.put(x).put(ymh).put((short)0);
         sb.put(xpw).put(ymh).put((short)0);
         sb.put(xpw).put(ymh).put((short)0);
         sb.put(xpw).put(y).put((short)0);
         sb.put(xpw).put(y).put((short)0);
     }
     }
 
 
-    public void appendTexCoords(FloatBuffer fb){
+    public void appendTexCoords(FloatBuffer fb) {
         // flip coords to be compatible with OGL
         // flip coords to be compatible with OGL
         float v0 = 1 - this.v0;
         float v0 = 1 - this.v0;
         float v1 = 1 - this.v1;
         float v1 = 1 - this.v1;
@@ -538,14 +538,14 @@ class LetterQuad {
         fb.put(u1).put(v0);
         fb.put(u1).put(v0);
     }
     }
 
 
-    public void appendColors(ByteBuffer bb){
+    public void appendColors(ByteBuffer bb) {
         bb.putInt(colorInt);
         bb.putInt(colorInt);
         bb.putInt(colorInt);
         bb.putInt(colorInt);
         bb.putInt(colorInt);
         bb.putInt(colorInt);
         bb.putInt(colorInt);
         bb.putInt(colorInt);
     }
     }
 
 
-    public void appendIndices(ShortBuffer sb, int quadIndex){
+    public void appendIndices(ShortBuffer sb, int quadIndex) {
         // each quad has 4 indices
         // each quad has 4 indices
         short v0 = (short) (quadIndex * 4);
         short v0 = (short) (quadIndex * 4);
         short v1 = (short) (v0 + 1);
         short v1 = (short) (v0 + 1);
@@ -580,9 +580,9 @@ class LetterQuad {
     boolean isLineFeed() {
     boolean isLineFeed() {
         return c == '\n';
         return c == '\n';
     }
     }
-    
+
     boolean isTab() {
     boolean isTab() {
         return c == '\t';
         return c == '\t';
     }
     }
-    
+
 }
 }

+ 6 - 5
jme3-core/src/main/java/com/jme3/font/Letters.java

@@ -83,7 +83,7 @@ class Letters {
                 if (baseColor != null) {
                 if (baseColor != null) {
                     // Give the letter a default color if
                     // Give the letter a default color if
                     // one has been provided.
                     // one has been provided.
-                    l.setColor( baseColor );
+                    l.setColor(baseColor);
                 }
                 }
             }
             }
         }
         }
@@ -170,7 +170,7 @@ class Letters {
 
 
                         // Clear the rest up to the next line feed.
                         // Clear the rest up to the next line feed.
                         // = for texts attached to a text block, all coming characters are cleared except a linefeed is explicitly used
                         // = for texts attached to a text block, all coming characters are cleared except a linefeed is explicitly used
-                        for( LetterQuad q = l.getNext(); !q.isTail() && !q.isLineFeed(); q = q.getNext() ) {
+                        for (LetterQuad q = l.getNext(); !q.isTail() && !q.isLineFeed(); q = q.getNext()) {
                             q.setBitmapChar(null);
                             q.setBitmapChar(null);
                             q.update(block);
                             q.update(block);
                         }
                         }
@@ -395,10 +395,10 @@ class Letters {
      * Sets the base color for all new letter quads and resets
      * Sets the base color for all new letter quads and resets
      * the color of existing letter quads.
      * the color of existing letter quads.
      */
      */
-    void setColor( ColorRGBA color ) {
+    void setColor(ColorRGBA color) {
         baseColor = color;
         baseColor = color;
         colorTags.setBaseColor(color);
         colorTags.setBaseColor(color);
-        setColor( 0, block.getText().length(), color );
+        setColor(0, block.getText().length(), color);
     }
     }
 
 
     ColorRGBA getBaseColor() {
     ColorRGBA getBaseColor() {
@@ -424,7 +424,8 @@ class Letters {
         return baseAlpha;
         return baseAlpha;
     }
     }
 
 
-    void setBaseAlpha( float alpha ) {        this.baseAlpha = alpha;
+    void setBaseAlpha(float alpha) {
+        this.baseAlpha = alpha;
         colorTags.setBaseAlpha(alpha);
         colorTags.setBaseAlpha(alpha);
 
 
         if (alpha == -1) {
         if (alpha == -1) {

+ 4 - 3
jme3-core/src/main/java/com/jme3/font/Rectangle.java

@@ -54,16 +54,17 @@ public class Rectangle implements Cloneable {
     }
     }
 
 
     @Override
     @Override
-    public Rectangle clone(){
+    public Rectangle clone() {
         try {
         try {
             return (Rectangle) super.clone();
             return (Rectangle) super.clone();
         } catch (CloneNotSupportedException ex) {
         } catch (CloneNotSupportedException ex) {
             throw new AssertionError();
             throw new AssertionError();
         }
         }
     }
     }
-    
+
     @Override
     @Override
     public String toString() {
     public String toString() {
-        return getClass().getSimpleName() + "[x=" + x + ", y=" + y + ", width=" + width + ", height=" + height + "]"; 
+        return getClass().getSimpleName()
+                + "[x=" + x + ", y=" + y + ", width=" + width + ", height=" + height + "]";
     }
     }
 }
 }

+ 11 - 11
jme3-core/src/main/java/com/jme3/font/StringBlock.java

@@ -75,7 +75,7 @@ class StringBlock implements Cloneable {
         this.kerning = kerning;
         this.kerning = kerning;
     }
     }
 
 
-    StringBlock(){
+    StringBlock() {
         this.text = "";
         this.text = "";
         this.textBox = null;
         this.textBox = null;
         this.alignment = Align.Left;
         this.alignment = Align.Left;
@@ -85,7 +85,7 @@ class StringBlock implements Cloneable {
     }
     }
 
 
     @Override
     @Override
-    public StringBlock clone(){
+    public StringBlock clone() {
         try {
         try {
             StringBlock clone = (StringBlock) super.clone();
             StringBlock clone = (StringBlock) super.clone();
             clone.color = color.clone();
             clone.color = color.clone();
@@ -101,7 +101,7 @@ class StringBlock implements Cloneable {
         return text;
         return text;
     }
     }
 
 
-    void setText(String text){
+    void setText(String text) {
         this.text = text == null ? "" : text;
         this.text = text == null ? "" : text;
     }
     }
 
 
@@ -116,7 +116,7 @@ class StringBlock implements Cloneable {
     BitmapFont.Align getAlignment() {
     BitmapFont.Align getAlignment() {
         return alignment;
         return alignment;
     }
     }
-    
+
     BitmapFont.VAlign getVerticalAlignment() {
     BitmapFont.VAlign getVerticalAlignment() {
         return valignment;
         return valignment;
     }
     }
@@ -124,7 +124,7 @@ class StringBlock implements Cloneable {
     void setAlignment(BitmapFont.Align alignment) {
     void setAlignment(BitmapFont.Align alignment) {
         this.alignment = alignment;
         this.alignment = alignment;
     }
     }
-    
+
     void setVerticalAlignment(BitmapFont.VAlign alignment) {
     void setVerticalAlignment(BitmapFont.VAlign alignment) {
         this.valignment = alignment;
         this.valignment = alignment;
     }
     }
@@ -160,19 +160,19 @@ class StringBlock implements Cloneable {
     void setLineCount(int lineCount) {
     void setLineCount(int lineCount) {
         this.lineCount = lineCount;
         this.lineCount = lineCount;
     }
     }
-    
+
     LineWrapMode getLineWrapMode() {
     LineWrapMode getLineWrapMode() {
         return wrapType;
         return wrapType;
     }
     }
-    
+
     /**
     /**
-     * available only when bounding is set. <code>setBox()</code> method call is needed in advance. 
+     * available only when bounding is set. <code>setBox()</code> method call is needed in advance.
      * @param wrap true when word need not be split at the end of the line.
      * @param wrap true when word need not be split at the end of the line.
      */
      */
     void setLineWrapMode(LineWrapMode wrap) {
     void setLineWrapMode(LineWrapMode wrap) {
         this.wrapType = wrap;
         this.wrapType = wrap;
     }
     }
-    
+
     void setTabWidth(float tabWidth) {
     void setTabWidth(float tabWidth) {
         this.tabWidth = tabWidth;
         this.tabWidth = tabWidth;
     }
     }
@@ -180,11 +180,11 @@ class StringBlock implements Cloneable {
     void setTabPosition(float[] tabs) {
     void setTabPosition(float[] tabs) {
         this.tabPos = tabs;
         this.tabPos = tabs;
     }
     }
-    
+
     float getTabWidth() {
     float getTabWidth() {
         return tabWidth;
         return tabWidth;
     }
     }
-    
+
     float[] getTabPosition() {
     float[] getTabPosition() {
         return tabPos;
         return tabPos;
     }
     }

+ 25 - 25
jme3-core/src/main/java/com/jme3/input/AbstractJoystick.java

@@ -46,9 +46,9 @@ public abstract class AbstractJoystick implements Joystick {
     final private JoyInput joyInput;
     final private JoyInput joyInput;
     final private int joyId;
     final private int joyId;
     final private String name;
     final private String name;
-    
-    final private List<JoystickAxis> axes = new ArrayList<>();       
-    final private List<JoystickButton> buttons = new ArrayList<>();       
+
+    final private List<JoystickAxis> axes = new ArrayList<>();
+    final private List<JoystickButton> buttons = new ArrayList<>();
 
 
     /**
     /**
      * Creates a new joystick instance. Only used internally.
      * Creates a new joystick instance. Only used internally.
@@ -65,20 +65,20 @@ public abstract class AbstractJoystick implements Joystick {
         this.joyId = joyId;
         this.joyId = joyId;
         this.name = name;
         this.name = name;
     }
     }
-    
+
     protected InputManager getInputManager() {
     protected InputManager getInputManager() {
         return inputManager;
         return inputManager;
     }
     }
-    
+
     protected JoyInput getJoyInput() {
     protected JoyInput getJoyInput() {
-        return joyInput; 
+        return joyInput;
     }
     }
 
 
-    protected void addAxis( JoystickAxis axis ) {
+    protected void addAxis(JoystickAxis axis) {
         axes.add(axis);
         axes.add(axis);
     }
     }
 
 
-    protected void addButton( JoystickButton button ) {
+    protected void addButton(JoystickButton button) {
         buttons.add(button);
         buttons.add(button);
     }
     }
 
 
@@ -88,7 +88,7 @@ public abstract class AbstractJoystick implements Joystick {
      * @param amount The amount to rumble. Should be between 0 and 1.
      * @param amount The amount to rumble. Should be between 0 and 1.
      */
      */
     @Override
     @Override
-    public void rumble(float amount){
+    public void rumble(float amount) {
         joyInput.setJoyRumble(joyId, amount);
         joyInput.setJoyRumble(joyId, amount);
     }
     }
 
 
@@ -104,7 +104,7 @@ public abstract class AbstractJoystick implements Joystick {
      */
      */
     @Override
     @Override
     @Deprecated
     @Deprecated
-    public void assignButton(String mappingName, int buttonId){
+    public void assignButton(String mappingName, int buttonId) {
         if (buttonId < 0 || buttonId >= getButtonCount())
         if (buttonId < 0 || buttonId >= getButtonCount())
             throw new IllegalArgumentException();
             throw new IllegalArgumentException();
 
 
@@ -123,23 +123,23 @@ public abstract class AbstractJoystick implements Joystick {
      */
      */
     @Override
     @Override
     @Deprecated
     @Deprecated
-    public void assignAxis(String positiveMapping, String negativeMapping, int axisId){
-    
+    public void assignAxis(String positiveMapping, String negativeMapping, int axisId) {
+
         // For backwards compatibility
         // For backwards compatibility
-        if( axisId == JoyInput.AXIS_POV_X ) {
+        if (axisId == JoyInput.AXIS_POV_X) {
             axisId = getPovXAxis().getAxisId();
             axisId = getPovXAxis().getAxisId();
-        } else if( axisId == JoyInput.AXIS_POV_Y ) {
+        } else if (axisId == JoyInput.AXIS_POV_Y) {
             axisId = getPovYAxis().getAxisId();
             axisId = getPovYAxis().getAxisId();
         }
         }
-    
+
         inputManager.addMapping(positiveMapping, new JoyAxisTrigger(joyId, axisId, false));
         inputManager.addMapping(positiveMapping, new JoyAxisTrigger(joyId, axisId, false));
         inputManager.addMapping(negativeMapping, new JoyAxisTrigger(joyId, axisId, true));
         inputManager.addMapping(negativeMapping, new JoyAxisTrigger(joyId, axisId, true));
     }
     }
 
 
     @Override
     @Override
     public JoystickAxis getAxis(String logicalId) {
     public JoystickAxis getAxis(String logicalId) {
-        for( JoystickAxis axis : axes ) {
-            if( axis.getLogicalId().equals(logicalId) )
+        for (JoystickAxis axis : axes) {
+            if (axis.getLogicalId().equals(logicalId))
                 return axis;
                 return axis;
         }
         }
         return null;
         return null;
@@ -161,12 +161,12 @@ public abstract class AbstractJoystick implements Joystick {
     @Override
     @Override
     public int getAxisCount() {
     public int getAxisCount() {
         return axes.size();
         return axes.size();
-    } 
+    }
 
 
     @Override
     @Override
     public JoystickButton getButton(String logicalId) {
     public JoystickButton getButton(String logicalId) {
-        for( JoystickButton b : buttons ) {
-            if( b.getLogicalId().equals(logicalId) )
+        for (JoystickButton b : buttons) {
+            if (b.getLogicalId().equals(logicalId))
                 return b;
                 return b;
         }
         }
         return null;
         return null;
@@ -178,7 +178,7 @@ public abstract class AbstractJoystick implements Joystick {
     @Override
     @Override
     public List<JoystickButton> getButtons() {
     public List<JoystickButton> getButtons() {
         return Collections.unmodifiableList(buttons);
         return Collections.unmodifiableList(buttons);
-    }     
+    }
 
 
     /**
     /**
      * Returns the number of buttons on this joystick.
      * Returns the number of buttons on this joystick.
@@ -189,7 +189,7 @@ public abstract class AbstractJoystick implements Joystick {
     public int getButtonCount() {
     public int getButtonCount() {
         return buttons.size();
         return buttons.size();
     }
     }
-    
+
     /**
     /**
      * Returns the name of this joystick.
      * Returns the name of this joystick.
      *
      *
@@ -220,7 +220,7 @@ public abstract class AbstractJoystick implements Joystick {
      * @see Joystick#assignAxis(java.lang.String, java.lang.String, int)
      * @see Joystick#assignAxis(java.lang.String, java.lang.String, int)
      */
      */
     @Override
     @Override
-    public int getXAxisIndex(){
+    public int getXAxisIndex() {
         return getXAxis().getAxisId();
         return getXAxis().getAxisId();
     }
     }
 
 
@@ -234,12 +234,12 @@ public abstract class AbstractJoystick implements Joystick {
      * @see Joystick#assignAxis(java.lang.String, java.lang.String, int)
      * @see Joystick#assignAxis(java.lang.String, java.lang.String, int)
      */
      */
     @Override
     @Override
-    public int getYAxisIndex(){
+    public int getYAxisIndex() {
         return getYAxis().getAxisId();
         return getYAxis().getAxisId();
     }
     }
 
 
     @Override
     @Override
-    public String toString(){
+    public String toString() {
         return "Joystick[name=" + name + ", id=" + joyId + ", buttons=" + getButtonCount()
         return "Joystick[name=" + name + ", id=" + joyId + ", buttons=" + getButtonCount()
                                 + ", axes=" + getAxisCount() + "]";
                                 + ", axes=" + getAxisCount() + "]";
     }
     }

+ 33 - 24
jme3-core/src/main/java/com/jme3/input/ChaseCamera.java

@@ -57,7 +57,7 @@ public class ChaseCamera implements ActionListener, AnalogListener, Control, Jme
     protected float maxVerticalRotation = FastMath.PI / 2;
     protected float maxVerticalRotation = FastMath.PI / 2;
     protected float minDistance = 1.0f;
     protected float minDistance = 1.0f;
     protected float maxDistance = 40.0f;
     protected float maxDistance = 40.0f;
-    protected float distance = 20;    
+    protected float distance = 20;
     protected float rotationSpeed = 1.0f;
     protected float rotationSpeed = 1.0f;
     protected float rotation = 0;
     protected float rotation = 0;
     protected float trailingRotationInertia = 0.05f;
     protected float trailingRotationInertia = 0.05f;
@@ -100,7 +100,7 @@ public class ChaseCamera implements ActionListener, AnalogListener, Control, Jme
     protected Vector3f temp = new Vector3f(0, 0, 0);
     protected Vector3f temp = new Vector3f(0, 0, 0);
     protected boolean invertYaxis = false;
     protected boolean invertYaxis = false;
     protected boolean invertXaxis = false;
     protected boolean invertXaxis = false;
-    
+
     /**
     /**
      * @deprecated use {@link CameraInput#CHASECAM_DOWN}
      * @deprecated use {@link CameraInput#CHASECAM_DOWN}
      */
      */
@@ -201,10 +201,8 @@ public class ChaseCamera implements ActionListener, AnalogListener, Control, Jme
                 }
                 }
             }
             }
         }
         }
-
     }
     }
 
 
-
     @Override
     @Override
     public void onAnalog(String name, float value, float tpf) {
     public void onAnalog(String name, float value, float tpf) {
         if (name.equals(CameraInput.CHASECAM_MOVELEFT)) {
         if (name.equals(CameraInput.CHASECAM_MOVELEFT)) {
@@ -236,7 +234,6 @@ public class ChaseCamera implements ActionListener, AnalogListener, Control, Jme
      * @param inputManager (alias created)
      * @param inputManager (alias created)
      */
      */
     public final void registerWithInput(InputManager inputManager) {
     public final void registerWithInput(InputManager inputManager) {
-
         String[] inputs = {CameraInput.CHASECAM_TOGGLEROTATE,
         String[] inputs = {CameraInput.CHASECAM_TOGGLEROTATE,
             CameraInput.CHASECAM_DOWN,
             CameraInput.CHASECAM_DOWN,
             CameraInput.CHASECAM_UP,
             CameraInput.CHASECAM_UP,
@@ -247,33 +244,45 @@ public class ChaseCamera implements ActionListener, AnalogListener, Control, Jme
 
 
         this.inputManager = inputManager;
         this.inputManager = inputManager;
         if (!invertYaxis) {
         if (!invertYaxis) {
-            inputManager.addMapping(CameraInput.CHASECAM_DOWN, new MouseAxisTrigger(MouseInput.AXIS_Y, true));
-            inputManager.addMapping(CameraInput.CHASECAM_UP, new MouseAxisTrigger(MouseInput.AXIS_Y, false));
+            inputManager.addMapping(CameraInput.CHASECAM_DOWN,
+                    new MouseAxisTrigger(MouseInput.AXIS_Y, true));
+            inputManager.addMapping(CameraInput.CHASECAM_UP,
+                    new MouseAxisTrigger(MouseInput.AXIS_Y, false));
         } else {
         } else {
-            inputManager.addMapping(CameraInput.CHASECAM_DOWN, new MouseAxisTrigger(MouseInput.AXIS_Y, false));
-            inputManager.addMapping(CameraInput.CHASECAM_UP, new MouseAxisTrigger(MouseInput.AXIS_Y, true));
+            inputManager.addMapping(CameraInput.CHASECAM_DOWN,
+                    new MouseAxisTrigger(MouseInput.AXIS_Y, false));
+            inputManager.addMapping(CameraInput.CHASECAM_UP,
+                    new MouseAxisTrigger(MouseInput.AXIS_Y, true));
         }
         }
-        inputManager.addMapping(CameraInput.CHASECAM_ZOOMIN, new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false));
-        inputManager.addMapping(CameraInput.CHASECAM_ZOOMOUT, new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true));
+        inputManager.addMapping(CameraInput.CHASECAM_ZOOMIN,
+                new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false));
+        inputManager.addMapping(CameraInput.CHASECAM_ZOOMOUT,
+                new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true));
         if (!invertXaxis) {
         if (!invertXaxis) {
-            inputManager.addMapping(CameraInput.CHASECAM_MOVELEFT, new MouseAxisTrigger(MouseInput.AXIS_X, true));
-            inputManager.addMapping(CameraInput.CHASECAM_MOVERIGHT, new MouseAxisTrigger(MouseInput.AXIS_X, false));
+            inputManager.addMapping(CameraInput.CHASECAM_MOVELEFT,
+                    new MouseAxisTrigger(MouseInput.AXIS_X, true));
+            inputManager.addMapping(CameraInput.CHASECAM_MOVERIGHT,
+                    new MouseAxisTrigger(MouseInput.AXIS_X, false));
         } else {
         } else {
-            inputManager.addMapping(CameraInput.CHASECAM_MOVELEFT, new MouseAxisTrigger(MouseInput.AXIS_X, false));
-            inputManager.addMapping(CameraInput.CHASECAM_MOVERIGHT, new MouseAxisTrigger(MouseInput.AXIS_X, true));
+            inputManager.addMapping(CameraInput.CHASECAM_MOVELEFT,
+                    new MouseAxisTrigger(MouseInput.AXIS_X, false));
+            inputManager.addMapping(CameraInput.CHASECAM_MOVERIGHT,
+                    new MouseAxisTrigger(MouseInput.AXIS_X, true));
         }
         }
-        inputManager.addMapping(CameraInput.CHASECAM_TOGGLEROTATE, new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
-        inputManager.addMapping(CameraInput.CHASECAM_TOGGLEROTATE, new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
+        inputManager.addMapping(CameraInput.CHASECAM_TOGGLEROTATE,
+                new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
+        inputManager.addMapping(CameraInput.CHASECAM_TOGGLEROTATE,
+                new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
 
 
         inputManager.addListener(this, inputs);
         inputManager.addListener(this, inputs);
     }
     }
-    
+
     /**
     /**
     * Cleans up the input mappings from the input manager.
     * Cleans up the input mappings from the input manager.
     * Undoes the work of registerWithInput().
     * Undoes the work of registerWithInput().
     * @param mgr the InputManager to clean up
     * @param mgr the InputManager to clean up
     */
     */
-    public void cleanupWithInput(InputManager mgr){
+    public void cleanupWithInput(InputManager mgr) {
         mgr.deleteMapping(CameraInput.CHASECAM_TOGGLEROTATE);
         mgr.deleteMapping(CameraInput.CHASECAM_TOGGLEROTATE);
         mgr.deleteMapping(CameraInput.CHASECAM_DOWN);
         mgr.deleteMapping(CameraInput.CHASECAM_DOWN);
         mgr.deleteMapping(CameraInput.CHASECAM_UP);
         mgr.deleteMapping(CameraInput.CHASECAM_UP);
@@ -614,16 +623,16 @@ public class ChaseCamera implements ActionListener, AnalogListener, Control, Jme
         cc.setMaxDistance(getMaxDistance());
         cc.setMaxDistance(getMaxDistance());
         cc.setMinDistance(getMinDistance());
         cc.setMinDistance(getMinDistance());
         return cc;
         return cc;
-    }     
+    }
 
 
-    @Override   
-    public void cloneFields( Cloner cloner, Object original ) { 
+    @Override
+    public void cloneFields(Cloner cloner, Object original) {
         this.target = cloner.clone(target);
         this.target = cloner.clone(target);
         computePosition();
         computePosition();
         prevPos = new Vector3f(target.getWorldTranslation());
         prevPos = new Vector3f(target.getWorldTranslation());
         cam.setLocation(pos);
         cam.setLocation(pos);
     }
     }
-         
+
     /**
     /**
      * Sets the spatial for the camera control, should only be used internally
      * Sets the spatial for the camera control, should only be used internally
      *
      *
@@ -847,7 +856,7 @@ public class ChaseCamera implements ActionListener, AnalogListener, Control, Jme
     public void setZoomSensitivity(float zoomSensitivity) {
     public void setZoomSensitivity(float zoomSensitivity) {
         this.zoomSensitivity = zoomSensitivity;
         this.zoomSensitivity = zoomSensitivity;
     }
     }
-    
+
     /**
     /**
      * Returns the rotation speed when the mouse is moved.
      * Returns the rotation speed when the mouse is moved.
      *
      *

+ 11 - 11
jme3-core/src/main/java/com/jme3/input/DefaultJoystickAxis.java

@@ -62,8 +62,8 @@ public class DefaultJoystickAxis implements JoystickAxis {
      * @param deadZone the radius of the dead zone
      * @param deadZone the radius of the dead zone
      */
      */
     public DefaultJoystickAxis(InputManager inputManager, Joystick parent,
     public DefaultJoystickAxis(InputManager inputManager, Joystick parent,
-                               int axisIndex, String name, String logicalId,
-                               boolean isAnalog, boolean isRelative, float deadZone ) {
+            int axisIndex, String name, String logicalId,
+            boolean isAnalog, boolean isRelative, float deadZone) {
         this.inputManager = inputManager;
         this.inputManager = inputManager;
         this.parent = parent;
         this.parent = parent;
         this.axisIndex = axisIndex;
         this.axisIndex = axisIndex;
@@ -81,7 +81,7 @@ public class DefaultJoystickAxis implements JoystickAxis {
      *  @param negativeMapping The mapping to receive events when the axis is positive
      *  @param negativeMapping The mapping to receive events when the axis is positive
      */
      */
     @Override
     @Override
-    public void assignAxis(String positiveMapping, String negativeMapping){
+    public void assignAxis(String positiveMapping, String negativeMapping) {
         if (axisIndex != -1) {
         if (axisIndex != -1) {
             inputManager.addMapping(positiveMapping, new JoyAxisTrigger(parent.getJoyId(), axisIndex, false));
             inputManager.addMapping(positiveMapping, new JoyAxisTrigger(parent.getJoyId(), axisIndex, false));
             inputManager.addMapping(negativeMapping, new JoyAxisTrigger(parent.getJoyId(), axisIndex, true));
             inputManager.addMapping(negativeMapping, new JoyAxisTrigger(parent.getJoyId(), axisIndex, true));
@@ -114,7 +114,7 @@ public class DefaultJoystickAxis implements JoystickAxis {
     @Override
     @Override
     public String getLogicalId() {
     public String getLogicalId() {
         return logicalId;
         return logicalId;
-    }    
+    }
 
 
     /**
     /**
      *  Returns the axisId of this joystick axis.
      *  Returns the axisId of this joystick axis.
@@ -134,7 +134,7 @@ public class DefaultJoystickAxis implements JoystickAxis {
     public boolean isAnalog() {
     public boolean isAnalog() {
         return isAnalog;
         return isAnalog;
     }
     }
-    
+
     /**
     /**
      *  Returns true if this axis presents relative values.
      *  Returns true if this axis presents relative values.
      */
      */
@@ -142,7 +142,7 @@ public class DefaultJoystickAxis implements JoystickAxis {
     public boolean isRelative() {
     public boolean isRelative() {
         return isRelative;
         return isRelative;
     }
     }
-    
+
     /**
     /**
      *  Returns the suggested dead zone for this axis.  Values less than this
      *  Returns the suggested dead zone for this axis.  Values less than this
      *  can be safely ignored.
      *  can be safely ignored.
@@ -150,7 +150,7 @@ public class DefaultJoystickAxis implements JoystickAxis {
     @Override
     @Override
     public float getDeadZone() {
     public float getDeadZone() {
         return deadZone;
         return deadZone;
-    }        
+    }
 
 
     /**
     /**
      *  Sets/overrides the dead zone for this axis.  This indicates that values
      *  Sets/overrides the dead zone for this axis.  This indicates that values
@@ -158,13 +158,13 @@ public class DefaultJoystickAxis implements JoystickAxis {
      *
      *
      * @param f the desired radius
      * @param f the desired radius
      */
      */
-    public void setDeadZone( float f ) {
+    public void setDeadZone(float f) {
         this.deadZone = f;
         this.deadZone = f;
-    }     
+    }
 
 
     @Override
     @Override
-    public String toString(){
-        return "JoystickAxis[name=" + name + ", parent=" + parent.getName() + ", id=" + axisIndex 
+    public String toString() {
+        return "JoystickAxis[name=" + name + ", parent=" + parent.getName() + ", id=" + axisIndex
                                     + ", logicalId=" + logicalId + ", isAnalog=" + isAnalog
                                     + ", logicalId=" + logicalId + ", isAnalog=" + isAnalog
                                     + ", isRelative=" + isRelative + ", deadZone=" + deadZone + "]";
                                     + ", isRelative=" + isRelative + ", deadZone=" + deadZone + "]";
     }
     }

+ 13 - 13
jme3-core/src/main/java/com/jme3/input/DefaultJoystickButton.java

@@ -39,21 +39,21 @@ import com.jme3.input.controls.JoyButtonTrigger;
  *  @author Paul Speed
  *  @author Paul Speed
  */
  */
 public class DefaultJoystickButton implements JoystickButton {
 public class DefaultJoystickButton implements JoystickButton {
-    
+
     final private InputManager inputManager;
     final private InputManager inputManager;
     final private Joystick parent;
     final private Joystick parent;
     final private int buttonIndex;
     final private int buttonIndex;
     final private String name;
     final private String name;
     final private String logicalId;
     final private String logicalId;
 
 
-    public DefaultJoystickButton( InputManager inputManager, Joystick parent, int buttonIndex,
-                                  String name, String logicalId ) {
+    public DefaultJoystickButton(InputManager inputManager, Joystick parent, int buttonIndex,
+            String name, String logicalId) {
         this.inputManager = inputManager;
         this.inputManager = inputManager;
         this.parent = parent;
         this.parent = parent;
         this.buttonIndex = buttonIndex;
         this.buttonIndex = buttonIndex;
         this.name = name;
         this.name = name;
-        this.logicalId = logicalId;        
-    }                                   
+        this.logicalId = logicalId;
+    }
 
 
     /**
     /**
      * Assign the mapping name to receive events from the given button index
      * Assign the mapping name to receive events from the given button index
@@ -65,14 +65,14 @@ public class DefaultJoystickButton implements JoystickButton {
     public void assignButton(String mappingName) {
     public void assignButton(String mappingName) {
         inputManager.addMapping(mappingName, new JoyButtonTrigger(parent.getJoyId(), buttonIndex));
         inputManager.addMapping(mappingName, new JoyButtonTrigger(parent.getJoyId(), buttonIndex));
     }
     }
-    
+
     /**
     /**
      *  Returns the joystick to which this axis object belongs.
      *  Returns the joystick to which this axis object belongs.
      */
      */
     @Override
     @Override
     public Joystick getJoystick() {
     public Joystick getJoystick() {
         return parent;
         return parent;
-    } 
+    }
 
 
     /**
     /**
      *  Returns the name of this joystick.
      *  Returns the name of this joystick.
@@ -82,7 +82,7 @@ public class DefaultJoystickButton implements JoystickButton {
     @Override
     @Override
     public String getName() {
     public String getName() {
         return name;
         return name;
-    } 
+    }
 
 
     /**
     /**
      *  Returns the logical identifier of this joystick axis.
      *  Returns the logical identifier of this joystick axis.
@@ -92,10 +92,10 @@ public class DefaultJoystickButton implements JoystickButton {
     @Override
     @Override
     public String getLogicalId() {
     public String getLogicalId() {
         return logicalId;
         return logicalId;
-    } 
+    }
 
 
     /**
     /**
-     *  Returns the unique buttonId of this joystick axis within a given 
+     *  Returns the unique buttonId of this joystick axis within a given
      *  InputManager context.
      *  InputManager context.
      *
      *
      *  @return the buttonId of this joystick axis.
      *  @return the buttonId of this joystick axis.
@@ -104,10 +104,10 @@ public class DefaultJoystickButton implements JoystickButton {
     public int getButtonId() {
     public int getButtonId() {
         return buttonIndex;
         return buttonIndex;
     }
     }
-     
+
     @Override
     @Override
-    public String toString(){
-        return "JoystickButton[name=" + getName() + ", parent=" + parent.getName() + ", id=" + getButtonId() 
+    public String toString() {
+        return "JoystickButton[name=" + getName() + ", parent=" + parent.getName() + ", id=" + getButtonId()
                                     + ", logicalId=" + getLogicalId() + "]";
                                     + ", logicalId=" + getLogicalId() + "]";
     }
     }
 }
 }

Some files were not shown because too many files changed in this diff