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 năm trước cách đây
mục cha
commit
ac8c1012d2
100 tập tin đã thay đổi với 1893 bổ sung1925 xóa
  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
  * {@link Armature armature} (skeletal) animation.
- * 
+ *
  * @author Nehon
  */
 public class AnimComposer extends AbstractControl {
-
     /**
      * 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.
-     * 
+     *
      * @param name The name of the animation.
      * @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.
-     * 
+     *
      * @param name The name of the action to run.
      * @return The action corresponding to the given name.
      */
     public Action setCurrentAction(String name) {
         return setCurrentAction(name, DEFAULT_LAYER);
     }
-    
+
     /**
      * Run an action on specified layer.
-     * 
+     *
      * @param actionName The name of the action to run.
      * @param layerName The layer on which action should run.
      * @return The action corresponding to the given name.
@@ -139,19 +138,19 @@ public class AnimComposer extends AbstractControl {
 
         return currentAction;
     }
-    
+
     /**
      * 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() {
         return getCurrentAction(DEFAULT_LAYER);
     }
-    
+
     /**
      * Return current action on specified layer.
-     * 
+     *
      * @param layerName The layer on which action should run.
      * @return The action corresponding to the given name.
      */
@@ -161,14 +160,14 @@ public class AnimComposer extends AbstractControl {
 
         return result;
     }
-    
+
     /**
      * Remove current action on default layer.
      */
     public void removeCurrentAction() {
         removeCurrentAction(DEFAULT_LAYER);
     }
-    
+
     /**
      * Remove current action on specified layer.
      *
@@ -178,19 +177,19 @@ public class AnimComposer extends AbstractControl {
         AnimLayer l = getLayer(layerName);
         l.setCurrentAction(null);
     }
-    
+
     /**
      * Returns current time of the default layer.
-     * 
+     *
      * @return The current time.
      */
     public double getTime() {
         return getTime(DEFAULT_LAYER);
     }
-    
+
     /**
      * Returns current time of the specified layer.
-     * 
+     *
      * @param layerName The layer from which to get the time.
      * @return the time (in seconds)
      */
@@ -200,7 +199,7 @@ public class AnimComposer extends AbstractControl {
 
         return result;
     }
-    
+
     /**
      * 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.
      * @return The action registered with specified name. It will make a new action if there isn't any.
      * @see #makeAction(java.lang.String)
@@ -239,29 +238,29 @@ public class AnimComposer extends AbstractControl {
         }
         return action;
     }
-    
+
     /**
-     * 
+     *
      * @param name The name of the action to return.
      * @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);
     }
-    
+
     /**
      * Register given action with specified name.
-     * 
+     *
      * @param name The name of the action.
      * @param action The action to add.
      */
-    public void addAction(String name, Action action){
+    public void addAction(String name, Action action) {
         actions.put(name, action);
     }
 
     /**
      * Create a new ClipAction with specified clip name.
-     * 
+     *
      * @param name The name of the clip.
      * @return a new action
      * @throws IllegalArgumentException if clip with specified name not found.
@@ -275,17 +274,17 @@ public class AnimComposer extends AbstractControl {
         action = new ClipAction(clip);
         return action;
     }
-    
+
     /**
      * Tells if an action is contained in the list of actions.
-     * 
+     *
      * @param name The name of the action.
      * @return true, if the named action is in the list of actions.
      */
     public boolean hasAction(String name) {
         return actions.containsKey(name);
     }
-    
+
     /**
      * 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.
  */
 public class FrameInterpolator {
-
     public static final FrameInterpolator DEFAULT = new FrameInterpolator();
 
     private AnimInterpolator<Float> timeInterpolator;
@@ -51,23 +50,23 @@ public class FrameInterpolator {
     final private TrackDataReader<Vector3f> scaleReader = new TrackDataReader<>();
     final private TrackTimeReader timesReader = new TrackTimeReader();
 
-
     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);
-        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);
             translationInterpolator.interpolate(t, currentIndex, translationReader, timesReader, transforms.getTranslation());
         }
-        if(rotations != null) {
+        if (rotations != null) {
             rotationReader.setData(rotations);
             rotationInterpolator.interpolate(t, currentIndex, rotationReader, timesReader, transforms.getRotation());
         }
-        if(scales != null){
+        if (scales != null) {
             scaleReader.setData(scales);
             scaleInterpolator.interpolate(t, currentIndex, scaleReader, timesReader, transforms.getScale());
         }
@@ -83,7 +82,7 @@ public class FrameInterpolator {
                 next = current;
             }
 
-            float val =  FastMath.interpolateLinear(t, weights[current], weights[next]);
+            float val = FastMath.interpolateLinear(t, weights[current], weights[next]);
             store[i] = val;
         }
     }
@@ -104,7 +103,6 @@ public class FrameInterpolator {
         this.scaleInterpolator = scaleInterpolator;
     }
 
-
     public static class TrackTimeReader {
         private float[] data;
 
@@ -122,7 +120,6 @@ public class FrameInterpolator {
     }
 
     public static class TrackDataReader<T> {
-
         private CompactArray<T> data;
 
         protected void setData(CompactArray<T> data) {
@@ -148,7 +145,6 @@ public class FrameInterpolator {
 
             index = mod(index, total);
 
-
             return data.get(index, store);
         }
     }
@@ -163,5 +159,4 @@ public class FrameInterpolator {
     private static int mod(int val, int 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>
      * <p>Would work for any of the following method signatures:</p>
      * <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 target object on which the method is to be invoked
@@ -208,7 +208,7 @@ public class Tweens {
             } else if (t > 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);
             return (result + 1) * 0.5;
         }
@@ -575,7 +575,7 @@ public class Tweens {
                 // We accept the 't' parameter as either first or last,
                 // so we'll see which one matches.
                 if (isFloatType(paramTypes[0]) || isDoubleType(paramTypes[0])) {
-                    // Try it as the first parameter 
+                    // Try it as the first parameter
                     int matches = 0;
 
                     for (int i = 1; i < paramTypes.length; i++) {
@@ -597,7 +597,7 @@ public class Tweens {
                     return m;
                 }
 
-                // Else try it at the end                
+                // Else try it at the end
                 int last = paramTypes.length - 1;
                 if (isFloatType(paramTypes[last]) || isDoubleType(paramTypes[last])) {
                     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;
 
 public class ClipAction extends BlendableAction {
-
     private AnimClip clip;
     private Transform transform = new Transform();
 
@@ -25,7 +24,7 @@ public class ClipAction extends BlendableAction {
         for (AnimTrack track : tracks) {
             if (track instanceof TransformTrack) {
                 TransformTrack tt = (TransformTrack) track;
-                if(getMask() != null && !getMask().contains(tt.getTarget())){
+                if (getMask() != null && !getMask().contains(tt.getTarget())) {
                     continue;
                 }
                 interpolateTransformTrack(t, tt);
@@ -46,6 +45,7 @@ public class ClipAction extends BlendableAction {
             this.collectTransform(target, transform, getTransitionWeight(), this);
         }
     }
+
     private void interpolateMorphTrack(double t, MorphTrack track) {
         Geometry target = track.getTarget();
         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
  * animation channel for its feet, and another for its torso, and
  * the animations for each channel are controlled independently.
- * 
+ *
  * @author Kirill Vainer
  */
 @Deprecated
 public final class AnimChannel {
-
     private static final float DEFAULT_BLEND_TIME = 0.15f;
-    
+
     private AnimControl control;
 
     private BitSet affectedBones;
@@ -63,36 +62,35 @@ public final class AnimChannel {
     private float timeBlendFrom;
     private float blendTime;
     private float speedBlendFrom;
-    private boolean notified=false;
+    private boolean notified = false;
 
     private LoopMode loopMode, loopModeBlendFrom;
-    
+
     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;
     }
 
     /**
      * Returns the parent control of this AnimChannel.
-     * 
+     *
      * @return the parent control of this AnimChannel.
      * @see AnimControl
      */
     public AnimControl getControl() {
         return control;
     }
-    
+
     /**
      * @return The name of the currently playing animation, or null if
      * none is assigned.
      *
-     * @see AnimChannel#setAnim(java.lang.String) 
+     * @see AnimChannel#setAnim(java.lang.String)
      */
     public String getAnimationName() {
         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
      * determines what will happen to the animation once it finishes
      * playing.
-     * 
+     *
      * For more information, see the LoopMode enum class.
      * @see LoopMode
      * @see AnimChannel#setLoopMode(com.jme3.animation.LoopMode)
@@ -141,10 +139,10 @@ public final class AnimChannel {
      */
     public void setSpeed(float speed) {
         this.speed = speed;
-        if(blendTime>0){
+        if (blendTime > 0) {
             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
-     * is clamped from 0 to {@link #getAnimMaxTime()}. 
+     * is clamped from 0 to {@link #getAnimMaxTime()}.
      */
     public void setTime(float time) {
         this.time = FastMath.clamp(time, 0, getAnimMaxTime());
@@ -172,7 +170,7 @@ public final class AnimChannel {
      *
      * @see AnimChannel#getTime()
      */
-    public float getAnimMaxTime(){
+    public float getAnimMaxTime() {
         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
      * animation will be applied instantly.
      */
-    public void setAnim(String name, float blendTime){
+    public void setAnim(String name, float blendTime) {
         if (name == null)
             throw new IllegalArgumentException("name cannot be null");
 
@@ -197,21 +195,21 @@ public final class AnimChannel {
 
         Animation anim = control.animationMap.get(name);
         if (anim == null)
-            throw new IllegalArgumentException("Cannot find animation named: '"+name+"'");
+            throw new IllegalArgumentException("Cannot find animation named: '" + name + "'");
 
         control.notifyAnimChange(this, name);
 
-        if (animation != null && blendTime > 0f){
+        if (animation != null && blendTime > 0f) {
             this.blendTime = blendTime;
             // activate blending
-            blendTime = Math.min(blendTime, anim.getLength() / speed);            
+            blendTime = Math.min(blendTime, anim.getLength() / speed);
             blendFrom = animation;
             timeBlendFrom = time;
             speedBlendFrom = speed;
             loopModeBlendFrom = loopMode;
             blendAmount = 0f;
-            blendRate   = 1f / blendTime;
-        }else{
+            blendRate = 1f / blendTime;
+        } else {
             blendFrom = null;
         }
 
@@ -227,10 +225,10 @@ public final class AnimChannel {
      * <p>
      * See {@link #setAnim(java.lang.String, float)}.
      * The blendTime argument by default is 150 milliseconds.
-     * 
+     *
      * @param name The name of the animation to play
      */
-    public void setAnim(String name){
+    public void setAnim(String name) {
         setAnim(name, DEFAULT_BLEND_TIME);
     }
 
@@ -244,7 +242,7 @@ public final class AnimChannel {
 
     /**
      * Add a single bone to be influenced by this animation channel.
-     * 
+     *
      * @param name the name of the Bone to be influenced
      */
     public void addBone(String name) {
@@ -258,7 +256,7 @@ public final class AnimChannel {
      */
     public void addBone(Bone bone) {
         int boneIndex = control.getSkeleton().getBoneIndex(bone);
-        if(affectedBones == null) {
+        if (affectedBones == null) {
             affectedBones = new BitSet(control.getSkeleton().getBoneCount());
         }
         affectedBones.set(boneIndex);
@@ -314,19 +312,19 @@ public final class AnimChannel {
         }
     }
 
-    BitSet getAffectedBones(){
+    BitSet getAffectedBones() {
         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();
-            }else{
+            } else {
                 TempVars vars = TempVars.get();
                 update(0, vars);
-                vars.release();    
+                vars.release();
             }
         }
         animation = null;
@@ -337,31 +335,31 @@ public final class AnimChannel {
         if (animation == null)
             return;
 
-        if (blendFrom != null && blendAmount != 1.0f){
+        if (blendFrom != null && blendAmount != 1.0f) {
             // 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 - blendAmount, control, this, vars);
-            
+
             timeBlendFrom += tpf * speedBlendFrom;
             timeBlendFrom = AnimationUtils.clampWrapTime(timeBlendFrom,
-                                          blendFrom.getLength(),
-                                          loopModeBlendFrom);
-            if (timeBlendFrom < 0){
+                    blendFrom.getLength(),
+                    loopModeBlendFrom);
+            if (timeBlendFrom < 0) {
                 timeBlendFrom = -timeBlendFrom;
                 speedBlendFrom = -speedBlendFrom;
             }
 
             blendAmount += tpf * blendRate;
-            if (blendAmount > 1f){
+            if (blendAmount > 1f) {
                 blendAmount = 1f;
                 blendFrom = null;
             }
         }
-        
+
         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 (loopMode == LoopMode.DontLoop) {
                     // Note that this flag has to be set before calling the notify,
@@ -370,10 +368,10 @@ public final class AnimChannel {
                     notified = true;
                 }
                 control.notifyAnimCycleDone(this, animation.getName());
-            } 
+            }
         }
         time = AnimationUtils.clampWrapTime(time, animation.getLength(), loopMode);
-        if (time < 0){
+        if (time < 0) {
             // Negative time indicates that speed should be inverted
             // (for cycle loop mode only)
             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() {
     }
 
-    @Override   
+    @Override
     public Object jmeClone() {
         AnimControl clone = (AnimControl) super.jmeClone();
         clone.channels = new ArrayList<AnimChannel>();
         clone.listeners = new ArrayList<AnimEventListener>();
 
         return clone;
-    }     
+    }
 
-    @Override   
-    public void cloneFields( Cloner cloner, Object original ) {
+    @Override
+    public void cloneFields(Cloner cloner, Object original) {
         super.cloneFields(cloner, original);
-        
+
         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<>();
-         
-        // 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()));
         }
-        
+
         this.animationMap = newMap;
     }
-         
+
     /**
      * @param animations Set the animations that this <code>AnimControl</code>
      * 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
      * in the skeleton.
-     * 
+     *
      * @return A new animation channel for this <code>AnimControl</code>.
      */
     public AnimChannel createChannel() {
@@ -376,11 +376,11 @@ public final class AnimControl extends AbstractControl implements Cloneable, Jme
         }
 
         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.
 
-            // 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.
             Savable[] sav = in.readSavableArray("targets", 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.
- * 
+ *
  * @author Kirill Vainer, Marcin Roguski (Kaelthas)
  * @deprecated use {@link com.jme3.anim.AnimClip}
  */
 @Deprecated
 public class Animation implements Savable, Cloneable, JmeCloneable {
-
-    /** 
-     * The name of the animation. 
+    /**
+     * The name of the animation.
      */
     private String name;
-    /** 
-     * The length of the animation. 
+    /**
+     * The length of the animation.
      */
     private float length;
-    /** 
-     * The tracks of the animation. 
+    /**
+     * The tracks of the animation.
      */
     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.
-     * 
+     *
      * @param name The name 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
-     * 
+     *
      * @return the length in seconds of this animation
      */
     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 behaves differently for every known track type.
      * Override this method if you have your own type of track.
-     * 
+     *
      * @param time the time of the animation
      * @param blendAmount the blend amount factor
      * @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.
-     * 
+     *
      * @param tracksArray The tracks to set.
      */
     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[]) }.
-     * 
+     *
      * @return the tracks set previously
      */
     public Track[] getTracks() {
@@ -192,7 +191,7 @@ public class Animation implements Savable, Cloneable, JmeCloneable {
     }
 
     /**
-     * 
+     *
      * @param spat the Spatial to clone for
      * @return a new instance
      */
@@ -213,33 +212,32 @@ public class Animation implements Savable, Cloneable, JmeCloneable {
         }
     }
 
-    @Override   
+    @Override
     public Object jmeClone() {
         try {
             return super.clone();
-        } catch( CloneNotSupportedException e ) {
+        } catch (CloneNotSupportedException 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
         // 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
         SafeArrayList<Track> newTracks = new SafeArrayList<>(Track.class);
-        for( Track track : tracks ) {
+        for (Track track : tracks) {
             if (track instanceof JmeCloneable) {
                 newTracks.add(cloner.clone(track));
             } else {
-                // this is the part that seems fishy 
+                // this is the part that seems fishy
                 newTracks.add(track);
             }
         }
         this.tracks = newTracks;
     }
-         
+
     @Override
     public String toString() {
         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
  */
 public class AnimationUtils {
-    
-    private AnimationUtils(){
-        
+    private AnimationUtils() {
     }
+
     /**
      * Clamps the time according to duration and loopMode
      *
@@ -48,10 +47,10 @@ public class AnimationUtils {
      * @param loopMode the animation's looping behavior (not null)
      * @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
-        }        
+        }
         switch (loopMode) {
             case Cycle:
                 boolean sign = ((int) (time / duration) % 2) != 0;
@@ -62,5 +61,5 @@ public class AnimationUtils {
                 return time % duration;
         }
         return time;
-     }
+    }
 }

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

@@ -156,9 +156,9 @@ public class AudioTrack implements ClonableTrack {
 
     @Override
     public float[] getKeyFrameTimes() {
-        return new float[] { startOffset };
+        return new float[]{startOffset};
     }
-    
+
     /**
      * Clone this track
      *
@@ -197,27 +197,25 @@ public class AudioTrack implements ClonableTrack {
         return audioTrack;
     }
 
-    @Override   
+    @Override
     public Object jmeClone() {
         try {
             return super.clone();
-        } catch( CloneNotSupportedException e ) {
+        } catch (CloneNotSupportedException 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()
         this.initialized = false;
         this.started = false;
-        this.played = false; 
+        this.played = false;
         this.audio = cloner.clone(audio);
     }
-         
-         
-    /**    
+
+    /**
      * recursive function responsible for finding the newly cloned AudioNode
      *
      * @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
  * system. A bone contains a name and an index, as well as relevant
  * transformation data.
- * 
+ *
  * A bone has 3 sets of transforms :
  * 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.
- * 
+ *
  * 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
  * 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.
- * 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.
  *
  * @author Kirill Vainer
@@ -96,14 +96,14 @@ public final class Bone implements Savable, JmeCloneable {
     private Vector3f bindPos;
     private Quaternion bindRot;
     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 Quaternion modelBindInverseRot;
     private Vector3f modelBindInverseScale;
-    
+
     /**
      * 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 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 Quaternion modelRot = new Quaternion();
     private Vector3f modelScale = new Vector3f();
-    
+
     // Used for getCombinedTransform
     private Transform tmpTransform;
-    
+
     /**
      * 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)}
@@ -129,13 +129,13 @@ public final class Bone implements Savable, JmeCloneable {
 
     /**
      * Creates a new bone with the given name.
-     * 
+     *
      * @param name Name to give to this bone
      */
     public Bone(String name) {
         if (name == null)
             throw new IllegalArgumentException("Name cannot be null");
-        
+
         this.name = name;
 
         bindPos = new Vector3f();
@@ -148,13 +148,13 @@ public final class Bone implements Savable, JmeCloneable {
     }
 
     /**
-     * Special-purpose copy constructor. 
+     * Special-purpose copy constructor.
      * <p>
      * Only copies the name, user control state and bind pose transforms from the original.
      * <p>
      * The rest of the data is <em>NOT</em> copied, as it will be
      * generated automatically when the bone is animated.
-     * 
+     *
      * @param source The bone from which to copy the data.
      */
     Bone(Bone source) {
@@ -178,48 +178,48 @@ public final class Bone implements Savable, JmeCloneable {
      */
     protected Bone() {
     }
-    
-    @Override   
+
+    @Override
     public Object jmeClone() {
         try {
-            Bone clone = (Bone)super.clone();
+            Bone clone = (Bone) super.clone();
             return clone;
         } catch (CloneNotSupportedException ex) {
             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.children = cloner.clone(children);    
-        
+        this.children = cloner.clone(children);
+
         this.attachNode = cloner.clone(attachNode);
         this.targetGeometry = cloner.clone(targetGeometry);
 
         this.bindPos = cloner.clone(bindPos);
         this.bindRot = cloner.clone(bindRot);
         this.bindScale = cloner.clone(bindScale);
-        
+
         this.modelBindInversePos = cloner.clone(modelBindInversePos);
         this.modelBindInverseRot = cloner.clone(modelBindInverseRot);
         this.modelBindInverseScale = cloner.clone(modelBindInverseScale);
-    
+
         this.localPos = cloner.clone(localPos);
         this.localRot = cloner.clone(localRot);
         this.localScale = cloner.clone(localScale);
-        
+
         this.modelPos = cloner.clone(modelPos);
         this.modelRot = cloner.clone(modelRot);
         this.modelScale = cloner.clone(modelScale);
-    
+
         this.tmpTransform = cloner.clone(tmpTransform);
     }
 
     /**
      * Returns the name of the bone, set in the constructor.
-     * 
+     *
      * @return The name of the bone, set in the constructor.
      */
     public String getName() {
@@ -236,7 +236,7 @@ public final class Bone implements Savable, JmeCloneable {
 
     /**
      * Returns all the children bones of this bone.
-     * 
+     *
      * @return All the children bones of this bone.
      */
     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.
-     * 
+     *
      * @return The local position of the bone, relative to the parent bone.
      */
     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.
-     * 
+     *
      * @return The local rotation of the bone, relative to the parent bone.
      */
     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.
-     * 
+     *
      * @return The local scale of the bone, relative to the parent bone.
      */
     public Vector3f getLocalScale() {
@@ -272,7 +272,7 @@ public final class Bone implements Savable, JmeCloneable {
 
     /**
      * Returns the position of the bone in model space.
-     * 
+     *
      * @return The position of the bone in model space.
      */
     public Vector3f getModelSpacePosition() {
@@ -281,7 +281,7 @@ public final class Bone implements Savable, JmeCloneable {
 
     /**
      * Returns the rotation of the bone in model space.
-     * 
+     *
      * @return The rotation of the bone in model space.
      */
     public Quaternion getModelSpaceRotation() {
@@ -290,7 +290,7 @@ public final class Bone implements Savable, JmeCloneable {
 
     /**
      * Returns the scale of the bone in model space.
-     * 
+     *
      * @return The scale of the bone in model space.
      */
     public Vector3f getModelSpaceScale() {
@@ -301,19 +301,19 @@ public final class Bone implements Savable, JmeCloneable {
      * @return the pre-existing vector
      * @deprecated use {@link #getModelBindInversePosition()}
      */
-    @Deprecated 
+    @Deprecated
     public Vector3f getWorldBindInversePosition() {
         return modelBindInversePos;
     }
-    
-      /**
+
+    /**
      * Returns the inverse Bind position of this bone expressed in model space.
      * <p>
      * The inverse bind pose transform of the bone in model space is its "default"
      * transform with no animation applied.
-     * 
+     *
      * @return the inverse bind position of this bone expressed in model space.
-     */   
+     */
     public Vector3f getModelBindInversePosition() {
         return modelBindInversePos;
     }
@@ -326,20 +326,19 @@ public final class Bone implements Savable, JmeCloneable {
     public Quaternion getWorldBindInverseRotation() {
         return modelBindInverseRot;
     }
-    
-      /**
+
+    /**
      * Returns the inverse bind rotation of this bone expressed in model space.
      * <p>
      * The inverse bind pose transform of the bone in model space is its "default"
      * transform with no animation applied.
-     * 
+     *
      * @return the inverse bind rotation of this bone expressed in model space.
      */
     public Quaternion getModelBindInverseRotation() {
         return modelBindInverseRot;
     }
 
-
     /**
      * @return the pre-existing vector
      * @deprecated use {@link #getModelBindInverseScale()}
@@ -348,13 +347,13 @@ public final class Bone implements Savable, JmeCloneable {
     public Vector3f getWorldBindInverseScale() {
         return modelBindInverseScale;
     }
-    
+
     /**
      * Returns the inverse world bind pose scale.
      * <p>
      * The inverse bind pose transform of the bone in model space is its "default"
      * transform with no animation applied.
-     * 
+     *
      * @return the inverse world bind pose scale.
      */
     public Vector3f getModelBindInverseScale() {
@@ -370,7 +369,7 @@ public final class Bone implements Savable, JmeCloneable {
         }
         return t;
     }
-    
+
     public Transform getBindInverseTransform() {
         Transform t = new Transform();
         t.setTranslation(bindPos);
@@ -380,7 +379,7 @@ public final class Bone implements Savable, JmeCloneable {
         }
         return t.invert();
     }
-    
+
     /**
      * @return the pre-existing vector
      * @deprecated use {@link #getBindPosition()}
@@ -389,13 +388,13 @@ public final class Bone implements Savable, JmeCloneable {
     public Vector3f getWorldBindPosition() {
         return bindPos;
     }
-    
-     /**
+
+    /**
      * Returns the bind position expressed in local space (relative to the parent bone).
      * <p>
      * The bind pose transform of the bone in local space is its "default"
      * transform with no animation applied.
-     * 
+     *
      * @return the bind position in local space.
      */
     public Vector3f getBindPosition() {
@@ -405,7 +404,7 @@ public final class Bone implements Savable, JmeCloneable {
     /**
      * @return the pre-existing Quaternion
      * @deprecated use {@link #getBindRotation() }
-     */    
+     */
     @Deprecated
     public Quaternion getWorldBindRotation() {
         return bindRot;
@@ -416,13 +415,13 @@ public final class Bone implements Savable, JmeCloneable {
      * <p>
      * The bind pose transform of the bone in local space is its "default"
      * transform with no animation applied.
-     * 
+     *
      * @return the bind rotation in local space.
-     */    
+     */
     public Quaternion getBindRotation() {
         return bindRot;
-    }  
-    
+    }
+
     /**
      * @return the pre-existing vector
      * @deprecated use {@link #getBindScale() }
@@ -431,13 +430,13 @@ public final class Bone implements Savable, JmeCloneable {
     public Vector3f getWorldBindScale() {
         return bindScale;
     }
-    
+
     /**
      * Returns the  bind scale expressed in local space (relative to the parent bone).
      * <p>
      * The bind pose transform of the bone in local space is its "default"
      * transform with no animation applied.
-     * 
+     *
      * @return the bind scale in local space.
      */
     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.
      * Can corrupt skeleton.
-     * 
+     *
      * @param bone The bone to add
      */
     public void addChild(Bone bone) {
@@ -466,15 +465,14 @@ public final class Bone implements Savable, JmeCloneable {
     }
 
     /**
-     * 
+     *
      * @deprecated use {@link #updateModelTransforms() }
      */
     @Deprecated
-    public final void updateWorldVectors(){
+    public final void updateWorldVectors() {
         updateModelTransforms();
     }
-            
-            
+
     /**
      * Updates the model transforms for this bone and, possibly, the attachments node
      * if not null.
@@ -497,11 +495,11 @@ public final class Bone implements Savable, JmeCloneable {
                 localPos.interpolateLocal(bindPos, invWeightSum);
                 localScale.interpolateLocal(bindScale, invWeightSum);
             }
-            
+
             // Future invocations of transform blend will start over.
             currentWeightSum = -1;
         }
-        
+
         if (parent != null) {
             //rotation
             parent.modelRot.mult(localRot, modelRot);
@@ -512,7 +510,7 @@ public final class Bone implements Savable, JmeCloneable {
             parent.modelScale.mult(localScale, modelScale);
 
             //translation
-            //scale and rotation of parent affect bone position            
+            //scale and rotation of parent affect bone position
             parent.modelRot.mult(localPos, modelPos);
             modelPos.multLocal(parent.modelScale);
             modelPos.addLocal(parent.modelPos);
@@ -624,14 +622,14 @@ public final class Bone implements Savable, JmeCloneable {
         }
     }
 
-     /**
+    /**
      * Stores the skinning transform in the specified Matrix4f.
      * The skinning transform applies the animation of the bone to a vertex.
-     * 
+     *
      * This assumes that the world transforms for the entire bone hierarchy
      * have already been computed, otherwise this method will return undefined
      * results.
-     * 
+     *
      * @param outTransform
      */
     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)
      *
      * @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)
-     * 
+     *
      * Must update all bones in skeleton for this to work.
      * @param translation translation in model space
      * @param rotation rotation in model space
@@ -686,9 +684,9 @@ public final class Bone implements Savable, JmeCloneable {
         // TODO: add scale here ???
         modelPos.set(translation);
         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.setLocalRotation(rotation);
         }
@@ -701,7 +699,7 @@ public final class Bone implements Savable, JmeCloneable {
      * @return the resulting Transform (in reusable temporary storage!)
      */
     public Transform getCombinedTransform(Vector3f position, Quaternion rotation) {
-        if(tmpTransform == null){
+        if (tmpTransform == null) {
             tmpTransform = new Transform();
         }
         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.
      * Two transform blends with weight = 0.5 each will result in the two
      * transforms blended together (nlerp) with blend = 0.5.
-     * 
+     *
      * @param translation The translation to blend in
      * @param rotation The rotation to blend in
      * @param scale The scale to blend in
@@ -792,13 +790,13 @@ public final class Bone implements Savable, JmeCloneable {
         if (userControl) {
             return;
         }
-        
+
         if (weight == 0) {
             // Do not apply this transform at all.
             return;
         }
 
-        if (currentWeightSum == 1){
+        if (currentWeightSum == 1) {
             return; // More than 2 transforms are being blended
         } else if (currentWeightSum == -1 || currentWeightSum == 0) {
             // Set the transform fully
@@ -810,14 +808,14 @@ public final class Bone implements Savable, JmeCloneable {
             // Set the weight. It will be applied in updateModelTransforms().
             currentWeightSum = weight;
         } else {
-            // The weight is already set. 
+            // The weight is already set.
             // Blend in the new transform.
             TempVars vars = TempVars.get();
 
             Vector3f tmpV = vars.vect1;
             Vector3f tmpV2 = vars.vect2;
             Quaternion tmpQ = vars.quat1;
-            
+
             tmpV.set(bindPos).addLocal(translation);
             localPos.interpolateLocal(tmpV, weight);
 
@@ -828,10 +826,10 @@ public final class Bone implements Savable, JmeCloneable {
                 tmpV2.set(bindScale).multLocal(scale);
                 localScale.interpolateLocal(tmpV2, weight);
             }
-        
+
             // Ensures no new weights will be blended in the future.
             currentWeightSum = 1;
-            
+
             vars.release();
         }
     }
@@ -884,16 +882,16 @@ public final class Bone implements Savable, JmeCloneable {
 
         name = input.readString("name", null);
         int ver = input.getSavableVersion(Bone.class);
-        if(ver < 2){
+        if (ver < 2) {
             bindPos = (Vector3f) input.readSavable("initialPos", null);
             bindRot = (Quaternion) input.readSavable("initialRot", null);
             bindScale = (Vector3f) input.readSavable("initialScale", new Vector3f(1.0f, 1.0f, 1.0f));
-        }else{
+        } else {
             bindPos = (Vector3f) input.readSavable("bindPos", null);
             bindRot = (Quaternion) input.readSavable("bindRot", null);
             bindScale = (Vector3f) input.readSavable("bindScale", new Vector3f(1.0f, 1.0f, 1.0f));
         }
-        
+
         attachNode = (Node) input.readSavable("attachNode", 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)
      */
-    public void setLocalRotation(Quaternion rot){
+    public void setLocalRotation(Quaternion rot) {
         if (!userControl) {
             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)
      */
-    public void setLocalTranslation(Vector3f pos){
+    public void setLocalTranslation(Vector3f pos) {
         if (!userControl) {
             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
      * @param scale the scale to apply
      */
-    public void setLocalScale(Vector3f scale){
+    public void setLocalScale(Vector3f scale) {
         if (!userControl) {
             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)
      * @return true if it can be manipulated
      */
-    public boolean hasUserControl(){
+    public boolean hasUserControl() {
         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.
- * 
+ *
  * @author Kirill Vainer
  * @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.
      */
     private int targetBoneIndex;
-    
+
     /**
      * Transforms and times for track.
      */
@@ -61,7 +61,7 @@ public final class BoneTrack implements JmeCloneable, Track {
     private CompactQuaternionArray rotations;
     private CompactVector3Array scales;
     private float[] times;
-    
+
     /**
      * 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
      * the correct animation transforms for a given time.
      * 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)) {
             return;
         }
-        
+
         Bone target = control.getSkeleton().getBone(targetBoneIndex);
 
         Vector3f tempV = vars.vect1;
@@ -217,7 +217,7 @@ public final class BoneTrack implements JmeCloneable, Track {
         Vector3f tempV2 = vars.vect3;
         Vector3f tempS2 = vars.vect4;
         Quaternion tempQ2 = vars.quat2;
-        
+
         int lastFrame = times.length - 1;
         if (time < 0 || lastFrame == 0) {
             rotations.get(0, tempQ);
@@ -260,12 +260,12 @@ public final class BoneTrack implements JmeCloneable, Track {
         }
 
 //        if (weight != 1f) {
-            target.blendAnimTransforms(tempV, tempQ, scales != null ? tempS : null, weight);
+        target.blendAnimTransforms(tempV, tempQ, scales != null ? tempS : null, weight);
 //        } else {
 //            target.setAnimTransforms(tempV, tempQ, scales != null ? tempS : null);
 //        }
     }
-    
+
     /**
      * @return the length of the track
      */
@@ -341,7 +341,7 @@ public final class BoneTrack implements JmeCloneable, Track {
         scales = (CompactVector3Array) ic.readSavable("scales", null);
 
         //Backward compatibility for old j3o files generated before revision 6807
-        if (im.getFormatVersion() == 0){
+        if (im.getFormatVersion() == 0) {
             if (translations == null) {
                 Savable[] sav = ic.readSavableArray("translations", 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);
     }
 
-    public void fill(int startIndex, float[] store ){
+    public void fill(int startIndex, float[] store) {
         for (int i = 0; i < store.length; i++) {
             store[i] = get(startIndex + i, null);
         }
     }
-    
+
     @Override
     protected void serialize(int i, Float data) {
         array[i] = data;
@@ -96,4 +96,4 @@ public class CompactFloatArray extends CompactArray<Float> implements Savable {
     protected Float deserialize(int i, Float store) {
         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");
                 }
             }
-
-
         }
 
         @Override
@@ -241,7 +239,7 @@ public class EffectTrack implements ClonableTrack {
 
     @Override
     public float[] getKeyFrameTimes() {
-        return new float[] { startOffset };
+        return new float[]{startOffset};
     }
 
     /**
@@ -288,14 +286,13 @@ public class EffectTrack implements ClonableTrack {
     public Object jmeClone() {
         try {
             return super.clone();
-        } catch( CloneNotSupportedException e ) {
+        } catch (CloneNotSupportedException e) {
             throw new RuntimeException("Error cloning", e);
         }
     }
 
-
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         this.emitter = cloner.clone(emitter);
     }
 
@@ -391,8 +388,6 @@ public class EffectTrack implements ClonableTrack {
 
         //adding the given Track to the TrackInfo.
         data.addTrack(effectTrack);
-
-
     }
 
     private void removeUserData(EffectTrack effectTrack) {
@@ -406,8 +401,6 @@ public class EffectTrack implements ClonableTrack {
 
         //removing the given Track to the TrackInfo.
         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 int[] indices;
 
-    private transient final Vector3f tempVec  = new Vector3f();
+    private transient final Vector3f tempVec = 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.targetMeshIndex = targetMeshIndex;
         this.offsets = offsets;
@@ -63,25 +63,23 @@ public final class Pose implements Savable, Cloneable {
     /**
      * Serialization-only. Do not use.
      */
-    protected Pose()
-    {
+    protected Pose() {
     }
-    
-    public int getTargetMeshIndex(){
+
+    public int getTargetMeshIndex() {
         return targetMeshIndex;
     }
 
-
     /**
      * 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 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];
-            int vertIndex   = indices[i];
+            int vertIndex = indices[i];
 
             tempVec.set(offset).multLocal(blend);
 
@@ -95,7 +93,7 @@ public final class Pose implements Savable, Cloneable {
             BufferUtils.setInBuffer(tempVec2, vertexBuffer, vertIndex);
         }
     }
-    
+
     /**
      * This method creates 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
 public final class PoseTrack implements Track {
-    
     private int targetMeshIndex;
     private PoseFrame[] frames;
     private float[] times;
@@ -54,14 +53,13 @@ public final class PoseTrack implements Track {
             this.poses = poses;
             this.weights = weights;
         }
-        
+
         /**
          * Serialization-only. Do not use.
          */
-        protected PoseFrame()
-        {
+        protected PoseFrame() {
         }
-        
+
         /**
          * This method creates 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 {
             InputCapsule in = i.getCapsule(this);
             weights = in.readFloatArray("weights", null);
-            
+
             Savable[] readSavableArray = in.readSavableArray("poses", null);
             if (readSavableArray != null) {
                 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.times = times;
         this.frames = frames;
     }
-    
+
     /**
      * Serialization-only. Do not use.
      */
-    protected PoseTrack()
-    {
+    protected PoseTrack() {
     }
-    
+
     @Override
     public void setTime(float time, float weight, AnimControl control, AnimChannel channel, TempVars vars) {
         // TODO: When MeshControl is created, it will gather targets
         // list automatically which is then retrieved here.
-        
+
         /*
         Mesh target = targets[targetMeshIndex];
         if (time < times[0]) {
@@ -150,12 +147,12 @@ public final class PoseTrack implements Track {
     public float getLength() {
         return times == null ? 0 : times[times.length - 1] - times[0];
     }
-    
+
     @Override
     public float[] getKeyFrameTimes() {
         return times;
     }
-    
+
     /**
      * This method creates 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();
         }
     }
-    
+
     @Override
     public void write(JmeExporter e) throws IOException {
         OutputCapsule out = e.getCapsule(this);
@@ -190,7 +187,7 @@ public final class PoseTrack implements Track {
         InputCapsule in = i.getCapsule(this);
         targetMeshIndex = in.readInt("meshIndex", 0);
         times = in.readFloatArray("times", null);
-        
+
         Savable[] readSavableArray = in.readSavableArray("frames", null);
         if (readSavableArray != null) {
             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.
  * Skeleton updates the world transforms to reflect the current local
  * animated matrixes.
- * 
+ *
  * @author Kirill Vainer
  * @deprecated use {@link Armature}
  */
@@ -55,7 +55,7 @@ public final class Skeleton implements Savable, JmeCloneable {
 
     private Bone[] rootBones;
     private Bone[] boneList;
-    
+
     /**
      * Contains the skinning matrices, multiplying it by a vertex affected by a bone
      * will cause it to go to the animated position.
@@ -63,12 +63,12 @@ public final class Skeleton implements Savable, JmeCloneable {
     private transient Matrix4f[] skinningMatrixes;
 
     /**
-     * Creates a skeleton from a bone list. 
+     * Creates a skeleton from a bone list.
      * The root bones are found automatically.
      * <p>
      * Note that using this constructor will cause the bones in the list
      * to have their bind pose recomputed based on their local transforms.
-     * 
+     *
      * @param boneList The list of bones to manage by this Skeleton
      */
     public Skeleton(Bone[] boneList) {
@@ -97,7 +97,7 @@ public final class Skeleton implements Savable, JmeCloneable {
      * <p>
      * Shallow copies bind pose data from the source skeleton, does not
      * copy any other data.
-     * 
+     *
      * @param source The source Skeleton to copy from
      */
     public Skeleton(Skeleton source) {
@@ -124,18 +124,18 @@ public final class Skeleton implements Savable, JmeCloneable {
     protected Skeleton() {
     }
 
-    @Override   
+    @Override
     public Object jmeClone() {
         try {
-            Skeleton clone = (Skeleton)super.clone();
+            Skeleton clone = (Skeleton) super.clone();
             return clone;
         } catch (CloneNotSupportedException ex) {
             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.boneList = cloner.clone(boneList);
         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
      *
      * @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) {
         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.
      */
     private boolean wasMeshUpdated = false;
-    
+
     /**
      * User wishes to use hardware skinning if available.
      */
     private transient boolean hwSkinningDesired = true;
-    
+
     /**
      * Hardware skinning is currently being used.
      */
     private transient boolean hwSkinningEnabled = false;
-    
+
     /**
      * Hardware skinning was tested on this GPU, results
      * are stored in {@link #hwSkinningSupported} variable.
      */
     private transient boolean hwSkinningTested = false;
-    
+
     /**
      * If hardware skinning was {@link #hwSkinningTested tested}, then
      * this variable will be set to true if supported, and false if otherwise.
      */
     private transient boolean hwSkinningSupported = false;
-    
+
     /**
      * Bone offset matrices, recreated each frame
      */
     private transient Matrix4f[] offsetMatrices;
 
-    
     private MatParamOverride numberOfBonesParam;
     private MatParamOverride boneMatricesParam;
-    
+
     /**
      * Serialization only. Do not use.
      */
@@ -119,11 +118,11 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
     private void switchToHardware() {
         numberOfBonesParam.setEnabled(true);
         boneMatricesParam.setEnabled(true);
-        
+
         // Next full 10 bones (e.g. 30 on 24 bones)
         int numBones = ((skeleton.getBoneCount() / 10) + 1) * 10;
         numberOfBonesParam.setValue(numBones);
-        
+
         for (Geometry geometry : targets) {
             Mesh mesh = geometry.getMesh();
             if (mesh != null && mesh.isAnimated()) {
@@ -135,7 +134,7 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
     private void switchToSoftware() {
         numberOfBonesParam.setEnabled(false);
         boneMatricesParam.setEnabled(false);
-        
+
         for (Geometry geometry : targets) {
             Mesh mesh = geometry.getMesh();
             if (mesh != null && mesh.isAnimated()) {
@@ -152,7 +151,7 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
         }
 
         switchToHardware();
-        
+
         try {
             rm.preloadScene(spatial);
             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
      * supported by GPU, it shall be enabled, if it's not preferred, or not
      * 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)
-     * @see #isHardwareSkinningUsed() 
+     * @see #isHardwareSkinningUsed()
      */
     public void setHardwareSkinningPreferred(boolean preferred) {
         hwSkinningDesired = preferred;
     }
-    
+
     /**
      * @return True if hardware skinning is preferable to software skinning.
      * Set to false by default.
-     * 
-     * @see #setHardwareSkinningPreferred(boolean) 
+     *
+     * @see #setHardwareSkinningPreferred(boolean)
      */
     public boolean isHardwareSkinningPreferred() {
         return hwSkinningDesired;
     }
-    
+
     /**
      * @return True is hardware skinning is activated and is currently used, false otherwise.
      */
     public boolean isHardwareSkinningUsed() {
         return hwSkinningEnabled;
     }
-    
+
     /**
      * Creates a skeleton control. The list of targets will be acquired
      * 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()) {
             targets.add(geometry);
         }
-        
     }
 
     private void findTargets(Node node) {
@@ -234,12 +232,12 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
         Spatial oldSpatial = this.spatial;
         super.setSpatial(spatial);
         updateTargetsAndMaterials(spatial);
-        
+
         if (oldSpatial != null) {
             oldSpatial.removeMatParamOverride(numberOfBonesParam);
             oldSpatial.removeMatParamOverride(boneMatricesParam);
         }
-        
+
         if (spatial != null) {
             spatial.removeMatParamOverride(numberOfBonesParam);
             spatial.removeMatParamOverride(boneMatricesParam);
@@ -259,19 +257,19 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
             // already ensured this mesh is animated.
             // Otherwise a crash will happen in skin update.
             softwareSkinUpdate(mesh, offsetMatrices);
-        }     
+        }
     }
-    
+
     private void controlRenderHardware() {
         offsetMatrices = skeleton.computeSkinningMatrices();
         boneMatricesParam.setValue(offsetMatrices);
     }
-    
+
     @Override
     protected void controlRender(RenderManager rm, ViewPort vp) {
         if (!wasMeshUpdated) {
             updateTargetsAndMaterials(spatial);
-            
+
             // Prevent illegal cases. These should never happen.
             assert hwSkinningTested || (!hwSkinningTested && !hwSkinningSupported && !hwSkinningEnabled);
             assert !hwSkinningEnabled || (hwSkinningEnabled && hwSkinningTested && hwSkinningSupported);
@@ -282,7 +280,7 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
 
                 if (hwSkinningSupported) {
                     hwSkinningEnabled = true;
-                    
+
                     Logger.getLogger(SkeletonControl.class.getName()).log(Level.INFO, "Hardware skinning engaged for {0}", spatial);
                 } else {
                     switchToSoftware();
@@ -308,7 +306,7 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
     @Override
     protected void controlUpdate(float tpf) {
         wasMeshUpdated = false;
-     }
+    }
 
     //only do this for software updates
     void resetToBind() {
@@ -344,32 +342,31 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
                     tb.put(btb).clear();
                 }
 
-
                 pb.put(bpb).clear();
                 nb.put(bnb).clear();
             }
         }
     }
 
-    @Override   
+    @Override
     public Object jmeClone() {
         return super.jmeClone();
-    }     
+    }
 
-    @Override   
-    public void cloneFields( Cloner cloner, Object original ) {
+    @Override
+    public void cloneFields(Cloner cloner, Object original) {
         super.cloneFields(cloner, original);
-         
+
         this.skeleton = cloner.clone(skeleton);
-        
+
         // If the targets were cloned then this will clone them.  If the targets
         // were shared then this will share them.
         this.targets = cloner.clone(targets);
-        
+
         this.numberOfBonesParam = cloner.clone(numberOfBonesParam);
         this.boneMatricesParam = cloner.clone(boneMatricesParam);
     }
-         
+
     /**
      * 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
@@ -445,8 +442,6 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
             //if there are tangents use the skinning with tangents
             applySkinningTangents(mesh, offsetMatrices, tb);
         }
-
-
     }
 
     /**
@@ -582,11 +577,9 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
         FloatBuffer fnb = (FloatBuffer) nb.getData();
         fnb.rewind();
 
-
         FloatBuffer ftb = (FloatBuffer) tb.getData();
         ftb.rewind();
 
-
         // get boneIndexes and weights for mesh
         IndexBuffer ib = IndexBuffer.wrapIndexBuffer(mesh.getBuffer(Type.BoneIndex).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();
 
-
         float[] posBuf = vars.skinPositions;
         float[] normBuf = vars.skinNormals;
         float[] tanBuf = vars.skinTangents;
@@ -695,8 +687,6 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
         vb.updateData(fvb);
         nb.updateData(fnb);
         tb.updateData(ftb);
-
-
     }
 
     @Override
@@ -704,7 +694,7 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
         super.write(ex);
         OutputCapsule oc = ex.getCapsule(this);
         oc.write(skeleton, "skeleton", null);
-        
+
         oc.write(numberOfBonesParam, "numberOfBonesParam", null);
         oc.write(boneMatricesParam, "boneMatricesParam", null);
     }
@@ -714,10 +704,10 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
         super.read(im);
         InputCapsule in = im.getCapsule(this);
         skeleton = (Skeleton) in.readSavable("skeleton", null);
-        
+
         numberOfBonesParam = (MatParamOverride) in.readSavable("numberOfBonesParam", null);
         boneMatricesParam = (MatParamOverride) in.readSavable("boneMatricesParam", null);
-        
+
         if (numberOfBonesParam == null) {
             numberOfBonesParam = new MatParamOverride(VarType.Int, "NumberOfBones", 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.
  * (ParticleEmitter for EffectTrack and AudioNode for AudioTrack)
  * 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.
  *
  * @author Nehon
@@ -75,18 +75,18 @@ public class TrackInfo implements Savable, JmeCloneable {
     public void addTrack(Track track) {
         tracks.add(track);
     }
-    
-    @Override   
+
+    @Override
     public Object jmeClone() {
         try {
             return super.clone();
-        } catch( CloneNotSupportedException e ) {
+        } catch (CloneNotSupportedException 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
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
- 
+
 package com.jme3.app;
 
 import com.jme3.profile.*;
@@ -40,13 +40,12 @@ import com.jme3.scene.VertexBuffer.Type;
 import com.jme3.util.BufferUtils;
 import java.nio.FloatBuffer;
 
-
 /**
  *  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.
  *
  *  <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>
  *
  *  <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 {
 
@@ -69,38 +68,38 @@ public class BasicProfiler implements AppProfiler {
     private long renderTime;
     private long updateInterval = 1000000L; // once a millisecond
     private long lastUpdate = 0;
-    
+
     private Mesh mesh;
-    
+
     public BasicProfiler() {
         this(1280);
     }
-    
-    public BasicProfiler( int size ) {
+
+    public BasicProfiler(int size) {
         setFrameCount(size);
     }
 
     /**
      *  Sets the number of frames to display and track.  By default,
      *  this is 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;
         }
-        
+
         this.size = size;
-        this.frames = new long[size*2];
- 
+        this.frames = new long[size * 2];
+
         createMesh();
-        
-        if( frameIndex >= size ) {
+
+        if (frameIndex >= size) {
             frameIndex = 0;
-        }       
+        }
     }
-    
+
     public int getFrameCount() {
         return size;
     }
@@ -108,13 +107,13 @@ public class BasicProfiler implements AppProfiler {
     /**
      *  Sets the number of nanoseconds to wait before updating the
      *  mesh.  By default, this is once a millisecond, i.e. 1000000 nanoseconds.
-     * 
+     *
      * @param nanos the desired update interval (in nanoseconds, default=1e6)
      */
-    public void setUpdateInterval( long nanos ) {
+    public void setUpdateInterval(long nanos) {
         this.updateInterval = nanos;
     }
-    
+
     public long getUpdateInterval() {
         return updateInterval;
     }
@@ -122,7 +121,7 @@ public class BasicProfiler implements AppProfiler {
     /**
      *  Returns the mesh that contains the bar chart of tracked frame
      *  timings.
-     * 
+     *
      * @return the pre-existing Mesh
      */
     public Mesh getMesh() {
@@ -130,33 +129,33 @@ public class BasicProfiler implements AppProfiler {
     }
 
     protected final void createMesh() {
-        if( mesh == null ) {
+        if (mesh == null) {
             mesh = new Mesh();
             mesh.setMode(Mesh.Mode.Lines);
         }
-        
+
         mesh.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(size * 4 * 3));
-        
+
         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
             // endpoint for two layers.
             cb.put(0.5f).put(0.5f).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(1).put(1).put(1);
-        }         
+        }
         mesh.setBuffer(Type.Color, 4, cb);
     }
-    
+
     protected void updateMesh() {
-        FloatBuffer pb = (FloatBuffer)mesh.getBuffer(Type.Position).getData();
+        FloatBuffer pb = (FloatBuffer) mesh.getBuffer(Type.Position).getData();
         pb.rewind();
         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 t2 = frames[i * 2 + 1] * scale;
-            
+
             pb.put(i).put(0).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
-    public void appStep( AppStep step ) {
-        
-        switch(step) {
+    public void appStep(AppStep step) {
+        switch (step) {
             case BeginFrame:
                 startTime = System.nanoTime();
                 break;
@@ -180,30 +178,26 @@ public class BasicProfiler implements AppProfiler {
                 long time = System.nanoTime();
                 frames[frameIndex * 2 + 1] = time - renderTime;
                 frameIndex++;
-                if( frameIndex >= size ) {
+                if (frameIndex >= size) {
                     frameIndex = 0;
                 }
-                if( startTime - lastUpdate > updateInterval ) {
+                if (startTime - lastUpdate > updateInterval) {
                     updateMesh();
                     lastUpdate = startTime;
-                }                
+                }
                 break;
         }
     }
-    
+
     @Override
     public void appSubStep(String... additionalInfo) {
     }
-    
+
     @Override
-    public void vpStep( VpStep step, ViewPort vp, Bucket bucket ) {
+    public void vpStep(VpStep step, ViewPort vp, Bucket bucket) {
     }
 
     @Override
     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
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
- 
+
 package com.jme3.app;
 
 import com.jme3.app.state.BaseAppState;
@@ -44,13 +44,12 @@ import com.jme3.scene.Mesh;
 import com.jme3.scene.Node;
 import com.jme3.scene.VertexBuffer.Type;
 
-
 /**
  *  Provides a basic profiling visualization that shows
  *  per-frame application-wide timings for update and
  *  rendering.
  *
- *  @author    Paul Speed
+ * @author Paul Speed
  */
 public class BasicProfilerState extends BaseAppState {
 
@@ -67,7 +66,7 @@ public class BasicProfilerState extends BaseAppState {
         this(false);
     }
 
-    public BasicProfilerState( boolean enabled ) {
+    public BasicProfilerState(boolean enabled) {
         setEnabled(enabled);
         this.profiler = new BasicProfiler();
     }
@@ -86,82 +85,82 @@ public class BasicProfilerState extends BaseAppState {
      *  single millisecond stretches two pixels high.
      * @param scale the scale
      */
-    public void setGraphScale( float scale ) {
-        if( this.scale == scale ) {
+    public void setGraphScale(float scale) {
+        if (this.scale == scale) {
             return;
         }
         this.scale = scale;
-        if( graph != null ) {
-            graph.setLocalScale(1, scale, 1);            
+        if (graph != null) {
+            graph.setLocalScale(1, scale, 1);
         }
     }
 
     public float getGraphScale() {
         return scale;
     }
- 
+
     /**
      *  Sets the number frames displayed and tracked.
      * @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;
         }
         profiler.setFrameCount(count);
         refreshBackground();
     }
-    
+
     public int getFrameCount() {
         return profiler.getFrameCount();
     }
-    
+
     protected void refreshBackground() {
         Mesh mesh = background.getMesh();
-        
+
         int size = profiler.getFrameCount();
         float frameTime = 1000f / 60;
         mesh.setBuffer(Type.Position, 3, new float[] {
-                    
+
                     // first quad
                     0, 0, 0,
                     size, 0, 0,
                     size, frameTime, 0,
                     0, frameTime, 0,
-                    
+
                     // second quad
                     0, frameTime, 0,
                     size, frameTime, 0,
                     size, frameTime * 2, 0,
                     0, frameTime * 2, 0,
-                    
+
                     // A lower dark border just to frame the
                     // 'update' stats against bright backgrounds
                     0, -2, 0,
                     size, -2, 0,
                     size, 0, 0,
-                    0, 0, 0 
+                    0, 0, 0
                 });
-                
+
         mesh.setBuffer(Type.Color, 4, new float[] {
                     // first quad, within normal frame limits
                     0, 1, 0, 0.25f,
                     0, 1, 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,
                     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
                 });
-                
+
         mesh.setBuffer(Type.Index, 3, new short[] {
                     0, 1, 2,
                     0, 2, 3,
@@ -173,16 +172,15 @@ public class BasicProfilerState extends BaseAppState {
     }
 
     @Override
-    protected void initialize( Application app ) {
-        
+    protected void initialize(Application app) {
         graph = new Geometry("profiler", profiler.getMesh());
-        
+
         Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
         mat.setBoolean("VertexColor", true);
         graph.setMaterial(mat);
         graph.setLocalTranslation(0, 300, 0);
         graph.setLocalScale(1, scale, 1);
-               
+
         Mesh mesh = new Mesh();
         background = new Geometry("profiler.background", mesh);
         mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
@@ -190,34 +188,33 @@ public class BasicProfilerState extends BaseAppState {
         mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
         background.setMaterial(mat);
         background.setLocalTranslation(0, 300, -1);
-        background.setLocalScale(1, scale, 1);        
-        
+        background.setLocalScale(1, scale, 1);
+
         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.addListener(keyListener, INPUT_MAPPING_PROFILER_TOGGLE); 
-        }               
+            inputManager.addListener(keyListener, INPUT_MAPPING_PROFILER_TOGGLE);
+        }
     }
 
     @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);
     }
 
     @Override
     protected void onEnable() {
-    
         // Set the number of visible frames to the current width of the screen
         setFrameCount(getApplication().getCamera().getWidth());
-    
+
         getApplication().setAppProfiler(profiler);
-        Node gui = ((SimpleApplication)getApplication()).getGuiNode();
+        Node gui = ((SimpleApplication) getApplication()).getGuiNode();
         gui.attachChild(graph);
         gui.attachChild(background);
     }
@@ -228,9 +225,8 @@ public class BasicProfilerState extends BaseAppState {
         graph.removeFromParent();
         background.removeFromParent();
     }
-    
-    private class ProfilerKeyListener implements ActionListener {
 
+    private class ProfilerKeyListener implements ActionListener {
         @Override
         public void onAction(String name, boolean value, float tpf) {
             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);
         this.inputManager = app.getInputManager();
         target = new Node("ChaseCamTarget");
-        camNode.setCamera(app.getCamera());        
+        camNode.setCamera(app.getCamera());
         camNode.setControlDir(CameraControl.ControlDirection.SpatialToCamera);
         target.attachChild(camNode);
         camNode.setLocalTranslation(0, 0, distance);
@@ -281,7 +281,7 @@ public class ChaseCameraAppState extends AbstractAppState implements ActionListe
      */
     public void setMaxDistance(float maxDistance) {
         this.maxDistance = maxDistance;
-        if(initialized){
+        if (initialized) {
             zoomCamera(distance);
         }
     }
@@ -297,13 +297,13 @@ public class ChaseCameraAppState extends AbstractAppState implements ActionListe
 
     /**
      * Sets the min zoom distance of the camera (default is 1)
-     * 
+     *
      * @param minDistance the desired minimum distance (in world units,
      * default=1)
      */
     public void setMinDistance(float minDistance) {
         this.minDistance = minDistance;
-        if(initialized){
+        if (initialized) {
             zoomCamera(distance);
         }
     }
@@ -325,7 +325,7 @@ public class ChaseCameraAppState extends AbstractAppState implements ActionListe
      */
     public void setMaxVerticalRotation(float maxVerticalRotation) {
         this.maxVerticalRotation = maxVerticalRotation;
-        if(initialized){
+        if (initialized) {
             rotateCamera();
         }
     }
@@ -347,7 +347,7 @@ public class ChaseCameraAppState extends AbstractAppState implements ActionListe
      */
     public void setMinVerticalRotation(float minHeight) {
         this.minVerticalRotation = minHeight;
-        if(initialized){
+        if (initialized) {
             rotateCamera();
         }
     }
@@ -438,7 +438,7 @@ public class ChaseCameraAppState extends AbstractAppState implements ActionListe
     public void setDragToRotate(boolean dragToRotate) {
         this.dragToRotate = dragToRotate;
         this.canRotate = !dragToRotate;
-        if(inputManager != null){
+        if (inputManager != null) {
             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.input.FlyByCamera;
 
-
 /**
- *  Manages a FlyByCamera.  
+ *  Manages a FlyByCamera.
  *
- *  @author    Paul Speed
+ * @author Paul Speed
  */
 public class FlyCamAppState extends AbstractAppState {
 
@@ -47,15 +46,15 @@ public class FlyCamAppState extends AbstractAppState {
     private FlyByCamera flyCam;
 
     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;
     }
-    
+
     public FlyByCamera getCamera() {
         return flyCam;
     }
@@ -63,34 +62,31 @@ public class FlyCamAppState extends AbstractAppState {
     @Override
     public void initialize(AppStateManager stateManager, Application app) {
         super.initialize(stateManager, app);
-        
+
         this.app = app;
 
         if (app.getInputManager() != null) {
-        
+
             if (flyCam == null) {
                 flyCam = new FlyByCamera(app.getCamera());
             }
-            
-            flyCam.registerWithInput(app.getInputManager());            
-        }               
+
+            flyCam.registerWithInput(app.getInputManager());
+        }
     }
-            
+
     @Override
     public void setEnabled(boolean enabled) {
         super.setEnabled(enabled);
-        
         flyCam.setEnabled(enabled);
     }
-    
+
     @Override
     public void cleanup() {
         super.cleanup();
 
-        if (app.getInputManager() != null) {        
+        if (app.getInputManager() != null) {
             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>.
      */
     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
      */
-    public LegacyApplication( AppState... initialStates ) {
+    public LegacyApplication(AppState... initialStates) {
         initStateManager();
 
         if (initialStates != null) {
@@ -187,20 +187,20 @@ public class LegacyApplication implements Application, SystemListener {
     }
 
     @Deprecated
-    public void setAssetManager(AssetManager assetManager){
+    public void setAssetManager(AssetManager assetManager) {
         if (this.assetManager != null)
             throw new IllegalStateException("Can only set asset manager"
-                                          + " before initialization.");
+                    + " before initialization.");
 
         this.assetManager = assetManager;
     }
 
-    private void initAssetManager(){
+    private void initAssetManager() {
         URL assetCfgUrl = null;
 
-        if (settings != null){
+        if (settings != null) {
             String assetCfg = settings.getString("AssetConfigURL");
-            if (assetCfg != null){
+            if (assetCfg != null) {
                 try {
                     assetCfgUrl = new URL(assetCfg);
                 } catch (MalformedURLException ex) {
@@ -217,7 +217,7 @@ public class LegacyApplication implements Application, SystemListener {
         if (assetCfgUrl == null) {
             assetCfgUrl = JmeSystem.getPlatformAssetConfigURL();
         }
-        if (assetManager == null){
+        if (assetManager == null) {
             assetManager = JmeSystem.newAssetManager(assetCfgUrl);
         }
     }
@@ -233,18 +233,18 @@ public class LegacyApplication implements Application, SystemListener {
      * @param settings The settings to set.
      */
     @Override
-    public void setSettings(AppSettings settings){
+    public void setSettings(AppSettings settings) {
         this.settings = settings;
-        if (context != null && settings.useInput() != inputEnabled){
+        if (context != null && settings.useInput() != inputEnabled) {
             // may need to create or destroy input based
             // on settings change
             inputEnabled = !inputEnabled;
-            if (inputEnabled){
+            if (inputEnabled) {
                 initInput();
-            }else{
+            } else {
                 destroyInput();
             }
-        }else{
+        } else {
             inputEnabled = settings.useInput();
         }
     }
@@ -255,7 +255,7 @@ public class LegacyApplication implements Application, SystemListener {
      * by the current JmeContext implementation.
      */
     @Override
-    public void setTimer(Timer timer){
+    public void setTimer(Timer timer) {
         this.timer = timer;
 
         if (timer != null) {
@@ -268,11 +268,11 @@ public class LegacyApplication implements Application, SystemListener {
     }
 
     @Override
-    public Timer getTimer(){
+    public Timer getTimer() {
         return timer;
     }
 
-    private void initDisplay(){
+    private void initDisplay() {
         // acquire important objects
         // from the context
         settings = context.getSettings();
@@ -285,8 +285,8 @@ public class LegacyApplication implements Application, SystemListener {
         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.initialize();
             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
      * units respectively.
      */
-    private void initCamera(){
+    private void initCamera() {
         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.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
      * AppSettings.
      */
-    private void initInput(){
+    private void initInput() {
         mouseInput = context.getMouseInput();
         if (mouseInput != null)
             mouseInput.initialize();
@@ -343,7 +343,7 @@ public class LegacyApplication implements Application, SystemListener {
         if (touchInput != null)
             touchInput.initialize();
 
-        if (!settings.getBoolean("DisableJoysticks")){
+        if (!settings.getBoolean("DisableJoysticks")) {
             joyInput = context.getJoyInput();
             if (joyInput != null)
                 joyInput.initialize();
@@ -352,7 +352,7 @@ public class LegacyApplication implements Application, SystemListener {
         inputManager = new InputManager(mouseInput, keyInput, joyInput, touchInput);
     }
 
-    private void initStateManager(){
+    private void initStateManager() {
         stateManager = new AppStateManager(this);
 
         // 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.
      */
     @Override
-    public AssetManager getAssetManager(){
+    public AssetManager getAssetManager() {
         return assetManager;
     }
 
@@ -372,7 +372,7 @@ public class LegacyApplication implements Application, SystemListener {
      * @return the {@link InputManager input manager}.
      */
     @Override
-    public InputManager getInputManager(){
+    public InputManager getInputManager() {
         return inputManager;
     }
 
@@ -396,7 +396,7 @@ public class LegacyApplication implements Application, SystemListener {
      * @return The {@link Renderer renderer} for the application
      */
     @Override
-    public Renderer getRenderer(){
+    public Renderer getRenderer() {
         return renderer;
     }
 
@@ -420,7 +420,7 @@ public class LegacyApplication implements Application, SystemListener {
      * @return The {@link JmeContext display context} for the application
      */
     @Override
-    public JmeContext getContext(){
+    public JmeContext getContext() {
         return context;
     }
 
@@ -428,7 +428,7 @@ public class LegacyApplication implements Application, SystemListener {
      * @return The {@link Camera camera} for the application
      */
     @Override
-    public Camera getCamera(){
+    public Camera getCamera() {
         return cam;
     }
 
@@ -438,7 +438,7 @@ public class LegacyApplication implements Application, SystemListener {
      * @see #start(com.jme3.system.JmeContext.Type)
      */
     @Override
-    public void start(){
+    public void start() {
         start(JmeContext.Type.Display, false);
     }
 
@@ -450,7 +450,7 @@ public class LegacyApplication implements Application, SystemListener {
      * @see #start(com.jme3.system.JmeContext.Type)
      */
     @Override
-    public void start(boolean waitFor){
+    public void start(boolean 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,
      * 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!");
             return;
         }
 
-        if (settings == null){
+        if (settings == null) {
             settings = new AppSettings(true);
         }
 
@@ -494,7 +494,7 @@ public class LegacyApplication implements Application, SystemListener {
      * Sets an AppProfiler hook that will be called back for
      * specific steps within a single update frame.  Value defaults
      * to null.
-     * 
+     *
      * @param prof the profiler to use (alias created) or null for none
      */
     @Override
@@ -527,13 +527,13 @@ public class LegacyApplication implements Application, SystemListener {
      *
      * @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!");
             return;
         }
 
-        if (settings == null){
+        if (settings == null) {
             settings = new AppSettings(true);
         }
 
@@ -551,7 +551,7 @@ public class LegacyApplication implements Application, SystemListener {
      *
      * @see #startCanvas(boolean)
      */
-    public void startCanvas(){
+    public void startCanvas() {
         startCanvas(false);
     }
 
@@ -564,7 +564,7 @@ public class LegacyApplication implements Application, SystemListener {
      * @param waitFor If true, the current thread will block until the
      * rendering thread is running
      */
-    public void startCanvas(boolean waitFor){
+    public void startCanvas(boolean waitFor) {
         context.create(waitFor);
     }
 
@@ -572,7 +572,7 @@ public class LegacyApplication implements Application, SystemListener {
      * Internal use only.
      */
     @Override
-    public void reshape(int w, int h){
+    public void reshape(int w, int h) {
         if (renderManager != null) {
             renderManager.notifyReshape(w, h);
         }
@@ -586,7 +586,7 @@ public class LegacyApplication implements Application, SystemListener {
      * to restart, applying the new settings.
      */
     @Override
-    public void restart(){
+    public void restart() {
         context.setSettings(settings);
         context.restart();
     }
@@ -600,7 +600,7 @@ public class LegacyApplication implements Application, SystemListener {
      * @see #stop(boolean)
      */
     @Override
-    public void stop(){
+    public void stop() {
         stop(false);
     }
 
@@ -613,7 +613,7 @@ public class LegacyApplication implements Application, SystemListener {
      * true&rarr;don't wait
      */
     @Override
-    public void stop(boolean waitFor){
+    public void stop(boolean waitFor) {
         logger.log(Level.FINE, "Closing application: {0}", getClass().getName());
         context.destroy(waitFor);
     }
@@ -629,15 +629,15 @@ public class LegacyApplication implements Application, SystemListener {
      * and far values 1 and 1000 units respectively.
      */
     @Override
-    public void initialize(){
-        if (assetManager == null){
+    public void initialize() {
+        if (assetManager == null) {
             initAssetManager();
         }
 
         initDisplay();
         initCamera();
 
-        if (inputEnabled){
+        if (inputEnabled) {
             initInput();
         }
         initAudio();
@@ -653,14 +653,14 @@ public class LegacyApplication implements Application, SystemListener {
      * Internal use only.
      */
     @Override
-    public void handleError(String errMsg, Throwable t){
+    public void handleError(String errMsg, Throwable t) {
         // Print error to log.
         logger.log(Level.SEVERE, errMsg, t);
         // Display error message on screen if not in headless mode
         if (context.getType() != JmeContext.Type.Headless) {
             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 {
                 JmeSystem.showErrorDialog(errMsg);
             }
@@ -673,7 +673,7 @@ public class LegacyApplication implements Application, SystemListener {
      * Internal use only.
      */
     @Override
-    public void gainFocus(){
+    public void gainFocus() {
         if (lostFocusBehavior != LostFocusBehavior.Disabled) {
             if (lostFocusBehavior == LostFocusBehavior.PauseOnLostFocus) {
                 paused = false;
@@ -689,8 +689,8 @@ public class LegacyApplication implements Application, SystemListener {
      * Internal use only.
      */
     @Override
-    public void loseFocus(){
-        if (lostFocusBehavior != LostFocusBehavior.Disabled){
+    public void loseFocus() {
+        if (lostFocusBehavior != LostFocusBehavior.Disabled) {
             if (lostFocusBehavior == LostFocusBehavior.PauseOnLostFocus) {
                 paused = true;
             }
@@ -702,7 +702,7 @@ public class LegacyApplication implements Application, SystemListener {
      * Internal use only.
      */
     @Override
-    public void requestClose(boolean esc){
+    public void requestClose(boolean esc) {
         context.destroy(false);
     }
 
@@ -737,7 +737,7 @@ public class LegacyApplication implements Application, SystemListener {
      */
     @Override
     @SuppressWarnings("unchecked")
-    public void enqueue(Runnable runnable){
+    public void enqueue(Runnable runnable) {
         enqueue(new RunnableWrapper(runnable));
     }
 
@@ -746,7 +746,7 @@ public class LegacyApplication implements Application, SystemListener {
      */
     protected void runQueuedTasks() {
         AppTask<?> task;
-        while( (task = taskQueue.poll()) != null ) {
+        while ((task = taskQueue.poll()) != null) {
             if (!task.isCancelled()) {
                 task.invoke();
             }
@@ -758,11 +758,12 @@ public class LegacyApplication implements Application, SystemListener {
      * Callback from ContextListener.
      */
     @Override
-    public void update(){
+    public void update() {
         // Make sure the audio renderer is available to callables
         AudioContext.setAudioRenderer(audioRenderer);
 
-        if (prof!=null) prof.appStep(AppStep.QueuedTasks);
+        if (prof != null)
+            prof.appStep(AppStep.QueuedTasks);
         runQueuedTasks();
 
         if (speed == 0 || paused)
@@ -770,20 +771,22 @@ public class LegacyApplication implements Application, SystemListener {
 
         timer.update();
 
-        if (inputEnabled){
-            if (prof!=null) prof.appStep(AppStep.ProcessInput);
+        if (inputEnabled) {
+            if (prof != null)
+                prof.appStep(AppStep.ProcessInput);
             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());
         }
 
         // user code here
     }
 
-    protected void destroyInput(){
+    protected void destroyInput() {
         if (mouseInput != null)
             mouseInput.destroy();
 
@@ -804,7 +807,7 @@ public class LegacyApplication implements Application, SystemListener {
      * Callback from ContextListener.
      */
     @Override
-    public void destroy(){
+    public void destroy() {
         stateManager.cleanup();
 
         destroyInput();
@@ -828,19 +831,17 @@ public class LegacyApplication implements Application, SystemListener {
         return viewPort;
     }
 
-    private class RunnableWrapper implements Callable{
+    private class RunnableWrapper implements Callable {
         private final Runnable runnable;
 
-        public RunnableWrapper(Runnable runnable){
+        public RunnableWrapper(Runnable runnable) {
             this.runnable = runnable;
         }
 
         @Override
-        public Object call(){
+        public Object call() {
             runnable.run();
             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>
  *
  * 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 {
 
@@ -88,7 +88,7 @@ public abstract class SimpleApplication extends LegacyApplication {
 
             if (name.equals(INPUT_MAPPING_EXIT)) {
                 stop();
-            }else if (name.equals(INPUT_MAPPING_HIDE_STATS)){
+            } else if (name.equals(INPUT_MAPPING_HIDE_STATS)) {
                 if (stateManager.getState(StatsAppState.class) != null) {
                     stateManager.getState(StatsAppState.class).toggleStats();
                 }
@@ -98,10 +98,10 @@ public abstract class SimpleApplication extends LegacyApplication {
 
     public SimpleApplication() {
         this(new StatsAppState(), new FlyCamAppState(), new AudioListenerState(), new DebugKeysAppState(),
-             new ConstantVerifierState());
+                new ConstantVerifierState());
     }
 
-    public SimpleApplication( AppState... initialStates ) {
+    public SimpleApplication(AppState... initialStates) {
         super(initialStates);
     }
 
@@ -125,7 +125,7 @@ public abstract class SimpleApplication extends LegacyApplication {
         setSettings(settings);
         super.start();
     }
-        
+
     /**
      * Returns the applications speed.
      *
@@ -134,7 +134,7 @@ public abstract class SimpleApplication extends LegacyApplication {
     public float getSpeed() {
         return speed;
     }
-    
+
     /**
      * Changes the application speed. 0.0f prevents the application from updating.
      * @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
      *  and subsequently set as the font for the stats text.
-     * 
+     *
      * @return the loaded BitmapFont
      */
     protected BitmapFont loadGuiFont() {
@@ -214,7 +214,7 @@ public abstract class SimpleApplication extends LegacyApplication {
             if (stateManager.getState(FlyCamAppState.class) != null) {
                 flyCam = new FlyByCamera(cam);
                 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) {
@@ -242,7 +242,8 @@ public abstract class SimpleApplication extends LegacyApplication {
 
     @Override
     public void update() {
-        if (prof!=null) prof.appStep(AppStep.BeginFrame);
+        if (prof != null)
+            prof.appStep(AppStep.BeginFrame);
 
         super.update(); // makes sure to execute AppTasks
         if (speed == 0 || paused) {
@@ -252,13 +253,15 @@ public abstract class SimpleApplication extends LegacyApplication {
         float tpf = timer.getTimePerFrame() * speed;
 
         // update states
-        if (prof!=null) prof.appStep(AppStep.StateManagerUpdate);
+        if (prof != null)
+            prof.appStep(AppStep.StateManagerUpdate);
         stateManager.update(tpf);
 
         // simple update and root node
         simpleUpdate(tpf);
 
-        if (prof!=null) prof.appStep(AppStep.SpatialUpdate);
+        if (prof != null)
+            prof.appStep(AppStep.SpatialUpdate);
         rootNode.updateLogicalState(tpf);
         guiNode.updateLogicalState(tpf);
 
@@ -266,15 +269,18 @@ public abstract class SimpleApplication extends LegacyApplication {
         guiNode.updateGeometricState();
 
         // render states
-        if (prof!=null) prof.appStep(AppStep.StateManagerRender);
+        if (prof != null)
+            prof.appStep(AppStep.StateManagerRender);
         stateManager.render(renderManager);
 
-        if (prof!=null) prof.appStep(AppStep.RenderFrame);
+        if (prof != null)
+            prof.appStep(AppStep.RenderFrame);
         renderManager.render(tpf, context.isRenderable());
         simpleRender(renderManager);
         stateManager.postRender();
 
-        if (prof!=null) prof.appStep(AppStep.EndFrame);
+        if (prof != null)
+            prof.appStep(AppStep.EndFrame);
     }
 
     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.shape.Quad;
 
-
 /**
  *  Displays stats in SimpleApplication's GUI node or
  *  using the node and font parameters provided.
  *
- *  @author    Paul Speed
+ * @author Paul Speed
  */
 public class StatsAppState extends AbstractAppState {
 
@@ -70,7 +69,7 @@ public class StatsAppState extends AbstractAppState {
     public StatsAppState() {
     }
 
-    public StatsAppState( Node guiNode, BitmapFont guiFont ) {
+    public StatsAppState(Node guiNode, BitmapFont guiFont) {
         this.guiNode = guiNode;
         this.guiFont = guiFont;
     }
@@ -80,10 +79,10 @@ public class StatsAppState extends AbstractAppState {
      *  so that the fpsText can be created before init.  This
      *  is because several applications expect to directly access
      *  fpsText... unfortunately.
-     * 
+     *
      * @param guiFont the desired font (not null, alias created)
      */
-    public void setFont( BitmapFont guiFont ) {
+    public void setFont(BitmapFont guiFont) {
         this.guiFont = guiFont;
         this.fpsText = new BitmapText(guiFont);
     }
@@ -101,8 +100,8 @@ public class StatsAppState extends AbstractAppState {
     }
 
     public void toggleStats() {
-        setDisplayFps( !showFps );
-        setDisplayStatView( !showStats );
+        setDisplayFps(!showFps);
+        setDisplayStatView(!showStats);
     }
 
     public void setDisplayFps(boolean show) {
@@ -118,7 +117,7 @@ public class StatsAppState extends AbstractAppState {
 
     public void setDisplayStatView(boolean show) {
         showStats = show;
-        if (statsView != null ) {
+        if (statsView != null) {
             statsView.setEnabled(show);
             statsView.setCullHint(show ? CullHint.Never : CullHint.Always);
             if (darkenStats != null) {
@@ -142,17 +141,17 @@ public class StatsAppState extends AbstractAppState {
         this.app = app;
 
         if (app instanceof SimpleApplication) {
-            SimpleApplication simpleApp = (SimpleApplication)app;
+            SimpleApplication simpleApp = (SimpleApplication) app;
             if (guiNode == null) {
                 guiNode = simpleApp.guiNode;
             }
-            if (guiFont == null ) {
+            if (guiFont == null) {
                 guiFont = simpleApp.guiFont;
             }
         }
 
         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) {
@@ -187,8 +186,8 @@ public class StatsAppState extends AbstractAppState {
      */
     public void loadStatsView() {
         statsView = new StatsView("Statistics View",
-                                  app.getAssetManager(),
-                                  app.getRenderer().getStatistics());
+                app.getAssetManager(),
+                app.getRenderer().getStatistics());
         // move it up so it appears above fps text
         statsView.setLocalTranslation(0, fpsText.getLineHeight(), 0);
         statsView.setEnabled(showStats);
@@ -198,7 +197,7 @@ public class StatsAppState extends AbstractAppState {
 
     public void loadDarken() {
         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);
 
         darkenFps = new Geometry("StatsDarken", new Quad(200, fpsText.getLineHeight()));
@@ -237,7 +236,7 @@ public class StatsAppState extends AbstractAppState {
     public void update(float tpf) {
         if (showFps) {
             secondCounter += app.getTimer().getTimePerFrame();
-            frameCounter ++;
+            frameCounter++;
             if (secondCounter >= 1.0f) {
                 int fps = (int) (frameCounter / secondCounter);
                 fpsText.setText("Frames per second: " + fps);
@@ -256,6 +255,4 @@ public class StatsAppState extends AbstractAppState {
         guiNode.detachChild(darkenFps);
         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>
  */
 public class StatsView extends Node implements Control, JmeCloneable {
-
     final private BitmapText statText;
     final private Statistics statistics;
 
@@ -71,7 +70,7 @@ public class StatsView extends Node implements Control, JmeCloneable {
 
     private final StringBuilder stringBuilder = new StringBuilder();
 
-    public StatsView(String name, AssetManager manager, Statistics stats){
+    public StatsView(String name, AssetManager manager, Statistics stats) {
         super(name);
 
         setQueueBucket(Bucket.Gui);
@@ -97,7 +96,6 @@ public class StatsView extends Node implements Control, JmeCloneable {
 
     @Override
     public void update(float tpf) {
-
         if (!isEnabled())
             return;
 
@@ -122,14 +120,14 @@ public class StatsView extends Node implements Control, JmeCloneable {
     public Control cloneForSpatial(Spatial spatial) {
         throw new UnsupportedOperationException();
     }
-    
+
     @Override
     public StatsView jmeClone() {
         throw new UnsupportedOperationException("Not yet implemented.");
     }
 
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         throw new UnsupportedOperationException("Not yet implemented.");
     }
 
@@ -149,5 +147,4 @@ public class StatsView extends Node implements Control, JmeCloneable {
     @Override
     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;
     private boolean enabled = true;
     private String id;
-    
-    protected AbstractAppState() {    
+
+    protected AbstractAppState() {
     }
-    
-    protected AbstractAppState( String id ) {
+
+    protected AbstractAppState(String id) {
         this.id = id;
     }
 
@@ -76,7 +76,7 @@ public abstract class AbstractAppState implements AppState {
      *
      * @param id the desired ID
      */
-    protected void setId( String id ) {
+    protected void setId(String id) {
         this.id = id;
     }
 
@@ -89,7 +89,7 @@ public abstract class AbstractAppState implements AppState {
     public void setEnabled(boolean enabled) {
         this.enabled = enabled;
     }
-    
+
     @Override
     public boolean isEnabled() {
         return enabled;
@@ -112,12 +112,11 @@ public abstract class AbstractAppState implements AppState {
     }
 
     @Override
-    public void postRender(){
+    public void postRender() {
     }
 
     @Override
     public void cleanup() {
         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.
  */
 package com.jme3.app.state;
- 
+
 import com.jme3.app.Application;
 import com.jme3.renderer.RenderManager;
 import com.jme3.util.SafeArrayList;
@@ -58,29 +58,28 @@ import java.util.concurrent.ConcurrentHashMap;
  *                       render thread and it is not necessarily safe to modify
  *                       the scene graph, etc..
  * <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
  */
 public class AppStateManager {
-
     /**
      *  List holding the attached app states that are pending
      *  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);
-    
+
     /**
-     *  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);
-    
+
     /**
      *  List holding the detached app states that are pending
-     *  cleanup.  
+     *  cleanup.
      */
     private final SafeArrayList<AppState> terminating = new SafeArrayList<>(AppState.class);
 
@@ -89,20 +88,20 @@ public class AppStateManager {
      *  an ID.
      */
     private final ConcurrentMap<String, AppState> stateIndex = new ConcurrentHashMap<>();
- 
+
     // All of the above lists need to be thread-safe, but access will be
     // synchronized separately.... but always on the states list.  This
     // is to avoid deadlocking. Anyway, the most common use case
     // is that they are all modified from the same thread.
-    
+
     private final Application app;
 
-    public AppStateManager(Application app){
+    public AppStateManager(Application 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
      */
@@ -110,41 +109,41 @@ public class AppStateManager {
         return app;
     }
 
-    protected AppState[] getInitializing() { 
-        synchronized (states){
+    protected AppState[] getInitializing() {
+        synchronized (states) {
             return initializing.getArray();
         }
-    } 
+    }
 
-    protected AppState[] getTerminating() { 
-        synchronized (states){
+    protected AppState[] getTerminating() {
+        synchronized (states) {
             return terminating.getArray();
         }
-    } 
+    }
 
-    protected AppState[] getStates(){
-        synchronized (states){
+    protected AppState[] getStates() {
+        synchronized (states) {
             return states.getArray();
         }
     }
 
     /**
      * 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
      * @return True if the state was successfully attached, false if the state
      * 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()));
             }
-            if (!states.contains(state) && !initializing.contains(state)){
+            if (!states.contains(state) && !initializing.contains(state)) {
                 state.stateAttached(this);
                 initializing.add(state);
                 return true;
@@ -161,7 +160,7 @@ public class AppStateManager {
      *
      * @param states The states to attach
      */
-    public void attachAll(AppState... states){
+    public void attachAll(AppState... states) {
         attachAll(Arrays.asList(states));
     }
 
@@ -172,39 +171,39 @@ public class AppStateManager {
      *
      * @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);
             }
         }
     }
 
     /**
-     * Detaches the state from the AppStateManager. 
+     * Detaches the state from the AppStateManager.
      *
      * @param state The state to detach
      * @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.
             // Note: we remove it directly from the values() in case
             // the state has changed its ID since registered.
             stateIndex.values().remove(state);
-        
-            if (states.contains(state)){
+
+            if (states.contains(state)) {
                 state.stateDetached(this);
                 states.remove(state);
                 terminating.add(state);
                 return true;
-            } else if(initializing.contains(state)){
+            } else if (initializing.contains(state)) {
                 state.stateDetached(this);
                 initializing.remove(state);
                 return true;
-            }else{
+            } else {
                 return false;
             }
         }
@@ -215,11 +214,11 @@ public class AppStateManager {
      *
      * @param state The state to check
      * @return True if the state is currently attached to this AppStateManager.
-     * 
+     *
      * @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);
         }
     }
@@ -231,140 +230,140 @@ public class AppStateManager {
      * @param stateClass the desired type of AppState
      * @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);
     }
-    
+
     /**
      * Returns the first state that is an instance of subclass of the specified class.
      *
      * @param <T> the desired type of AppState
      * @param stateClass the desired type of AppState
      * @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")
-    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();
             for (AppState state : array) {
-                if (stateClass.isAssignableFrom(state.getClass())){
+                if (stateClass.isAssignableFrom(state.getClass())) {
                     return (T) state;
                 }
             }
-            
+
             // This may be more trouble than it's worth, but I think
             // it's necessary for proper decoupling of states and provides
             // similar behavior to before where a state could be looked
             // up even if it wasn't initialized. -pspeed
             array = getInitializing();
             for (AppState state : array) {
-                if (stateClass.isAssignableFrom(state.getClass())){
+                if (stateClass.isAssignableFrom(state.getClass())) {
                     return (T) state;
                 }
             }
         }
-        
-        if(failOnMiss) {
+
+        if (failOnMiss) {
             throw new IllegalArgumentException("State not found for:" + stateClass);
-        }    
+        }
         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 id the AppState ID
      * @param stateClass the desired type of AppState
      * @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));
     }
-    
+
     /**
-     *  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
      * @return true if found, otherwise false
      */
-    public boolean hasState( String id ) {
+    public boolean hasState(String id) {
         return stateIndex.containsKey(id);
     }
- 
+
     /**
      *  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.
      *
      * @param <T> the desired type of AppState
      * @param id the AppState ID
      * @param stateClass the desired type of AppState
      * @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);
-        if( result == null ) {
+        if (result == null) {
             throw new IllegalArgumentException("State not found for:" + id);
         }
         return stateClass.cast(result);
-    } 
+    }
 
-    protected void initializePending(){
+    protected void initializePending() {
         AppState[] array = getInitializing();
         if (array.length == 0)
             return;
-            
-        synchronized( states ) {
+
+        synchronized (states) {
             // Move the states that will be initialized
             // into the active array.  In all but one case the
             // order doesn't matter but if we do this here then
             // a state can detach itself in initialize().  If we
             // did it after then it couldn't.
-            List<AppState> transfer = Arrays.asList(array);         
+            List<AppState> transfer = Arrays.asList(array);
             states.addAll(transfer);
             initializing.removeAll(transfer);
-        }        
+        }
         for (AppState state : array) {
             state.initialize(this, app);
         }
     }
-    
-    protected void terminatePending(){
+
+    protected void terminatePending() {
         AppState[] array = getTerminating();
         if (array.length == 0)
             return;
-            
+
         for (AppState state : array) {
             state.cleanup();
-        }        
-        synchronized( states ) {
+        }
+        synchronized (states) {
             // Remove just the states that were terminated...
             // which might now be a subset of the total terminating
             // list.
-            terminating.removeAll(Arrays.asList(array));         
+            terminating.removeAll(Arrays.asList(array));
         }
-    }    
+    }
 
     /**
      * Calls update for attached states, do not call directly.
      * @param tpf Time per frame.
      */
-    public void update(float tpf){
-    
+    public void update(float tpf) {
+
         // Cleanup any states pending
         terminatePending();
 
         // Initialize any states pending
         initializePending();
 
-        // Update enabled states    
+        // Update enabled states
         AppState[] array = getStates();
-        for (AppState state : array){
+        for (AppState state : array) {
             if (state.isEnabled()) {
                 if (app.getAppProfiler() != null) {
                     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.
      * @param rm The RenderManager
      */
-    public void render(RenderManager rm){
+    public void render(RenderManager rm) {
         AppState[] array = getStates();
-        for (AppState state : array){
+        for (AppState state : array) {
             if (state.isEnabled()) {
                 if (app.getAppProfiler() != null) {
                     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.
      */
-    public void postRender(){
+    public void postRender() {
         AppState[] array = getStates();
-        for (AppState state : array){
+        for (AppState state : array) {
             if (state.isEnabled()) {
                 if (app.getAppProfiler() != null) {
                     app.getAppProfiler().appSubStep(state.getClass().getSimpleName());
@@ -408,10 +407,10 @@ public class AppStateManager {
     /**
      * Calls cleanup on attached states, do not call directly.
      */
-    public void cleanup(){
+    public void cleanup() {
         AppState[] array = getStates();
-        for (AppState state : array){
+        for (AppState state : array) {
             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
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
- 
+
 package com.jme3.app.state;
 
 import com.jme3.app.Application;
@@ -37,8 +37,6 @@ import com.jme3.renderer.RenderManager;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-
-
 /**
  *  A base app state implementation the provides more built-in
  *  management convenience than AbstractAppState, including methods
@@ -46,9 +44,9 @@ import java.util.logging.Logger;
  *  The abstract onEnable() and onDisable() methods are called
  *  appropriately during initialize(), cleanup(), or setEnabled()
  *  depending on the mutual state of "initialized" and "enabled".
- *  
+ *
  *  <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
  *  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().
  *  onEnable()/onDisable() are also called appropriate when setEnabled()
  *  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>
  *
  *  <p>It is technically safe to do all initialization and cleanup in
@@ -72,7 +70,6 @@ import java.util.logging.Logger;
  *  @author    Paul Speed
  */
 public abstract class BaseAppState implements AppState {
-
     private static final Logger log = Logger.getLogger(BaseAppState.class.getName());
 
     private Application app;
@@ -82,8 +79,8 @@ public abstract class BaseAppState implements AppState {
 
     protected BaseAppState() {
     }
-    
-    protected BaseAppState( String id ) {
+
+    protected BaseAppState(String id) {
         this.id = id;
     }
 
@@ -92,8 +89,8 @@ public abstract class BaseAppState implements AppState {
      *  attached and before onEnable() is called.
      * @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
      *  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.
      * @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
      *  and isEnabled() is true or when the setEnabled() status
      *  changes after the state is attached.
      */
     protected abstract void onEnable();
-    
+
     /**
      *  Called when the state was previously enabled but is
      *  now disabled either because setEnabled(false) was called
@@ -118,19 +115,19 @@ public abstract class BaseAppState implements AppState {
     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.
      *  This implementation calls initialize(app) and then onEnable() if the
      *  state is enabled.
      */
     @Override
-    public final void initialize( AppStateManager stateManager, Application app ) {
+    public final void initialize(AppStateManager stateManager, Application app) {
         log.log(Level.FINEST, "initialize():{0}", this);
 
         this.app = app;
         initialized = true;
         initialize(app);
-        if( isEnabled() ) {
+        if (isEnabled()) {
             log.log(Level.FINEST, "onEnable():{0}", this);
             onEnable();
         }
@@ -148,7 +145,7 @@ public abstract class BaseAppState implements AppState {
      *
      * @param id the desired ID
      */
-    protected void setId( String id ) {
+    protected void setId(String id) {
         this.id = id;
     }
 
@@ -165,34 +162,33 @@ public abstract class BaseAppState implements AppState {
         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);
     }
-    
-    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().getState(id, type);
     }
 
     @Override
-    public final void setEnabled( boolean enabled )
-    {
-        if( this.enabled == enabled )
+    public final void setEnabled(boolean enabled) {
+        if (this.enabled == enabled)
             return;
         this.enabled = enabled;
-        if( !isInitialized() )
+        if (!isInitialized())
             return;
-        if( enabled ) {
+        if (enabled) {
             log.log(Level.FINEST, "onEnable():{0}", this);
             onEnable();
         } else {
@@ -207,19 +203,19 @@ public abstract class BaseAppState implements AppState {
     }
 
     @Override
-    public void stateAttached( AppStateManager stateManager ) {
+    public void stateAttached(AppStateManager stateManager) {
     }
 
     @Override
-    public void stateDetached( AppStateManager stateManager ) {
+    public void stateDetached(AppStateManager stateManager) {
     }
 
     @Override
-    public void update( float tpf ) {
+    public void update(float tpf) {
     }
 
     @Override
-    public void render( RenderManager rm ) {
+    public void render(RenderManager rm) {
     }
 
     @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.
      *  This implementation calls onDisable() if the state is enabled and
      *  then cleanup(app).
@@ -236,7 +232,7 @@ public abstract class BaseAppState implements AppState {
     public final void cleanup() {
         log.log(Level.FINEST, "cleanup():{0}", this);
 
-        if( isEnabled() ) {
+        if (isEnabled()) {
             log.log(Level.FINEST, "onDisable():{0}", this);
             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
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
- 
+
 package com.jme3.app.state;
 
 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_Z, new Vector3f(0, 0, 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.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(Vector2f.ZERO, new Vector2f(0f, 0f)),
             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_W, new Vector4f(0, 0, 0, 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.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)),
@@ -96,112 +101,113 @@ public class ConstantVerifierState extends BaseAppState {
      *  constant checks using asserts.
      */
     public ConstantVerifierState() {
-        this(ErrorType.Assert);        
+        this(ErrorType.Assert);
     }
-    
+
     /**
      *  Creates a verifier app state that will check all of the default
      *  constant checks using the specified error reporting mechanism.
-     * 
+     *
      * @param errorType the mechanism to use
      */
-    public ConstantVerifierState( ErrorType errorType ) {
+    public ConstantVerifierState(ErrorType errorType) {
         this(errorType, DEFAULT_CHECKS);
     }
 
     /**
      *  Creates a verifier app state that will check all of the specified
      *  checks and report errors using the specified error type.
-     * 
+     *
      * @param errorType the mechanism to use
      * @param checkers which checks to perform
      */
-    private ConstantVerifierState( ErrorType errorType, Checker... checkers ) {
+    private ConstantVerifierState(ErrorType errorType, Checker... checkers) {
         this.errorType = errorType;
         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));
     }
-    
-    public void setErrorType( ErrorType errorType ) {
+
+    public void setErrorType(ErrorType errorType) {
         this.errorType = errorType;
     }
-    
+
     public ErrorType getErrorType() {
         return errorType;
     }
-    
+
     @Override
-    protected void initialize( Application app ) {
+    protected void initialize(Application app) {
     }
-    
+
     @Override
-    protected void cleanup( Application app ) {
+    protected void cleanup(Application app) {
     }
-    
+
     @Override
     protected void onEnable() {
     }
-    
+
     @Override
     protected void onDisable() {
     }
-    
+
     @Override
     public void postRender() {
         // Check as late in the frame as possible.  Subclasses can check earlier
         // if they like.
         checkValues();
     }
-    
+
     protected void checkValues() {
-        for( Checker checker : checkers.getArray() ) {
-            switch( errorType ) {
+        for (Checker checker : checkers.getArray()) {
+            switch (errorType) {
                 default:
                 case Assert:
                     assert checker.isValid() : checker.toString();
                     break;
                 case Exception:
-                    if( !checker.isValid() ) {
+                    if (!checker.isValid()) {
                         throw new RuntimeException("Constant has changed, " + checker.toString());
                     }
                     break;
                 case Log:
-                    if( !checker.isValid() ) {
+                    if (!checker.isValid()) {
                         log.severe("Constant has changed, " + checker.toString());
                     }
                     break;
             }
         }
     }
- 
+
     /**
      *  Checks the specified 'constant' value against its known good
      *  value.  These should obviously be different instances for this to
      *  mean anything.
-     */   
+     */
     private static class Checker {
         private Object constant;
         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");
             }
-            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.goodValue = goodValue;
         }
-          
+
         public boolean isValid() {
             return constant.equals(goodValue);
         }
- 
-        @Override       
+
+        @Override
         public String toString() {
             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 rootNode An existing root Node
      */
-    public RootNodeAppState( String id, ViewPort viewPort, Node rootNode ) {
+    public RootNodeAppState(String id, ViewPort viewPort, Node rootNode) {
         super(id);
         this.viewPort = viewPort;
         this.rootNode = rootNode;
@@ -115,12 +115,12 @@ public class RootNodeAppState extends AbstractAppState {
     public void update(float tpf) {
         super.update(tpf);
         rootNode.updateLogicalState(tpf);
-        
+
         // FIXME: I'm 99% sure that updateGeometricState() should be
         // 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();
     }
 

+ 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.
      * @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
-     *                  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) {
         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 fileName The name of the file to save the screenshot as.
      * @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) {
         this.filePath = filePath;
         this.shotName = fileName;
         this.shotIndex = shotIndex;
     }
-    
+
     /**
      * Set the file path to store the screenshot.
      * 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.
      * @param numberedWanted If numbering is wanted.
      */
@@ -234,7 +234,7 @@ public class ScreenshotAppState extends AbstractAppState implements ActionListen
 
     @Override
     public void onAction(String name, boolean value, float tpf) {
-        if (value){
+        if (value) {
             capture = true;
         }
     }
@@ -274,7 +274,7 @@ public class ScreenshotAppState extends AbstractAppState implements ActionListen
 
     @Override
     public void postFrame(FrameBuffer out) {
-        if (capture){
+        if (capture) {
             capture = false;
 
             Camera curCamera = rm.getCurrentCamera();
@@ -310,7 +310,7 @@ public class ScreenshotAppState extends AbstractAppState implements ActionListen
                 writeImageFile(file);
             } catch (IOException 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
      * @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);
         try {
             JmeSystem.writeImageFile(outStream, "png", outBuf, width, height);
         } finally {
             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 {
 
     private static final Logger logger = Logger.getLogger(AssetConfig.class.getName());
-    
+
     private AssetConfig() { }
-    
+
     private static Class acquireClass(String name) {
         try {
             return Class.forName(name);
@@ -64,24 +64,24 @@ public final class AssetConfig {
             return null;
         }
     }
-    
+
     @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();
         try {
             Scanner scan = new Scanner(in, "UTF-8");
             scan.useLocale(Locale.US); // Fix commas / periods ??
-            while (scan.hasNext()){
+            while (scan.hasNext()) {
                 String cmd = scan.next();
-                if (cmd.equals("LOADER")){
+                if (cmd.equals("LOADER")) {
                     String loaderClass = 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[] extensions = extensionsList.split(",");
-                    for (int i = 0; i < extensions.length; i++){
+                    for (int i = 0; i < extensions.length; i++) {
                         extensions[i] = extensions[i].trim();
                     }
                     Class clazz = acquireClass(loaderClass);
@@ -115,7 +115,8 @@ public final class AssetConfig {
                 }
             }
         } 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
-    public String toString(){
+    public String toString() {
         return getClass().getName() + "[" + "key=" + key + "]";
     }
 
@@ -68,9 +68,8 @@ public abstract class AssetInfo {
      * <p>
      * Each invocation of this method should return a new stream to the
      * asset data, starting at the beginning of the file.
-     * 
+     *
      * @return The asset data.
      */
     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
- * look up a resource from a cache. 
+ * look up a resource from a cache.
  * This class should be immutable.
  */
 public class AssetKey<T> implements Savable, Cloneable {
@@ -49,13 +49,13 @@ public class AssetKey<T> implements Savable, Cloneable {
     protected String name;
     protected transient String folder;
     protected transient String extension;
-    
-    public AssetKey(String name){
+
+    public AssetKey(String name) {
         this.name = reducePath(name);
         this.extension = getExtension(this.name);
     }
 
-    public AssetKey(){
+    public AssetKey() {
     }
 
     @Override
@@ -67,7 +67,7 @@ public class AssetKey<T> implements Savable, Cloneable {
             throw new AssertionError();
         }
     }
-    
+
     protected static String getExtension(String name) {
         int idx = name.lastIndexOf('.');
         //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.
-     * 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.
      */
-    public String getFolder(){
+    public String getFolder() {
         if (folder == null)
             folder = getFolder(name);
-        
+
         return folder;
     }
 
@@ -125,18 +125,18 @@ public class AssetKey<T> implements Savable, Cloneable {
      * if caching is to be disabled. By default, the
      * {@link SimpleAssetCache} is returned.
      */
-    public Class<? extends AssetCache> getCacheType(){
+    public Class<? extends AssetCache> getCacheType() {
         return SimpleAssetCache.class;
     }
-    
+
     /**
      * @return The preferred processor type for this asset type. Specify "null"
      * if no processing is required.
      */
-    public Class<? extends AssetProcessor> getProcessorType(){
+    public Class<? extends AssetProcessor> getProcessorType() {
         return null;
     }
-    
+
     /**
      * Removes all relative elements of a path (A/B/../C.png and A/./C.png).
      * @param path The path containing relative elements
@@ -157,7 +157,8 @@ public class AssetKey<T> implements Savable, Cloneable {
                     list.removeLast();
                 } else {
                     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 {
                 list.add(string);
@@ -173,22 +174,22 @@ public class AssetKey<T> implements Savable, Cloneable {
         }
         return builder.toString();
     }
-    
+
     @Override
-    public boolean equals(Object other){
-        if (!(other instanceof AssetKey)){
+    public boolean equals(Object other) {
+        if (!(other instanceof AssetKey)) {
             return false;
         }
-        return name.equals(((AssetKey)other).name);
+        return name.equals(((AssetKey) other).name);
     }
 
     @Override
-    public int hashCode(){
+    public int hashCode() {
         return name.hashCode();
     }
 
     @Override
-    public String toString(){
+    public String toString() {
         return name;
     }
 
@@ -204,5 +205,4 @@ public class AssetKey<T> implements Savable, Cloneable {
         name = reducePath(ic.readString("name", null));
         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
  */
 public class AssetLoadException extends RuntimeException {
-    public AssetLoadException(String message){
+    public AssetLoadException(String message) {
         super(message);
     }
-    public AssetLoadException(String message, Throwable cause){
+
+    public AssetLoadException(String message, Throwable 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
  */
 public class AssetNotFoundException extends RuntimeException {
-    public AssetNotFoundException(String message){
+    public AssetNotFoundException(String message) {
         super(message);
     }
-    public AssetNotFoundException(String message, Exception ex){
+
+    public AssetNotFoundException(String message, Exception 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 ShaderGenerator shaderGenerator;
-    
+
     private final ImplHandler handler = new ImplHandler(this);
 
-    final private CopyOnWriteArrayList<AssetEventListener> eventListeners = 
+    final private CopyOnWriteArrayList<AssetEventListener> eventListeners =
             new CopyOnWriteArrayList<>();
-    
+
     final private List<ClassLoader> classLoaders =
             Collections.synchronizedList(new ArrayList<>());
 
-    public DesktopAssetManager(){
+    public DesktopAssetManager() {
         this(null);
     }
-    
-    public DesktopAssetManager(boolean usePlatformConfig){
+
+    public DesktopAssetManager(boolean usePlatformConfig) {
         this(usePlatformConfig ? JmeSystem.getPlatformAssetConfigURL() : null);
     }
 
-    public DesktopAssetManager(URL configFile){
-        if (configFile != null){
+    public DesktopAssetManager(URL configFile) {
+        if (configFile != null) {
             loadConfigFile(configFile);
-        }        
+        }
         logger.fine("DesktopAssetManager created.");
     }
 
@@ -98,22 +98,22 @@ public class DesktopAssetManager implements AssetManager {
             logger.log(Level.SEVERE, "Failed to load asset config", ex);
         }
     }
-    
+
     @Override
     public void addClassLoader(ClassLoader loader) {
         classLoaders.add(loader);
     }
-    
+
     @Override
     public void removeClassLoader(ClassLoader loader) {
         classLoaders.remove(loader);
     }
 
     @Override
-    public List<ClassLoader> getClassLoaders(){
+    public List<ClassLoader> getClassLoaders() {
         return Collections.unmodifiableList(classLoaders);
     }
-    
+
     @Override
     public void addAssetEventListener(AssetEventListener listener) {
         eventListeners.add(listener);
@@ -128,85 +128,85 @@ public class DesktopAssetManager implements AssetManager {
     public void clearAssetEventListeners() {
         eventListeners.clear();
     }
-    
-    public void setAssetEventListener(AssetEventListener listener){
+
+    public void setAssetEventListener(AssetEventListener listener) {
         eventListeners.clear();
         eventListeners.add(listener);
     }
 
     @Override
-    public void registerLoader(Class<? extends AssetLoader> loader, String ... extensions){
+    public void registerLoader(Class<? extends AssetLoader> loader, String ... 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}",
-              new Object[]{loader.getSimpleName(), Arrays.toString(extensions)});
+                    new Object[]{loader.getSimpleName(), Arrays.toString(extensions)});
         }
     }
 
     @SuppressWarnings("unchecked")
-    public void registerLoader(String clsName, String ... extensions){
+    public void registerLoader(String clsName, String ... extensions) {
         Class<? extends AssetLoader> clazz = null;
-        try{
+        try {
             clazz = (Class<? extends AssetLoader>) Class.forName(clsName);
         } 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);
         }
     }
-    
+
     @Override
     public void unregisterLoader(Class<? extends AssetLoader> loaderClass) {
         handler.removeLoader(loaderClass);
-        if (logger.isLoggable(Level.FINER)){
+        if (logger.isLoggable(Level.FINER)) {
             logger.log(Level.FINER, "Unregistered loader: {0}",
                     loaderClass.getSimpleName());
         }
     }
 
     @Override
-    public void registerLocator(String rootPath, Class<? extends AssetLocator> locatorClass){
+    public void registerLocator(String rootPath, Class<? extends AssetLocator> locatorClass) {
         handler.addLocator(locatorClass, rootPath);
-        if (logger.isLoggable(Level.FINER)){
+        if (logger.isLoggable(Level.FINER)) {
             logger.log(Level.FINER, "Registered locator: {0}",
                     locatorClass.getSimpleName());
         }
     }
 
     @SuppressWarnings("unchecked")
-    public void registerLocator(String rootPath, String clsName){
+    public void registerLocator(String rootPath, String clsName) {
         Class<? extends AssetLocator> clazz = null;
-        try{
+        try {
             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);
         }
     }
-    
+
     @Override
-    public void unregisterLocator(String rootPath, Class<? extends AssetLocator> clazz){
+    public void unregisterLocator(String rootPath, Class<? extends AssetLocator> clazz) {
         handler.removeLocator(clazz, rootPath);
-        if (logger.isLoggable(Level.FINER)){
+        if (logger.isLoggable(Level.FINER)) {
             logger.log(Level.FINER, "Unregistered locator: {0}",
                     clazz.getSimpleName());
         }
     }
-    
+
     @Override
-    public AssetInfo locateAsset(AssetKey<?> key){
+    public AssetInfo locateAsset(AssetKey<?> key) {
         AssetInfo info = handler.tryLocate(key);
-        if (info == null){
+        if (info == null) {
             logger.log(Level.WARNING, "Cannot locate resource: {0}", key);
         }
         return info;
     }
-    
+
     @Override
     public <T> T getFromCache(AssetKey<T> key) {
         AssetCache cache = handler.getCache(key.getCacheType());
@@ -221,7 +221,7 @@ public class DesktopAssetManager implements AssetManager {
             throw new IllegalArgumentException("Key " + key + " specifies no cache.");
         }
     }
-    
+
     @Override
     public <T> void addToCache(AssetKey<T> key, T asset) {
         AssetCache cache = handler.getCache(key.getCacheType());
@@ -232,7 +232,7 @@ public class DesktopAssetManager implements AssetManager {
             throw new IllegalArgumentException("Key " + key + " specifies no cache.");
         }
     }
-    
+
     @Override
     public <T> boolean deleteFromCache(AssetKey<T> key) {
         AssetCache cache = handler.getCache(key.getCacheType());
@@ -242,11 +242,11 @@ public class DesktopAssetManager implements AssetManager {
             throw new IllegalArgumentException("Key " + key + " specifies no cache.");
         }
     }
-    
+
     @Override
-    public void clearCache(){
+    public void clearCache() {
         handler.clearCache();
-        if (logger.isLoggable(Level.FINER)){
+        if (logger.isLoggable(Level.FINER)) {
             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 cache The cache to store the asset in, or null to disable caching
      * @return The loaded asset
-     * 
+     *
      * @throws AssetLoadException If failed to load asset due to exception or
      * other error.
      */
@@ -301,22 +301,22 @@ public class DesktopAssetManager implements AssetManager {
             return (T) obj;
         }
     }
-    
+
     /**
      * Clones the asset using the given processor and registers the clone
      * with the cache.
-     * 
+     *
      * @param <T> The asset type
      * @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 cache The cache to register the clone with, cannot be null.
      * @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.
      */
     @SuppressWarnings("unchecked")
@@ -339,118 +339,118 @@ public class DesktopAssetManager implements AssetManager {
             return clone;
         }
     }
-    
+
     @Override
     public <T> T loadAssetFromStream(AssetKey<T> key, InputStream inputStream) {
         if (key == null) {
             throw new IllegalArgumentException("key cannot be null");
         }
-        
-        for (AssetEventListener listener : eventListeners){
+
+        for (AssetEventListener listener : eventListeners) {
             listener.assetRequested(key);
         }
-        
+
         AssetProcessor proc = handler.getProcessor(key.getProcessorType());
         StreamAssetInfo info = new StreamAssetInfo(this, key, inputStream);
         return loadLocatedAsset(key, info, proc, null);
     }
-    
+
     @Override
     @SuppressWarnings("unchecked")
-    public <T> T loadAsset(AssetKey<T> key){
+    public <T> T loadAsset(AssetKey<T> key) {
         if (key == null)
             throw new IllegalArgumentException("key cannot be null");
-        
-        for (AssetEventListener listener : eventListeners){
+
+        for (AssetEventListener listener : eventListeners) {
             listener.assetRequested(key);
         }
-        
+
         AssetCache cache = handler.getCache(key.getCacheType());
         AssetProcessor proc = handler.getProcessor(key.getProcessorType());
-        
+
         Object obj = cache != null ? cache.getFromCache(key) : null;
-        if (obj == null){
+        if (obj == null) {
             // Asset not in cache, load it from file system.
             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.
                     // If the parent AssetLoader chooses not to propagate
                     // the exception, this is the only means of finding
                     // that something went wrong.
-                    for (AssetEventListener listener : eventListeners){
+                    for (AssetEventListener listener : eventListeners) {
                         listener.assetDependencyNotFound(handler.getParentKey(), key);
                     }
                 }
                 throw new AssetNotFoundException(key.toString());
             }
-            
+
             obj = loadLocatedAsset(key, info, proc, cache);
         }
 
         T clone = (T) obj;
-        
+
         if (obj instanceof CloneableSmartAsset) {
             clone = registerAndCloneSmartAsset(key, clone, proc, cache);
         }
-        
+
         return clone;
     }
 
     @Override
-    public Object loadAsset(String name){
+    public Object loadAsset(String name) {
         return loadAsset(new AssetKey<>(name));
     }
 
     @Override
-    public Texture loadTexture(TextureKey key){                
+    public Texture loadTexture(TextureKey key) {
         return loadAsset(key);
     }
 
     @Override
-    public Material loadMaterial(String name){
+    public Material loadMaterial(String name) {
         return loadAsset(new MaterialKey(name));
     }
 
     @Override
-    public Texture loadTexture(String name){
+    public Texture loadTexture(String name) {
         TextureKey key = new TextureKey(name, true);
         key.setGenerateMips(true);
         return loadTexture(key);
     }
 
     @Override
-    public AudioData loadAudio(AudioKey key){
+    public AudioData loadAudio(AudioKey key) {
         return loadAsset(key);
     }
 
     @Override
-    public AudioData loadAudio(String name){
+    public AudioData loadAudio(String name) {
         return loadAudio(new AudioKey(name, false));
     }
 
     @Override
-    public BitmapFont loadFont(String name){
+    public BitmapFont loadFont(String name) {
         return loadAsset(new AssetKey<BitmapFont>(name));
     }
 
     @Override
-    public Spatial loadModel(ModelKey key){
+    public Spatial loadModel(ModelKey key) {
         return loadAsset(key);
     }
 
     @Override
-    public Spatial loadModel(String name){
+    public Spatial loadModel(String name) {
         return loadModel(new ModelKey(name));
     }
 
     @Override
-    public FilterPostProcessor loadFilter(FilterKey key){
+    public FilterPostProcessor loadFilter(FilterKey key) {
         return loadAsset(key);
     }
 
     @Override
-    public FilterPostProcessor loadFilter(String name){
+    public FilterPostProcessor loadFilter(String name) {
         return loadFilter(new FilterKey(name));
     }
 
@@ -460,11 +460,11 @@ public class DesktopAssetManager implements AssetManager {
     @Override
     public ShaderGenerator getShaderGenerator(EnumSet<Caps> caps) {
         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);
-            }else if(caps.contains(Caps.GLSL150)) {
+            } else if (caps.contains(Caps.GLSL150)) {
                 shaderGenerator = new Glsl150ShaderGenerator(this);
-            }else{
+            } else {
                 shaderGenerator = new Glsl100ShaderGenerator(this);
             }
         }
@@ -478,6 +478,4 @@ public class DesktopAssetManager implements AssetManager {
     public void setShaderGenerator(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.
- * 
+ *
  * @author Andrew Wason
  */
 public class FilterKey extends AssetKey<FilterPostProcessor> {
@@ -50,7 +50,7 @@ public class FilterKey extends AssetKey<FilterPostProcessor> {
     }
 
     @Override
-    public Class<? extends AssetCache> getCacheType(){
+    public Class<? extends AssetCache> getCacheType() {
         // Do not cache filter processors
         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 final AssetManager assetManager;
-    
-    private final ThreadLocal<AssetKey> parentAssetKey 
+
+    private final ThreadLocal<AssetKey> parentAssetKey
             = new ThreadLocal<>();
-    
+
     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 =
-                new ConcurrentHashMap<>();
-    
+            new ConcurrentHashMap<>();
+
     private final ConcurrentHashMap<Class<? extends AssetProcessor>, AssetProcessor> classToProcMap =
-                new ConcurrentHashMap<>();
-    
+            new ConcurrentHashMap<>();
+
     private final ConcurrentHashMap<Class<? extends AssetCache>, AssetCache> classToCacheMap =
-                new ConcurrentHashMap<>();
+            new ConcurrentHashMap<>();
 
-    public ImplHandler(AssetManager assetManager){
+    public ImplHandler(AssetManager assetManager) {
         this.assetManager = assetManager;
     }
 
@@ -82,48 +82,48 @@ final class ImplHandler {
         private final String path;
         private final String[] extensions;
 
-        public ImplThreadLocal(Class<T> type, String[] extensions){
+        public ImplThreadLocal(Class<T> type, String[] extensions) {
             this.type = type;
             this.extensions = extensions.clone();
             this.path = null;
         }
 
-        public ImplThreadLocal(Class<T> type, String path){
+        public ImplThreadLocal(Class<T> type, String path) {
             this.type = type;
             this.path = path;
             this.extensions = null;
         }
 
-        public ImplThreadLocal(Class<T> type){
+        public ImplThreadLocal(Class<T> type) {
             this.type = type;
             this.path = null;
             this.extensions = null;
         }
-        
+
         public String getPath() {
             return path;
         }
-        
-        public String[] getExtensions(){
+
+        public String[] getExtensions() {
             return extensions;
         }
-        
-        public Class<?> getTypeClass(){
+
+        public Class<?> getTypeClass() {
             return type;
         }
 
         @Override
-        protected T initialValue(){
+        protected T initialValue() {
             try {
                 T obj = type.newInstance();
                 if (path != null) {
-                    ((AssetLocator)obj).setRootPath(path);
+                    ((AssetLocator) obj).setRootPath(path);
                 }
                 return obj;
             } 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);
             }
             return null;
@@ -135,51 +135,51 @@ final class ImplHandler {
      * that have failed to load. When set, the {@link DesktopAssetManager}
      * gets a hint that it should suppress {@link AssetNotFoundException}s
      * 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);
         }
     }
-    
-    public void releaseParentKey(AssetKey parentKey){
-        if (parentAssetKey.get() == parentKey){
+
+    public void releaseParentKey(AssetKey parentKey) {
+        if (parentAssetKey.get() == parentKey) {
             parentAssetKey.set(null);
         }
     }
-    
-    public AssetKey getParentKey(){
+
+    public AssetKey getParentKey() {
         return parentAssetKey.get();
     }
-    
+
     /**
      * Attempts to locate the given resource name.
      * @param key The full name of the resource.
      * @return The AssetInfo containing resource information required for
      * 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;
         }
-        
-        for (ImplThreadLocal<AssetLocator> local : locatorsList){
+
+        for (ImplThreadLocal<AssetLocator> local : locatorsList) {
             AssetInfo info = local.get().locate(assetManager, key);
             if (info != null) {
                 return info;
             }
         }
-        
+
         return null;
     }
 
-    public int getLocatorCount(){
+    public int getLocatorCount() {
         return locatorsList.size();
     }
 
@@ -188,32 +188,32 @@ final class ImplHandler {
      * of the current thread.
      * @return AssetLoader registered with addLoader.
      */
-    public AssetLoader aquireLoader(AssetKey key){
+    public AssetLoader aquireLoader(AssetKey key) {
         // No need to synchronize() against map, its concurrent
         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();
     }
-    
-    public void clearCache(){
+
+    public void clearCache() {
         // The iterator over the values collection is thread-safe.
         synchronized (classToCacheMap) {
-            for (AssetCache cache : classToCacheMap.values()){
+            for (AssetCache cache : classToCacheMap.values()) {
                 cache.clearCache();
             }
         }
     }
-    
+
     @SuppressWarnings("unchecked")
     public <T extends AssetCache> T getCache(Class<T> cacheClass) {
         if (cacheClass == null) {
             return null;
         }
-        
+
         T cache = (T) classToCacheMap.get(cacheClass);
         if (cache == null) {
             synchronized (classToCacheMap) {
@@ -234,15 +234,15 @@ final class ImplHandler {
         }
         return cache;
     }
-    
+
     @SuppressWarnings("unchecked")
-    public <T extends AssetProcessor> T getProcessor(Class<T> procClass){
+    public <T extends AssetProcessor> T getProcessor(Class<T> procClass) {
         if (procClass == null)
             return null;
-        
+
         T proc = (T) classToProcMap.get(procClass);
-        if (proc == null){
-            synchronized(classToProcMap){
+        if (proc == null) {
+            synchronized (classToProcMap) {
                 proc = (T) classToProcMap.get(procClass);
                 if (proc == null) {
                     try {
@@ -260,55 +260,55 @@ final class ImplHandler {
         }
         return proc;
     }
-    
+
     @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
         ImplThreadLocal local = new ImplThreadLocal(loaderType, extensions);
-        for (String extension : extensions){
+        for (String extension : extensions) {
             extension = extension.toLowerCase();
-            synchronized (classToLoaderMap){
+            synchronized (classToLoaderMap) {
                 classToLoaderMap.put(loaderType, 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
         // Find the loader ImplThreadLocal for this class
-        synchronized (classToLoaderMap){
+        synchronized (classToLoaderMap) {
             // Remove it from the class->loader map
             ImplThreadLocal local = classToLoaderMap.remove(loaderType);
-            if (local == null) return;
+            if (local == null)
+                return;
             // Remove it from the extension->loader map
-            for (String extension : local.getExtensions()){
+            for (String extension : local.getExtensions()) {
                 extensionToLoaderMap.remove(extension);
             }
         }
     }
-    
+
     @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));
     }
 
-    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<>();
         Iterator<ImplThreadLocal<AssetLocator>> it = locatorsList.iterator();
-       
-        while (it.hasNext()){
+
+        while (it.hasNext()) {
             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();
                 // copy on write list doesn't support iterator remove,
                 // must use temporary list
                 locatorsToRemove.add(locator);
             }
         }
-        
+
         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.
  * This uses cloneable smart asset management, so that when all clones of
  * 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.
- * 
+ *
  * @author Kirill Vainer
  */
 public class ModelKey extends AssetKey<Spatial> {
@@ -53,14 +53,14 @@ public class ModelKey extends AssetKey<Spatial> {
     public ModelKey() {
         super();
     }
-    
+
     @Override
-    public Class<? extends AssetCache> getCacheType(){
+    public Class<? extends AssetCache> getCacheType() {
         return WeakRefCloneAssetCache.class;
     }
-    
+
     @Override
-    public Class<? extends AssetProcessor> getProcessorType(){
+    public Class<? extends AssetProcessor> getProcessorType() {
         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;
 
 /**
- * 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}
- * 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
  * in the cache will be collected when all clones of the texture become
  * unreachable.
- * 
+ *
  * @author Kirill Vainer
  */
 public class TextureKey extends AssetKey<Texture> {
@@ -96,17 +96,17 @@ public class TextureKey extends AssetKey<Texture> {
         }
         return name + (flipY ? " (Flipped)" : "") + type + (generateMips ? " (Mipmapped)" : "");
     }
-    
+
     @Override
-    public Class<? extends AssetCache> getCacheType(){
+    public Class<? extends AssetCache> getCacheType() {
         return WeakRefCloneAssetCache.class;
     }
 
     @Override
-    public Class<? extends AssetProcessor> getProcessorType(){
+    public Class<? extends AssetProcessor> getProcessorType() {
         return TextureProcessor.class;
     }
-    
+
     public boolean isFlipY() {
         return flipY;
     }
@@ -114,7 +114,7 @@ public class TextureKey extends AssetKey<Texture> {
     public void setFlipY(boolean flipY) {
         this.flipY = flipY;
     }
-    
+
     public int getAnisotropy() {
         return anisotropy;
     }
@@ -133,7 +133,7 @@ public class TextureKey extends AssetKey<Texture> {
 
     /**
      * The type of texture expected to be returned.
-     * 
+     *
      * @return type of texture expected to be returned.
      */
     public Type getTextureTypeHint() {
@@ -142,13 +142,13 @@ public class TextureKey extends AssetKey<Texture> {
 
     /**
      * Hints the loader as to which type of texture is expected.
-     * 
+     *
      * @param textureTypeHint The type of texture expected to be loaded.
      */
     public void setTextureTypeHint(Type textureTypeHint) {
         this.textureTypeHint = textureTypeHint;
     }
-    
+
     @Override
     public boolean equals(Object obj) {
         if (obj == null) {
@@ -186,7 +186,7 @@ public class TextureKey extends AssetKey<Texture> {
         hash = 17 * hash + (this.textureTypeHint != null ? this.textureTypeHint.hashCode() : 0);
         return hash;
     }
-    
+
     @Override
     public void write(JmeExporter ex) throws IOException {
         super.write(ex);
@@ -195,7 +195,7 @@ public class TextureKey extends AssetKey<Texture> {
         oc.write(generateMips, "generate_mips", false);
         oc.write(anisotropy, "anisotropy", 0);
         oc.write(textureTypeHint, "tex_type", Type.TwoDimensional);
-        
+
         // Backwards compat
         oc.write(textureTypeHint == Type.CubeMap, "as_cubemap", false);
     }
@@ -208,7 +208,7 @@ public class TextureKey extends AssetKey<Texture> {
         generateMips = ic.readBoolean("generate_mips", false);
         anisotropy = ic.readInt("anisotropy", 0);
         boolean asCube = ic.readBoolean("as_cubemap", false);
-        
+
         if (asCube) {
             // Backwards compat
             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
  * 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
- * render thread is active. 
+ * render thread is active.
  */
 public class ThreadingManager {
 
     protected final ExecutorService executor =
-            Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(), 
-                                         new LoadingThreadFactory());
+            Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(),
+                    new LoadingThreadFactory());
 
     protected final AssetManager owner;
     protected int nextThreadId = 0;
 
-    public ThreadingManager(AssetManager owner){
+    public ThreadingManager(AssetManager owner) {
         this.owner = owner;
     }
 
@@ -83,6 +83,4 @@ public class ThreadingManager {
     public static boolean isLoadingThread() {
         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.
  * 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
  * 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,
  * e.g. the VM feels like purging the weak references for that asset.
- * 
+ *
  * @author Kirill Vainer
  */
 public class WeakRefAssetCache implements AssetCache {
 
     private static final Logger logger = Logger.getLogger(WeakRefAssetCache.class.getName());
-    
+
     private final ReferenceQueue<Object> refQueue = new ReferenceQueue<>();
-    
-    private final ConcurrentHashMap<AssetKey, AssetRef> assetCache 
+
+    private final ConcurrentHashMap<AssetKey, AssetRef> assetCache
             = new ConcurrentHashMap<>();
 
     private static class AssetRef extends WeakReference<Object> {
-        
+
         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);
             this.assetKey = assetKey;
         }
     }
-    
-    private void removeCollectedAssets(){
+
+    private void removeCollectedAssets() {
         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.
-            if (assetCache.remove(ref.assetKey) != null){
-                removedAssets ++;
+            if (assetCache.remove(ref.assetKey) != null) {
+                removedAssets++;
             }
         }
         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
     public <T> void addToCache(AssetKey<T> key, T obj) {
         removeCollectedAssets();
-        
+
         // NOTE: Some thread issues can happen if another
         // thread is loading an asset with the same key.
         AssetRef ref = new AssetRef(key, obj, refQueue);
@@ -98,9 +99,9 @@ public class WeakRefAssetCache implements AssetCache {
     @SuppressWarnings("unchecked")
     public <T> T getFromCache(AssetKey<T> key) {
         AssetRef ref = assetCache.get(key);
-        if (ref != null){
+        if (ref != null) {
             return (T) ref.get();
-        }else{
+        } else {
             return null;
         }
     }
@@ -114,11 +115,11 @@ public class WeakRefAssetCache implements AssetCache {
     public void clearCache() {
         assetCache.clear();
     }
-    
+
     @Override
     public <T> void registerAssetClone(AssetKey<T> key, T clone) {
     }
-    
+
     @Override
     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
  * cache, allowing them to be collected when memory is low.
  * 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.
- * 
-* @author Kirill Vainer
+ *
+ * @author Kirill Vainer
  */
 public class WeakRefCloneAssetCache implements AssetCache {
 
     private static final Logger logger = Logger.getLogger(WeakRefAssetCache.class.getName());
-    
+
     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.
      */
-    private final ConcurrentHashMap<AssetKey, AssetRef> smartCache 
+    private final ConcurrentHashMap<AssetKey, AssetRef> smartCache
             = new ConcurrentHashMap<>();
-    
+
     /**
      * Stored in the ReferenceQueue to find out when originalKey is collected
      * by GC. Once collected, the clonedKey is used to remove the asset
      * from the cache.
      */
     private static final class KeyRef extends PhantomReference<AssetKey> {
-        
+
         AssetKey clonedKey;
-        
+
         public KeyRef(AssetKey originalKey, ReferenceQueue<AssetKey> refQueue) {
             super(originalKey, refQueue);
             clonedKey = originalKey.clone();
         }
     }
-    
+
     /**
      * Stores the original key and original asset.
      * 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>>() {
         @Override
         protected ArrayList<AssetKey> initialValue() {
             return new ArrayList<>();
         }
     };
-    
-    private void removeCollectedAssets(){
+
+    private void removeCollectedAssets() {
         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!)
             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.
-            if (smartCache.remove(key) != null){
-                removedAssets ++;
+            if (smartCache.remove(key) != null) {
+                removedAssets++;
             }
         }
         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
     public <T> void addToCache(AssetKey<T> originalKey, T obj) {
         // Make room for new asset
         removeCollectedAssets();
-        
+
         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.
-        asset.setKey(null); 
-        
+        asset.setKey(null);
+
         // Start tracking the collection of originalKey
         // (this adds the KeyRef to the ReferenceQueue)
         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.
         smartCache.put(ref.clonedKey, new AssetRef(asset, originalKey));
-        
+
         // Push the original key used to load the asset
         // so that it can be set on the clone later
         ArrayList<AssetKey> loadStack = assetLoadStack.get();
@@ -147,9 +148,9 @@ public class WeakRefCloneAssetCache implements AssetCache {
     @Override
     public <T> void registerAssetClone(AssetKey<T> key, T clone) {
         ArrayList<AssetKey> loadStack = assetLoadStack.get();
-        ((CloneableSmartAsset)clone).setKey(loadStack.remove(loadStack.size() - 1));
+        ((CloneableSmartAsset) clone).setKey(loadStack.remove(loadStack.size() - 1));
     }
-    
+
     @Override
     public void notifyNoAssetClone() {
         ArrayList<AssetKey> loadStack = assetLoadStack.get();
@@ -167,17 +168,17 @@ public class WeakRefCloneAssetCache implements AssetCache {
             // can check this and determine that the asset clone
             // belongs to the asset retrieved here.
             AssetKey keyForTheClone = smartInfo.get();
-            if (keyForTheClone == null){
+            if (keyForTheClone == null) {
                 // The asset was JUST collected by GC
                 // (between here and smartCache.get)
                 return null;
             }
-            
+
             // Prevent original key from getting collected
             // while an asset is loaded for it.
             ArrayList<AssetKey> loadStack = assetLoadStack.get();
             loadStack.add(keyForTheClone);
-            
+
             return (T) smartInfo.asset;
         }
     }
@@ -185,24 +186,24 @@ public class WeakRefCloneAssetCache implements AssetCache {
     @Override
     public boolean deleteFromCache(AssetKey key) {
         ArrayList<AssetKey> loadStack = assetLoadStack.get();
-        
-        if (!loadStack.isEmpty()){
+
+        if (!loadStack.isEmpty()) {
             throw new UnsupportedOperationException("Cache cannot be modified"
-                                                  + "while assets are being loaded");
+                    + "while assets are being loaded");
         }
-        
+
         return smartCache.remove(key) != null;
     }
-    
+
     @Override
     public void clearCache() {
         ArrayList<AssetKey> loadStack = assetLoadStack.get();
-        
-        if (!loadStack.isEmpty()){
+
+        if (!loadStack.isEmpty()) {
             throw new UnsupportedOperationException("Cache cannot be modified"
-                                                  + "while assets are being loaded");
+                    + "while assets are being loaded");
         }
-        
+
         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;
 
-    public AudioBuffer(){
+    public AudioBuffer() {
         super();
     }
-    
-    protected AudioBuffer(int id){
+
+    protected AudioBuffer(int id) {
         super(id);
     }
 
@@ -69,7 +69,7 @@ public class AudioBuffer extends AudioData {
      * that audio is uncompressed.
      */
     @Override
-    public float getDuration(){
+    public float getDuration() {
         int bytesPerSec = (bitsPerSample / 8) * channels * sampleRate;
         if (audioData != null)
             return (float) audioData.limit() / bytesPerSec;
@@ -78,10 +78,10 @@ public class AudioBuffer extends AudioData {
     }
 
     @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)
      * @throws IllegalArgumentException if the provided buffer is not a direct buffer
      */
-    public void updateData(ByteBuffer data){
+    public void updateData(ByteBuffer data) {
         if (!data.isDirect()) {
             throw new IllegalArgumentException(
                     "Currently only direct buffers are allowed");
@@ -103,7 +103,7 @@ public class AudioBuffer extends AudioData {
     /**
      * @return The buffered audio data.
      */
-    public ByteBuffer getData(){
+    public ByteBuffer getData() {
         return audioData;
     }
 
@@ -119,10 +119,10 @@ public class AudioBuffer extends AudioData {
             BufferUtils.destroyDirectBuffer(audioData);
         }
     }
-    
+
     @Override
     public void deleteObject(Object rendererObject) {
-        ((AudioRenderer)rendererObject).deleteAudioData(this);
+        ((AudioRenderer) rendererObject).deleteAudioData(this);
     }
 
     @Override
@@ -132,6 +132,6 @@ public class AudioBuffer extends AudioData {
 
     @Override
     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 {
 
     final private static ThreadLocal<AudioRenderer> audioRenderer = new ThreadLocal<AudioRenderer>();
- 
+
     /**
      * A private constructor to inhibit instantiation of this class.
      */
     private AudioContext() {
     }
 
-    public static void setAudioRenderer( AudioRenderer ar ) {
-        audioRenderer.set(ar);       
+    public static void setAudioRenderer(AudioRenderer ar) {
+        audioRenderer.set(ar);
     }
-    
+
     public static AudioRenderer getAudioRenderer() {
         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,
         Stream
     }
-    
-    public AudioData(){
+
+    public AudioData() {
         super();
     }
 
-    protected AudioData(int id){
+    protected AudioData(int id) {
         super(id);
     }
-    
+
     /**
      * @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.
      */
     public abstract float getDuration();
-    
+
     /**
      * @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 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)
             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.
-     * 
+     *
      * @param name Name of the asset
      * @param stream If true, the audio will be streamed.
      *     Otherwise, it will be buffered entirely and then played.
      * @param streamCache If stream is 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 
+     * be read entirely but not decoded, allowing features such as
      * 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.streamCache = streamCache;
     }
-    
+
     /**
      * Create a new AudioKey
      *
@@ -74,26 +74,24 @@ public class AudioKey extends AssetKey<AudioData> {
      * @param stream If true, the audio will be streamed.
      *     Otherwise, it will be buffered entirely and then played.
      */
-    public AudioKey(String name, boolean stream){
+    public AudioKey(String name, boolean stream) {
         super(name);
         this.stream = stream;
     }
 
-    public AudioKey(String name){
+    public AudioKey(String name) {
         super(name);
         this.stream = false;
     }
 
-    public AudioKey(){
+    public AudioKey() {
     }
 
     @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() {
         return stream;
     }
-    
+
     /**
-     * Specifies if the stream cache is used. 
-     * 
+     * Specifies if 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, looping and determining duration.
-     * 
+     *
      * @return true if stream cache is in use, otherwise false
      */
-    public boolean useStreamCache(){
+    public boolean useStreamCache() {
         return streamCache;
     }
 
@@ -157,14 +155,14 @@ public class AudioKey extends AssetKey<AudioData> {
         hash = 67 * hash + (this.streamCache ? 1 : 0);
         return hash;
     }
-    
+
     @Override
     public Class<? extends AssetProcessor> getProcessorType() {
         return null;
     }
-    
+
     @Override
-    public void write(JmeExporter ex) throws IOException{
+    public void write(JmeExporter ex) throws IOException {
         super.write(ex);
         OutputCapsule oc = ex.getCapsule(this);
         oc.write(stream, "do_stream", false);
@@ -172,11 +170,10 @@ public class AudioKey extends AssetKey<AudioData> {
     }
 
     @Override
-    public void read(JmeImporter im) throws IOException{
+    public void read(JmeImporter im) throws IOException {
         super.read(im);
         InputCapsule ic = im.getCapsule(this);
         stream = ic.readBoolean("do_stream", 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.
  *
  * The "positional" property of an AudioNode can be set via
- * {@link AudioNode#setPositional(boolean) }.
+ * {@link AudioNode#setPositional(boolean)}.
  *
  * @author normenhansen
  * @author Kirill Vainer
  */
 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;
     protected boolean loop = false;
     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.
      * @param assetManager The asset manager to use to load 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) {
         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 name The filename of the audio file
      * @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
-     * 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
     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 name The filename of the audio file
      * @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
     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 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
     public AudioNode(AssetManager assetManager, String name) {
@@ -207,15 +211,16 @@ public class AudioNode extends Node implements AudioSource {
 
     protected AudioRenderer getRenderer() {
         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;
     }
 
     /**
      * Start playing the audio.
      */
-    public void play(){
+    public void play() {
         if (positional && data.getChannels() > 1) {
             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
      * instances already playing.
      */
-    public void playInstance(){
+    public void playInstance() {
         if (positional && data.getChannels() > 1) {
             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() }.
      */
-    public void stop(){
+    public void stop() {
         getRenderer().stopSource(this);
     }
 
     /**
      * Pause the audio that was started with {@link AudioNode#play() }.
      */
-    public void pause(){
+    public void pause() {
         getRenderer().pauseSource(this);
     }
 
@@ -454,7 +459,7 @@ public class AudioNode extends Node implements AudioSource {
         this.timeOffset = timeOffset;
         if (data instanceof AudioStream) {
             ((AudioStream) data).setTime(timeOffset);
-        }else if(status == AudioSource.Status.Playing){
+        } else if (status == AudioSource.Status.Playing) {
             stop();
             play();
         }
@@ -602,7 +607,7 @@ public class AudioNode extends Node implements AudioSource {
      * audio node will be exactly half of its volume.
      *
      * @param refDistance The reference playing distance.
-     * @throws  IllegalArgumentException If refDistance is negative
+     * @throws IllegalArgumentException If refDistance is negative
      */
     public void setRefDistance(float refDistance) {
         if (refDistance < 0) {
@@ -749,12 +754,14 @@ public class AudioNode extends Node implements AudioSource {
     @Override
     public void updateGeometricState() {
         super.updateGeometricState();
-        if (channel < 0) return;
+        if (channel < 0)
+            return;
         Vector3f currentWorldTranslation = worldTransform.getTranslation();
         if (!previousWorldTranslation.equals(currentWorldTranslation)) {
             getRenderer().updateSourceParam(this, AudioParam.Position);
             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);
             }
             previousWorldTranslation.set(currentWorldTranslation);
@@ -762,21 +769,21 @@ public class AudioNode extends Node implements AudioSource {
     }
 
     @Override
-    public AudioNode clone(){
+    public AudioNode clone() {
         AudioNode clone = (AudioNode) super.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
-    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
         // 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
         // written with the name "key". This has been changed
         // 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);
-        }else{
+        } else {
             audioKey = (AudioKey) ic.readSavable("audio_key", null);
         }
 
@@ -855,8 +862,9 @@ public class AudioNode extends Node implements AudioSource {
         if (audioKey != null) {
             try {
                 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();
             }
         }

+ 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);
     }
 
-    private static float eaxDbToAmp(float eaxDb){
+    private static float eaxDbToAmp(float eaxDb) {
         float dB = eaxDb / 2000f;
         return FastMath.pow(10f, dB);
     }
 
-    public Environment(){
+    public Environment() {
     }
 
     public Environment(Environment source) {
@@ -95,7 +95,7 @@ public class Environment {
 
     public Environment(float density, float diffusion, float gain, float gainHf,
                        float decayTime, float decayHf, float reflGain,
-                       float reflDelay, float lateGain, float lateDelay){
+                       float reflDelay, float lateGain, float lateDelay) {
         this.decayTime = decayTime;
         this.decayHFRatio = decayHf;
         this.density = density;
@@ -108,7 +108,7 @@ public class Environment {
         this.reflectGain = reflGain;
     }
 
-    public Environment(float[] e){
+    public Environment(float[] e) {
         if (e.length != 28)
             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 Filter(){
+    public Filter() {
         super();
     }
-    
-    protected Filter(int id){
+
+    protected Filter(int id) {
         super(id);
     }
-    
+
     @Override
     public void write(JmeExporter ex) throws IOException {
         // nothing to save
@@ -65,7 +65,7 @@ public abstract class Filter extends NativeObject implements Savable {
 
     @Override
     public void deleteObject(Object rendererObject) {
-        ((AudioRenderer)rendererObject).deleteFilter(this);
+        ((AudioRenderer) rendererObject).deleteFilter(this);
     }
 
     @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 AudioRenderer renderer;
 
-    public Listener(){
+    public Listener() {
         location = new Vector3f();
         velocity = new Vector3f();
         rotation = new Quaternion();
     }
-    
-    public Listener(Listener source){
+
+    public Listener(Listener source) {
         location = source.location.clone();
         velocity = source.velocity.clone();
         rotation = source.rotation.clone();
         volume = source.volume;
     }
 
-    public void setRenderer(AudioRenderer renderer){
+    public void setRenderer(AudioRenderer renderer) {
         this.renderer = renderer;
     }
 
@@ -68,7 +68,7 @@ public class Listener {
         if (renderer != null)
             renderer.updateListenerParam(this, ListenerParam.Volume);
     }
-    
+
     public Vector3f getLocation() {
         return location;
     }
@@ -81,18 +81,18 @@ public class Listener {
         return velocity;
     }
 
-    public Vector3f getLeft(){
+    public Vector3f getLeft() {
         return rotation.getRotationColumn(0);
     }
 
-    public Vector3f getUp(){
+    public Vector3f getUp() {
         return rotation.getRotationColumn(1);
     }
 
-    public Vector3f getDirection(){
+    public Vector3f getDirection() {
         return rotation.getRotationColumn(2);
     }
-    
+
     public void setLocation(Vector3f location) {
         this.location.set(location);
         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);
         setHighFreqVolume(highFreqVolume);
     }
-    
-    protected LowPassFilter(int id){
+
+    protected LowPassFilter(int id) {
         super(id);
     }
 
@@ -71,13 +71,13 @@ public class LowPassFilter extends Filter {
     public void setVolume(float volume) {
         if (volume < 0 || volume > 1)
             throw new IllegalArgumentException("Volume must be between 0 and 1");
-        
+
         this.volume = volume;
         this.updateNeeded = true;
     }
 
     @Override
-    public void write(JmeExporter ex) throws IOException{
+    public void write(JmeExporter ex) throws IOException {
         super.write(ex);
         OutputCapsule oc = ex.getCapsule(this);
         oc.write(volume, "volume", 0);
@@ -85,7 +85,7 @@ public class LowPassFilter extends Filter {
     }
 
     @Override
-    public void read(JmeImporter im) throws IOException{
+    public void read(JmeImporter im) throws IOException {
         super.read(im);
         InputCapsule ic = im.getCapsule(this);
         volume = ic.readFloat("volume", 0);
@@ -99,6 +99,6 @@ public class LowPassFilter extends Filter {
 
     @Override
     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 {
 
     private static final Logger logger = Logger.getLogger(ALAudioRenderer.class.getName());
-    
+
     private static final String THREAD_NAME = "jME3 Audio Decoder";
-    
+
     private final NativeObjectManager objManager = new NativeObjectManager();
     // When multiplied by STREAMING_BUFFER_COUNT, will equal 44100 * 2 * 2
     // which is exactly 1 second of audio.
@@ -72,7 +72,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
     private int auxSends = 0;
     private int reverbFx = -1;
     private int reverbFxSlot = -1;
-    
+
     // Fill streaming sources every 50 ms
     private static final float UPDATE_RATE = 0.05f;
     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 ALC alc;
     private final EFX efx;
-    
+
     public ALAudioRenderer(AL al, ALC alc, EFX efx) {
         this.al = al;
         this.alc = alc;
         this.efx = efx;
     }
-    
+
     private void initOpenAL() {
         try {
             if (!alc.isCreated()) {
@@ -120,15 +120,15 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
 
         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,
                         al.alGetString(AL_VENDOR),
                         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.");
         }
     }
-    
+
     private void destroyOpenAL() {
         if (audioDisabled) {
             alc.destroyALC();
@@ -224,7 +224,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
         if (decoderThread.isAlive()) {
             throw new IllegalStateException("Initialize already called");
         }
-        
+
         // Initialize OpenAL context.
         initOpenAL();
 
@@ -279,13 +279,13 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
         if (!decoderThread.isAlive()) {
             return;
         }
-        
+
         decoderThread.interrupt();
         try {
             decoderThread.join();
         } catch (InterruptedException ex) {
         }
-        
+
         // destroy OpenAL context
         destroyOpenAL();
     }
@@ -321,51 +321,51 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
             if (audioDisabled) {
                 return 0;
             }
-            
+
             // See comment in updateSourceParam().
             if (src.getChannel() < 0) {
                 return 0;
             }
-            
+
             int id = channels[src.getChannel()];
             AudioData data = src.getAudioData();
             int playbackOffsetBytes = 0;
-            
+
             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
                 // been playing based on the number of buffers that were processed.
                 AudioStream stream = (AudioStream) data;
-                
+
                 // NOTE: the assumption is that all enqueued buffers are the same size.
                 //       this is currently enforced by fillBuffer().
-                
+
                 // The number of unenqueued bytes that the decoder thread
                 // keeps track of.
                 int unqueuedBytes = stream.getUnqueuedBufferBytes();
-                
+
                 // Additional processed buffers that the decoder thread
                 // did not unenqueue yet (it only updates 20 times per second).
                 int unqueuedBytesExtra = al.alGetSourcei(id, AL_BUFFERS_PROCESSED) * BUFFER_SIZE;
-                
+
                 // Total additional bytes that need to be considered.
                 playbackOffsetBytes = unqueuedBytes; // + unqueuedBytesExtra;
             }
-            
+
             // Add byte offset from source (for both streams and buffers)
             playbackOffsetBytes += al.alGetSourcei(id, AL_BYTE_OFFSET);
-            
+
             // Compute time value from bytes
             // E.g. for 44100 source with 2 channels and 16 bits per sample:
             //    (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
     public void updateSourceParam(AudioSource src, AudioParam param) {
         checkDead();
@@ -381,7 +381,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
             // still has a channel value but the audio thread may
             // clear that channel before setVolume() gets to call
             // 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.
             if (src.getChannel() < 0) {
                 return;
@@ -453,7 +453,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
                         al.alSourcei(id, AL_SOURCE_RELATIVE, AL_TRUE);
                         al.alSource3f(id, AL_POSITION, 0, 0, 0);
                         al.alSource3f(id, AL_VELOCITY, 0, 0, 0);
-                        
+
                         // Disable reverb
                         al.alSource3i(id, EFX.AL_AUXILIARY_SEND_FILTER, 0, 0, EFX.AL_FILTER_NULL);
                     } else {
@@ -717,34 +717,34 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
         boolean success = false;
         int processed = al.alGetSourcei(sourceId, AL_BUFFERS_PROCESSED);
         int unqueuedBufferBytes = 0;
-        
+
         for (int i = 0; i < processed; i++) {
             int buffer;
 
             ib.position(0).limit(1);
             al.alSourceUnqueueBuffers(sourceId, 1, ib);
             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
             // be the case...
             unqueuedBufferBytes += BUFFER_SIZE;
-            
+
             boolean active = fillBuffer(stream, buffer);
-            
+
             if (!active && !stream.isEOF()) {
                 throw new AssertionError();
             }
-            
+
             if (!active && looping) {
                 stream.setTime(0);
                 active = fillBuffer(stream, buffer);
                 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) {
                 ib.position(0).limit(1);
                 ib.put(0, buffer);
@@ -756,7 +756,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
                 break;
             }
         }
-        
+
         stream.setUnqueuedBufferBytes(stream.getUnqueuedBufferBytes() + unqueuedBufferBytes);
 
         return success;
@@ -764,15 +764,15 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
 
     private void attachStreamToSource(int sourceId, AudioStream stream, boolean looping) {
         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
         // since it might not be at the EOF when stopped.
         if (stream.isEOF()) {
             stream.setTime(0);
         }
-        
+
         for (int id : stream.getIds()) {
             boolean active = fillBuffer(stream, id);
             if (!active && !stream.isEOF()) {
@@ -782,8 +782,8 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
                 stream.setTime(0);
                 active = fillBuffer(stream, id);
                 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) {
@@ -793,7 +793,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
                 success = true;
             }
         }
-        
+
         if (!success) {
             // should never happen
             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];
             al.alSourceStop(sourceId);
-            
+
             // For streaming sources, this will clear all queued buffers.
             al.alSourcei(sourceId, AL_BUFFER, 0);
 
@@ -840,7 +840,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
             chanSrcs[index] = null;
         }
     }
-    
+
     private AudioSource.Status convertStatus(int oalStatus) {
         switch (oalStatus) {
             case AL_INITIAL:
@@ -889,10 +889,10 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
         if (audioDisabled) {
             return;
         }
-        
+
         for (int i = 0; i < channels.length; i++) {
             AudioSource src = chanSrcs[i];
-            
+
             if (src == null) {
                 continue;
             }
@@ -900,11 +900,11 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
             int sourceId = channels[i];
             boolean boundSource = i == src.getChannel();
             boolean reclaimChannel = false;
-            
+
             Status oalStatus = convertStatus(al.alGetSourcei(sourceId, AL_SOURCE_STATE));
-            
+
             if (!boundSource) {
-                // Rules for instanced playback vary significantly. 
+                // Rules for instanced playback vary significantly.
                 // Handle it here.
                 if (oalStatus == Status.Stopped) {
                     // Instanced audio stopped playing. Reclaim channel.
@@ -913,26 +913,26 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
                 } else if (oalStatus == Status.Paused) {
                     throw new AssertionError("Instanced audio cannot be paused");
                 }
-                
+
                 continue;
             }
-            
+
             Status jmeStatus = src.getStatus();
-            
+
             // Check if we need to sync JME status with OAL status.
             if (oalStatus != jmeStatus) {
                 if (oalStatus == Status.Stopped && jmeStatus == Status.Playing) {
                     // Maybe we need to reclaim the channel.
                     if (src.getAudioData() instanceof AudioStream) {
                         AudioStream stream = (AudioStream) src.getAudioData();
-                        
+
                         if (stream.isEOF() && !src.isLooping()) {
                             // Stream finished playing
                             reclaimChannel = true;
                         } else {
-                            // Stream still has data. 
+                            // Stream still has data.
                             // Buffer starvation occurred.
-                            // Audio decoder thread will fill the data 
+                            // Audio decoder thread will fill the data
                             // and start the channel again.
                         }
                     } else {
@@ -945,7 +945,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
 
                         reclaimChannel = true;
                     }
-                    
+
                     if (reclaimChannel) {
                         src.setStatus(Status.Stopped);
                         src.setChannel(-1);
@@ -956,7 +956,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
                     // jME3 state does not match OAL state.
                     // This is only relevant for bound sources.
                     throw new AssertionError("Unexpected sound status. "
-                                            + "OAL: " + oalStatus 
+                                            + "OAL: " + oalStatus
                                             + ", JME: " + jmeStatus);
                 }
             } else {
@@ -967,7 +967,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
             }
         }
     }
-    
+
     public void updateInDecoderThread(float tpf) {
         if (audioDisabled) {
             return;
@@ -975,7 +975,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
 
         for (int i = 0; i < channels.length; i++) {
             AudioSource src = chanSrcs[i];
-            
+
             if (src == null || !(src.getAudioData() instanceof AudioStream)) {
                 continue;
             }
@@ -1030,13 +1030,13 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
             setListenerParams(listener);
         }
     }
-    
+
     @Override
     public void pauseAll() {
         if (!supportPauseDevice) {
             throw new UnsupportedOperationException("Pause device is NOT supported!");
         }
-        
+
         alc.alcDevicePauseSOFT();
     }
 
@@ -1045,7 +1045,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
         if (!supportPauseDevice) {
             throw new UnsupportedOperationException("Pause device is NOT supported!");
         }
-        
+
         alc.alcDeviceResumeSOFT();
     }
 
@@ -1101,7 +1101,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
                 // Assertion removed because it seems it's not possible to have
                 // something different from -1 when first playing an AudioNode.
                 // assert src.getChannel() != -1;
-                
+
                 // allocate channel to this source
                 int index = newChannel();
                 if (index == -1) {
@@ -1158,11 +1158,11 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
                 src.setChannel(-1);
                 clearChannel(chan);
                 freeChannel(chan);
-                
+
                 if (src.getAudioData() instanceof AudioStream) {
                     // If the stream is seekable, then rewind it.
                     // Otherwise, close it, as it is no longer valid.
-                    AudioStream stream = (AudioStream)src.getAudioData();
+                    AudioStream stream = (AudioStream) src.getAudioData();
                     if (stream.isSeekable()) {
                         stream.setTime(0);
                     } 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
      * was originally found in C++ at <br>
      * <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
-     *  
+     *
      * @param points
      *            The points to calculate the minimum bounds from.
      */
@@ -812,39 +812,39 @@ public class BoundingSphere extends BoundingVolume {
         }
         return 1;
     }
-    
+
     private int collideWithTri(Triangle tri, CollisionResults results) {
         TempVars tvars = TempVars.get();
         try {
-        
+
             // Much of this is based on adaptation from this algorithm:
             // http://realtimecollisiondetection.net/blog/?p=103
             // ...mostly the stuff about eliminating sqrts wherever
             // possible.
-    
+
             // Math is done in center-relative space.
             Vector3f a = tri.get1().subtract(center, tvars.vect1);
             Vector3f b = tri.get2().subtract(center, tvars.vect2);
             Vector3f c = tri.get3().subtract(center, tvars.vect3);
-            
+
             Vector3f ab = b.subtract(a, tvars.vect4);
             Vector3f ac = c.subtract(a, tvars.vect5);
-            
+
             // Check the plane... if it doesn't intersect the plane
             // then it doesn't intersect the triangle.
             Vector3f n = ab.cross(ac, tvars.vect6);
             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
                 return 0;
             }
-                
+
             // We intersect the verts, or the edges, or the face...
-    
+
             // First check against the face since it's the most
             // specific.
-    
+
             // Calculate the barycentric coordinates of the
             // sphere center
             Vector3f v0 = ac;
@@ -852,163 +852,163 @@ public class BoundingSphere extends BoundingVolume {
             // a was P relative, so p.subtract(a) is just -a
             // instead of wasting a vector we'll just negate the
             // dot products below... it's all v2 is used for.
-            Vector3f v2 = a; 
-            
+            Vector3f v2 = a;
+
             float dot00 = v0.dot(v0);
             float dot01 = v0.dot(v1);
             float dot02 = -v0.dot(v2);
             float dot11 = v1.dot(v1);
             float dot12 = -v1.dot(v2);
-            
+
             float invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
             float u = (dot11 * dot02 - dot01 * dot12) * 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
                 Vector3f part1 = ac;
                 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();
-                Vector3f normal = n.normalize();                                               
+                Vector3f normal = n.normalize();
                 float dist = -normal.dot(a);  // a is center relative, so -a points to center
                 dist = dist - radius;
-                
+
                 r.setDistance(dist);
                 r.setContactNormal(normal);
                 r.setContactPoint(p);
                 results.addCollision(r);
                 return 1;
             }
-    
+
             // Check the edges looking for the nearest point
             // that is also less than the radius.  We don't care
             // about points that are farther away than that.
             Vector3f nearestPt = null;
-            float nearestDist = radius * radius; 
-            
+            float nearestDist = radius * radius;
+
             Vector3f base;
             Vector3f edge;
             float t;
-            
+
             // Edge AB
             base = a;
-            edge = ab;        
-    
+            edge = ab;
+
             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);
                 float distSq = Q.dot(Q); // distance squared to origin
-                if( distSq < nearestDist ) {
+                if (distSq < nearestDist) {
                     nearestPt = Q;
                     nearestDist = distSq;
                 }
             }
-            
+
             // Edge AC
             base = a;
             edge = ac;
-    
+
             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);
                 float distSq = Q.dot(Q); // distance squared to origin
-                if( distSq < nearestDist ) {
+                if (distSq < nearestDist) {
                     nearestPt = Q;
                     nearestDist = distSq;
                 }
             }
-            
+
             // Edge BC
             base = b;
-            Vector3f bc = c.subtract(b); 
-            edge = bc; 
-    
+            Vector3f bc = c.subtract(b);
+            edge = bc;
+
             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);
                 float distSq = Q.dot(Q); // distance squared to origin
-                if( distSq < nearestDist ) {
+                if (distSq < nearestDist) {
                     nearestPt = Q;
                     nearestDist = distSq;
                 }
             }
-    
+
             // If we have a point at all then it is going to be
             // closer than any vertex to center distance... so we're
-            // done.       
-            if( nearestPt != null ) {
+            // done.
+            if (nearestPt != null) {
                 // We have a hit
                 float dist = FastMath.sqrt(nearestDist);
                 Vector3f cn = nearestPt.divide(-dist);
-                
-                CollisionResult r = new CollisionResult();                                
+
+                CollisionResult r = new CollisionResult();
                 r.setDistance(dist - radius);
                 r.setContactNormal(cn);
                 r.setContactPoint(nearestPt.add(center));
                 results.addCollision(r);
-                
-                return 1;              
+
+                return 1;
             }
- 
+
             // Finally, check each of the triangle corners.
-            
+
             // Vert A
             base = a;
             t = base.dot(base); // distance squared to origin
-            if( t < nearestDist ) {
+            if (t < nearestDist) {
                 nearestDist = t;
                 nearestPt = base;
             }
-            
+
             // Vert B
             base = b;
             t = base.dot(base); // distance squared to origin
-            if( t < nearestDist ) {
+            if (t < nearestDist) {
                 nearestDist = t;
                 nearestPt = base;
             }
-    
+
             // Vert C
             base = c;
             t = base.dot(base); // distance squared to origin
-            if( t < nearestDist ) {
+            if (t < nearestDist) {
                 nearestDist = t;
                 nearestPt = base;
             }
-    
-            if( nearestPt != null ) {
+
+            if (nearestPt != null) {
                 // We have a hit
                 float dist = FastMath.sqrt(nearestDist);
                 Vector3f cn = nearestPt.divide(-dist);
-                
-                CollisionResult r = new CollisionResult();                                
+
+                CollisionResult r = new CollisionResult();
                 r.setDistance(dist - radius);
                 r.setContactNormal(cn);
                 r.setContactPoint(nearestPt.add(center));
                 results.addCollision(r);
-                
-                return 1;              
+
+                return 1;
             }
-            
-            // Nothing hit... oh, well 
+
+            // Nothing hit... oh, well
             return 0;
         } finally {
             tvars.release();
         }
     }
-    
+
     @Override
     public int collideWith(Collidable other, CollisionResults results) {
         if (other instanceof Ray) {
             Ray ray = (Ray) other;
             return collideWithRay(ray, results);
-        } else if (other instanceof Triangle){
+        } else if (other instanceof Triangle) {
             Triangle t = (Triangle) other;
             return collideWithTri(t, results);
         } else if (other instanceof BoundingVolume) {
-            if (intersects((BoundingVolume)other)) {
+            if (intersects((BoundingVolume) other)) {
                 CollisionResult result = new CollisionResult();
                 results.addCollision(result);
                 return 1;
@@ -1026,16 +1026,15 @@ public class BoundingSphere extends BoundingVolume {
         if (other instanceof Ray) {
             Ray ray = (Ray) other;
             return collideWithRay(ray);
-        } else if (other instanceof Triangle){
+        } else if (other instanceof Triangle) {
             return super.collideWith(other);
         } else if (other instanceof BoundingVolume) {
-            return intersects((BoundingVolume)other) ? 1 : 0;
+            return intersects((BoundingVolume) other) ? 1 : 0;
         } else {
             throw new UnsupportedCollisionException();
         }
     }
 
-    
     @Override
     public boolean contains(Vector3f point) {
         return center.distanceSquared(point) < (getRadius() * getRadius());
@@ -1075,4 +1074,4 @@ public class BoundingSphere extends BoundingVolume {
     public float getVolume() {
         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
  * between bounding volumes and triangles.
- * 
+ *
  * @author Kirill
  */
 public final class Intersection {
@@ -62,36 +62,40 @@ public final class Intersection {
             vars.release();
         }
     }
-    
+
     public static boolean intersect(BoundingBox bbox, Vector3f center, float radius) {
         assert Vector3f.isValidVector(center) && Vector3f.isValidVector(bbox.center);
 
-        // Arvo's algorithm 
+        // Arvo's algorithm
         float distSqr = radius * radius;
-        
+
         float minX = bbox.center.x - bbox.xExtent;
         float maxX = bbox.center.x + bbox.xExtent;
-        
+
         float minY = bbox.center.y - bbox.yExtent;
         float maxY = bbox.center.y + bbox.yExtent;
-        
+
         float minZ = 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;
     }
-    
+
     private static final void findMinMax(float x0, float x1, float x2, Vector3f minMax) {
         minMax.set(x0, x0, 0);
         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--) {
             if (camera.getWorldPlane(i).pseudoDistance(center) <= -radius) {
                 return false;
@@ -145,7 +149,6 @@ public final class Intersection {
 
         TempVars vars = TempVars.get();
 
-
         Vector3f tmp0 = vars.vect1,
                 tmp1 = vars.vect2,
                 tmp2 = vars.vect3;
@@ -179,8 +182,6 @@ public final class Intersection {
         float fey = FastMath.abs(e0.y);
         float fez = FastMath.abs(e0.z);
 
-
-
         //AXISTEST_X01(e0[Z], e0[Y], fez, fey);
         p0 = e0.z * tmp0.y - e0.y * tmp0.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
         //  the triangle against the AABB
 
-
         Vector3f minMax = vars.vect7;
 
         // 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) {
             cinematicEvent.initEvent(app, this);
         }
-        if(!cameras.isEmpty()){
-            for(CameraNode n : cameras.values()){
+        if (!cameras.isEmpty()) {
+            for (CameraNode n : cameras.values()) {
                 n.setCamera(app.getCamera());
             }
         }
@@ -302,7 +302,7 @@ public class Cinematic extends AbstractCinematicEvent implements AppState {
      *
      * @param id the desired ID
      */
-    protected void setId( String id ) {
+    protected void setId(String id) {
         this.id = id;
     }
 
@@ -405,7 +405,7 @@ public class Cinematic extends AbstractCinematicEvent implements AppState {
         super.setTime(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
         for (int i = 0; i <= keyFrameIndex; i++) {
             KeyFrame keyFrame = timeLine.get(i);
@@ -697,8 +697,8 @@ public class Cinematic extends AbstractCinematicEvent implements AppState {
      */
     public void setScene(Node scene) {
         this.scene = scene;
-        if(!cameras.isEmpty()){
-            for(CameraNode n : cameras.values()){
+        if (!cameras.isEmpty()) {
+            for (CameraNode n : cameras.values()) {
                 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 KeyFrame(){
-        
+    public KeyFrame() {
     }
-    
+
     List<CinematicEvent> cinematicEvents = new ArrayList<>();
     private int index;
 
@@ -64,8 +63,8 @@ public class KeyFrame implements Savable {
         }
         return cinematicEvents;
     }
-    
-    public boolean isEmpty(){
+
+    public boolean isEmpty() {
         return cinematicEvents.isEmpty();
     }
 
@@ -81,7 +80,7 @@ public class KeyFrame implements Savable {
     public void read(JmeImporter im) throws IOException {
         InputCapsule ic = im.getCapsule(this);
         cinematicEvents = ic.readSavableArrayList("cinematicEvents", null);
-        index=ic.readInt("index", 0);
+        index = ic.readInt("index", 0);
     }
 
     public int getIndex() {
@@ -91,6 +90,4 @@ public class KeyFrame implements Savable {
     public void setIndex(int 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.
      * @param time the time since the animation started
      * @param control the control over the moving spatial
@@ -87,7 +87,7 @@ public class MotionPath implements Savable {
         traveledDistance = time * (getLength() / control.getInitialDuration());
 
         //getting waypoint index and current value from new traveled distance
-        v = getWayPointIndexForDistance(traveledDistance,v);
+        v = getWayPointIndexForDistance(traveledDistance, v);
 
         //setting values
         control.setCurrentWayPoint((int) v.x);
@@ -108,7 +108,7 @@ public class MotionPath implements Savable {
 
     public void checkWayPoint(MotionEvent control, float tpf) {
         //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.getCurrentValue() >= 0f && control.getCurrentValue() < epsilon) {
                 triggerWayPointReach(control.getCurrentWayPoint(), control);
@@ -175,7 +175,6 @@ public class MotionPath implements Savable {
     public void read(JmeImporter im) throws IOException {
         InputCapsule in = im.getCapsule(this);
         spline = (Spline) in.readSavable("spline", null);
-
     }
 
     /**
@@ -187,7 +186,7 @@ public class MotionPath implements Savable {
      */
     public Vector2f getWayPointIndexForDistance(float distance, Vector2f store) {
         float sum = 0;
-        if(spline.getTotalLength() == 0){
+        if (spline.getTotalLength() == 0) {
             store.set(0, 0);
             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) {
         removeKeyFrame(getKeyFrameIndexFromTime(time));
@@ -91,9 +89,9 @@ public class TimeLine extends HashMap<Integer, KeyFrame> implements Savable {
     public int getKeyFrameIndexFromTime(float time) {
         return Math.round(time * keyFramesPerSeconds);
     }
-    
+
     public float getKeyFrameTime(KeyFrame keyFrame) {
-        return keyFrame.getIndex()/(float)keyFramesPerSeconds;
+        return keyFrame.getIndex() / (float) keyFramesPerSeconds;
     }
 
     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.
  * 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.
  * @author Nehon
  */
@@ -60,7 +60,7 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
     protected float speed = 1;
     protected float time = 0;
     protected boolean resuming = false;
-    
+
     /**
      * The list of listeners.
      */
@@ -100,15 +100,15 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
         this.initialDuration = initialDuration;
         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),
      * or when it was force-stopped during playback.
      * By default, this method just calls regular stop().
      */
     @Override
-    public void forceStop(){
+    public void forceStop() {
         stop();
     }
 
@@ -117,7 +117,7 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
      */
     @Override
     public void play() {
-        onPlay();        
+        onPlay();
         playState = PlayState.Playing;
         if (listeners != null) {
             for (int i = 0; i < listeners.size(); i++) {
@@ -139,17 +139,17 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
     @Override
     public void internalUpdate(float tpf) {
         if (playState == PlayState.Playing) {
-            time = time + (tpf * speed);         
+            time = time + (tpf * speed);
             onUpdate(tpf);
             if (time >= initialDuration && loopMode == LoopMode.DontLoop) {
                 stop();
-            } else if(time >= initialDuration && loopMode == LoopMode.Loop){
+            } else if (time >= initialDuration && loopMode == LoopMode.Loop) {
                 setTime(0);
-            }else{
+            } else {
                 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).
      * @param tpf time per frame
      */
     protected abstract void onUpdate(float tpf);
 
     /**
-     * Stops the animation. 
+     * Stops the animation.
      * Next time when play() is called, the animation starts from the beginning.
      */
     @Override
@@ -322,7 +322,7 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
 
     /**
      * Returns the list of CinematicEventListeners added to this event.
-     * @return 
+     * @return
      */
     private List<CinematicEventListener> getListeners() {
         if (listeners == null) {
@@ -356,7 +356,7 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
      */
     @Override
     public void setTime(float time) {
-        this.time = time ;
+        this.time = time;
     }
 
     /**
@@ -368,8 +368,6 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
     }
 
     @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
 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
     //For backward compatibility, if the model is null it's looked up into the scene
     public static final int SAVABLE_VERSION = 2;
@@ -79,7 +79,7 @@ public class AnimationEvent extends AbstractCinematicEvent {
     protected AnimationEvent() {
         super();
     }
-    
+
     /**
      * creates an animation event
      *
@@ -202,7 +202,7 @@ public class AnimationEvent extends AbstractCinematicEvent {
      * @param loopMode the loopMode
      * @see LoopMode
      * @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) {
         super(loopMode);
@@ -219,7 +219,7 @@ public class AnimationEvent extends AbstractCinematicEvent {
      * @param model the model on which the animation will be played
      * @param animationName the name of the animation to play
      * @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) {
         this.model = model;
@@ -228,7 +228,7 @@ public class AnimationEvent extends AbstractCinematicEvent {
         initialDuration = model.getControl(AnimControl.class).getAnimationLength(animationName);
         this.channelIndex = channelIndex;
     }
-    
+
     /**
      * creates an animation event
      *
@@ -237,7 +237,7 @@ public class AnimationEvent extends AbstractCinematicEvent {
      * @param loopMode the desired mode (Loop/DontLoop/Cycle)
      * @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
-     * 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) {
         this.model = model;
@@ -256,7 +256,7 @@ public class AnimationEvent extends AbstractCinematicEvent {
      * @param animationName the name of the animation to play
      * @param initialDuration the initial duration of the event
      * @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) {
         super(initialDuration);
@@ -275,7 +275,7 @@ public class AnimationEvent extends AbstractCinematicEvent {
      * @param loopMode the loopMode
      * @see LoopMode
      * @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) {
         super(initialDuration, loopMode);
@@ -295,8 +295,9 @@ public class AnimationEvent extends AbstractCinematicEvent {
             if (s == null) {
                 s = new HashMap<Integer, AnimChannel>();
                 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);
             }
@@ -311,9 +312,9 @@ public class AnimationEvent extends AbstractCinematicEvent {
                     model = cinematic.getScene().getChild(modelName);
                 }
                 if (model != null) {
-                    if(cinematic.getScene() != null){
+                    if (cinematic.getScene() != null) {
                         Spatial sceneModel = cinematic.getScene().getChild(model.getName());
-                        if(sceneModel != null){
+                        if (sceneModel != null) {
                             Node parent = sceneModel.getParent();
                             parent.detachChild(sceneModel);
                             sceneModel = model;
@@ -322,15 +323,14 @@ public class AnimationEvent extends AbstractCinematicEvent {
                             cinematic.getScene().attachChild(model);
                         }
                     }
-                    
+
                     channel = model.getControl(AnimControl.class).createChannel();
                     map.put(channelIndex, channel);
                 } else {
                     //it's an error
                     throw new UnsupportedOperationException("model should not be null");
                 }
-            } 
-
+            }
         }
     }
 
@@ -365,7 +365,6 @@ public class AnimationEvent extends AbstractCinematicEvent {
             channel.setTime(t);
             channel.getControl().update(0);
         }
-
     }
 
     @Override
@@ -429,7 +428,6 @@ public class AnimationEvent extends AbstractCinematicEvent {
         oc.write(animationName, "animationName", "");
         oc.write(blendTime, "blendTime", 0f);
         oc.write(channelIndex, "channelIndex", 0);
-
     }
 
     @Override
@@ -437,14 +435,14 @@ public class AnimationEvent extends AbstractCinematicEvent {
         super.read(im);
         InputCapsule ic = im.getCapsule(this);
 //        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
-        //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
         //This brings a reflection about the cinematic being an appstate,
         //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.
         //for now as nobody probably ever saved a cinematic, this is not a critical issue
         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)
  */
-public class CameraEvent extends AbstractCinematicEvent{
+public class CameraEvent extends AbstractCinematicEvent {
 
     private String cameraName;
     private Cinematic cinematic;
@@ -56,27 +56,26 @@ public class CameraEvent extends AbstractCinematicEvent{
         this.cameraName = cameraName;
     }
 
-    public CameraEvent(){
-        
+    public CameraEvent() {
     }
-    
-    public CameraEvent(Cinematic parentEvent, String cameraName){
+
+    public CameraEvent(Cinematic parentEvent, String cameraName) {
         this.cinematic = parentEvent;
         this.cameraName = cameraName;
     }
-    
-     @Override
+
+    @Override
     public void initEvent(Application app, Cinematic cinematic) {
         super.initEvent(app, cinematic);
         this.cinematic = cinematic;
     }
-    
+
     @Override
     public void play() {
         super.play();
         stop();
     }
-    
+
     @Override
     public void onPlay() {
         cinematic.setActiveCamera(cameraName);
@@ -110,9 +109,7 @@ public class CameraEvent extends AbstractCinematicEvent{
     public void setCinematic(Cinematic cinematic) {
         this.cinematic = cinematic;
     }
-    
-    
-    
+
     /**
      * 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() {
         super();
     }
-    
+
     /**
      * 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);
             if (loopMode == LoopMode.Loop && time < 0) {
                 time = initialDuration;
-            }            
+            }
             if ((time >= initialDuration || time < 0) && loopMode == LoopMode.DontLoop) {
                 if (time >= initialDuration) {
                     path.triggerWayPointReach(path.getNbWayPoints() - 1, this);
@@ -187,9 +187,9 @@ public class MotionEvent extends AbstractCinematicEvent implements Control, JmeC
                 stop();
             } else {
                 time = AnimationUtils.clampWrapTime(time, initialDuration, loopMode);
-                if(time<0){
-                    speed = - speed;
-                    time = - time;
+                if (time < 0) {
+                    speed = -speed;
+                    time = -time;
                 }
                 onUpdate(tpf);
             }
@@ -290,7 +290,7 @@ public class MotionEvent extends AbstractCinematicEvent implements Control, JmeC
         throw new UnsupportedOperationException();
     }
 
-    @Override   
+    @Override
     public Object jmeClone() {
         MotionEvent control = new MotionEvent();
         control.path = path;
@@ -308,13 +308,13 @@ public class MotionEvent extends AbstractCinematicEvent implements Control, JmeC
         control.spatial = spatial;
 
         return control;
-    }     
+    }
 
-    @Override   
-    public void cloneFields( Cloner cloner, Object original ) { 
+    @Override
+    public void cloneFields(Cloner cloner, Object original) {
         this.spatial = cloner.clone(spatial);
     }
-         
+
     @Override
     public void onPlay() {
         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.
-     * Use MotionEvent#setDirection((Vector3f direction,Vector3f upVector) if 
+     * Use MotionEvent#setDirection((Vector3f direction,Vector3f upVector) if
      * you want a custom up vector.
      * This method is used by the motion path.
      *
      * @param direction the desired forward direction (not null, unaffected)
      */
     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.
      * 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 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.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
      * @param path the path to an audio file (ie : "Sounds/mySound.wav")
      * @param stream true to make the audio data streamed
-     * @param loopMode the loopMode 
+     * @param loopMode the loopMode
      * @see LoopMode
      */
     public SoundEvent(String path, boolean stream, LoopMode loopMode) {
@@ -95,12 +95,12 @@ public class SoundEvent extends AbstractCinematicEvent {
         this.stream = stream;
     }
 
-     /**
+    /**
      * creates a sound track from the given resource path
      * @param path the path to an audio file (ie : "Sounds/mySound.wav")
      * @param stream true to make the audio data streamed
      * @param initialDuration the initial duration of the event
-     * @param loopMode the loopMode 
+     * @param loopMode the loopMode
      * @see LoopMode
      */
     public SoundEvent(String path, boolean stream, float initialDuration, LoopMode loopMode) {
@@ -109,9 +109,9 @@ public class SoundEvent extends AbstractCinematicEvent {
         this.stream = stream;
     }
 
-     /**
+    /**
      * 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
      */
     public SoundEvent(String path, float initialDuration) {
@@ -119,10 +119,10 @@ public class SoundEvent extends AbstractCinematicEvent {
         this.path = 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
      */
     public SoundEvent(String path, LoopMode loopMode) {
@@ -130,11 +130,11 @@ public class SoundEvent extends AbstractCinematicEvent {
         this.path = 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 loopMode the loopMode 
+     * @param loopMode the loopMode
      * @see LoopMode
      */
     public SoundEvent(String path, float initialDuration, LoopMode loopMode) {
@@ -162,9 +162,9 @@ public class SoundEvent extends AbstractCinematicEvent {
     public void setTime(float time) {
         super.setTime(time);
         //can occur on rewind
-        if (time < 0f) {            
+        if (time < 0f) {
             stop();
-        }else{
+        } else {
             audioNode.setTimeOffset(time);
         }
     }
@@ -177,7 +177,6 @@ public class SoundEvent extends AbstractCinematicEvent {
     @Override
     public void onStop() {
         audioNode.stop();
-
     }
 
     @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
      */
     public AudioNode getAudioNode() {
@@ -225,6 +224,5 @@ public class SoundEvent extends AbstractCinematicEvent {
         InputCapsule ic = im.getCapsule(this);
         path = ic.readString("path", "");
         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;
     }
 
-    public CollisionResult(){
+    public CollisionResult() {
     }
 
-    public void setGeometry(Geometry geom){
+    public void setGeometry(Geometry geom) {
         this.geometry = geom;
     }
 
-    public void setContactNormal(Vector3f norm){
+    public void setContactNormal(Vector3f norm) {
         this.contactNormal = norm;
     }
 
-    public void setContactPoint(Vector3f point){
+    public void setContactPoint(Vector3f point) {
         this.contactPoint = point;
     }
 
-    public void setDistance(float dist){
+    public void setDistance(float dist) {
         this.distance = dist;
     }
 
-    public void setTriangleIndex(int index){
+    public void setTriangleIndex(int index) {
         this.triangleIndex = index;
     }
 
-    public Triangle getTriangle(Triangle store){
+    public Triangle getTriangle(Triangle store) {
         if (store == null)
             store = new Triangle();
 
@@ -104,8 +104,8 @@ public class CollisionResult implements Comparable<CollisionResult> {
 
     @Override
     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);
     }

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

@@ -37,9 +37,9 @@ import java.util.Iterator;
 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}.
- * 
+ *
  * @author Kirill Vainer
  */
 public class CollisionResults implements Iterable<CollisionResult> {
@@ -50,7 +50,7 @@ public class CollisionResults implements Iterable<CollisionResult> {
     /**
      * Clears all collision results added to this list
      */
-    public void clear(){
+    public void clear() {
         if (results != null) {
             results.clear();
         }
@@ -58,17 +58,17 @@ public class CollisionResults implements Iterable<CollisionResult> {
 
     /**
      * Iterator for iterating over the collision results.
-     * 
+     *
      * @return the iterator
      */
     @Override
     public Iterator<CollisionResult> iterator() {
         if (results == null) {
-            List<CollisionResult> dumbCompiler = Collections.emptyList();            
+            List<CollisionResult> dumbCompiler = Collections.emptyList();
             return dumbCompiler.iterator();
         }
-        
-        if (!sorted){
+
+        if (!sorted) {
             Collections.sort(results);
             sorted = true;
         }
@@ -76,7 +76,7 @@ public class CollisionResults implements Iterable<CollisionResult> {
         return results.iterator();
     }
 
-    public void addCollision(CollisionResult result){
+    public void addCollision(CollisionResult result) {
         if (results == null) {
             results = new ArrayList<CollisionResult>();
         }
@@ -84,18 +84,18 @@ public class CollisionResults implements Iterable<CollisionResult> {
         sorted = false;
     }
 
-    public int size(){
+    public int size() {
         if (results == null) {
             return 0;
         }
         return results.size();
     }
 
-    public CollisionResult getClosestCollision(){
+    public CollisionResult getClosestCollision() {
         if (results == null || size() == 0)
             return null;
 
-        if (!sorted){
+        if (!sorted) {
             Collections.sort(results);
             sorted = true;
         }
@@ -103,24 +103,24 @@ public class CollisionResults implements Iterable<CollisionResult> {
         return results.get(0);
     }
 
-    public CollisionResult getFarthestCollision(){
+    public CollisionResult getFarthestCollision() {
         if (results == null || size() == 0)
             return null;
 
-        if (!sorted){
+        if (!sorted) {
             Collections.sort(results);
             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) {
             throw new IndexOutOfBoundsException("Index: " + index + ", Size: 0");
         }
-        
-        if (!sorted){
+
+        if (!sorted) {
             Collections.sort(results);
             sorted = true;
         }
@@ -134,7 +134,7 @@ public class CollisionResults implements Iterable<CollisionResult> {
      * @param index the zero-based index of the desired result
      * @return the pre-existing instance
      */
-    public CollisionResult getCollisionDirect(int index){
+    public CollisionResult getCollisionDirect(int index) {
         if (results == null) {
             throw new IndexOutOfBoundsException("Index: " + index + ", Size: 0");
         }
@@ -142,19 +142,18 @@ public class CollisionResults implements Iterable<CollisionResult> {
     }
 
     @Override
-    public String toString(){
+    public String toString() {
         StringBuilder sb = new StringBuilder();
         sb.append("CollisionResults[");
         if (results != null) {
-            for (CollisionResult result : results){
+            for (CollisionResult result : results) {
                 sb.append(result).append(", ");
             }
             if (results.size() > 0)
-                sb.setLength(sb.length()-2);
-        }                
+                sb.setLength(sb.length() - 2);
+        }
 
         sb.append("]");
         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) {
         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.invDim.set(1,1,1).divideLocal(dimension);
+        this.invDim.set(1, 1, 1).divideLocal(dimension);
     }
 
     public Vector3f getVelocity() {
@@ -106,16 +106,17 @@ class SweepSphere implements Collidable {
     }
 
     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) {
         float determinant = b * b - 4f * a * c;
-        if (determinant < 0){
+        if (determinant < 0) {
             return Float.NaN;
         }
 
@@ -123,17 +124,17 @@ class SweepSphere implements Collidable {
         float r1 = (-b - sqrtDet) / (2f * a);
         float r2 = (-b + sqrtDet) / (2f * a);
 
-        if (r1 > r2){
+        if (r1 > r2) {
             float temp = r2;
             r2 = r1;
             r1 = temp;
         }
 
-        if (r1 > 0 && r1 < maxR){
+        if (r1 > 0 && r1 < maxR) {
             return r1;
         }
 
-        if (r2 > 0 && r2 < maxR){
+        if (r2 > 0 && r2 < maxR) {
             return r2;
         }
 
@@ -159,7 +160,7 @@ class SweepSphere implements Collidable {
 //        float newT = getLowestRoot(A, B, C, Float.MAX_VALUE);
 //        if (newT > 1.0f)
 //            newT = Float.NaN;
-        
+
         return newT;
     }
 
@@ -184,9 +185,9 @@ class SweepSphere implements Collidable {
                 - (2f * EdotV * EdotB);
         float c = (edgeSquared * (1f - baseSquared)) + EdotB * EdotB;
         float newT = getLowestRoot(a, b, c, t);
-        if (!Float.isNaN(newT)){
+        if (!Float.isNaN(newT)) {
             float f = (EdotV * newT - EdotB) / edgeSquared;
-            if (f >= 0f && f < 1f){
+            if (f >= 0f && f < 1f) {
                 store.scaleAdd(f, edge, l1);
                 return newT;
             }
@@ -194,7 +195,7 @@ class SweepSphere implements Collidable {
         return Float.NaN;
     }
 
-    private CollisionResult collideWithTriangle(AbstractTriangle tri){
+    private CollisionResult collideWithTriangle(AbstractTriangle tri) {
         // scale scaledTriangle based on dimension
         scaledTri.get1().set(tri.get1()).multLocal(invDim);
         scaledTri.get2().set(tri.get2()).multLocal(invDim);
@@ -216,12 +217,12 @@ class SweepSphere implements Collidable {
         boolean embedded = false;
 
         float signedDistanceToPlane = triPlane.pseudoDistance(sCenter);
-        if (normalDotVelocity == 0.0f){
+        if (normalDotVelocity == 0.0f) {
             // we are travelling exactly parallel to the plane
-            if (FastMath.abs(signedDistanceToPlane) >= 1.0f){
+            if (FastMath.abs(signedDistanceToPlane) >= 1.0f) {
                 // no collision possible
                 return null;
-            }else{
+            } else {
                 // we are embedded
                 t0 = 0;
                 t1 = 1;
@@ -229,17 +230,17 @@ class SweepSphere implements Collidable {
                 System.out.println("EMBEDDED");
                 return null;
             }
-        }else{
+        } else {
             t0 = (-1f - signedDistanceToPlane) / normalDotVelocity;
-            t1 = ( 1f - signedDistanceToPlane) / normalDotVelocity;
+            t1 = (1f - signedDistanceToPlane) / normalDotVelocity;
 
-            if (t0 > t1){
+            if (t0 > t1) {
                 float tf = t1;
                 t1 = t0;
                 t0 = tf;
             }
 
-            if (t0 > 1.0f || t1 < 0.0f){
+            if (t0 > 1.0f || t1 < 0.0f) {
                 // collision is out of this sVelocity range
                 return null;
             }
@@ -254,35 +255,35 @@ class SweepSphere implements Collidable {
 
         Vector3f contactPoint = 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());
-                
-                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();
@@ -294,7 +295,7 @@ class SweepSphere implements Collidable {
         // vertex 1
         float newT;
         newT = collideWithVertex(sCenter, sVelocity, velocitySquared, v1, minT);
-        if (!Float.isNaN(newT)){
+        if (!Float.isNaN(newT)) {
             minT = newT;
             contactPoint.set(v1);
             foundCollision = true;
@@ -302,7 +303,7 @@ class SweepSphere implements Collidable {
 
         // vertex 2
         newT = collideWithVertex(sCenter, sVelocity, velocitySquared, v2, minT);
-        if (!Float.isNaN(newT)){
+        if (!Float.isNaN(newT)) {
             minT = newT;
             contactPoint.set(v2);
             foundCollision = true;
@@ -310,7 +311,7 @@ class SweepSphere implements Collidable {
 
         // vertex 3
         newT = collideWithVertex(sCenter, sVelocity, velocitySquared, v3, minT);
-        if (!Float.isNaN(newT)){
+        if (!Float.isNaN(newT)) {
             minT = newT;
             contactPoint.set(v3);
             foundCollision = true;
@@ -318,26 +319,26 @@ class SweepSphere implements Collidable {
 
         // edge 1-2
         newT = collideWithSegment(sCenter, sVelocity, velocitySquared, v1, v2, minT, contactPoint);
-        if (!Float.isNaN(newT)){
+        if (!Float.isNaN(newT)) {
             minT = newT;
             foundCollision = true;
         }
 
         // edge 2-3
         newT = collideWithSegment(sCenter, sVelocity, velocitySquared, v2, v3, minT, contactPoint);
-        if (!Float.isNaN(newT)){
+        if (!Float.isNaN(newT)) {
             minT = newT;
             foundCollision = true;
         }
 
         // edge 3-1
         newT = collideWithSegment(sCenter, sVelocity, velocitySquared, v3, v1, minT, contactPoint);
-        if (!Float.isNaN(newT)){
+        if (!Float.isNaN(newT)) {
             minT = newT;
             foundCollision = true;
         }
 
-        if (foundCollision){
+        if (foundCollision) {
             // compute contact normal based on minimum t
             contactPoint.multLocal(dimension);
             contactNormal.set(velocity).multLocal(t0);
@@ -350,12 +351,12 @@ class SweepSphere implements Collidable {
             result.setDistance(minT * velocity.length());
 
             return result;
-        }else{
+        } else {
             return null;
         }
     }
 
-    public CollisionResult collideWithSweepSphere(SweepSphere other){
+    public CollisionResult collideWithSweepSphere(SweepSphere other) {
         temp1.set(velocity).subtractLocal(other.velocity);
         temp2.set(center).subtractLocal(other.center);
         temp3.set(dimension).addLocal(other.dimension);
@@ -387,11 +388,11 @@ class SweepSphere implements Collidable {
         // temp3 is contact point
         temp3.set(temp2).multLocal(dimension).addLocal(temp1);
         result.setContactPoint(new Vector3f(temp3));
-        
+
         return result;
     }
 
-    public static void main(String[] args){
+    public static void main(String[] args) {
         SweepSphere ss = new SweepSphere();
         ss.setCenter(Vector3f.ZERO);
         ss.setDimension(1);
@@ -404,37 +405,36 @@ class SweepSphere implements Collidable {
 
         CollisionResults cr = new CollisionResults();
         ss.collideWith(ss2, cr);
-        if (cr.size() > 0){
+        if (cr.size() > 0) {
             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
     public int collideWith(Collidable other, CollisionResults results)
             throws UnsupportedCollisionException {
-        if (other instanceof AbstractTriangle){
+        if (other instanceof AbstractTriangle) {
             AbstractTriangle tri = (AbstractTriangle) other;
             CollisionResult result = collideWithTriangle(tri);
-            if (result != null){
+            if (result != null) {
                 results.addCollision(result);
                 return 1;
             }
             return 0;
-        }else if (other instanceof SweepSphere){
+        } else if (other instanceof SweepSphere) {
             SweepSphere sph = (SweepSphere) other;
 
             CollisionResult result = collideWithSweepSphere(sph);
-            if (result != null){
+            if (result != null) {
                 results.addCollision(result);
                 return 1;
             }
             return 0;
-        }else{
+        } else {
             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 float[] pointData;
     private int[] triIndices;
-    
+
     // private transient CollisionResults boundResults = new CollisionResults();
     private transient float[] bihSwapTmp;
-    
+
     private void initTriList(FloatBuffer vb, IndexBuffer ib) {
         pointData = new float[numTris * 3 * 3];
         int p = 0;
@@ -112,12 +112,12 @@ public class BIHTree implements CollisionData {
         bihSwapTmp = new float[9];
 
         VertexBuffer vBuffer = mesh.getBuffer(Type.Position);
-        if(vBuffer == null){
+        if (vBuffer == null) {
             throw new IllegalArgumentException("A mesh should at least contain a Position buffer");
-        }        
+        }
         IndexBuffer ib = mesh.getIndexBuffer();
         FloatBuffer vb = (FloatBuffer) vBuffer.getData();
-        
+
         if (ib == null) {
             ib = new VirtualIndexBuffer(mesh.getVertexCount(), mesh.getMode());
         } else if (mesh.getMode() != Mode.Triangles) {
@@ -326,7 +326,7 @@ public class BIHTree implements CollisionData {
             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) {
             //Only right
             BoundingBox rbbox = new BoundingBox(currentBox);
@@ -338,21 +338,21 @@ public class BIHTree implements CollisionData {
             setMinMax(lbbox, false, axis, split);
             return createNode(l, r, lbbox, depth + 1);
         } else {
-            //Build the node
+            // Build the node
             BIHNode node = new BIHNode(axis);
 
-            //Left child
+            // Left child
             BoundingBox lbbox = new BoundingBox(currentBox);
             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.setLeftChild(createNode(l, max(l, pivot - 1), lbbox, depth + 1)); //Recursive call
 
-            //Right Child
+            // Right Child
             BoundingBox rbbox = new BoundingBox(currentBox);
             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.setRightChild(createNode(pivot, r, rbbox, depth + 1)); //Recursive call
 
@@ -421,7 +421,7 @@ public class BIHTree implements CollisionData {
 
                 if (r.getLimit() < Float.POSITIVE_INFINITY) {
                     tMax = Math.min(tMax, r.getLimit());
-                    if (tMin > tMax){
+                    if (tMin > tMax) {
                         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);
     }
 
-    public Vector3f get1(){
+    public Vector3f get1() {
         return pointa;
     }
 
-    public Vector3f get2(){
+    public Vector3f get2() {
         return pointb;
     }
 
-    public Vector3f get3(){
+    public Vector3f get3() {
         return pointc;
     }
 
@@ -65,40 +65,55 @@ public final class BIHTriangle {
         return center;
     }
 
-    public Vector3f getNormal(){
+    public Vector3f getNormal() {
         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();
         return normal;
     }
 
-    public float getExtreme(int axis, boolean left){
+    public float getExtreme(int axis, boolean left) {
         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)
                     return v1;
                 else
                     return v3;
-            }else{
+            } else {
                 if (v2 < v3)
                     return v2;
                 else
                     return v3;
             }
-        }else{
-            if (v1 > v2){
+        } else {
+            if (v1 > v2) {
                 if (v1 > v3)
                     return v1;
                 else
                     return v3;
-            }else{
+            } else {
                 if (v2 > v3)
                     return v2;
                 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;
 
-    public TriangleAxisComparator(int axis){
+    public TriangleAxisComparator(int axis) {
         this.axis = axis;
     }
 
@@ -47,11 +47,22 @@ public class TriangleAxisComparator implements Comparator<BIHTriangle> {
         float v1, v2;
         Vector3f c1 = o1.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)
             return 1;
@@ -60,4 +71,4 @@ public class TriangleAxisComparator implements Comparator<BIHTriangle> {
         else
             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() {
             try {
                 return super.clone();
-            } catch( CloneNotSupportedException e ) {
+            } catch (CloneNotSupportedException e) {
                 throw new RuntimeException("Error cloning", e);
             }
         }
 
         @Override
-        public void cloneFields( Cloner cloner, Object original ) {
+        public void cloneFields(Cloner cloner, Object original) {
             this.parentEmitter = cloner.clone(parentEmitter);
         }
 
@@ -179,7 +179,7 @@ public class ParticleEmitter extends Geometry {
 
     @Override
     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.
      */
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         super.cloneFields(cloner, original);
 
         this.shape = cloner.clone(shape);
@@ -418,7 +418,7 @@ public class ParticleEmitter extends Geometry {
      * Calling this method many times is not recommended.
      *
      * @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) {
         particles = new Particle[numParticles];
@@ -513,7 +513,7 @@ public class ParticleEmitter extends Geometry {
      * should have a random facing angle.
      *
      * @return true if every particle spawned
-     * should have a random facing angle.
+     *     should have a random facing angle.
      *
      * @see ParticleEmitter#setRandomAngle(boolean)
      */
@@ -526,7 +526,7 @@ public class ParticleEmitter extends Geometry {
      * should have a random facing angle.
      *
      * @param randomAngle if every particle spawned
-     * should have a random facing angle.
+     *     should have a random facing angle.
      */
     public void setRandomAngle(boolean randomAngle) {
         this.randomAngle = randomAngle;
@@ -537,7 +537,7 @@ public class ParticleEmitter extends Geometry {
      * image.
      *
      * @return True if every particle spawned should get a random
-     * image.
+     *     image.
      *
      * @see ParticleEmitter#setSelectRandomImage(boolean)
      */
@@ -559,7 +559,7 @@ public class ParticleEmitter extends Geometry {
      * the particle reaches its end of life.
      *
      * @param selectRandomImage True if every particle spawned should get a random
-     * image.
+     *     image.
      */
     public void setSelectRandomImage(boolean selectRandomImage) {
         this.selectRandomImage = selectRandomImage;
@@ -772,7 +772,7 @@ public class ParticleEmitter extends Geometry {
      * second.
      *
      * @return the number of particles to spawn per
-     * second.
+     *     second.
      *
      * @see ParticleEmitter#setParticlesPerSec(float)
      */
@@ -785,11 +785,12 @@ public class ParticleEmitter extends Geometry {
      * second.
      *
      * @param particlesPerSec the number of particles to spawn per
-     * second.
+     *     second.
      */
     public void setParticlesPerSec(float 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.
-     * 
+     *
      * @return the pre-existing velocity vector
      */
     @Deprecated
@@ -852,17 +853,17 @@ public class ParticleEmitter extends Geometry {
 
     /**
      * @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
-     * 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 #setGravity(com.jme3.math.Vector3f) 
+     * @see #setGravity(com.jme3.math.Vector3f)
      */
     @Deprecated
     public void setInitialVelocity(Vector3f initialVelocity) {
@@ -871,8 +872,8 @@ public class ParticleEmitter extends Geometry {
 
     /**
      * @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
      */
     @Deprecated
@@ -882,15 +883,15 @@ public class ParticleEmitter extends Geometry {
 
     /**
      * @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
-     * This method is deprecated.
-     * Use ParticleEmitter.getParticleInfluencer().setVelocityVariation(variation); instead.
+     *     This method is deprecated.
+     *     Use ParticleEmitter.getParticleInfluencer().setVelocityVariation(variation); instead.
      */
     @Deprecated
     public void setVelocityVariation(float variation) {
@@ -905,7 +906,8 @@ public class ParticleEmitter extends Geometry {
 
         Particle p = particles[idx];
         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);
@@ -946,7 +948,7 @@ public class ParticleEmitter extends Geometry {
 
     /**
      * Instantly emits available particles, up to num.
-     * 
+     *
      * @param num the maximum number of particles to emit
      */
     public void emitParticles(int num) {
@@ -970,8 +972,9 @@ public class ParticleEmitter extends Geometry {
             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);
@@ -998,7 +1001,7 @@ public class ParticleEmitter extends Geometry {
      * @param index The index of the particle to kill
      * @see #getParticles()
      */
-    public void killParticle(int index){
+    public void killParticle(int index) {
         freeParticle(index);
     }
 
@@ -1027,7 +1030,7 @@ public class ParticleEmitter extends Geometry {
         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
         p.velocity.x -= gravity.x * tpf;
         p.velocity.y -= gravity.y * tpf;
@@ -1089,17 +1092,17 @@ public class ParticleEmitter extends Geometry {
         float interval = 1f / particlesPerSec;
         float originalTpf = tpf;
         tpf += timeDifference;
-        while (tpf > interval){
+        while (tpf > interval) {
             tpf -= interval;
             Particle p = emitParticle(min, max);
-            if (p != null){
+            if (p != null) {
                 p.life -= tpf;
                 if (lastPos != null && isInWorldSpace()) {
                     p.position.interpolateLocal(lastPos, 1 - tpf / originalTpf);
                 }
-                if (p.life <= 0){
+                if (p.life <= 0) {
                     freeParticle(lastUsed);
-                }else{
+                } else {
                     updateParticle(p, tpf, min, max);
                 }
             }
@@ -1234,7 +1237,6 @@ public class ParticleEmitter extends Geometry {
         meshType = ic.readEnum("meshType", ParticleMesh.Type.class, ParticleMesh.Type.Triangle);
         int numParticles = ic.readInt("numParticles", 0);
 
-
         enabled = ic.readBoolean("enabled", true);
         particlesPerSec = ic.readFloat("particlesPerSec", 0);
         lowLife = ic.readFloat("lowLife", 0);
@@ -1250,7 +1252,7 @@ public class ParticleEmitter extends Geometry {
         worldSpace = ic.readBoolean("worldSpace", false);
         this.setIgnoreTransform(worldSpace);
         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);
         randomAngle = ic.readBoolean("randomAngle", false);
         rotateSpeed = ic.readFloat("rotateSpeed", 0);
@@ -1300,7 +1302,6 @@ public class ParticleEmitter extends Geometry {
             // loaded separately
             control = getControl(ParticleEmitterControl.class);
             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
         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);
         if (buf != null) {
             buf.updateData(pb);
@@ -74,7 +74,7 @@ public class ParticlePointMesh extends ParticleMesh {
 
         // set colors
         ByteBuffer cb = BufferUtils.createByteBuffer(numParticles * 4);
-        
+
         buf = getBuffer(VertexBuffer.Type.Color);
         if (buf != null) {
             buf.updateData(cb);
@@ -87,7 +87,7 @@ public class ParticlePointMesh extends ParticleMesh {
 
         // set sizes
         FloatBuffer sb = BufferUtils.createFloatBuffer(numParticles);
-        
+
         buf = getBuffer(VertexBuffer.Type.Size);
         if (buf != null) {
             buf.updateData(sb);
@@ -98,8 +98,8 @@ public class ParticlePointMesh extends ParticleMesh {
         }
 
         // set UV-scale
-        FloatBuffer tb = BufferUtils.createFloatBuffer(numParticles*4);
-        
+        FloatBuffer tb = BufferUtils.createFloatBuffer(numParticles * 4);
+
         buf = getBuffer(VertexBuffer.Type.TexCoord);
         if (buf != null) {
             buf.updateData(tb);
@@ -108,7 +108,7 @@ public class ParticlePointMesh extends ParticleMesh {
             tvb.setupData(Usage.Stream, 4, Format.Float, tb);
             setBuffer(tvb);
         }
-        
+
         updateCounts();
     }
 
@@ -133,9 +133,9 @@ public class ParticlePointMesh extends ParticleMesh {
         colors.rewind();
         sizes.rewind();
         texcoords.rewind();
-        for (int i = 0; i < particles.length; i++){
+        for (int i = 0; i < particles.length; i++) {
             Particle p = particles[i];
-            
+
             positions.put(p.position.x)
                      .put(p.position.y)
                      .put(p.position.z);
@@ -144,12 +144,12 @@ public class ParticlePointMesh extends ParticleMesh {
             colors.putInt(p.color.asIntABGR());
 
             int imgX = p.imageIndex % imagesX;
-            int imgY = p.imageIndex/imagesX;
+            int imgY = p.imageIndex / imagesX;
 
             float startX = ((float) imgX) / imagesX;
             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);
         }

+ 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);
             setBuffer(pvb);
         }
-        
+
         // set colors
         ByteBuffer cb = BufferUtils.createByteBuffer(numParticles * 4 * 4);
         buf = getBuffer(VertexBuffer.Type.Color);
@@ -88,14 +88,14 @@ public class ParticleTriMesh extends ParticleMesh {
         // set texcoords
         FloatBuffer tb = BufferUtils.createVector2Buffer(numParticles * 4);
         uniqueTexCoords = false;
-        for (int i = 0; i < numParticles; i++){
+        for (int i = 0; i < numParticles; i++) {
             tb.put(0f).put(1f);
             tb.put(1f).put(1f);
             tb.put(0f).put(0f);
             tb.put(1f).put(0f);
         }
         tb.flip();
-        
+
         buf = getBuffer(VertexBuffer.Type.TexCoord);
         if (buf != null) {
             buf.updateData(tb);
@@ -107,18 +107,18 @@ public class ParticleTriMesh extends ParticleMesh {
 
         // set indices
         ShortBuffer ib = BufferUtils.createShortBuffer(numParticles * 6);
-        for (int i = 0; i < numParticles; i++){
+        for (int i = 0; i < numParticles; i++) {
             int startIdx = (i * 4);
 
             // 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
-            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();
 
@@ -130,15 +130,15 @@ public class ParticleTriMesh extends ParticleMesh {
             ivb.setupData(Usage.Static, 3, Format.UnsignedShort, ib);
             setBuffer(ivb);
         }
-        
+
         updateCounts();
     }
-    
+
     @Override
     public void setImagesXY(int imagesX, int imagesY) {
         this.imagesX = imagesX;
         this.imagesY = imagesY;
-        if (imagesX != 1 || imagesY != 1){
+        if (imagesX != 1 || imagesY != 1) {
             uniqueTexCoords = true;
             getBuffer(VertexBuffer.Type.TexCoord).setUsage(Usage.Stream);
         }
@@ -162,9 +162,9 @@ public class ParticleTriMesh extends ParticleMesh {
         VertexBuffer tvb = getBuffer(VertexBuffer.Type.TexCoord);
         FloatBuffer texcoords = (FloatBuffer) tvb.getData();
 
-        Vector3f camUp   = cam.getUp();
+        Vector3f camUp = cam.getUp();
         Vector3f camLeft = cam.getLeft();
-        Vector3f camDir  = cam.getDirection();
+        Vector3f camDir = cam.getDirection();
 
         inverseRotation.multLocal(camUp);
         inverseRotation.multLocal(camLeft);
@@ -175,7 +175,7 @@ public class ParticleTriMesh extends ParticleMesh {
         Vector3f up = new Vector3f(),
                  left = new Vector3f();
 
-        if (!facingVelocity){
+        if (!facingVelocity) {
             up.set(camUp);
             left.set(camLeft);
         }
@@ -185,24 +185,24 @@ public class ParticleTriMesh extends ParticleMesh {
         colors.clear();
         texcoords.clear();
         Vector3f faceNormal = emitter.getFaceNormal();
-        
-        for (int i = 0; i < particles.length; i++){
+
+        for (int i = 0; i < particles.length; i++) {
             Particle p = particles[i];
             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);
                 continue;
             }
-            
-            if (facingVelocity){
+
+            if (facingVelocity) {
                 left.set(p.velocity).normalizeLocal();
                 camDir.cross(left, up);
                 up.multLocal(p.size);
                 left.multLocal(p.size);
-            }else if (faceNormal != null){
+            } else if (faceNormal != null) {
                 up.set(faceNormal).crossLocal(Vector3f.UNIT_X);
                 faceNormal.cross(up, left);
                 up.multLocal(p.size);
@@ -215,7 +215,7 @@ public class ParticleTriMesh extends ParticleMesh {
                     vars.quat1.multLocal(up);
                     vars.release();
                 }
-            }else if (p.angle != 0){
+            } else if (p.angle != 0) {
                 float cos = FastMath.cos(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.y = camLeft.y * -sin + camUp.y * cos;
                 up.z = camLeft.z * -sin + camUp.z * cos;
-            }else{
+            } else {
                 up.set(camUp);
                 left.set(camLeft);
                 up.multLocal(p.size);
@@ -249,14 +249,14 @@ public class ParticleTriMesh extends ParticleMesh {
                      .put(p.position.y - left.y - up.y)
                      .put(p.position.z - left.z - up.z);
 
-            if (uniqueTexCoords){
+            if (uniqueTexCoords) {
                 int imgX = p.imageIndex % imagesX;
                 int imgY = p.imageIndex / imagesX;
 
                 float startX = ((float) imgX) / imagesX;
                 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(endX).put(endY);
@@ -275,7 +275,7 @@ public class ParticleTriMesh extends ParticleMesh {
         colors.clear();
         if (!uniqueTexCoords)
             texcoords.clear();
-        else{
+        else {
             texcoords.clear();
             tvb.updateData(texcoords);
         }
@@ -284,5 +284,4 @@ public class ParticleTriMesh extends ParticleMesh {
         pvb.updateData(positions);
         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 {
         InputCapsule ic = im.getCapsule(this);
         // 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());
-        }else{
+        } else {
             initialVelocity = (Vector3f) ic.readSavable("initialVelocity", Vector3f.ZERO.clone());
         }
         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.
      */
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         this.initialVelocity = cloner.clone(initialVelocity);
 
         // 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.
      */
     @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.
      */
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         super.cloneFields(cloner, original);
 
         // Change in behavior: the old origin was not cloned -pspeed
         this.origin = cloner.clone(origin);
     }
 
-
     @Override
     public void write(JmeExporter ex) throws IOException {
         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.
      */
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         this.min = cloner.clone(min);
         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.
      */
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         this.vertices = cloner.clone(vertices);
         this.normals = cloner.clone(normals);
     }
@@ -204,7 +204,7 @@ public class EmitterMeshVertexShape implements EmitterShape {
         this.vertices = ic.readSavableArrayList("vertices", null);
 
         List<List<Vector3f>> tmpNormals = ic.readSavableArrayList("normals", null);
-        if (tmpNormals != null){
+        if (tmpNormals != null) {
             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.
      */
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         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.
      */
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         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.
      * @return array of ViewPorts
      */
-    public ViewPort[] getViewPorts(){
+    public ViewPort[] getViewPorts() {
         return viewports;
     }
 
@@ -310,7 +310,6 @@ public class EnvironmentCamera extends BaseAppState {
         }
     }
 
-
     @Override
     protected void cleanup(Application app) {
         this.backGroundColor = null;
@@ -320,7 +319,7 @@ public class EnvironmentCamera extends BaseAppState {
         }
 
         for (final Image image : images) {
-            if( image != null){
+            if (image != null) {
                 image.dispose();
             }
         }
@@ -353,7 +352,8 @@ public class EnvironmentCamera extends BaseAppState {
      * @param axisZ tha z axis
      * @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);
         offCamera.setLocation(worldPos);
         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.
  * Still a wip and for now it only displays light probes.
- * 
+ *
  * @author nehon
  */
 public class LightsDebugState extends BaseAppState {
@@ -78,7 +78,7 @@ public class LightsDebugState extends BaseAppState {
 
     @Override
     public void update(float tpf) {
-        if(!isEnabled()){
+        if (!isEnabled()) {
             return;
         }
         updateLights(scene);
@@ -115,7 +115,7 @@ public class LightsDebugState extends BaseAppState {
                     break;
             }
         }
-        if( scene instanceof Node){
+        if (scene instanceof Node) {
             Node n = (Node)scene;
             for (Spatial spatial : n.getChildren()) {
                 updateLights(spatial);
@@ -149,13 +149,12 @@ public class LightsDebugState extends BaseAppState {
 
     @Override
     public void render(RenderManager rm) {
-        if(!isEnabled()){
+        if (!isEnabled()) {
             return;
         }
         rm.renderScene(debugNode, getApplication().getViewPort());
     }
 
-
     /**
      * returns the scale of the probe's debug sphere
      * @return the scale factor
@@ -175,17 +174,13 @@ public class LightsDebugState extends BaseAppState {
 
     @Override
     protected void cleanup(Application app) {
-
     }
 
     @Override
     protected void onEnable() {
-
     }
 
     @Override
     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.
- * 
+ *
  * @author Kirill Vainer
  */
 public final class FormatVersion {
@@ -42,12 +42,12 @@ public final class FormatVersion {
      * Version number of the format
      */
     public static final int VERSION = 2;
-    
+
     /**
      * Signature of the format: currently, "JME3" as ASCII.
      */
     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 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());
     }
 
@@ -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);
         return result;
     }
 
     @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<>();
         Class superclass = clazz;
         do {
@@ -110,20 +110,20 @@ public class SavableClassUtil {
         } while (superclass != null && SavableClassUtil.isImplementingSavable(superclass));
 
         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);
         }
         return versions;
     }
 
     @SuppressWarnings("unchecked")
-    public static int getSavableVersion(Class<? extends Savable> clazz) throws IOException{
+    public static int getSavableVersion(Class<? extends Savable> clazz) throws IOException {
         try {
             Field field = clazz.getField("SAVABLE_VERSION");
             Class<? extends Savable> declaringClass = (Class<? extends Savable>) field.getDeclaringClass();
-            if (declaringClass == clazz){
+            if (declaringClass == clazz) {
                 return field.getInt(null);
-            }else{
+            } else {
                 return 0; // This class doesn't declare this field, e.g. version == 0
             }
         } 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();
         int count = 0;
 
         while (thisClass != desiredClass) {
             thisClass = thisClass.getSuperclass();
-            if (thisClass != null && SavableClassUtil.isImplementingSavable(thisClass)){
-                count ++;
-            }else{
+            if (thisClass != null && SavableClassUtil.isImplementingSavable(thisClass)) {
+                count++;
+            } else {
                 break;
             }
         }
 
-        if (thisClass == null){
+        if (thisClass == null) {
             throw new IllegalArgumentException(savable.getClass().getName() +
                                                " does not extend " +
                                                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
-            }else{
+            } else {
                 throw new IllegalArgumentException(savable.getClass().getName() +
                                                    " cannot access version of " +
                                                    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 IntMap<Integer> kerning = new IntMap<>();
     private int page;
-    
+
     public BitmapCharacter() {}
-    
+
     public BitmapCharacter(char c) {
         this.c = c;
     }
@@ -131,20 +131,20 @@ public class BitmapCharacter implements Savable, Cloneable {
     public int getPage() {
         return page;
     }
-    
+
     public char getChar() {
         return c;
     }
-    
+
     public void setChar(char c) {
         this.c = c;
     }
 
-    public void addKerning(int second, int amount){
+    public void addKerning(int second, int amount) {
         kerning.put(second, amount);
     }
 
-    public int getKerning(int second){
+    public int getKerning(int second) {
         Integer i = kerning.get(second);
         if (i == null)
             return 0;
@@ -168,7 +168,7 @@ public class BitmapCharacter implements Savable, Cloneable {
         int[] amounts = new int[seconds.length];
 
         int i = 0;
-        for (Entry<Integer> entry : kerning){
+        for (Entry<Integer> entry : kerning) {
             seconds[i] = entry.getKey();
             amounts[i] = entry.getValue();
             i++;
@@ -193,7 +193,7 @@ public class BitmapCharacter implements Savable, Cloneable {
         int[] seconds = ic.readIntArray("seconds", 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]);
         }
     }

+ 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];
         BitmapCharacter[] chars = new BitmapCharacter[size];
         int i = 0;
-        for (Entry<BitmapCharacter> chr : charset){
+        for (Entry<BitmapCharacter> chr : charset) {
             indexes[i] = (short) chr.getKey();
             chars[i] = chr.getValue();
             i++;
@@ -104,7 +104,7 @@ public class BitmapCharacterSet implements Savable {
         short[] indexes = ic.readShortArray("indexes"+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;
             BitmapCharacter chr = (BitmapCharacter) chars[i];
             charset.put(index, chr);
@@ -116,11 +116,11 @@ public class BitmapCharacterSet implements Savable {
         characters = new IntMap<IntMap<BitmapCharacter>>();
     }
 
-    public BitmapCharacter getCharacter(int index){
+    public BitmapCharacter getCharacter(int index) {
         return getCharacter(index, 0);
     }
-    
-    public BitmapCharacter getCharacter(int index, int style){
+
+    public BitmapCharacter getCharacter(int index, int style) {
         IntMap<BitmapCharacter> map = getCharacterSet(style);
         return map.get(index);
     }
@@ -132,7 +132,7 @@ public class BitmapCharacterSet implements Savable {
         return characters.get(style);
     }
 
-    public void addCharacter(int index, BitmapCharacter ch){
+    public void addCharacter(int index, BitmapCharacter ch) {
         getCharacterSet(0).put(index, ch);
     }
 
@@ -175,7 +175,7 @@ public class BitmapCharacterSet implements Savable {
     public void setHeight(int height) {
         this.height = height;
     }
-    
+
     /**
      * Merge two fonts.
      * If two font have the same style, merge will fail.
@@ -197,7 +197,7 @@ public class BitmapCharacterSet implements Savable {
             if (old != null) {
                 throw new RuntimeException("Can't override old style");
             }
-            
+
             for (Entry<BitmapCharacter> charEntry : charset) {
                 BitmapCharacter ch = charEntry.getValue();
                 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.
-     * 
-     * @see BitmapText#setAlignment(com.jme3.font.BitmapFont.Align) 
+     *
+     * @see BitmapText#setAlignment(com.jme3.font.BitmapFont.Align)
      */
     public enum Align {
-        
+
         /**
          * Align text on the left of the text block
          */
-        Left, 
-        
+        Left,
+
         /**
          * Align text in the center of the text block
          */
-        Center, 
-        
+        Center,
+
         /**
          * Align text on the right of the text block
          */
         Right
     }
-    
+
     /**
      * Specifies vertical alignment for text.
-     * 
-     * @see BitmapText#setVerticalAlignment(com.jme3.font.BitmapFont.VAlign) 
+     *
+     * @see BitmapText#setVerticalAlignment(com.jme3.font.BitmapFont.VAlign)
      */
     public enum VAlign {
         /**
          * Align text on the top of the text block
          */
-        Top, 
-        
+        Top,
+
         /**
          * Align text in the center of the text block
          */
-        Center, 
-        
+        Center,
+
         /**
          * Align text at the bottom of the text block
          */
@@ -114,14 +114,14 @@ public class BitmapFont implements Savable {
     public BitmapFont() {
     }
 
-    public BitmapText createLabel(String content){
+    public BitmapText createLabel(String content) {
         BitmapText label = new BitmapText(this);
         label.setSize(getCharSet().getRenderedSize());
         label.setText(content);
         return label;
     }
 
-    public float getPreferredSize(){
+    public float getPreferredSize() {
         return getCharSet().getRenderedSize();
     }
 
@@ -175,7 +175,7 @@ public class BitmapFont implements Savable {
         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);
         if (c == null)
             return 0f;
@@ -212,8 +212,7 @@ public class BitmapFont implements Savable {
         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
         // nightmare since it bases its calculation on a different
         // 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
         // just to create a Letters object for the sole purpose of
         // 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...
         //
         // 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
         // -xOffset + xAdvance for the first character and then each subsequent
         // character is just xAdvance more 'width'.
-        // 
+        //
         // 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.
-        
+
         float lineWidth = 0f;
         float maxLineWidth = 0f;
         char lastChar = 0;
@@ -255,9 +254,9 @@ public class BitmapFont implements Savable {
         float sizeScale = 1f;
         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);
-            if (theChar == '\n'){
+            if (theChar == '\n') {
                 maxLineWidth = Math.max(maxLineWidth, lineWidth);
                 lineWidth = 0f;
                 firstCharOfLine = true;
@@ -308,7 +307,7 @@ public class BitmapFont implements Savable {
                         // we just added by the appropriate amount.
                         lineWidth += c.getXOffset() * sizeScale;
                     }
-                } else {                 
+                } else {
                     lineWidth += xAdvance;
                 }
             }
@@ -327,13 +326,13 @@ public class BitmapFont implements Savable {
         charSet.merge(newFont.charSet);
         final int size1 = this.pages.length;
         final int size2 = newFont.pages.length;
-        
+
         Material[] tmp = new Material[size1+size2];
         System.arraycopy(this.pages, 0, tmp, 0, size1);
         System.arraycopy(newFont.pages, 0, tmp, size1, size2);
-        
+
         this.pages = tmp;
-        
+
 //        this.pages = Arrays.copyOf(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.
      */
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         super.cloneFields(cloner, original);
 
         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]);
         }
-        
+
         // Cannot use the cloner to clone the StringBlock because it
         // is package private... so we'll forgo the (probably unnecessary)
         // reference fixup in this case and just clone it directly.
@@ -276,7 +276,8 @@ public class BitmapText extends Node {
         if (textBox != null) {
             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();
     }
 

+ 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.
      */
     @Override
-    public void cloneFields( Cloner cloner, Object original ) {
+    public void cloneFields(Cloner cloner, Object original) {
         
         Mesh originalMesh = this.mesh;
     
@@ -138,7 +138,7 @@ class BitmapTextPage extends Geometry {
         // BitmapText instances will clobber one another.
         // But if we were already deep cloning meshes then we don't
         // want to do it again... so we'll check first.
-        if( this.mesh == originalMesh ) {
+        if (this.mesh == originalMesh) {
             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) {
         setText(seq);
     }
-    
+
     /**
      * @return text without color tags
      */
     String getPlainText() {
         return text;
     }
-    
+
     LinkedList<Range> getTags() {
         return colors;
     }
@@ -96,34 +96,34 @@ class ColorTags {
         }
     }
 
-    void setBaseAlpha( float alpha ) {
+    void setBaseAlpha(float alpha) {
         this.baseAlpha = alpha;
-        if( alpha == -1 ) {
+        if (alpha == -1) {
             // Need to reinitialize from the original text
             setText(original);
             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;
         }
     }
- 
+
     /**
      *  Sets the colors of all ranges, overriding any color tags
      *  that were in the original text.
-     */   
-    void setBaseColor( ColorRGBA color ) {
+     */
+    void setBaseColor(ColorRGBA color) {
         // There are times when the alpha is directly modified
         // and the caller may have passed a constant... so we
         // should clone it.
         color = color.clone();
-        for( Range r : colors ) {
+        for (Range r : colors) {
             r.color = color;
         }
     }
-    
+
     class Range {
         int start;
         ColorRGBA color;
@@ -140,7 +140,7 @@ class ColorTags {
                 }
                 else if (colorStr.length() == 8) {
                     color.a = Integer.parseInt(colorStr.subSequence(6,8).toString(), 16) / 255f;
-                } 
+                }
             } else {
                 color.set(Integer.parseInt(Character.toString(colorStr.charAt(0)), 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 alignY;
     private float sizeScale = 1;
-    
+
     /**
      * create head / tail
      * @param font
@@ -86,7 +86,7 @@ class LetterQuad {
 
     /**
      * create letter and append to previous LetterQuad
-     * 
+     *
      * @param c
      * @param prev previous character
      */
@@ -99,7 +99,7 @@ class LetterQuad {
         setBitmapChar(c);
         prev.insert(this);
     }
-    
+
     LetterQuad addNextCharacter(char c) {
         LetterQuad n = new LetterQuad(c, this);
         return n;
@@ -108,11 +108,11 @@ class LetterQuad {
     BitmapCharacter getBitmapChar() {
         return bitmapChar;
     }
-    
+
     char getChar() {
         return c;
     }
-    
+
     int getIndex() {
         return index;
     }
@@ -147,11 +147,11 @@ class LetterQuad {
     float getV1() {
         return v1;
     }
-    
-    boolean isRightToLeft(){
+
+    boolean isRightToLeft() {
         return rightToLeft;
     }
-    
+
     boolean isInvalid() {
         return x0 == Integer.MIN_VALUE;
     }
@@ -159,7 +159,7 @@ class LetterQuad {
     boolean isInvalid(StringBlock block) {
         return isInvalid(block, 0);
     }
-    
+
     boolean isInvalid(StringBlock block, float gap) {
         if (isHead() || isTail())
             return false;
@@ -177,25 +177,25 @@ class LetterQuad {
             return x0 > 0 && bound.x+bound.width-gap < getX1();
         }
     }
-    
+
     void clip(StringBlock block) {
         Rectangle bound = block.getTextBox();
         if (bound == null)
             return;
-            
+
         // Clip the right x position and texture coordinate
         // to the string block
         float x1 = Math.min(bound.x + bound.width, x0 + width);
         float newWidth = x1 - x0;
         if (isRightToLeft()) newWidth = x1; // only the available space to the left
-        if( newWidth == width )
+        if (newWidth == width)
             return;
-            
+
         float rescale = newWidth / width;
         u1 = u0 + (u1 - u0) * rescale;
-        width = newWidth;  
+        width = newWidth;
     }
-    
+
     float getX0() {
         return x0;
     }
@@ -218,11 +218,11 @@ class LetterQuad {
     float getY1() {
         return y0-height;
     }
-    
+
     float getWidth() {
         return width;
     }
-    
+
     float getHeight() {
         return height;
     }
@@ -234,7 +234,7 @@ class LetterQuad {
         ins.previous = this;
         n.previous = ins;
     }
-    
+
     void invalidate() {
         eol = isLineFeed();
         setBitmapChar(font.getCharSet().getCharacter(c, style));
@@ -260,20 +260,20 @@ class LetterQuad {
     void setPrevious(LetterQuad before) {
         this.previous = before;
     }
-    
+
     void setStyle(int style) {
         this.style = style;
         invalidate();
     }
-    
+
     void setColor(ColorRGBA color) {
         this.colorInt = color.asIntRGBA();
         invalidate();
     }
 
     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();
     }
 
@@ -282,7 +282,7 @@ class LetterQuad {
         BitmapCharacter bm = charSet.getCharacter(c, style);
         setBitmapChar(bm);
     }
-    
+
     void setBitmapChar(BitmapCharacter bitmapChar) {
         x0 = Integer.MIN_VALUE;
         y0 = Integer.MIN_VALUE;
@@ -290,7 +290,7 @@ class LetterQuad {
         height = Integer.MIN_VALUE;
         alignX = 0;
         alignY = 0;
-        
+
         BitmapCharacterSet charSet = font.getCharSet();
         this.bitmapChar = bitmapChar;
         if (bitmapChar != null) {
@@ -425,22 +425,22 @@ class LetterQuad {
             xAdvance = bound.x-x0;
         }
     }
-    
+
     /**
      * add temporary linewrap indicator
      */
     void setEndOfLine() {
         this.eol = true;
     }
-    
+
     boolean isEndOfLine() {
         return eol;
     }
-    
+
     boolean isLineWrap() {
         return !isHead() && !isTail() && bitmapChar == null && c == Character.MIN_VALUE;
     }
-    
+
     private float computeLineY(StringBlock block) {
         if (isHead()) {
             return getBound(block).y;
@@ -451,16 +451,16 @@ class LetterQuad {
         }
     }
 
-    
+
     boolean isLineStart() {
         return x0 == 0 || (previous != null && previous.eol);
     }
-    
+
     boolean isBlank() {
         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 y = y0-alignY;
         float xpw = x+width;
@@ -495,8 +495,8 @@ class LetterQuad {
         idx[0] = i0; idx[1] = i1; idx[2] = i2;
         idx[3] = i0; idx[4] = i2; idx[5] = i3;
     }
-    
-    public void appendPositions(FloatBuffer fb){
+
+    public void appendPositions(FloatBuffer fb) {
         float sx = x0+alignX;
         float sy = y0-alignY;
         float ex = sx+width;
@@ -509,21 +509,21 @@ class LetterQuad {
         fb.put(ex).put(sy).put(0f);
     }
 
-    public void appendPositions(ShortBuffer sb){
+    public void appendPositions(ShortBuffer sb) {
         final float x1 = getX1();
         final float y1 = getY1();
         short x = (short) x0;
         short y = (short) y0;
         short xpw = (short) (x1);
         short ymh = (short) (y1);
-        
+
         sb.put(x).put(y).put((short)0);
         sb.put(x).put(ymh).put((short)0);
         sb.put(xpw).put(ymh).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
         float v0 = 1 - this.v0;
         float v1 = 1 - this.v1;
@@ -538,14 +538,14 @@ class LetterQuad {
         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);
     }
 
-    public void appendIndices(ShortBuffer sb, int quadIndex){
+    public void appendIndices(ShortBuffer sb, int quadIndex) {
         // each quad has 4 indices
         short v0 = (short) (quadIndex * 4);
         short v1 = (short) (v0 + 1);
@@ -580,9 +580,9 @@ class LetterQuad {
     boolean isLineFeed() {
         return c == '\n';
     }
-    
+
     boolean isTab() {
         return c == '\t';
     }
-    
+
 }

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

@@ -83,7 +83,7 @@ class Letters {
                 if (baseColor != null) {
                     // Give the letter a default color if
                     // 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.
                         // = 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.update(block);
                         }
@@ -395,10 +395,10 @@ class Letters {
      * Sets the base color for all new letter quads and resets
      * the color of existing letter quads.
      */
-    void setColor( ColorRGBA color ) {
+    void setColor(ColorRGBA color) {
         baseColor = color;
         colorTags.setBaseColor(color);
-        setColor( 0, block.getText().length(), color );
+        setColor(0, block.getText().length(), color);
     }
 
     ColorRGBA getBaseColor() {
@@ -424,7 +424,8 @@ class Letters {
         return baseAlpha;
     }
 
-    void setBaseAlpha( float alpha ) {        this.baseAlpha = alpha;
+    void setBaseAlpha(float alpha) {
+        this.baseAlpha = alpha;
         colorTags.setBaseAlpha(alpha);
 
         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
-    public Rectangle clone(){
+    public Rectangle clone() {
         try {
             return (Rectangle) super.clone();
         } catch (CloneNotSupportedException ex) {
             throw new AssertionError();
         }
     }
-    
+
     @Override
     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;
     }
 
-    StringBlock(){
+    StringBlock() {
         this.text = "";
         this.textBox = null;
         this.alignment = Align.Left;
@@ -85,7 +85,7 @@ class StringBlock implements Cloneable {
     }
 
     @Override
-    public StringBlock clone(){
+    public StringBlock clone() {
         try {
             StringBlock clone = (StringBlock) super.clone();
             clone.color = color.clone();
@@ -101,7 +101,7 @@ class StringBlock implements Cloneable {
         return text;
     }
 
-    void setText(String text){
+    void setText(String text) {
         this.text = text == null ? "" : text;
     }
 
@@ -116,7 +116,7 @@ class StringBlock implements Cloneable {
     BitmapFont.Align getAlignment() {
         return alignment;
     }
-    
+
     BitmapFont.VAlign getVerticalAlignment() {
         return valignment;
     }
@@ -124,7 +124,7 @@ class StringBlock implements Cloneable {
     void setAlignment(BitmapFont.Align alignment) {
         this.alignment = alignment;
     }
-    
+
     void setVerticalAlignment(BitmapFont.VAlign alignment) {
         this.valignment = alignment;
     }
@@ -160,19 +160,19 @@ class StringBlock implements Cloneable {
     void setLineCount(int lineCount) {
         this.lineCount = lineCount;
     }
-    
+
     LineWrapMode getLineWrapMode() {
         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.
      */
     void setLineWrapMode(LineWrapMode wrap) {
         this.wrapType = wrap;
     }
-    
+
     void setTabWidth(float tabWidth) {
         this.tabWidth = tabWidth;
     }
@@ -180,11 +180,11 @@ class StringBlock implements Cloneable {
     void setTabPosition(float[] tabs) {
         this.tabPos = tabs;
     }
-    
+
     float getTabWidth() {
         return tabWidth;
     }
-    
+
     float[] getTabPosition() {
         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 int joyId;
     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.
@@ -65,20 +65,20 @@ public abstract class AbstractJoystick implements Joystick {
         this.joyId = joyId;
         this.name = name;
     }
-    
+
     protected InputManager getInputManager() {
         return inputManager;
     }
-    
+
     protected JoyInput getJoyInput() {
-        return joyInput; 
+        return joyInput;
     }
 
-    protected void addAxis( JoystickAxis axis ) {
+    protected void addAxis(JoystickAxis axis) {
         axes.add(axis);
     }
 
-    protected void addButton( JoystickButton button ) {
+    protected void addButton(JoystickButton 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.
      */
     @Override
-    public void rumble(float amount){
+    public void rumble(float amount) {
         joyInput.setJoyRumble(joyId, amount);
     }
 
@@ -104,7 +104,7 @@ public abstract class AbstractJoystick implements Joystick {
      */
     @Override
     @Deprecated
-    public void assignButton(String mappingName, int buttonId){
+    public void assignButton(String mappingName, int buttonId) {
         if (buttonId < 0 || buttonId >= getButtonCount())
             throw new IllegalArgumentException();
 
@@ -123,23 +123,23 @@ public abstract class AbstractJoystick implements Joystick {
      */
     @Override
     @Deprecated
-    public void assignAxis(String positiveMapping, String negativeMapping, int axisId){
-    
+    public void assignAxis(String positiveMapping, String negativeMapping, int axisId) {
+
         // For backwards compatibility
-        if( axisId == JoyInput.AXIS_POV_X ) {
+        if (axisId == JoyInput.AXIS_POV_X) {
             axisId = getPovXAxis().getAxisId();
-        } else if( axisId == JoyInput.AXIS_POV_Y ) {
+        } else if (axisId == JoyInput.AXIS_POV_Y) {
             axisId = getPovYAxis().getAxisId();
         }
-    
+
         inputManager.addMapping(positiveMapping, new JoyAxisTrigger(joyId, axisId, false));
         inputManager.addMapping(negativeMapping, new JoyAxisTrigger(joyId, axisId, true));
     }
 
     @Override
     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 null;
@@ -161,12 +161,12 @@ public abstract class AbstractJoystick implements Joystick {
     @Override
     public int getAxisCount() {
         return axes.size();
-    } 
+    }
 
     @Override
     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 null;
@@ -178,7 +178,7 @@ public abstract class AbstractJoystick implements Joystick {
     @Override
     public List<JoystickButton> getButtons() {
         return Collections.unmodifiableList(buttons);
-    }     
+    }
 
     /**
      * Returns the number of buttons on this joystick.
@@ -189,7 +189,7 @@ public abstract class AbstractJoystick implements Joystick {
     public int getButtonCount() {
         return buttons.size();
     }
-    
+
     /**
      * 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)
      */
     @Override
-    public int getXAxisIndex(){
+    public int getXAxisIndex() {
         return getXAxis().getAxisId();
     }
 
@@ -234,12 +234,12 @@ public abstract class AbstractJoystick implements Joystick {
      * @see Joystick#assignAxis(java.lang.String, java.lang.String, int)
      */
     @Override
-    public int getYAxisIndex(){
+    public int getYAxisIndex() {
         return getYAxis().getAxisId();
     }
 
     @Override
-    public String toString(){
+    public String toString() {
         return "Joystick[name=" + name + ", id=" + joyId + ", buttons=" + getButtonCount()
                                 + ", 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 minDistance = 1.0f;
     protected float maxDistance = 40.0f;
-    protected float distance = 20;    
+    protected float distance = 20;
     protected float rotationSpeed = 1.0f;
     protected float rotation = 0;
     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 boolean invertYaxis = false;
     protected boolean invertXaxis = false;
-    
+
     /**
      * @deprecated use {@link CameraInput#CHASECAM_DOWN}
      */
@@ -201,10 +201,8 @@ public class ChaseCamera implements ActionListener, AnalogListener, Control, Jme
                 }
             }
         }
-
     }
 
-
     @Override
     public void onAnalog(String name, float value, float tpf) {
         if (name.equals(CameraInput.CHASECAM_MOVELEFT)) {
@@ -236,7 +234,6 @@ public class ChaseCamera implements ActionListener, AnalogListener, Control, Jme
      * @param inputManager (alias created)
      */
     public final void registerWithInput(InputManager inputManager) {
-
         String[] inputs = {CameraInput.CHASECAM_TOGGLEROTATE,
             CameraInput.CHASECAM_DOWN,
             CameraInput.CHASECAM_UP,
@@ -247,33 +244,45 @@ public class ChaseCamera implements ActionListener, AnalogListener, Control, Jme
 
         this.inputManager = inputManager;
         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 {
-            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) {
-            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 {
-            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);
     }
-    
+
     /**
     * Cleans up the input mappings from the input manager.
     * Undoes the work of registerWithInput().
     * @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_DOWN);
         mgr.deleteMapping(CameraInput.CHASECAM_UP);
@@ -614,16 +623,16 @@ public class ChaseCamera implements ActionListener, AnalogListener, Control, Jme
         cc.setMaxDistance(getMaxDistance());
         cc.setMinDistance(getMinDistance());
         return cc;
-    }     
+    }
 
-    @Override   
-    public void cloneFields( Cloner cloner, Object original ) { 
+    @Override
+    public void cloneFields(Cloner cloner, Object original) {
         this.target = cloner.clone(target);
         computePosition();
         prevPos = new Vector3f(target.getWorldTranslation());
         cam.setLocation(pos);
     }
-         
+
     /**
      * 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) {
         this.zoomSensitivity = zoomSensitivity;
     }
-    
+
     /**
      * 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
      */
     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.parent = parent;
         this.axisIndex = axisIndex;
@@ -81,7 +81,7 @@ public class DefaultJoystickAxis implements JoystickAxis {
      *  @param negativeMapping The mapping to receive events when the axis is positive
      */
     @Override
-    public void assignAxis(String positiveMapping, String negativeMapping){
+    public void assignAxis(String positiveMapping, String negativeMapping) {
         if (axisIndex != -1) {
             inputManager.addMapping(positiveMapping, new JoyAxisTrigger(parent.getJoyId(), axisIndex, false));
             inputManager.addMapping(negativeMapping, new JoyAxisTrigger(parent.getJoyId(), axisIndex, true));
@@ -114,7 +114,7 @@ public class DefaultJoystickAxis implements JoystickAxis {
     @Override
     public String getLogicalId() {
         return logicalId;
-    }    
+    }
 
     /**
      *  Returns the axisId of this joystick axis.
@@ -134,7 +134,7 @@ public class DefaultJoystickAxis implements JoystickAxis {
     public boolean isAnalog() {
         return isAnalog;
     }
-    
+
     /**
      *  Returns true if this axis presents relative values.
      */
@@ -142,7 +142,7 @@ public class DefaultJoystickAxis implements JoystickAxis {
     public boolean isRelative() {
         return isRelative;
     }
-    
+
     /**
      *  Returns the suggested dead zone for this axis.  Values less than this
      *  can be safely ignored.
@@ -150,7 +150,7 @@ public class DefaultJoystickAxis implements JoystickAxis {
     @Override
     public float getDeadZone() {
         return deadZone;
-    }        
+    }
 
     /**
      *  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
      */
-    public void setDeadZone( float f ) {
+    public void setDeadZone(float f) {
         this.deadZone = f;
-    }     
+    }
 
     @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
                                     + ", 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
  */
 public class DefaultJoystickButton implements JoystickButton {
-    
+
     final private InputManager inputManager;
     final private Joystick parent;
     final private int buttonIndex;
     final private String name;
     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.parent = parent;
         this.buttonIndex = buttonIndex;
         this.name = name;
-        this.logicalId = logicalId;        
-    }                                   
+        this.logicalId = logicalId;
+    }
 
     /**
      * 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) {
         inputManager.addMapping(mappingName, new JoyButtonTrigger(parent.getJoyId(), buttonIndex));
     }
-    
+
     /**
      *  Returns the joystick to which this axis object belongs.
      */
     @Override
     public Joystick getJoystick() {
         return parent;
-    } 
+    }
 
     /**
      *  Returns the name of this joystick.
@@ -82,7 +82,7 @@ public class DefaultJoystickButton implements JoystickButton {
     @Override
     public String getName() {
         return name;
-    } 
+    }
 
     /**
      *  Returns the logical identifier of this joystick axis.
@@ -92,10 +92,10 @@ public class DefaultJoystickButton implements JoystickButton {
     @Override
     public String getLogicalId() {
         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.
      *
      *  @return the buttonId of this joystick axis.
@@ -104,10 +104,10 @@ public class DefaultJoystickButton implements JoystickButton {
     public int getButtonId() {
         return buttonIndex;
     }
-     
+
     @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() + "]";
     }
 }

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác