2
0
Эх сурвалжийг харах

jme3-examples: convert fields to local variables (#1501)

Stephen Gold 4 жил өмнө
parent
commit
39d09de879
70 өөрчлөгдсөн 270 нэмэгдсэн , 385 устгасан
  1. 3 5
      jme3-examples/src/main/java/jme3test/animation/TestCinematic.java
  2. 5 7
      jme3-examples/src/main/java/jme3test/audio/TestAmbient.java
  3. 1 2
      jme3-examples/src/main/java/jme3test/batching/TestBatchNodeCluster.java
  4. 3 4
      jme3-examples/src/main/java/jme3test/batching/TestBatchNodeTower.java
  5. 2 2
      jme3-examples/src/main/java/jme3test/bullet/TestAttachDriver.java
  6. 1 2
      jme3-examples/src/main/java/jme3test/bullet/TestCollisionListener.java
  7. 1 2
      jme3-examples/src/main/java/jme3test/bullet/TestFancyCar.java
  8. 4 4
      jme3-examples/src/main/java/jme3test/bullet/TestHoveringTank.java
  9. 2 3
      jme3-examples/src/main/java/jme3test/bullet/TestIssue1120.java
  10. 2 4
      jme3-examples/src/main/java/jme3test/bullet/TestPhysicsCharacter.java
  11. 3 3
      jme3-examples/src/main/java/jme3test/bullet/TestPhysicsReadWrite.java
  12. 1 2
      jme3-examples/src/main/java/jme3test/bullet/TestQ3.java
  13. 2 3
      jme3-examples/src/main/java/jme3test/bullet/TestRagdollCharacter.java
  14. 3 4
      jme3-examples/src/main/java/jme3test/bullet/TestSweepTest.java
  15. 5 7
      jme3-examples/src/main/java/jme3test/bullet/TestWalkingChar.java
  16. 2 3
      jme3-examples/src/main/java/jme3test/bullet/shape/TestGimpactShape.java
  17. 1 2
      jme3-examples/src/main/java/jme3test/collision/RayTrace.java
  18. 2 3
      jme3-examples/src/main/java/jme3test/effect/TestSoftParticles.java
  19. 2 5
      jme3-examples/src/main/java/jme3test/games/CubeField.java
  20. 2 7
      jme3-examples/src/main/java/jme3test/games/RollingTheMonkey.java
  21. 1 2
      jme3-examples/src/main/java/jme3test/gui/TestBitmapFont.java
  22. 1 2
      jme3-examples/src/main/java/jme3test/helloworld/HelloAnimation.java
  23. 2 4
      jme3-examples/src/main/java/jme3test/helloworld/HelloAudio.java
  24. 3 6
      jme3-examples/src/main/java/jme3test/helloworld/HelloCollision.java
  25. 4 7
      jme3-examples/src/main/java/jme3test/helloworld/HelloPhysics.java
  26. 3 5
      jme3-examples/src/main/java/jme3test/helloworld/HelloTerrain.java
  27. 3 4
      jme3-examples/src/main/java/jme3test/helloworld/HelloTerrainCollision.java
  28. 3 4
      jme3-examples/src/main/java/jme3test/input/TestCameraNode.java
  29. 2 3
      jme3-examples/src/main/java/jme3test/input/TestChaseCamera.java
  30. 2 8
      jme3-examples/src/main/java/jme3test/light/TestConeVSFrustum.java
  31. 2 4
      jme3-examples/src/main/java/jme3test/light/TestDirectionalLightShadow.java
  32. 17 18
      jme3-examples/src/main/java/jme3test/light/TestPointDirectionalAndSpotLightShadows.java
  33. 3 5
      jme3-examples/src/main/java/jme3test/light/TestPointLightShadows.java
  34. 6 6
      jme3-examples/src/main/java/jme3test/light/TestSpotLightTerrain.java
  35. 1 3
      jme3-examples/src/main/java/jme3test/material/TestParallax.java
  36. 2 5
      jme3-examples/src/main/java/jme3test/model/anim/TestArmature.java
  37. 2 3
      jme3-examples/src/main/java/jme3test/model/anim/TestAttachmentsNode.java
  38. 2 4
      jme3-examples/src/main/java/jme3test/model/anim/TestBaseAnimSerialization.java
  39. 2 5
      jme3-examples/src/main/java/jme3test/model/anim/TestHWSkinningOld.java
  40. 2 2
      jme3-examples/src/main/java/jme3test/model/anim/TestSkeletonControlRefresh.java
  41. 2 3
      jme3-examples/src/main/java/jme3test/model/shape/TestExpandingTorus.java
  42. 2 5
      jme3-examples/src/main/java/jme3test/niftygui/TestNiftyExamples.java
  43. 2 4
      jme3-examples/src/main/java/jme3test/niftygui/TestNiftyToMesh.java
  44. 4 5
      jme3-examples/src/main/java/jme3test/opencl/TestContextSwitching.java
  45. 2 5
      jme3-examples/src/main/java/jme3test/opencl/TestMultipleApplications.java
  46. 2 3
      jme3-examples/src/main/java/jme3test/opencl/TestWriteToTexture.java
  47. 1 3
      jme3-examples/src/main/java/jme3test/post/TestBloom.java
  48. 2 3
      jme3-examples/src/main/java/jme3test/post/TestBloomAlphaThreshold.java
  49. 1 3
      jme3-examples/src/main/java/jme3test/post/TestCrossHatch.java
  50. 3 6
      jme3-examples/src/main/java/jme3test/post/TestDepthOfField.java
  51. 5 5
      jme3-examples/src/main/java/jme3test/post/TestMultiRenderTarget.java
  52. 1 2
      jme3-examples/src/main/java/jme3test/post/TestMultiplesFilters.java
  53. 1 2
      jme3-examples/src/main/java/jme3test/post/TestPosterization.java
  54. 3 3
      jme3-examples/src/main/java/jme3test/post/TestRenderToCubemap.java
  55. 3 4
      jme3-examples/src/main/java/jme3test/post/TestRenderToMemory.java
  56. 2 3
      jme3-examples/src/main/java/jme3test/post/TestSSAO.java
  57. 2 3
      jme3-examples/src/main/java/jme3test/renderer/TestSplitScreen.java
  58. 1 2
      jme3-examples/src/main/java/jme3test/stress/TestLodGeneration.java
  59. 45 53
      jme3-examples/src/main/java/jme3test/terrain/TerrainFractalGridTest.java
  60. 28 33
      jme3-examples/src/main/java/jme3test/terrain/TerrainGridAlphaMapTest.java
  61. 13 13
      jme3-examples/src/main/java/jme3test/terrain/TerrainGridTest.java
  62. 14 14
      jme3-examples/src/main/java/jme3test/terrain/TerrainGridTileLoaderTest.java
  63. 1 6
      jme3-examples/src/main/java/jme3test/terrain/TerrainTest.java
  64. 1 2
      jme3-examples/src/main/java/jme3test/terrain/TerrainTestAdvanced.java
  65. 1 2
      jme3-examples/src/main/java/jme3test/terrain/TerrainTestAndroid.java
  66. 3 6
      jme3-examples/src/main/java/jme3test/terrain/TerrainTestCollision.java
  67. 5 6
      jme3-examples/src/main/java/jme3test/terrain/TerrainTestReadWrite.java
  68. 1 2
      jme3-examples/src/main/java/jme3test/terrain/TerrainTestTile.java
  69. 5 6
      jme3-examples/src/main/java/jme3test/water/TestMultiPostWater.java
  70. 4 4
      jme3-examples/src/main/java/jme3test/water/TestPostWater.java

+ 3 - 5
jme3-examples/src/main/java/jme3test/animation/TestCinematic.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2020 jMonkeyEngine
+ * Copyright (c) 2009-2021 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -57,11 +57,9 @@ public class TestCinematic extends SimpleApplication {
 
     private Spatial model;
     private Spatial teapot;
-    private MotionPath path;
     private MotionEvent cameraMotionEvent;
     private Cinematic cinematic;
     private ChaseCamera chaseCam;
-    private FilterPostProcessor fpp;
     private FadeFilter fade;
     private float time = 0;
 
@@ -181,7 +179,7 @@ public class TestCinematic extends SimpleApplication {
         camNode.lookAt(teapot.getLocalTranslation(), Vector3f.UNIT_Y);
 
         CameraNode camNode2 = cinematic.bindCamera("aroundCam", cam);
-        path = new MotionPath();
+        MotionPath path = new MotionPath();
         path.setCycle(true);
         path.addWayPoint(new Vector3f(20, 3, 0));
         path.addWayPoint(new Vector3f(0, 3, 20));
@@ -227,7 +225,7 @@ public class TestCinematic extends SimpleApplication {
         light.setColor(ColorRGBA.White.mult(1.5f));
         rootNode.addLight(light);
 
-        fpp = new FilterPostProcessor(assetManager);
+        FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
         fade = new FadeFilter();
         fpp.addFilter(fade);
 

+ 5 - 7
jme3-examples/src/main/java/jme3test/audio/TestAmbient.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2012 jMonkeyEngine
+ * Copyright (c) 2009-2021 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -43,8 +43,6 @@ import com.jme3.scene.shape.Box;
 
 public class TestAmbient extends SimpleApplication {
 
-  private AudioNode nature, waves;
-
   public static void main(String[] args) {
     TestAmbient test = new TestAmbient();
     test.start();
@@ -59,15 +57,15 @@ public class TestAmbient extends SimpleApplication {
     Environment env = new Environment(eax);
     audioRenderer.setEnvironment(env);
 
-    waves = new AudioNode(assetManager, "Sound/Environment/Ocean Waves.ogg",
-            DataType.Buffer);
+    AudioNode waves = new AudioNode(assetManager,
+            "Sound/Environment/Ocean Waves.ogg", DataType.Buffer);
     waves.setPositional(true);
     waves.setLocalTranslation(new Vector3f(0, 0,0));
     waves.setMaxDistance(100);
     waves.setRefDistance(5);
 
-    nature = new AudioNode(assetManager, "Sound/Environment/Nature.ogg",
-            DataType.Stream);
+    AudioNode nature = new AudioNode(assetManager,
+            "Sound/Environment/Nature.ogg", DataType.Stream);
     nature.setPositional(false);
     nature.setVolume(3);
     

+ 1 - 2
jme3-examples/src/main/java/jme3test/batching/TestBatchNodeCluster.java

@@ -331,7 +331,6 @@ public class TestBatchNodeCluster extends SimpleApplication {
         return zPosition.get(i);
     }
     private float time = 0;
-    private Spatial box;
 
     @Override
     public void simpleUpdate(float tpf) {
@@ -352,7 +351,7 @@ public class TestBatchNodeCluster extends SimpleApplication {
             mult1 = -1.0f;
             mult2 = -1.0f;
         }
-        box = batchNode.getChild("Box" + random);
+        Spatial box = batchNode.getChild("Box" + random);
         if (box != null) {
             Vector3f v = box.getLocalTranslation();
             box.setLocalTranslation(v.x + FastMath.sin(time * mult1) * 20, v.y + (FastMath.sin(time * mult1) * FastMath.cos(time * mult1) * 20), v.z + FastMath.cos(time * mult2) * 20);

+ 3 - 4
jme3-examples/src/main/java/jme3test/batching/TestBatchNodeTower.java

@@ -78,7 +78,6 @@ public class TestBatchNodeTower extends SimpleApplication {
     private Material mat;
     private Material mat2;
     private Material mat3;
-    private DirectionalLightShadowFilter shadowRenderer;
     private Sphere bullet;
     private Box brick;
     private SphereCollisionShape bulletCollisionShape;
@@ -120,9 +119,9 @@ public class TestBatchNodeTower extends SimpleApplication {
         batchNode.batch();
         batchNode.setShadowMode(ShadowMode.CastAndReceive);
         rootNode.attachChild(batchNode);
-        
-        
-        shadowRenderer = new DirectionalLightShadowFilter(assetManager, 1024, 2);
+
+        DirectionalLightShadowFilter shadowRenderer
+                = new DirectionalLightShadowFilter(assetManager, 1024, 2);
         DirectionalLight dl = new DirectionalLight();
         dl.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
         shadowRenderer.setLight(dl);

+ 2 - 2
jme3-examples/src/main/java/jme3test/bullet/TestAttachDriver.java

@@ -60,7 +60,6 @@ import com.jme3.texture.Texture;
 public class TestAttachDriver extends SimpleApplication implements ActionListener {
 
     private VehicleControl vehicle;
-    private RigidBodyControl driver;
     private RigidBodyControl bridge;
     private SliderJoint slider;
     private final float accelerationForce = 1000.0f;
@@ -202,7 +201,8 @@ public class TestAttachDriver extends SimpleApplication implements ActionListene
         //driver
         Node driverNode=new Node("driverNode");
         driverNode.setLocalTranslation(0,2,0);
-        driver=new RigidBodyControl(new BoxCollisionShape(new Vector3f(0.2f,.5f,0.2f)));
+        RigidBodyControl driver
+                = new RigidBodyControl(new BoxCollisionShape(new Vector3f(0.2f,.5f,0.2f)));
         driverNode.addControl(driver);
 
         rootNode.attachChild(driverNode);

+ 1 - 2
jme3-examples/src/main/java/jme3test/bullet/TestCollisionListener.java

@@ -48,7 +48,6 @@ import com.jme3.scene.shape.Sphere.TextureMode;
 public class TestCollisionListener extends SimpleApplication implements PhysicsCollisionListener {
 
     private BulletAppState bulletAppState;
-    private Sphere bullet;
 
     public static void main(String[] args) {
         TestCollisionListener app = new TestCollisionListener();
@@ -60,7 +59,7 @@ public class TestCollisionListener extends SimpleApplication implements PhysicsC
         bulletAppState = new BulletAppState();
         stateManager.attach(bulletAppState);
         bulletAppState.setDebugEnabled(true);
-        bullet = new Sphere(32, 32, 0.4f, true, false);
+        Sphere bullet = new Sphere(32, 32, 0.4f, true, false);
         bullet.setTextureMode(TextureMode.Projected);
 
         PhysicsTestHelper.createPhysicsTestWorld(rootNode, assetManager, bulletAppState.getPhysicsSpace());

+ 1 - 2
jme3-examples/src/main/java/jme3test/bullet/TestFancyCar.java

@@ -54,7 +54,6 @@ public class TestFancyCar extends SimpleApplication implements ActionListener {
 
     private BulletAppState bulletAppState;
     private VehicleControl player;
-    private float wheelRadius;
     private float steeringValue = 0;
     private float accelerationValue = 0;
     private Node carNode;
@@ -174,7 +173,7 @@ public class TestFancyCar extends SimpleApplication implements ActionListener {
         Geometry wheel_fr = findGeom(carNode, "WheelFrontRight");
         wheel_fr.center();
         box = (BoundingBox) wheel_fr.getModelBound();
-        wheelRadius = box.getYExtent();
+        float wheelRadius = box.getYExtent();
         float back_wheel_h = (wheelRadius * 1.7f) - 1f;
         float front_wheel_h = (wheelRadius * 1.9f) - 1f;
         player.addWheel(wheel_fr.getParent(), box.getCenter().add(0, -front_wheel_h, 0),

+ 4 - 4
jme3-examples/src/main/java/jme3test/bullet/TestHoveringTank.java

@@ -70,8 +70,6 @@ public class TestHoveringTank extends SimpleApplication implements AnalogListene
     private BulletAppState bulletAppState;
     private PhysicsHoverControl hoverControl;
     private Spatial spaceCraft;
-    private TerrainQuad terrain;
-    private Material matRock;
     /**
      * initial location of the tank (in world/physics-space coordinates)
      */
@@ -252,7 +250,8 @@ public class TestHoveringTank extends SimpleApplication implements AnalogListene
     }
 
     private void createTerrain() {
-        matRock = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
+        Material matRock = new Material(assetManager,
+                "Common/MatDefs/Terrain/TerrainLighting.j3md");
         matRock.setBoolean("useTriPlanarMapping", false);
         matRock.setBoolean("WardIso", true);
         matRock.setTexture("AlphaMap", assetManager.loadTexture("Textures/Terrain/splat/alphamap.png"));
@@ -286,7 +285,8 @@ public class TestHoveringTank extends SimpleApplication implements AnalogListene
         } catch (Exception e) {
             e.printStackTrace();
         }
-        terrain = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());
+        TerrainQuad terrain
+                = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());
         List<Camera> cameras = new ArrayList<>();
         cameras.add(getCamera());
         TerrainLodControl control = new TerrainLodControl(terrain, cameras);

+ 2 - 3
jme3-examples/src/main/java/jme3test/bullet/TestIssue1120.java

@@ -68,8 +68,6 @@ public class TestIssue1120 extends SimpleApplication {
     private static TestIssue1120 test;
     private BulletAppState bulletAppState;
     private final boolean physicsDebug = true;
-    private BitmapFont font;
-    private final BitmapText[] testInfo = new BitmapText[2];
     private BitmapText speedText;
     private final List<Spatial> testObjects = new ArrayList<>();
     private static final boolean SKIP_SETTINGS = false;//Used for repeated runs of this test during dev
@@ -133,7 +131,8 @@ public class TestIssue1120 extends SimpleApplication {
         }, "pause", "restart", "+", "-");
 
         guiNode = getGuiNode();
-        font = assetManager.loadFont("Interface/Fonts/Default.fnt");
+        BitmapFont font = assetManager.loadFont("Interface/Fonts/Default.fnt");
+        BitmapText[] testInfo = new BitmapText[2];
         testInfo[0] = new BitmapText(font);
         testInfo[1] = new BitmapText(font);
         speedText = new BitmapText(font);

+ 2 - 4
jme3-examples/src/main/java/jme3test/bullet/TestPhysicsCharacter.java

@@ -56,8 +56,6 @@ public class TestPhysicsCharacter extends SimpleApplication implements ActionLis
 
   private BulletAppState bulletAppState;
   private CharacterControl physicsCharacter;
-  private Node characterNode;
-  private CameraNode camNode;
   final private Vector3f walkDirection = new Vector3f(0,0,0);
   final private Vector3f viewDirection = new Vector3f(0,0,0);
   private boolean leftStrafe = false, rightStrafe = false, forward = false, backward = false, 
@@ -110,7 +108,7 @@ public class TestPhysicsCharacter extends SimpleApplication implements ActionLis
     // Add a physics character to the world
     physicsCharacter = new CharacterControl(new CapsuleCollisionShape(0.5f, 1.8f), .1f);
     physicsCharacter.setPhysicsLocation(new Vector3f(0, 1, 0));
-    characterNode = new Node("character node");
+    Node characterNode = new Node("character node");
     Spatial model = assetManager.loadModel("Models/Sinbad/Sinbad.mesh.xml");
     model.scale(0.25f);
     characterNode.addControl(physicsCharacter);
@@ -119,7 +117,7 @@ public class TestPhysicsCharacter extends SimpleApplication implements ActionLis
     characterNode.attachChild(model);
 
     // set forward camera node that follows the character
-    camNode = new CameraNode("CamNode", cam);
+    CameraNode camNode = new CameraNode("CamNode", cam);
     camNode.setControlDir(ControlDirection.SpatialToCamera);
     camNode.setLocalTranslation(new Vector3f(0, 1, -5));
     camNode.lookAt(model.getLocalTranslation(), Vector3f.UNIT_Y);

+ 3 - 3
jme3-examples/src/main/java/jme3test/bullet/TestPhysicsReadWrite.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2012 jMonkeyEngine
+ * Copyright (c) 2009-2021 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -59,7 +59,7 @@ import java.util.logging.Logger;
  */
 public class TestPhysicsReadWrite extends SimpleApplication{
     private BulletAppState bulletAppState;
-    private Node physicsRootNode;
+
     public static void main(String[] args){
         TestPhysicsReadWrite app = new TestPhysicsReadWrite();
         app.start();
@@ -70,7 +70,7 @@ public class TestPhysicsReadWrite extends SimpleApplication{
         bulletAppState = new BulletAppState();
         stateManager.attach(bulletAppState);
         bulletAppState.setDebugEnabled(true);
-        physicsRootNode=new Node("PhysicsRootNode");
+        Node physicsRootNode = new Node("PhysicsRootNode");
         rootNode.attachChild(physicsRootNode);
 
         // Add a physics sphere to the world

+ 1 - 2
jme3-examples/src/main/java/jme3test/bullet/TestQ3.java

@@ -55,7 +55,6 @@ import java.io.File;
 public class TestQ3 extends SimpleApplication implements ActionListener {
 
     private BulletAppState bulletAppState;
-    private Node gameLevel;
     private PhysicsCharacter player;
     final private Vector3f walkDirection = new Vector3f();
     private static boolean useHttp = false;
@@ -101,7 +100,7 @@ public class TestQ3 extends SimpleApplication implements ActionListener {
         // create the geometry and attach it
         MaterialList matList = (MaterialList) assetManager.loadAsset("Scene.material");
         OgreMeshKey key = new OgreMeshKey("main.meshxml", matList);
-        gameLevel = (Node) assetManager.loadAsset(key);
+        Node gameLevel = (Node) assetManager.loadAsset(key);
         gameLevel.setLocalScale(0.1f);
 
         // add a physics control, it will generate a MeshCollisionShape based on the gameLevel

+ 2 - 3
jme3-examples/src/main/java/jme3test/bullet/TestRagdollCharacter.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2019 jMonkeyEngine
+ * Copyright (c) 2009-2021 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -66,7 +66,6 @@ public class TestRagdollCharacter
     private AnimComposer composer;
     private boolean forward = false, backward = false,
             leftRotate = false, rightRotate = false;
-    private DynamicAnimControl ragdoll;
     private Node model;
     private PhysicsSpace physicsSpace;
 
@@ -173,7 +172,7 @@ public class TestRagdollCharacter
         composer.actionSequence("SliceOnce",
                 slice, Tweens.callMethod(this, "onSliceDone"));
 
-        ragdoll = new DynamicAnimControl();
+        DynamicAnimControl ragdoll = new DynamicAnimControl();
         setupSinbad(ragdoll);
         model.addControl(ragdoll);
         physicsSpace.add(ragdoll);

+ 3 - 4
jme3-examples/src/main/java/jme3test/bullet/TestSweepTest.java

@@ -20,10 +20,8 @@ import java.util.List;
 public class TestSweepTest extends SimpleApplication {
 
     final private BulletAppState bulletAppState = new BulletAppState();
-    private CapsuleCollisionShape obstacleCollisionShape;
     private CapsuleCollisionShape capsuleCollisionShape;
     private Node capsule;
-    private Node obstacle;
     final private float dist = .5f;
 
     public static void main(String[] args) {
@@ -32,7 +30,8 @@ public class TestSweepTest extends SimpleApplication {
 
     @Override
     public void simpleInitApp() {
-        obstacleCollisionShape = new CapsuleCollisionShape(0.3f, 0.5f);
+        CapsuleCollisionShape obstacleCollisionShape
+                = new CapsuleCollisionShape(0.3f, 0.5f);
         capsuleCollisionShape = new CapsuleCollisionShape(1f, 1f);
 
         stateManager.attach(bulletAppState);
@@ -44,7 +43,7 @@ public class TestSweepTest extends SimpleApplication {
         bulletAppState.getPhysicsSpace().add(capsule);
         rootNode.attachChild(capsule);
 
-        obstacle = new Node("obstacle");
+        Node obstacle = new Node("obstacle");
         obstacle.move(2, 0, 0);
         RigidBodyControl bodyControl = new RigidBodyControl(obstacleCollisionShape, 0);
         obstacle.addControl(bodyControl);

+ 5 - 7
jme3-examples/src/main/java/jme3test/bullet/TestWalkingChar.java

@@ -90,11 +90,7 @@ public class TestWalkingChar extends SimpleApplication
     private Node model;
     //temp vectors
     final private Vector3f walkDirection = new Vector3f();
-    //terrain
-    private TerrainQuad terrain;
-    private RigidBodyControl terrainPhysicsNode;
     //Materials
-    private Material matRock;
     private Material matBullet;
     //animation
     private Action standAction;
@@ -243,7 +239,7 @@ public class TestWalkingChar extends SimpleApplication
     }
 
     private void createTerrain() {
-        matRock = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
+        Material matRock = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
         matRock.setBoolean("useTriPlanarMapping", false);
         matRock.setBoolean("WardIso", true);
         matRock.setTexture("AlphaMap", assetManager.loadTexture("Textures/Terrain/splat/alphamap.png"));
@@ -279,7 +275,8 @@ public class TestWalkingChar extends SimpleApplication
             e.printStackTrace();
         }
 
-        terrain = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());
+        TerrainQuad terrain
+                = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());
         List<Camera> cameras = new ArrayList<>();
         cameras.add(getCamera());
         TerrainLodControl control = new TerrainLodControl(terrain, cameras);
@@ -287,7 +284,8 @@ public class TestWalkingChar extends SimpleApplication
         terrain.setMaterial(matRock);
         terrain.setLocalScale(new Vector3f(2, 2, 2));
 
-        terrainPhysicsNode = new RigidBodyControl(CollisionShapeFactory.createMeshShape(terrain), 0);
+        RigidBodyControl terrainPhysicsNode
+                = new RigidBodyControl(CollisionShapeFactory.createMeshShape(terrain), 0);
         terrain.addControl(terrainPhysicsNode);
         rootNode.attachChild(terrain);
         getPhysicsSpace().add(terrainPhysicsNode);

+ 2 - 3
jme3-examples/src/main/java/jme3test/bullet/shape/TestGimpactShape.java

@@ -92,8 +92,6 @@ public class TestGimpactShape extends SimpleApplication {
     private static TestGimpactShape test;
     private BulletAppState bulletAppState;
     private int solverNumIterations = 10;
-    private BitmapFont font;
-    private final BitmapText[] testInfo = new BitmapText[2];
     private BitmapText timeElapsedTxt;
     private BitmapText solverNumIterationsTxt;
     private BitmapText testScale;
@@ -129,7 +127,8 @@ public class TestGimpactShape extends SimpleApplication {
 
         //Setup test instructions
         guiNode = getGuiNode();
-        font = assetManager.loadFont("Interface/Fonts/Default.fnt");
+        BitmapFont font = assetManager.loadFont("Interface/Fonts/Default.fnt");
+        BitmapText[] testInfo = new BitmapText[2];
         testInfo[0] = new BitmapText(font);
         testInfo[1] = new BitmapText(font);
         timeElapsedTxt = new BitmapText(font);

+ 1 - 2
jme3-examples/src/main/java/jme3test/collision/RayTrace.java

@@ -50,7 +50,6 @@ public class RayTrace {
     final private Camera cam;
     final private Spatial scene;
     final private CollisionResults results = new CollisionResults();
-    private JFrame frame;
     private JLabel label;
 
     public RayTrace(Spatial scene, Camera cam, int width, int height){
@@ -60,7 +59,7 @@ public class RayTrace {
     }
 
     public void show(){
-        frame = new JFrame("HDR View");
+        JFrame frame = new JFrame("HDR View");
         label = new JLabel(new ImageIcon(image));
         frame.getContentPane().add(label);
         frame.setLayout(new FlowLayout());

+ 2 - 3
jme3-examples/src/main/java/jme3test/effect/TestSoftParticles.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2020 jMonkeyEngine
+ * Copyright (c) 2009-2021 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -58,7 +58,6 @@ public class TestSoftParticles extends SimpleApplication {
 
     private boolean softParticles = true;
     private FilterPostProcessor fpp;
-    private TranslucentBucketFilter tbf;
     private Node particleNode;
 
     public static void main(String[] args) {
@@ -93,7 +92,7 @@ public class TestSoftParticles extends SimpleApplication {
         geom2.setLocalScale(0.1f, 0.2f, 1);
 
         fpp = new FilterPostProcessor(assetManager);        
-        tbf = new TranslucentBucketFilter(true);
+        TranslucentBucketFilter tbf = new TranslucentBucketFilter(true);
         fpp.addFilter(tbf);
         int samples = context.getSettings().getSamples();
         if (samples > 0) {

+ 2 - 5
jme3-examples/src/main/java/jme3test/games/CubeField.java

@@ -65,7 +65,7 @@ public class CubeField extends SimpleApplication implements AnalogListener {
     private BitmapFont defaultFont;
 
     private boolean START;
-    private int difficulty, Score, colorInt, highCap, lowCap,diffHelp;
+    private int difficulty, Score, colorInt, lowCap;
     private Node player;
     private Geometry fcube;
     private ArrayList<Geometry> cubeField;
@@ -113,8 +113,7 @@ public class CubeField extends SimpleApplication implements AnalogListener {
         Score = 0;
         lowCap = 10;
         colorInt = 0;
-        highCap = 40;
-        difficulty = highCap;
+        difficulty = 40;
 
         for (Geometry cube : cubeField){
             cube.removeFromParent();
@@ -134,7 +133,6 @@ public class CubeField extends SimpleApplication implements AnalogListener {
         speed = lowCap / 400f;
         coreTime = 20.0f;
         coreTime2 = 10.0f;
-        diffHelp=lowCap;
         player.setLocalTranslation(0,0,0);
     }
 
@@ -258,7 +256,6 @@ public class CubeField extends SimpleApplication implements AnalogListener {
 			}
 			else if(difficulty>lowCap){
 				difficulty-=5;
-				diffHelp+=1;
 			}
 		}
     	

+ 2 - 7
jme3-examples/src/main/java/jme3test/games/RollingTheMonkey.java

@@ -102,15 +102,10 @@ public class RollingTheMonkey extends SimpleApplication implements ActionListene
     private boolean keyBackward;
     private boolean keyLeft;
     private boolean keyRight;
-    
-    private PhysicsSpace space;
-    
     private RigidBodyControl player;
     private int score;
     
     private Node pickUps;
-    
-    private BitmapText infoText;
     private BitmapText scoreText;
     private BitmapText messageText;
     
@@ -123,7 +118,7 @@ public class RollingTheMonkey extends SimpleApplication implements ActionListene
         // init physics
         BulletAppState bulletState = new BulletAppState();
         stateManager.attach(bulletState);
-        space = bulletState.getPhysicsSpace();
+        PhysicsSpace space = bulletState.getPhysicsSpace();
         space.addCollisionListener(this);
         
         // create light
@@ -277,7 +272,7 @@ public class RollingTheMonkey extends SimpleApplication implements ActionListene
                 , INPUT_MAPPING_LEFT, INPUT_MAPPING_RIGHT, INPUT_MAPPING_RESET);
         
         // init UI
-        infoText = new BitmapText(guiFont, false);
+        BitmapText infoText = new BitmapText(guiFont, false);
         infoText.setText(INFO_MESSAGE);
         guiNode.attachChild(infoText);
         

+ 1 - 2
jme3-examples/src/main/java/jme3test/gui/TestBitmapFont.java

@@ -49,7 +49,6 @@ public class TestBitmapFont extends SimpleApplication {
     "ABCDEFGHIKLMNOPQRSTUVWXYZ1234567 890`~!@#$%^&*()-=_+[]\\;',./{}|:<>?";
 
     private BitmapText txt;
-    private BitmapText txt2;
     private BitmapText txt3;
 
     public static void main(String[] args){
@@ -71,7 +70,7 @@ public class TestBitmapFont extends SimpleApplication {
         txt.setLocalTranslation(0, txt.getHeight(), 0);
         guiNode.attachChild(txt);
 
-        txt2 = new BitmapText(fnt, false);
+        BitmapText txt2 = new BitmapText(fnt, false);
         txt2.setSize(fnt.getPreferredSize() * 1.2f);
         txt2.setText("Text without restriction. \nText without restriction. Text without restriction. Text without restriction");
         txt2.setLocalTranslation(0, txt2.getHeight(), 0);

+ 1 - 2
jme3-examples/src/main/java/jme3test/helloworld/HelloAnimation.java

@@ -54,7 +54,6 @@ public class HelloAnimation extends SimpleApplication {
 
   private Action advance;
   private AnimComposer control;
-  private Node player;
 
   public static void main(String[] args) {
     HelloAnimation app = new HelloAnimation();
@@ -72,7 +71,7 @@ public class HelloAnimation extends SimpleApplication {
     rootNode.addLight(dl);
 
     /** Load a model that contains animation */
-    player = (Node) assetManager.loadModel("Models/Oto/Oto.mesh.xml");
+    Node player = (Node) assetManager.loadModel("Models/Oto/Oto.mesh.xml");
     player.setLocalScale(0.5f);
     rootNode.attachChild(player);
 

+ 2 - 4
jme3-examples/src/main/java/jme3test/helloworld/HelloAudio.java

@@ -15,8 +15,6 @@ import com.jme3.scene.shape.Box;
 public class HelloAudio extends SimpleApplication {
 
   private AudioNode audio_gun;
-  private AudioNode audio_nature;
-  private Geometry player;
 
   public static void main(String[] args) {
     HelloAudio app = new HelloAudio();
@@ -29,7 +27,7 @@ public class HelloAudio extends SimpleApplication {
     
     /** just a blue box floating in space */
     Box box1 = new Box(1, 1, 1);
-    player = new Geometry("Player", box1);
+    Geometry player = new Geometry("Player", box1);
     Material mat1 = new Material(assetManager,"Common/MatDefs/Misc/Unshaded.j3md");
     mat1.setColor("Color", ColorRGBA.Blue);
     player.setMaterial(mat1);
@@ -51,7 +49,7 @@ public class HelloAudio extends SimpleApplication {
     rootNode.attachChild(audio_gun);
 
     /* nature sound - keeps playing in a loop. */
-    audio_nature = new AudioNode(assetManager, 
+    AudioNode audio_nature = new AudioNode(assetManager, 
             "Sound/Environment/Ocean Waves.ogg", DataType.Stream);
     audio_nature.setLooping(true);  // activate continuous playing
     audio_nature.setPositional(true);   

+ 3 - 6
jme3-examples/src/main/java/jme3test/helloworld/HelloCollision.java

@@ -57,9 +57,6 @@ import com.jme3.scene.Spatial;
 public class HelloCollision extends SimpleApplication
         implements ActionListener {
 
-  private Spatial sceneModel;
-  private BulletAppState bulletAppState;
-  private RigidBodyControl landscape;
   private CharacterControl player;
   final private Vector3f walkDirection = new Vector3f();
   private boolean left = false, right = false, up = false, down = false;
@@ -77,7 +74,7 @@ public class HelloCollision extends SimpleApplication
   @Override
   public void simpleInitApp() {
     /** Set up Physics */
-    bulletAppState = new BulletAppState();
+    BulletAppState bulletAppState = new BulletAppState();
     stateManager.attach(bulletAppState);
 
     // We re-use the flyby camera for rotation, while positioning is handled by physics
@@ -90,14 +87,14 @@ public class HelloCollision extends SimpleApplication
     assetManager.registerLocator(
                     "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/jmonkeyengine/town.zip",
                     HttpZipLocator.class);
-    sceneModel = assetManager.loadModel("main.scene");
+    Spatial sceneModel = assetManager.loadModel("main.scene");
     sceneModel.setLocalScale(2f);
 
     // We set up collision detection for the scene by creating a
     // compound collision shape and a static RigidBodyControl with mass zero.
     CollisionShape sceneShape =
             CollisionShapeFactory.createMeshShape(sceneModel);
-    landscape = new RigidBodyControl(sceneShape, 0);
+    RigidBodyControl landscape = new RigidBodyControl(sceneShape, 0);
     sceneModel.addControl(landscape);
 
     // We set up collision detection for the player by creating

+ 4 - 7
jme3-examples/src/main/java/jme3test/helloworld/HelloPhysics.java

@@ -69,12 +69,9 @@ public class HelloPhysics extends SimpleApplication {
   private Material stone_mat;
   private Material floor_mat;
 
-  /** Prepare geometries and physical nodes for bricks and cannon balls. */
-  private RigidBodyControl    brick_phy;
+  /** Prepare geometries for bricks and cannon balls. */
   private static final Box    box;
-  private RigidBodyControl    ball_phy;
   private static final Sphere sphere;
-  private RigidBodyControl    floor_phy;
   private static final Box    floor;
   
   /** dimensions used for bricks and wall */
@@ -159,7 +156,7 @@ public class HelloPhysics extends SimpleApplication {
     floor_geo.setLocalTranslation(0, -0.1f, 0);
     this.rootNode.attachChild(floor_geo);
     /* Make the floor physical with mass 0.0f! */
-    floor_phy = new RigidBodyControl(0.0f);
+    RigidBodyControl floor_phy = new RigidBodyControl(0.0f);
     floor_geo.addControl(floor_phy);
     bulletAppState.getPhysicsSpace().add(floor_phy);
   }
@@ -188,7 +185,7 @@ public class HelloPhysics extends SimpleApplication {
     /** Position the brick geometry  */
     brick_geo.setLocalTranslation(loc);
     /** Make brick physical with a mass > 0.0f. */
-    brick_phy = new RigidBodyControl(2f);
+    RigidBodyControl brick_phy = new RigidBodyControl(2f);
     /** Add physical brick to physics space. */
     brick_geo.addControl(brick_phy);
     bulletAppState.getPhysicsSpace().add(brick_phy);
@@ -205,7 +202,7 @@ public class HelloPhysics extends SimpleApplication {
     /** Position the cannon ball  */
     ball_geo.setLocalTranslation(cam.getLocation());
     /** Make the ball physical with a mass > 0.0f */
-    ball_phy = new RigidBodyControl(1f);
+    RigidBodyControl ball_phy = new RigidBodyControl(1f);
     /** Add physical ball to physics space. */
     ball_geo.addControl(ball_phy);
     bulletAppState.getPhysicsSpace().add(ball_phy);

+ 3 - 5
jme3-examples/src/main/java/jme3test/helloworld/HelloTerrain.java

@@ -44,9 +44,6 @@ import com.jme3.texture.Texture.WrapMode;
 
 public class HelloTerrain extends SimpleApplication {
 
-  private TerrainQuad terrain;
-  private Material mat_terrain;
-
   public static void main(String[] args) {
     HelloTerrain app = new HelloTerrain();
     app.start();
@@ -57,7 +54,7 @@ public class HelloTerrain extends SimpleApplication {
     flyCam.setMoveSpeed(50);
 
     /** 1. Create terrain material and load four textures into it. */
-    mat_terrain = new Material(assetManager, 
+    Material mat_terrain = new Material(assetManager, 
             "Common/MatDefs/Terrain/Terrain.j3md");
 
     /** 1.1) Add ALPHA map (for red-blue-green coded splat textures) */
@@ -111,7 +108,8 @@ public class HelloTerrain extends SimpleApplication {
      * 3.5) We supply the prepared heightmap itself.
      */
     int patchSize = 65;
-    terrain = new TerrainQuad("my terrain", patchSize, 513, heightmap.getHeightMap());
+    TerrainQuad terrain
+            = new TerrainQuad("my terrain", patchSize, 513, heightmap.getHeightMap());
 
     /** 4. We give the terrain its material, position & scale it, and attach it. */
     terrain.setMaterial(mat_terrain);

+ 3 - 4
jme3-examples/src/main/java/jme3test/helloworld/HelloTerrainCollision.java

@@ -64,8 +64,6 @@ public class HelloTerrainCollision extends SimpleApplication
   private CharacterControl player;
   final private Vector3f walkDirection = new Vector3f();
   private boolean left = false, right = false, up = false, down = false;
-  private TerrainQuad terrain;
-  private Material mat_terrain;
   //Temporary vectors used on each frame.
   //They here to avoid instanciating new vectors on each frame
   final private Vector3f camDir = new Vector3f();
@@ -86,7 +84,7 @@ public class HelloTerrainCollision extends SimpleApplication
     setUpKeys();
 
     /** 1. Create terrain material and load four textures into it. */
-    mat_terrain = new Material(assetManager, 
+    Material mat_terrain = new Material(assetManager, 
             "Common/MatDefs/Terrain/Terrain.j3md");
 
     /** 1.1) Add ALPHA map (for red-blue-green coded splat textures) */
@@ -129,7 +127,8 @@ public class HelloTerrainCollision extends SimpleApplication
      * 3.4) As LOD step scale we supply Vector3f(1,1,1).
      * 3.5) We supply the prepared heightmap itself.
      */
-    terrain = new TerrainQuad("my terrain", 65, 513, heightmap.getHeightMap());
+    TerrainQuad terrain
+            = new TerrainQuad("my terrain", 65, 513, heightmap.getHeightMap());
 
     /** 4. We give the terrain its material, position & scale it, and attach it. */
     terrain.setMaterial(mat_terrain);

+ 3 - 4
jme3-examples/src/main/java/jme3test/input/TestCameraNode.java

@@ -51,9 +51,7 @@ import com.jme3.system.AppSettings;
  */
 public class TestCameraNode extends SimpleApplication implements AnalogListener, ActionListener {
 
-  private Geometry teaGeom;
   private Node teaNode;
-  private CameraNode camNode;
   private boolean rotate = false;
   final private Vector3f direction = new Vector3f();
 
@@ -68,7 +66,8 @@ public class TestCameraNode extends SimpleApplication implements AnalogListener,
   @Override
   public void simpleInitApp() {
     // load a teapot model 
-    teaGeom = (Geometry) assetManager.loadModel("Models/Teapot/Teapot.obj");
+    Geometry teaGeom 
+            = (Geometry) assetManager.loadModel("Models/Teapot/Teapot.obj");
     Material mat = new Material(assetManager, "Common/MatDefs/Misc/ShowNormals.j3md");
     teaGeom.setMaterial(mat);
     //create a node to attach the geometry and the camera node
@@ -85,7 +84,7 @@ public class TestCameraNode extends SimpleApplication implements AnalogListener,
     rootNode.attachChild(ground);
 
     //creating the camera Node
-    camNode = new CameraNode("CamNode", cam);
+    CameraNode camNode = new CameraNode("CamNode", cam);
     //Setting the direction to Spatial to camera, this means the camera will copy the movements of the Node
     camNode.setControlDir(ControlDirection.SpatialToCamera);
     //attaching the camNode to the teaNode

+ 2 - 3
jme3-examples/src/main/java/jme3test/input/TestChaseCamera.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2020 jMonkeyEngine
+ * Copyright (c) 2009-2021 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -48,7 +48,6 @@ import com.jme3.scene.shape.Quad;
 public class TestChaseCamera extends SimpleApplication implements AnalogListener, ActionListener {
 
   private Geometry teaGeom;
-  private ChaseCamera chaseCam;
 
   public static void main(String[] args) {
     TestChaseCamera app = new TestChaseCamera();
@@ -76,7 +75,7 @@ public class TestChaseCamera extends SimpleApplication implements AnalogListener
     flyCam.setEnabled(false);
 
     // Enable a chase cam
-    chaseCam = new ChaseCamera(cam, teaGeom, inputManager);
+    ChaseCamera chaseCam = new ChaseCamera(cam, teaGeom, inputManager);
 
     //Uncomment this to invert the camera's vertical rotation Axis 
     //chaseCam.setInvertVerticalAxis(true);

+ 2 - 8
jme3-examples/src/main/java/jme3test/light/TestConeVSFrustum.java

@@ -219,19 +219,15 @@ public class TestConeVSFrustum extends SimpleApplication {
          * library!
          */
         Box boxMesh = new Box(1f, 1f, 1f);
-        boxGeo = new Geometry("A Textured Box", boxMesh);
+        Geometry boxGeo = new Geometry("A Textured Box", boxMesh);
         Material boxMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         Texture monkeyTex = assetManager.loadTexture("Interface/Logo/Monkey.jpg");
         boxMat.setTexture("ColorMap", monkeyTex);
         boxGeo.setMaterial(boxMat);
-//        rootNode.attachChild(boxGeo);
-//
-//boxGeo2 = boxGeo.clone();
-//rootNode.attachChild(boxGeo2); 
         System.err.println("light " + spotLight.getPosition());
 
     }
-    private Geometry boxGeo;
+
     private final static float MOVE_SPEED = 60;
     final private Vector3f tmp = new Vector3f();
     final private Quaternion tmpQuat = new Quaternion();
@@ -263,7 +259,5 @@ public class TestConeVSFrustum extends SimpleApplication {
 
 
         vars.release();
-//        boxGeo.setLocalTranslation(spotLight.getPosition());
-        //  boxGeo.setLocalTranslation(projectedPoint);
     }
 }

+ 2 - 4
jme3-examples/src/main/java/jme3test/light/TestDirectionalLightShadow.java

@@ -63,8 +63,6 @@ import com.jme3.util.TangentBinormalGenerator;
 public class TestDirectionalLightShadow extends SimpleApplication implements ActionListener, AnalogListener {
 
     public static final int SHADOWMAP_SIZE = 1024;
-    private Spatial[] obj;
-    private Material[] mat;
     private DirectionalLightShadowRenderer dlsr;
     private DirectionalLightShadowFilter dlsf;
     private Geometry ground;
@@ -94,11 +92,11 @@ public class TestDirectionalLightShadow extends SimpleApplication implements Act
     }
 
     public void loadScene() {
-        obj = new Spatial[2];
+        Spatial[] obj = new Spatial[2];
         // Setup first view
 
 
-        mat = new Material[2];
+        Material[] mat = new Material[2];
         mat[0] = assetManager.loadMaterial("Common/Materials/RedColor.j3m");
         mat[1] = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m");
         mat[1].setBoolean("UseMaterialColors", true);

+ 17 - 18
jme3-examples/src/main/java/jme3test/light/TestPointDirectionalAndSpotLightShadows.java

@@ -61,12 +61,6 @@ public class TestPointDirectionalAndSpotLightShadows extends SimpleApplication {
         app.start();
     }
     private Node lightNode;
-    private PointLightShadowRenderer plsr;
-    private PointLightShadowFilter plsf;
-    private DirectionalLightShadowRenderer dlsr;
-    private DirectionalLightShadowFilter dlsf;
-    private SpotLightShadowRenderer slsr;
-    private SpotLightShadowFilter slsf;
     private SpotLight spotLight;
     
     final private boolean useFilter = false;
@@ -99,14 +93,14 @@ public class TestPointDirectionalAndSpotLightShadows extends SimpleApplication {
         box.setLocalTranslation(-1f, 0.5f, -2);
 
         scene.getLocalLightList().get(0).setColor(ColorRGBA.Red);
-        
-        plsr = new PointLightShadowRenderer(assetManager, SHADOWMAP_SIZE);
+
+        PointLightShadowRenderer plsr
+                = new PointLightShadowRenderer(assetManager, SHADOWMAP_SIZE);
         plsr.setLight((PointLight) scene.getLocalLightList().get(0));
         plsr.setEdgeFilteringMode(EdgeFilteringMode.PCF4);
 
-
-
-        plsf = new PointLightShadowFilter(assetManager, SHADOWMAP_SIZE);
+        PointLightShadowFilter plsf
+                = new PointLightShadowFilter(assetManager, SHADOWMAP_SIZE);
         plsf.setLight((PointLight) scene.getLocalLightList().get(0));     
         plsf.setEdgeFilteringMode(EdgeFilteringMode.PCF4);
         plsf.setEnabled(useFilter);
@@ -116,11 +110,14 @@ public class TestPointDirectionalAndSpotLightShadows extends SimpleApplication {
         rootNode.addLight(directionalLight);
         directionalLight.setColor(ColorRGBA.Blue);
         directionalLight.setDirection(new Vector3f(-1f, -.2f, 0f));
-        dlsr = new DirectionalLightShadowRenderer(assetManager, SHADOWMAP_SIZE*2, 4);
+
+        DirectionalLightShadowRenderer dlsr
+                = new DirectionalLightShadowRenderer(assetManager, SHADOWMAP_SIZE*2, 4);
         dlsr.setLight(directionalLight);
         dlsr.setEdgeFilteringMode(EdgeFilteringMode.PCF4);
-        
-        dlsf = new DirectionalLightShadowFilter(assetManager, SHADOWMAP_SIZE*2, 4);
+
+        DirectionalLightShadowFilter dlsf
+                = new DirectionalLightShadowFilter(assetManager, SHADOWMAP_SIZE*2, 4);
         dlsf.setEdgeFilteringMode(EdgeFilteringMode.PCF4);
         dlsf.setLight(directionalLight);        
         dlsf.setEnabled(useFilter);
@@ -137,12 +134,14 @@ public class TestPointDirectionalAndSpotLightShadows extends SimpleApplication {
         sphereGeometry.setMaterial(assetManager.loadMaterial("Common/Materials/WhiteColor.j3m"));
         rootNode.attachChild(sphereGeometry);
         rootNode.addLight(spotLight);
-        
-        slsr = new SpotLightShadowRenderer(assetManager, SHADOWMAP_SIZE);
+
+        SpotLightShadowRenderer slsr
+                = new SpotLightShadowRenderer(assetManager, SHADOWMAP_SIZE);
         slsr.setLight(spotLight);
         slsr.setEdgeFilteringMode(EdgeFilteringMode.PCF4);
-        
-        slsf = new SpotLightShadowFilter(assetManager, SHADOWMAP_SIZE);
+
+        SpotLightShadowFilter slsf
+                = new SpotLightShadowFilter(assetManager, SHADOWMAP_SIZE);
         slsf.setLight(spotLight);
         slsf.setEdgeFilteringMode(EdgeFilteringMode.PCF4);
         slsf.setEnabled(useFilter);

+ 3 - 5
jme3-examples/src/main/java/jme3test/light/TestPointLightShadows.java

@@ -55,9 +55,7 @@ public class TestPointLightShadows extends SimpleApplication implements ActionLi
         TestPointLightShadows app = new TestPointLightShadows();
         app.start();
     }
-    private Node lightNode;
     private PointLightShadowRenderer plsr;
-    private PointLightShadowFilter plsf;
     private AmbientLight al;
 
     @Override
@@ -76,7 +74,7 @@ public class TestPointLightShadows extends SimpleApplication implements ActionLi
         scene.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
         rootNode.attachChild(scene);
         rootNode.getChild("Cube").setShadowMode(RenderQueue.ShadowMode.Receive);
-        lightNode = (Node) rootNode.getChild("Lamp");
+        Node lightNode = (Node) rootNode.getChild("Lamp");
         Geometry lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
         //Geometry  lightMdl = new Geometry("Light", new Box(.1f,.1f,.1f));
         lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
@@ -104,8 +102,8 @@ public class TestPointLightShadows extends SimpleApplication implements ActionLi
         plsr.displayDebug();
         viewPort.addProcessor(plsr);
 
-
-        plsf = new PointLightShadowFilter(assetManager, SHADOWMAP_SIZE);
+        PointLightShadowFilter plsf
+                = new PointLightShadowFilter(assetManager, SHADOWMAP_SIZE);
         plsf.setLight((PointLight) scene.getLocalLightList().get(0));    
         plsf.setShadowZExtend(15);
         plsf.setShadowZFadeLength(5);

+ 6 - 6
jme3-examples/src/main/java/jme3test/light/TestSpotLightTerrain.java

@@ -57,9 +57,6 @@ import com.jme3.util.SkyFactory;
  */
 public class TestSpotLightTerrain extends SimpleApplication {
 
-    private TerrainQuad terrain;
-    private Material matTerrain;
-    private Material matWire;
     final private float grassScale = 64;
     final private float dirtScale = 16;
     final private float rockScale = 128;
@@ -105,7 +102,8 @@ public class TestSpotLightTerrain extends SimpleApplication {
 
     private void makeTerrain() {
         // TERRAIN TEXTURE material
-        matTerrain = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
+        Material matTerrain = new Material(assetManager,
+                "Common/MatDefs/Terrain/TerrainLighting.j3md");
         matTerrain.setBoolean("useTriPlanarMapping", false);
         matTerrain.setBoolean("WardIso", true);
 
@@ -160,7 +158,8 @@ public class TestSpotLightTerrain extends SimpleApplication {
         matTerrain.setTexture("NormalMap_4", normalMap2);
 
         // WIREFRAME material
-        matWire = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
+        Material matWire = new Material(assetManager,
+                "Common/MatDefs/Misc/Unshaded.j3md");
         matWire.getAdditionalRenderState().setWireframe(true);
         matWire.setColor("Color", ColorRGBA.Green);
 
@@ -178,7 +177,8 @@ public class TestSpotLightTerrain extends SimpleApplication {
             e.printStackTrace();
         }
 
-        terrain = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());//, new LodPerspectiveCalculatorFactory(getCamera(), 4)); // add this in to see it use entropy for LOD calculations
+        TerrainQuad terrain
+                = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());//, new LodPerspectiveCalculatorFactory(getCamera(), 4)); // add this in to see it use entropy for LOD calculations
         TerrainLodControl control = new TerrainLodControl(terrain, getCamera());
         control.setLodCalculator( new DistanceLodCalculator(65, 2.7f) );
         terrain.addControl(control);

+ 1 - 3
jme3-examples/src/main/java/jme3test/material/TestParallax.java

@@ -59,11 +59,9 @@ public class TestParallax extends SimpleApplication {
     public void setupSkyBox() {
         rootNode.attachChild(SkyFactory.createSky(assetManager, "Scenes/Beach/FullskiesSunset0068.dds", SkyFactory.EnvMapType.CubeMap));
     }
-    private DirectionalLight dl;
 
     public void setupLighting() {
-
-        dl = new DirectionalLight();
+        DirectionalLight dl = new DirectionalLight();
         dl.setDirection(lightDir);
         dl.setColor(new ColorRGBA(.9f, .9f, .9f, 1));
         rootNode.addLight(dl);

+ 2 - 5
jme3-examples/src/main/java/jme3test/model/anim/TestArmature.java

@@ -51,9 +51,6 @@ import java.nio.ShortBuffer;
  */
 public class TestArmature extends SimpleApplication {
 
-    private Joint j1;
-    private Joint j2;
-
     public static void main(String... argv) {
         TestArmature app = new TestArmature();
         app.start();
@@ -68,8 +65,8 @@ public class TestArmature extends SimpleApplication {
 
         //create armature
         Joint root = new Joint("Root_Joint");
-        j1 = new Joint("Joint_1");
-        j2 = new Joint("Joint_2");
+        Joint j1 = new Joint("Joint_1");
+        Joint j2 = new Joint("Joint_2");
         Joint j3 = new Joint("Joint_3");
         root.addChild(j1);
         j1.addChild(j2);

+ 2 - 3
jme3-examples/src/main/java/jme3test/model/anim/TestAttachmentsNode.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2018 jMonkeyEngine
+ * Copyright (c) 2009-2021 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -64,7 +64,6 @@ public class TestAttachmentsNode extends SimpleApplication
     }
 
     private AnimChannel channel;
-    private AnimControl control;
 
     @Override
     public void simpleInitApp() {
@@ -78,7 +77,7 @@ public class TestAttachmentsNode extends SimpleApplication
         rootNode.addLight(dl);
 
         Spatial model = assetManager.loadModel("Models/Jaime/Jaime.j3o");
-        control = model.getControl(AnimControl.class);
+        AnimControl control = model.getControl(AnimControl.class);
         SkeletonControl skeletonControl = model.getControl(SkeletonControl.class);
 
         model.center();

+ 2 - 4
jme3-examples/src/main/java/jme3test/model/anim/TestBaseAnimSerialization.java

@@ -56,8 +56,6 @@ import java.nio.ShortBuffer;
  */
 public class TestBaseAnimSerialization extends SimpleApplication {
 
-    private Joint j1;
-    private Joint j2;
     private AnimComposer composer;
     private Armature armature;
     private File file;
@@ -76,8 +74,8 @@ public class TestBaseAnimSerialization extends SimpleApplication {
 
         //create armature
         Joint root = new Joint("Root_Joint");
-        j1 = new Joint("Joint_1");
-        j2 = new Joint("Joint_2");
+        Joint j1 = new Joint("Joint_1");
+        Joint j2 = new Joint("Joint_2");
         Joint j3 = new Joint("Joint_3");
         root.addChild(j1);
         j1.addChild(j2);

+ 2 - 5
jme3-examples/src/main/java/jme3test/model/anim/TestHWSkinningOld.java

@@ -46,8 +46,6 @@ import java.util.List;
 
 public class TestHWSkinningOld extends SimpleApplication implements ActionListener {
 
-    private AnimChannel channel;
-    private AnimControl control;
     final private String[] animNames = {"Dodge", "Walk", "pull", "push"};
     private final static int SIZE = 50;
     private boolean hwSkinningEnable = true;
@@ -78,9 +76,8 @@ public class TestHWSkinningOld extends SimpleApplication implements ActionListen
                 Spatial model = assetManager.loadModel("Models/Oto/OtoOldAnim.j3o");
                 model.setLocalScale(0.1f);
                 model.setLocalTranslation(i - SIZE / 2, 0, j - SIZE / 2);
-                control = model.getControl(AnimControl.class);
-
-                channel = control.createChannel();
+                AnimControl control = model.getControl(AnimControl.class);
+                AnimChannel channel = control.createChannel();
                 channel.setAnim(animNames[(i + j) % 4]);
                 SkeletonControl skeletonControl = model.getControl(SkeletonControl.class);
                 skeletonControl.setHardwareSkinningPreferred(hwSkinningEnable);

+ 2 - 2
jme3-examples/src/main/java/jme3test/model/anim/TestSkeletonControlRefresh.java

@@ -65,7 +65,6 @@ import java.util.List;
 
 public class TestSkeletonControlRefresh extends SimpleApplication implements ActionListener{
 
-    private AnimComposer animComposer;
     private final static int SIZE = 10;
     private boolean hwSkinningEnable = true;
     final private List<SkinningControl> skinningControls = new ArrayList<>();
@@ -100,7 +99,8 @@ public class TestSkeletonControlRefresh extends SimpleApplication implements Act
                 model.setLocalScale(0.1f);
                 model.setLocalTranslation(i - SIZE / 2, 0, j - SIZE / 2);
 
-                animComposer = model.getControl(AnimComposer.class);
+                AnimComposer animComposer
+                        = model.getControl(AnimComposer.class);
                 for (AnimClip animClip : animComposer.getAnimClips()) {
                     Action action = animComposer.action(animClip.getName());
                     animComposer.addAction(animClip.getName(), new BaseAction(

+ 2 - 3
jme3-examples/src/main/java/jme3test/model/shape/TestExpandingTorus.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2012 jMonkeyEngine
+ * Copyright (c) 2009-2021 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,6 @@ public class TestExpandingTorus extends SimpleApplication {
     private float outerRadius = 1.5f;
     private float rate = 1;
     private Torus torus;
-    private Geometry geom;
     
     public static void main(String[] args) {
         TestExpandingTorus app = new TestExpandingTorus();
@@ -51,7 +50,7 @@ public class TestExpandingTorus extends SimpleApplication {
     @Override
     public void simpleInitApp() {
         torus = new Torus(30, 10, .5f, 1f);
-        geom = new Geometry("Torus", torus);
+        Geometry geom = new Geometry("Torus", torus);
         Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         geom.setMaterial(mat);
         rootNode.attachChild(geom);

+ 2 - 5
jme3-examples/src/main/java/jme3test/niftygui/TestNiftyExamples.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2020 jMonkeyEngine
+ * Copyright (c) 2009-2021 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,8 +38,6 @@ import de.lessvoid.nifty.Nifty;
 
 public class TestNiftyExamples extends SimpleApplication {
 
-    private Nifty nifty;
-
     public static void main(String[] args){
         TestNiftyExamples app = new TestNiftyExamples();
         app.setPauseOnLostFocus(false);
@@ -52,8 +50,7 @@ public class TestNiftyExamples extends SimpleApplication {
                                                           inputManager,
                                                           audioRenderer,
                                                           guiViewPort);
-        nifty = niftyDisplay.getNifty();
-
+        Nifty nifty = niftyDisplay.getNifty();
         nifty.fromXml("all/intro.xml", "start");
 
         // attach the nifty display to the gui view port as a processor

+ 2 - 4
jme3-examples/src/main/java/jme3test/niftygui/TestNiftyToMesh.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2020 jMonkeyEngine
+ * Copyright (c) 2009-2021 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -48,8 +48,6 @@ import de.lessvoid.nifty.Nifty;
 
 public class TestNiftyToMesh extends SimpleApplication{
 
-    private Nifty nifty;
-
     public static void main(String[] args){
         TestNiftyToMesh app = new TestNiftyToMesh();
         app.start();
@@ -63,7 +61,7 @@ public class TestNiftyToMesh extends SimpleApplication{
                                                           inputManager,
                                                           audioRenderer,
                                                           niftyView);
-        nifty = niftyDisplay.getNifty();
+        Nifty nifty = niftyDisplay.getNifty();
         nifty.fromXml("all/intro.xml", "start");
         niftyView.addProcessor(niftyDisplay);
 

+ 4 - 5
jme3-examples/src/main/java/jme3test/opencl/TestContextSwitching.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2016 jMonkeyEngine
+ * Copyright (c) 2009-2021 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -52,10 +52,8 @@ import java.util.logging.Logger;
 public class TestContextSwitching extends SimpleApplication implements ScreenController {
     private static final Logger LOG = Logger.getLogger(TestContextSwitching.class.getName());
     
-    private Nifty nifty;
     private Label infoLabel;
     private Button applyButton;
-    private ListBox<String> platformListBox;
     private ListBox<String> deviceListBox;
     
     private static String selectedPlatform;
@@ -95,7 +93,7 @@ public class TestContextSwitching extends SimpleApplication implements ScreenCon
                 inputManager,
                 audioRenderer,
                 guiViewPort);
-        nifty = niftyDisplay.getNifty();
+        Nifty nifty = niftyDisplay.getNifty();
         nifty.fromXml("jme3test/opencl/ContextSwitchingScreen.xml", "Screen", this);
         guiViewPort.addProcessor(niftyDisplay);
         inputManager.setCursorVisible(true);
@@ -113,7 +111,8 @@ public class TestContextSwitching extends SimpleApplication implements ScreenCon
     @SuppressWarnings("unchecked")
     public void bind(Nifty nifty, Screen screen) {
         applyButton = screen.findNiftyControl("ApplyButton", Button.class);
-        platformListBox = screen.findNiftyControl("PlatformListBox", ListBox.class);
+        ListBox<String> platformListBox
+                = screen.findNiftyControl("PlatformListBox", ListBox.class);
         deviceListBox = screen.findNiftyControl("DeviceListBox", ListBox.class);
         infoLabel = screen.findNiftyControl("InfoLabel", Label.class);
         

+ 2 - 5
jme3-examples/src/main/java/jme3test/opencl/TestMultipleApplications.java

@@ -53,13 +53,10 @@ public class TestMultipleApplications extends SimpleApplication {
     private static List<? extends Device> availableDevices;
     private static int currentDeviceIndex;
     
-    private Context clContext;
     private CommandQueue clQueue;
     private Kernel kernel;
     private Buffer buffer;
     private boolean failed;
-    
-    private BitmapText infoText;
     private BitmapText statusText;
 
     /**
@@ -115,7 +112,7 @@ public class TestMultipleApplications extends SimpleApplication {
     
     @Override
     public void simpleInitApp() {
-        clContext = context.getOpenCLContext();
+        Context clContext = context.getOpenCLContext();
         if (clContext == null) {
             LOG.severe("No OpenCL context found");
             stop();
@@ -144,7 +141,7 @@ public class TestMultipleApplications extends SimpleApplication {
         inputManager.setCursorVisible(true);
         
         BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt");
-        infoText = new BitmapText(fnt, false);
+        BitmapText infoText = new BitmapText(fnt, false);
         //infoText.setBox(new Rectangle(0, 0, settings.getWidth(), settings.getHeight()));
         infoText.setText("Device: "+clContext.getDevices());
         infoText.setLocalTranslation(0, settings.getHeight(), 0);

+ 2 - 3
jme3-examples/src/main/java/jme3test/opencl/TestWriteToTexture.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2012 jMonkeyEngine
+ * Copyright (c) 2009-2021 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -61,7 +61,6 @@ public class TestWriteToTexture extends SimpleApplication implements AnalogListe
     private int initCounter;
     private Context clContext;
     private CommandQueue clQueue;
-    private ProgramCache programCache;
     private Kernel kernel;
     private Vector2f C;
     private Image texCL;
@@ -123,7 +122,7 @@ public class TestWriteToTexture extends SimpleApplication implements AnalogListe
     private void initOpenCL1() {
         clContext = context.getOpenCLContext();
         clQueue = clContext.createQueue().register();
-        programCache = new ProgramCache(clContext);
+        ProgramCache programCache = new ProgramCache(clContext);
         //create kernel
         String cacheID = getClass().getName()+".Julia";
         Program program = programCache.loadFromCache(cacheID);

+ 1 - 3
jme3-examples/src/main/java/jme3test/post/TestBloom.java

@@ -52,7 +52,6 @@ import com.jme3.util.SkyFactory.EnvMapType;
 
 public class TestBloom extends SimpleApplication {
 
-    private Spatial teapot;
     private boolean active=true;
     private FilterPostProcessor fpp;
     
@@ -87,8 +86,7 @@ public class TestBloom extends SimpleApplication {
         matSoil.setColor("Specular", ColorRGBA.Gray);
        
 
-
-        teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
+        Spatial teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
         teapot.setLocalTranslation(0,0,10);
 
         teapot.setMaterial(mat);

+ 2 - 3
jme3-examples/src/main/java/jme3test/post/TestBloomAlphaThreshold.java

@@ -54,8 +54,6 @@ import com.jme3.util.SkyFactory.EnvMapType;
 
 public class TestBloomAlphaThreshold extends SimpleApplication
 {
-
-	private Spatial teapot;
 	private boolean active = true;
 	private FilterPostProcessor fpp;
 
@@ -89,7 +87,8 @@ public class TestBloomAlphaThreshold extends SimpleApplication
 		matSoil.setColor("Diffuse", ColorRGBA.Black);
 		matSoil.setColor("Specular", ColorRGBA.Gray);
 
-		teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
+		Spatial teapot
+                        = assetManager.loadModel("Models/Teapot/Teapot.obj");
 		teapot.setLocalTranslation(0, 0, 10);
 
 		teapot.setMaterial(mat);

+ 1 - 3
jme3-examples/src/main/java/jme3test/post/TestCrossHatch.java

@@ -52,7 +52,6 @@ import com.jme3.util.SkyFactory.EnvMapType;
 
 public class TestCrossHatch extends SimpleApplication {
 
-    private Spatial teapot;
     private boolean active=true;
     private FilterPostProcessor fpp;
     
@@ -87,8 +86,7 @@ public class TestCrossHatch extends SimpleApplication {
         matSoil.setColor("Specular", ColorRGBA.Gray);
        
 
-
-        teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
+        Spatial teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
         teapot.setLocalTranslation(0,0,10);
 
         teapot.setMaterial(mat);

+ 3 - 6
jme3-examples/src/main/java/jme3test/post/TestDepthOfField.java

@@ -62,10 +62,8 @@ import java.util.List;
  */
 public class TestDepthOfField extends SimpleApplication {
 
-    private FilterPostProcessor fpp;
     final private Vector3f lightDir = new Vector3f(-4.9236743f, -1.27054665f, 5.896916f);
     private TerrainQuad terrain;
-    private Material matRock;
     private DepthOfFieldFilter dofFilter;
 
     public static void main(String[] args) {
@@ -102,9 +100,7 @@ public class TestDepthOfField extends SimpleApplication {
         sky.setLocalScale(350);
         mainScene.attachChild(sky);
 
-
-
-        fpp = new FilterPostProcessor(assetManager);
+        FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
         //     fpp.setNumSamples(4);
         int numSamples = getContext().getSettings().getSamples();
         if( numSamples > 0 ) {
@@ -175,7 +171,8 @@ public class TestDepthOfField extends SimpleApplication {
     }
 
     private void createTerrain(Node rootNode) {
-        matRock = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
+        Material matRock = new Material(assetManager,
+                "Common/MatDefs/Terrain/TerrainLighting.j3md");
         matRock.setBoolean("useTriPlanarMapping", false);
         matRock.setBoolean("WardIso", true);
         matRock.setTexture("AlphaMap", assetManager.loadTexture("Textures/Terrain/splat/alphamap.png"));

+ 5 - 5
jme3-examples/src/main/java/jme3test/post/TestMultiRenderTarget.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2020 jMonkeyEngine
+ * Copyright (c) 2009-2021 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -55,7 +55,7 @@ import com.jme3.ui.Picture;
 public class TestMultiRenderTarget extends SimpleApplication implements SceneProcessor {
 
     private FrameBuffer fb;
-    private Texture2D diffuseData, normalData, specularData, depthData;
+    private Texture2D diffuseData;
     private Picture display1, display2, display3, display4;
     
     private Picture display;
@@ -138,9 +138,9 @@ public class TestMultiRenderTarget extends SimpleApplication implements ScenePro
     @Override
     public void reshape(ViewPort vp, int w, int h) {
         diffuseData  = new Texture2D(w, h, Format.RGBA8);
-        normalData   = new Texture2D(w, h, Format.RGBA8);
-        specularData = new Texture2D(w, h, Format.RGBA8);
-        depthData    = new Texture2D(w, h, Format.Depth);
+        Texture2D normalData = new Texture2D(w, h, Format.RGBA8);
+        Texture2D specularData = new Texture2D(w, h, Format.RGBA8);
+        Texture2D depthData = new Texture2D(w, h, Format.Depth);
 
         mat = new Material(assetManager, "Common/MatDefs/Light/Deferred.j3md");
         mat.setTexture("DiffuseData",  diffuseData);

+ 1 - 2
jme3-examples/src/main/java/jme3test/post/TestMultiplesFilters.java

@@ -59,7 +59,6 @@ public class TestMultiplesFilters extends SimpleApplication {
         app.start();
     }
     private SSAOFilter ssaoFilter;
-    private FilterPostProcessor fpp;
 
     @Override
     public void simpleInitApp() {
@@ -94,7 +93,7 @@ public class TestMultiplesFilters extends SimpleApplication {
         sun.setColor(ColorRGBA.White.clone().multLocal(2));
         scene.addLight(sun);
 
-        fpp = new FilterPostProcessor(assetManager);
+        FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
       //  fpp.setNumSamples(4);
         ssaoFilter = new SSAOFilter(0.92f, 2.2f, 0.46f, 0.2f);
         final WaterFilter water=new WaterFilter(rootNode,new Vector3f(-0.4790551f, -0.39247334f, -0.7851566f));

+ 1 - 2
jme3-examples/src/main/java/jme3test/post/TestPosterization.java

@@ -51,7 +51,6 @@ import com.jme3.util.SkyFactory;
 
 public class TestPosterization extends SimpleApplication {
 
-    private Spatial teapot;
     private PosterizationFilter pf;
     
     public static void main(String[] args){
@@ -79,7 +78,7 @@ public class TestPosterization extends SimpleApplication {
         matSoil.setColor("Diffuse", ColorRGBA.Black);
         matSoil.setColor("Specular", ColorRGBA.Gray);
 
-        teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
+        Spatial teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
         teapot.setLocalTranslation(0,0,10);
 
         teapot.setMaterial(mat);

+ 3 - 3
jme3-examples/src/main/java/jme3test/post/TestRenderToCubemap.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2012 jMonkeyEngine
+ * Copyright (c) 2009-2021 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -58,7 +58,6 @@ public class TestRenderToCubemap  extends SimpleApplication {
  
     private Geometry offBox;
     private float angle = 0;
-    private ViewPort offView;
  
     public static void main(String[] args){
         TestRenderToCubemap app = new TestRenderToCubemap();
@@ -68,7 +67,8 @@ public class TestRenderToCubemap  extends SimpleApplication {
     public Texture setupOffscreenView(){
         Camera offCamera = new Camera(512, 512);
  
-        offView = renderManager.createPreView("Offscreen View", offCamera);
+        ViewPort offView
+                = renderManager.createPreView("Offscreen View", offCamera);
         offView.setClearFlags(true, true, true);
         offView.setBackgroundColor(ColorRGBA.DarkGray);
  

+ 3 - 4
jme3-examples/src/main/java/jme3test/post/TestRenderToMemory.java

@@ -75,8 +75,6 @@ public class TestRenderToMemory extends SimpleApplication implements SceneProces
     private float angle = 0;
 
     private FrameBuffer offBuffer;
-    private ViewPort offView;
-    private Camera offCamera;
     private ImageDisplay display;
 
     private static final int width = 800, height = 600;
@@ -169,10 +167,11 @@ public class TestRenderToMemory extends SimpleApplication implements SceneProces
     }
 
     public void setupOffscreenView(){
-        offCamera = new Camera(width, height);
+        Camera offCamera = new Camera(width, height);
 
         // create a pre-view. a view that is rendered before the main view
-        offView = renderManager.createPreView("Offscreen View", offCamera);
+        ViewPort offView
+                = renderManager.createPreView("Offscreen View", offCamera);
         offView.setBackgroundColor(ColorRGBA.DarkGray);
         offView.setClearFlags(true, true, true);
         

+ 2 - 3
jme3-examples/src/main/java/jme3test/post/TestSSAO.java

@@ -45,8 +45,6 @@ import com.jme3.texture.Texture;
 
 public class TestSSAO extends SimpleApplication {
 
-    private Geometry model;
-
     public static void main(String[] args) {
         TestSSAO app = new TestSSAO();
         app.start();
@@ -75,7 +73,8 @@ public class TestSSAO extends SimpleApplication {
 
         rootNode.addLight(al);
 
-        model = (Geometry) assetManager.loadModel("Models/Sponza/Sponza.j3o");
+        Geometry model
+                = (Geometry) assetManager.loadModel("Models/Sponza/Sponza.j3o");
         model.getMesh().scaleTextureCoordinates(new Vector2f(2, 2));
 
         model.setMaterial(mat);

+ 2 - 3
jme3-examples/src/main/java/jme3test/renderer/TestSplitScreen.java

@@ -52,7 +52,6 @@ public class TestSplitScreen extends SimpleApplication implements ActionListener
 
     private boolean splitScreen = false;
     final private Box mesh = new Box(1f, 1f, 1f);
-    private Camera leftCam, rightCam;
     final private Node leftScene = new Node("left scene");
     private ViewPort leftView, rightView;
 
@@ -66,7 +65,7 @@ public class TestSplitScreen extends SimpleApplication implements ActionListener
         blueBox.setMaterial(blueMat);
         rootNode.attachChild(blueBox);
 
-        rightCam = cam.clone();
+        Camera rightCam = cam.clone();
         rightCam.setViewPort(0.5f, 1f, 0f, 1f);
 
         rightView = renderManager.createMainView("right", rightCam);
@@ -80,7 +79,7 @@ public class TestSplitScreen extends SimpleApplication implements ActionListener
         redBox.setMaterial(redMat);
         leftScene.attachChild(redBox);
 
-        leftCam = cam.clone();
+        Camera leftCam = cam.clone();
         leftCam.setViewPort(0f, 0.5f, 0f, 1f);
 
         leftView = renderManager.createMainView("left", leftCam);

+ 1 - 2
jme3-examples/src/main/java/jme3test/stress/TestLodGeneration.java

@@ -59,7 +59,6 @@ public class TestLodGeneration extends SimpleApplication {
     private boolean wireFrame = false;
     private float reductionvalue = 0.0f;
     private int lodLevel = 0;
-    private Node model;
     private BitmapText hudText;
     final private List<Geometry> listGeoms = new ArrayList<>();
     final private ScheduledThreadPoolExecutor exec = new ScheduledThreadPoolExecutor(5);
@@ -75,7 +74,7 @@ public class TestLodGeneration extends SimpleApplication {
         rootNode.addLight(al);
 
        // model = (Node) assetManager.loadModel("Models/Sinbad/Sinbad.mesh.xml");
-       model = (Node) assetManager.loadModel("Models/Jaime/Jaime.j3o");
+        Node model = (Node) assetManager.loadModel("Models/Jaime/Jaime.j3o");
         BoundingBox b = ((BoundingBox) model.getWorldBound());
         model.setLocalScale(1.2f / (b.getYExtent() * 2));
         //  model.setLocalTranslation(0,-(b.getCenter().y - b.getYExtent())* model.getLocalScale().y, 0);

+ 45 - 53
jme3-examples/src/main/java/jme3test/terrain/TerrainFractalGridTest.java

@@ -24,8 +24,6 @@ import com.jme3.texture.Texture.WrapMode;
 
 public class TerrainFractalGridTest extends SimpleApplication {
 
-    private Material mat_terrain;
-    private TerrainGrid terrain;
     final private float grassScale = 64;
     final private float dirtScale = 16;
     final private float rockScale = 128;
@@ -35,12 +33,6 @@ public class TerrainFractalGridTest extends SimpleApplication {
         app.start();
     }
 
-    private FractalSum base;
-    private PerturbFilter perturb;
-    private OptimizedErode therm;
-    private SmoothFilter smooth;
-    private IterativeFilter iterate;
-
     @Override
     public void simpleInitApp() {
         this.flyCam.setMoveSpeed(100f);
@@ -48,7 +40,8 @@ public class TerrainFractalGridTest extends SimpleApplication {
         this.stateManager.attach(state);
 
         // TERRAIN TEXTURE material
-        this.mat_terrain = new Material(this.assetManager, "Common/MatDefs/Terrain/HeightBasedTerrain.j3md");
+        Material mat_terrain = new Material(this.assetManager,
+                "Common/MatDefs/Terrain/HeightBasedTerrain.j3md");
 
         // Parameters to material:
         // regionXColorMap: X = 1..4 the texture that should be appliad to state X
@@ -63,37 +56,37 @@ public class TerrainFractalGridTest extends SimpleApplication {
         // GRASS texture
         Texture grass = this.assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
         grass.setWrap(WrapMode.Repeat);
-        this.mat_terrain.setTexture("region1ColorMap", grass);
-        this.mat_terrain.setVector3("region1", new Vector3f(15, 200, this.grassScale));
+        mat_terrain.setTexture("region1ColorMap", grass);
+        mat_terrain.setVector3("region1", new Vector3f(15, 200, this.grassScale));
 
         // DIRT texture
         Texture dirt = this.assetManager.loadTexture("Textures/Terrain/splat/dirt.jpg");
         dirt.setWrap(WrapMode.Repeat);
-        this.mat_terrain.setTexture("region2ColorMap", dirt);
-        this.mat_terrain.setVector3("region2", new Vector3f(0, 20, this.dirtScale));
+        mat_terrain.setTexture("region2ColorMap", dirt);
+        mat_terrain.setVector3("region2", new Vector3f(0, 20, this.dirtScale));
 
         // ROCK texture
         Texture rock = this.assetManager.loadTexture("Textures/Terrain/Rock2/rock.jpg");
         rock.setWrap(WrapMode.Repeat);
-        this.mat_terrain.setTexture("region3ColorMap", rock);
-        this.mat_terrain.setVector3("region3", new Vector3f(198, 260, this.rockScale));
+        mat_terrain.setTexture("region3ColorMap", rock);
+        mat_terrain.setVector3("region3", new Vector3f(198, 260, this.rockScale));
 
-        this.mat_terrain.setTexture("region4ColorMap", rock);
-        this.mat_terrain.setVector3("region4", new Vector3f(198, 260, this.rockScale));
+        mat_terrain.setTexture("region4ColorMap", rock);
+        mat_terrain.setVector3("region4", new Vector3f(198, 260, this.rockScale));
 
-        this.mat_terrain.setTexture("slopeColorMap", rock);
-        this.mat_terrain.setFloat("slopeTileFactor", 32);
+        mat_terrain.setTexture("slopeColorMap", rock);
+        mat_terrain.setFloat("slopeTileFactor", 32);
 
-        this.mat_terrain.setFloat("terrainSize", 513);
+        mat_terrain.setFloat("terrainSize", 513);
 
-        this.base = new FractalSum();
-        this.base.setRoughness(0.7f);
-        this.base.setFrequency(1.0f);
-        this.base.setAmplitude(1.0f);
-        this.base.setLacunarity(2.12f);
-        this.base.setOctaves(8);
-        this.base.setScale(0.02125f);
-        this.base.addModulator(new NoiseModulator() {
+        FractalSum base = new FractalSum();
+        base.setRoughness(0.7f);
+        base.setFrequency(1.0f);
+        base.setAmplitude(1.0f);
+        base.setLacunarity(2.12f);
+        base.setOctaves(8);
+        base.setScale(0.02125f);
+        base.addModulator(new NoiseModulator() {
 
             @Override
             public float value(float... in) {
@@ -101,39 +94,38 @@ public class TerrainFractalGridTest extends SimpleApplication {
             }
         });
 
-        FilteredBasis ground = new FilteredBasis(this.base);
-
-        this.perturb = new PerturbFilter();
-        this.perturb.setMagnitude(0.119f);
+        FilteredBasis ground = new FilteredBasis(base);
 
-        this.therm = new OptimizedErode();
-        this.therm.setRadius(5);
-        this.therm.setTalus(0.011f);
+        PerturbFilter perturb = new PerturbFilter();
+        perturb.setMagnitude(0.119f);
 
-        this.smooth = new SmoothFilter();
-        this.smooth.setRadius(1);
-        this.smooth.setEffect(0.7f);
+        OptimizedErode therm = new OptimizedErode();
+        therm.setRadius(5);
+        therm.setTalus(0.011f);
 
-        this.iterate = new IterativeFilter();
-        this.iterate.addPreFilter(this.perturb);
-        this.iterate.addPostFilter(this.smooth);
-        this.iterate.setFilter(this.therm);
-        this.iterate.setIterations(1);
+        SmoothFilter smooth = new SmoothFilter();
+        smooth.setRadius(1);
+        smooth.setEffect(0.7f);
 
-        ground.addPreFilter(this.iterate);
+        IterativeFilter iterate = new IterativeFilter();
+        iterate.addPreFilter(perturb);
+        iterate.addPostFilter(smooth);
+        iterate.setFilter(therm);
+        iterate.setIterations(1);
 
-        this.terrain = new TerrainGrid("terrain", 33, 129, new FractalTileLoader(ground, 256f));
+        ground.addPreFilter(iterate);
 
-        this.terrain.setMaterial(this.mat_terrain);
-        this.terrain.setLocalTranslation(0, 0, 0);
-        this.terrain.setLocalScale(2f, 1f, 2f);
-        this.rootNode.attachChild(this.terrain);
+        TerrainGrid terrain
+                = new TerrainGrid("terrain", 33, 129, new FractalTileLoader(ground, 256f));
+        terrain.setMaterial(mat_terrain);
+        terrain.setLocalTranslation(0, 0, 0);
+        terrain.setLocalScale(2f, 1f, 2f);
+        this.rootNode.attachChild(terrain);
 
-        TerrainLodControl control = new TerrainGridLodControl(this.terrain, this.getCamera());
+        TerrainLodControl control
+                = new TerrainGridLodControl(terrain, this.getCamera());
         control.setLodCalculator(new DistanceLodCalculator(33, 2.7f)); // patch size, and a multiplier
-        this.terrain.addControl(control);
-
-
+        terrain.addControl(control);
 
         this.getCamera().setLocation(new Vector3f(0, 300, 0));
         cam.setRotation(new Quaternion(0.51176f, -0.14f, 0.085f, 0.84336f));

+ 28 - 33
jme3-examples/src/main/java/jme3test/terrain/TerrainGridAlphaMapTest.java

@@ -55,13 +55,6 @@ public class TerrainGridAlphaMapTest extends SimpleApplication {
         app.start();
     }
     private CharacterControl player3;
-    private FractalSum base;
-    private PerturbFilter perturb;
-    private OptimizedErode therm;
-    private SmoothFilter smooth;
-    private IterativeFilter iterate;
-    private Material material;
-    private Material matWire;
 
     @Override
     public void simpleInitApp() {
@@ -86,7 +79,8 @@ public class TerrainGridAlphaMapTest extends SimpleApplication {
         this.stateManager.attach(state);
 
         // TERRAIN TEXTURE material
-        material = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
+        Material material = new Material(assetManager,
+                "Common/MatDefs/Terrain/TerrainLighting.j3md");
         material.setBoolean("useTriPlanarMapping", false);
         //material.setBoolean("isTerrainGrid", true);
         material.setFloat("Shininess", 0.0f);
@@ -110,18 +104,19 @@ public class TerrainGridAlphaMapTest extends SimpleApplication {
         material.setFloat("DiffuseMap_2_scale", rockScale);
 
         // WIREFRAME material
-        matWire = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
+        Material matWire = new Material(assetManager,
+                "Common/MatDefs/Misc/Unshaded.j3md");
         matWire.getAdditionalRenderState().setWireframe(true);
         matWire.setColor("Color", ColorRGBA.Green);
 
-        this.base = new FractalSum();
-        this.base.setRoughness(0.7f);
-        this.base.setFrequency(1.0f);
-        this.base.setAmplitude(1.0f);
-        this.base.setLacunarity(2.12f);
-        this.base.setOctaves(8);
-        this.base.setScale(0.02125f);
-        this.base.addModulator(new NoiseModulator() {
+        FractalSum base = new FractalSum();
+        base.setRoughness(0.7f);
+        base.setFrequency(1.0f);
+        base.setAmplitude(1.0f);
+        base.setLacunarity(2.12f);
+        base.setOctaves(8);
+        base.setScale(0.02125f);
+        base.addModulator(new NoiseModulator() {
 
             @Override
             public float value(float... in) {
@@ -129,29 +124,29 @@ public class TerrainGridAlphaMapTest extends SimpleApplication {
             }
         });
 
-        FilteredBasis ground = new FilteredBasis(this.base);
+        FilteredBasis ground = new FilteredBasis(base);
 
-        this.perturb = new PerturbFilter();
-        this.perturb.setMagnitude(0.119f);
+        PerturbFilter perturb = new PerturbFilter();
+        perturb.setMagnitude(0.119f);
 
-        this.therm = new OptimizedErode();
-        this.therm.setRadius(5);
-        this.therm.setTalus(0.011f);
+        OptimizedErode therm = new OptimizedErode();
+        therm.setRadius(5);
+        therm.setTalus(0.011f);
 
-        this.smooth = new SmoothFilter();
-        this.smooth.setRadius(1);
-        this.smooth.setEffect(0.7f);
+        SmoothFilter smooth = new SmoothFilter();
+        smooth.setRadius(1);
+        smooth.setEffect(0.7f);
 
-        this.iterate = new IterativeFilter();
-        this.iterate.addPreFilter(this.perturb);
-        this.iterate.addPostFilter(this.smooth);
-        this.iterate.setFilter(this.therm);
-        this.iterate.setIterations(1);
+        IterativeFilter iterate = new IterativeFilter();
+        iterate.addPreFilter(perturb);
+        iterate.addPostFilter(smooth);
+        iterate.setFilter(therm);
+        iterate.setIterations(1);
 
-        ground.addPreFilter(this.iterate);
+        ground.addPreFilter(iterate);
 
         this.terrain = new TerrainGrid("terrain", 33, 257, new FractalTileLoader(ground, 256));
-        this.terrain.setMaterial(this.material);
+        this.terrain.setMaterial(material);
 
         this.terrain.setLocalTranslation(0, 0, 0);
         this.terrain.setLocalScale(2f, 1f, 2f);

+ 13 - 13
jme3-examples/src/main/java/jme3test/terrain/TerrainGridTest.java

@@ -29,7 +29,6 @@ import com.jme3.texture.Texture.WrapMode;
 
 public class TerrainGridTest extends SimpleApplication {
 
-    private Material mat_terrain;
     private TerrainGrid terrain;
     final private float grassScale = 64;
     final private float dirtScale = 16;
@@ -51,7 +50,8 @@ public class TerrainGridTest extends SimpleApplication {
         this.stateManager.attach(state);
 
         // TERRAIN TEXTURE material
-        this.mat_terrain = new Material(this.assetManager, "Common/MatDefs/Terrain/HeightBasedTerrain.j3md");
+        Material mat_terrain = new Material(this.assetManager,
+                "Common/MatDefs/Terrain/HeightBasedTerrain.j3md");
 
         // Parameters to material:
         // regionXColorMap: X = 1..4 the texture that should be appliad to state X
@@ -66,28 +66,28 @@ public class TerrainGridTest extends SimpleApplication {
         // GRASS texture
         Texture grass = this.assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
         grass.setWrap(WrapMode.Repeat);
-        this.mat_terrain.setTexture("region1ColorMap", grass);
-        this.mat_terrain.setVector3("region1", new Vector3f(88, 200, this.grassScale));
+        mat_terrain.setTexture("region1ColorMap", grass);
+        mat_terrain.setVector3("region1", new Vector3f(88, 200, this.grassScale));
 
         // DIRT texture
         Texture dirt = this.assetManager.loadTexture("Textures/Terrain/splat/dirt.jpg");
         dirt.setWrap(WrapMode.Repeat);
-        this.mat_terrain.setTexture("region2ColorMap", dirt);
-        this.mat_terrain.setVector3("region2", new Vector3f(0, 90, this.dirtScale));
+        mat_terrain.setTexture("region2ColorMap", dirt);
+        mat_terrain.setVector3("region2", new Vector3f(0, 90, this.dirtScale));
 
         // ROCK texture
         Texture rock = this.assetManager.loadTexture("Textures/Terrain/Rock2/rock.jpg");
         rock.setWrap(WrapMode.Repeat);
-        this.mat_terrain.setTexture("region3ColorMap", rock);
-        this.mat_terrain.setVector3("region3", new Vector3f(198, 260, this.rockScale));
+        mat_terrain.setTexture("region3ColorMap", rock);
+        mat_terrain.setVector3("region3", new Vector3f(198, 260, this.rockScale));
 
-        this.mat_terrain.setTexture("region4ColorMap", rock);
-        this.mat_terrain.setVector3("region4", new Vector3f(198, 260, this.rockScale));
+        mat_terrain.setTexture("region4ColorMap", rock);
+        mat_terrain.setVector3("region4", new Vector3f(198, 260, this.rockScale));
 
-        this.mat_terrain.setTexture("slopeColorMap", rock);
-        this.mat_terrain.setFloat("slopeTileFactor", 32);
+        mat_terrain.setTexture("slopeColorMap", rock);
+        mat_terrain.setFloat("slopeTileFactor", 32);
 
-        this.mat_terrain.setFloat("terrainSize", 129);
+        mat_terrain.setFloat("terrainSize", 129);
 
         this.terrain = new TerrainGrid("terrain", 65, 257, new ImageTileLoader(assetManager, new Namer() {
 

+ 14 - 14
jme3-examples/src/main/java/jme3test/terrain/TerrainGridTileLoaderTest.java

@@ -32,7 +32,6 @@ import java.io.File;
 
 public class TerrainGridTileLoaderTest extends SimpleApplication {
 
-    private Material mat_terrain;
     private TerrainGrid terrain;
     final private float grassScale = 64;
     final private float dirtScale = 16;
@@ -59,7 +58,8 @@ public class TerrainGridTileLoaderTest extends SimpleApplication {
         this.stateManager.attach(state);
 
         // TERRAIN TEXTURE material
-        this.mat_terrain = new Material(this.assetManager, "Common/MatDefs/Terrain/HeightBasedTerrain.j3md");
+        Material mat_terrain = new Material(assetManager,
+                "Common/MatDefs/Terrain/HeightBasedTerrain.j3md");
 
         // Parameters to material:
         // regionXColorMap: X = 1..4 the texture that should be appliad to state X
@@ -74,33 +74,33 @@ public class TerrainGridTileLoaderTest extends SimpleApplication {
         // GRASS texture
         Texture grass = this.assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
         grass.setWrap(WrapMode.Repeat);
-        this.mat_terrain.setTexture("region1ColorMap", grass);
-        this.mat_terrain.setVector3("region1", new Vector3f(88, 200, this.grassScale));
+        mat_terrain.setTexture("region1ColorMap", grass);
+        mat_terrain.setVector3("region1", new Vector3f(88, 200, this.grassScale));
 
         // DIRT texture
         Texture dirt = this.assetManager.loadTexture("Textures/Terrain/splat/dirt.jpg");
         dirt.setWrap(WrapMode.Repeat);
-        this.mat_terrain.setTexture("region2ColorMap", dirt);
-        this.mat_terrain.setVector3("region2", new Vector3f(0, 90, this.dirtScale));
+        mat_terrain.setTexture("region2ColorMap", dirt);
+        mat_terrain.setVector3("region2", new Vector3f(0, 90, this.dirtScale));
 
         // ROCK texture
         Texture rock = this.assetManager.loadTexture("Textures/Terrain/Rock2/rock.jpg");
         rock.setWrap(WrapMode.Repeat);
-        this.mat_terrain.setTexture("region3ColorMap", rock);
-        this.mat_terrain.setVector3("region3", new Vector3f(198, 260, this.rockScale));
+        mat_terrain.setTexture("region3ColorMap", rock);
+        mat_terrain.setVector3("region3", new Vector3f(198, 260, this.rockScale));
 
-        this.mat_terrain.setTexture("region4ColorMap", rock);
-        this.mat_terrain.setVector3("region4", new Vector3f(198, 260, this.rockScale));
+        mat_terrain.setTexture("region4ColorMap", rock);
+        mat_terrain.setVector3("region4", new Vector3f(198, 260, this.rockScale));
 
-        this.mat_terrain.setTexture("slopeColorMap", rock);
-        this.mat_terrain.setFloat("slopeTileFactor", 32);
+        mat_terrain.setTexture("slopeColorMap", rock);
+        mat_terrain.setFloat("slopeTileFactor", 32);
 
-        this.mat_terrain.setFloat("terrainSize", 129);
+        mat_terrain.setFloat("terrainSize", 129);
 //quad.getHeightMap(), terrain.getLocalScale()), 0
         AssetTileLoader grid = new AssetTileLoader(assetManager, "testgrid", "TerrainGrid");
         this.terrain = new TerrainGrid("terrain", 65, 257, grid);
 
-        this.terrain.setMaterial(this.mat_terrain);
+        this.terrain.setMaterial(mat_terrain);
         this.terrain.setLocalTranslation(0, 0, 0);
         this.terrain.setLocalScale(2f, 1f, 2f);
 //        try {

+ 1 - 6
jme3-examples/src/main/java/jme3test/terrain/TerrainTest.java

@@ -37,12 +37,10 @@ import com.jme3.input.KeyInput;
 import com.jme3.input.controls.ActionListener;
 import com.jme3.input.controls.KeyTrigger;
 import com.jme3.light.DirectionalLight;
-import com.jme3.light.PointLight;
 import com.jme3.material.Material;
 import com.jme3.math.ColorRGBA;
 import com.jme3.math.Quaternion;
 import com.jme3.math.Vector3f;
-import com.jme3.scene.Geometry;
 import com.jme3.terrain.geomipmap.TerrainLodControl;
 import com.jme3.terrain.geomipmap.TerrainQuad;
 import com.jme3.terrain.geomipmap.lodcalc.DistanceLodCalculator;
@@ -77,9 +75,6 @@ public class TerrainTest extends SimpleApplication {
     private Material matWire;
     private boolean wireframe = false;
     private boolean triPlanar = false;
-    private BitmapText hintText;
-    private PointLight pl;
-    private Geometry lightMdl;
     private float grassScale = 64;
     private float dirtScale = 16;
     private float rockScale = 128;
@@ -174,7 +169,7 @@ public class TerrainTest extends SimpleApplication {
     }
 
     public void loadHintText() {
-        hintText = new BitmapText(guiFont, false);
+        BitmapText hintText = new BitmapText(guiFont, false);
         hintText.setSize(guiFont.getCharSet().getRenderedSize());
         hintText.setLocalTranslation(0, getCamera().getHeight(), 0);
         hintText.setText("Press T to toggle wireframe,  P to toggle tri-planar texturing");

+ 1 - 2
jme3-examples/src/main/java/jme3test/terrain/TerrainTestAdvanced.java

@@ -67,7 +67,6 @@ public class TerrainTestAdvanced extends SimpleApplication {
     private Material matWire;
     private boolean wireframe = false;
     private boolean triPlanar = false;
-    private BitmapText hintText;
     private float dirtScale = 16;
     private float darkRockScale = 32;
     private float pinkRockScale = 32;
@@ -226,7 +225,7 @@ public class TerrainTestAdvanced extends SimpleApplication {
     }
 
     public void loadHintText() {
-        hintText = new BitmapText(guiFont, false);
+        BitmapText hintText = new BitmapText(guiFont, false);
         hintText.setSize(guiFont.getCharSet().getRenderedSize());
         hintText.setLocalTranslation(0, getCamera().getHeight(), 0);
         hintText.setText("Press T to toggle wireframe,  P to toggle tri-planar texturing");

+ 1 - 2
jme3-examples/src/main/java/jme3test/terrain/TerrainTestAndroid.java

@@ -63,7 +63,6 @@ public class TerrainTestAndroid extends SimpleApplication {
     private Material matWire;
     private boolean wireframe = false;
     private boolean triPlanar = false;
-    private BitmapText hintText;
     private float grassScale = 64;
     private float dirtScale = 16;
     private float rockScale = 128;
@@ -151,7 +150,7 @@ public class TerrainTestAndroid extends SimpleApplication {
     }
 
     public void loadHintText() {
-        hintText = new BitmapText(guiFont, false);
+        BitmapText hintText = new BitmapText(guiFont, false);
         hintText.setSize(guiFont.getCharSet().getRenderedSize());
         hintText.setLocalTranslation(0, getCamera().getHeight(), 0);
         hintText.setText("Press T to toggle wireframe,  P to toggle tri-planar texturing");

+ 3 - 6
jme3-examples/src/main/java/jme3test/terrain/TerrainTestCollision.java

@@ -80,10 +80,7 @@ public class TerrainTestCollision extends SimpleApplication {
     private Material matRock;
     private Material matWire;
     private boolean wireframe = false;
-    private BitmapText hintText;
     private List<Geometry> collisionMarkers;
-    private BulletAppState bulletAppState;
-    private Geometry collisionBox;
     private Geometry selectedCollisionObject;
 
     public static void main(String[] args) {
@@ -101,7 +98,7 @@ public class TerrainTestCollision extends SimpleApplication {
     @Override
     public void simpleInitApp() {
         collisionMarkers = new ArrayList<>();
-        bulletAppState = new BulletAppState();
+        BulletAppState bulletAppState = new BulletAppState();
         bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
         stateManager.attach(bulletAppState);
         setupKeys();
@@ -165,7 +162,7 @@ public class TerrainTestCollision extends SimpleApplication {
             bulletAppState.getPhysicsSpace().add(sphere);
         }
 
-        collisionBox = new Geometry("collisionBox", new Box(2, 2, 2));
+        Geometry collisionBox = new Geometry("collisionBox", new Box(2, 2, 2));
         collisionBox.setModelBound(new BoundingBox());
         collisionBox.setLocalTranslation(new Vector3f(20, 95, 30));
         collisionBox.setMaterial(matWire);
@@ -182,7 +179,7 @@ public class TerrainTestCollision extends SimpleApplication {
     }
 
     public void loadHintText() {
-        hintText = new BitmapText(guiFont, false);
+        BitmapText hintText = new BitmapText(guiFont, false);
         hintText.setSize(guiFont.getCharSet().getRenderedSize());
         hintText.setLocalTranslation(0, getCamera().getHeight(), 0);
         hintText.setText("Press T to toggle wireframe");

+ 5 - 6
jme3-examples/src/main/java/jme3test/terrain/TerrainTestReadWrite.java

@@ -65,12 +65,9 @@ import java.util.logging.Logger;
 public class TerrainTestReadWrite extends SimpleApplication {
 
     private Terrain terrain;
-    private BitmapText hintText;
     final private float grassScale = 64;
     final private float dirtScale = 16;
     final private float rockScale = 128;
-    private Material matTerrain;
-    private Material matWire;
 
     public static void main(String[] args) {
         TerrainTestReadWrite app = new TerrainTestReadWrite();
@@ -94,7 +91,8 @@ public class TerrainTestReadWrite extends SimpleApplication {
     }
 
     private void createMap() {
-        matTerrain = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
+        Material matTerrain = new Material(assetManager,
+                "Common/MatDefs/Terrain/TerrainLighting.j3md");
         matTerrain.setBoolean("useTriPlanarMapping", false);
         matTerrain.setBoolean("WardIso", true);
 
@@ -134,7 +132,8 @@ public class TerrainTestReadWrite extends SimpleApplication {
         matTerrain.setTexture("NormalMap_1", normalMap1);
         matTerrain.setTexture("NormalMap_2", normalMap2);
 
-        matWire = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
+        Material matWire = new Material(assetManager,
+                "Common/MatDefs/Misc/Unshaded.j3md");
         matWire.getAdditionalRenderState().setWireframe(true);
         matWire.setColor("Color", ColorRGBA.Green);
 
@@ -189,7 +188,7 @@ public class TerrainTestReadWrite extends SimpleApplication {
     }
 
     public void loadHintText() {
-        hintText = new BitmapText(guiFont, false);
+        BitmapText hintText = new BitmapText(guiFont, false);
         hintText.setSize(guiFont.getCharSet().getRenderedSize());
         hintText.setLocalTranslation(0, getCamera().getHeight(), 0);
         hintText.setText("Hit T to save, and Y to load");

+ 1 - 2
jme3-examples/src/main/java/jme3test/terrain/TerrainTestTile.java

@@ -69,7 +69,6 @@ public class TerrainTestTile extends SimpleApplication {
     private Material matTerrain;
     private Material matWire;
     private boolean wireframe = false;
-    private BitmapText hintText;
     final private float grassScale = 256;
     
 
@@ -130,7 +129,7 @@ public class TerrainTestTile extends SimpleApplication {
     }
     
     public void loadHintText() {
-        hintText = new BitmapText(guiFont, false);
+        BitmapText hintText = new BitmapText(guiFont, false);
         hintText.setLocalTranslation(0, getCamera().getHeight(), 0);
         hintText.setText("Press T to toggle wireframe");
         guiNode.attachChild(hintText);

+ 5 - 6
jme3-examples/src/main/java/jme3test/water/TestMultiPostWater.java

@@ -64,9 +64,6 @@ import java.util.List;
 public class TestMultiPostWater extends SimpleApplication {
 
     final private Vector3f lightDir = new Vector3f(-4.9236743f, -1.27054665f, 5.896916f);
-    private WaterFilter water;
-    private TerrainQuad terrain;
-    private Material matRock;    
     final private static float WATER_HEIGHT = 90;
 
     public static void main(String[] args) {
@@ -113,7 +110,7 @@ public class TestMultiPostWater extends SimpleApplication {
 
         FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
 
-        water = new WaterFilter(rootNode, lightDir);
+        WaterFilter water = new WaterFilter(rootNode, lightDir);
         water.setCenter(new Vector3f(9.628218f, -15.830074f, 199.23595f));
         water.setRadius(260);
         water.setWaveScale(0.003f);
@@ -164,7 +161,8 @@ public class TestMultiPostWater extends SimpleApplication {
     }
 
     private void createTerrain(Node rootNode) {
-        matRock = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
+        Material matRock = new Material(assetManager,
+                "Common/MatDefs/Terrain/TerrainLighting.j3md");
         matRock.setBoolean("useTriPlanarMapping", false);
         matRock.setBoolean("WardIso", true);
         matRock.setTexture("AlphaMap", assetManager.loadTexture("Textures/Terrain/splat/alphamap.png"));
@@ -198,7 +196,8 @@ public class TestMultiPostWater extends SimpleApplication {
         } catch (Exception e) {
             e.printStackTrace();
         }
-        terrain = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());
+        TerrainQuad terrain
+                = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());
         List<Camera> cameras = new ArrayList<>();
         cameras.add(getCamera());
         terrain.setMaterial(matRock);

+ 4 - 4
jme3-examples/src/main/java/jme3test/water/TestPostWater.java

@@ -72,8 +72,6 @@ public class TestPostWater extends SimpleApplication {
 
     final private Vector3f lightDir = new Vector3f(-4.9236743f, -1.27054665f, 5.896916f);
     private WaterFilter water;
-    private TerrainQuad terrain;
-    private Material matRock;
     private AudioNode waves;
     final private LowPassFilter aboveWaterAudioFilter = new LowPassFilter(1, 1);
 
@@ -218,7 +216,8 @@ public class TestPostWater extends SimpleApplication {
     }
 
     private void createTerrain(Node rootNode) {
-        matRock = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
+        Material matRock = new Material(assetManager,
+                "Common/MatDefs/Terrain/TerrainLighting.j3md");
         matRock.setBoolean("useTriPlanarMapping", false);
         matRock.setBoolean("WardIso", true);
         matRock.setTexture("AlphaMap", assetManager.loadTexture("Textures/Terrain/splat/alphamap.png"));
@@ -252,7 +251,8 @@ public class TestPostWater extends SimpleApplication {
         } catch (Exception e) {
             e.printStackTrace();
         }
-        terrain = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());
+        TerrainQuad terrain
+                = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());
         terrain.setMaterial(matRock);
         terrain.setLocalScale(new Vector3f(5, 5, 5));
         terrain.setLocalTranslation(new Vector3f(0, -30, 0));