diff --git a/jme3-android-examples/src/main/java/org/jmonkeyengine/jme3androidexamples/MainActivity.java b/jme3-android-examples/src/main/java/org/jmonkeyengine/jme3androidexamples/MainActivity.java index 81cb3f8568..fcebf70f8e 100644 --- a/jme3-android-examples/src/main/java/org/jmonkeyengine/jme3androidexamples/MainActivity.java +++ b/jme3-android-examples/src/main/java/org/jmonkeyengine/jme3androidexamples/MainActivity.java @@ -286,7 +286,7 @@ private boolean checkClassName(String className) { private boolean checkClassType(String className) { boolean include = true; try { - Class clazz = (Class) Class.forName(className); + Class clazz = Class.forName(className); if (Application.class.isAssignableFrom(clazz)) { Log.d(TAG, "Class " + className + " is a jME Application"); } else { diff --git a/jme3-android/src/main/java/com/jme3/app/AndroidHarnessFragment.java b/jme3-android/src/main/java/com/jme3/app/AndroidHarnessFragment.java index ed8976955f..073feb3fe4 100644 --- a/jme3-android/src/main/java/com/jme3/app/AndroidHarnessFragment.java +++ b/jme3-android/src/main/java/com/jme3/app/AndroidHarnessFragment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2019 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -684,10 +684,10 @@ public void onLayoutChange(View v, if (viewWidth > viewHeight && viewWidth > maxResolutionDimension) { // landscape fixedSizeWidth = maxResolutionDimension; - fixedSizeHeight = (int)(maxResolutionDimension * ((float)viewHeight / (float)viewWidth)); + fixedSizeHeight = (int)(maxResolutionDimension * (viewHeight / (float)viewWidth)); } else if (viewHeight > viewWidth && viewHeight > maxResolutionDimension) { // portrait - fixedSizeWidth = (int)(maxResolutionDimension * ((float)viewWidth / (float)viewHeight)); + fixedSizeWidth = (int)(maxResolutionDimension * (viewWidth / (float)viewHeight)); fixedSizeHeight = maxResolutionDimension; } else if (viewWidth == viewHeight && viewWidth > maxResolutionDimension) { fixedSizeWidth = maxResolutionDimension; diff --git a/jme3-android/src/main/java/com/jme3/app/state/MjpegFileWriter.java b/jme3-android/src/main/java/com/jme3/app/state/MjpegFileWriter.java index 9a8361f440..61a1a5a399 100644 --- a/jme3-android/src/main/java/com/jme3/app/state/MjpegFileWriter.java +++ b/jme3-android/src/main/java/com/jme3/app/state/MjpegFileWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -478,7 +478,7 @@ public byte[] toBytes() throws Exception { baos.write(fcc); baos.write(intBytes(swapInt(cb))); for (int i = 0; i < ind.size(); i++) { - AVIIndex in = (AVIIndex) ind.get(i); + AVIIndex in = ind.get(i); baos.write(in.toBytes()); } diff --git a/jme3-android/src/main/java/com/jme3/app/state/VideoRecorderAppState.java b/jme3-android/src/main/java/com/jme3/app/state/VideoRecorderAppState.java index e8774a3db4..22e15c9611 100644 --- a/jme3-android/src/main/java/com/jme3/app/state/VideoRecorderAppState.java +++ b/jme3-android/src/main/java/com/jme3/app/state/VideoRecorderAppState.java @@ -358,7 +358,7 @@ public float getFrameRate() { @Override public float getTimePerFrame() { - return (float) (1.0f / this.framerate); + return 1.0f / this.framerate; } @Override diff --git a/jme3-android/src/main/java/com/jme3/input/android/AndroidSensorJoyInput.java b/jme3-android/src/main/java/com/jme3/input/android/AndroidSensorJoyInput.java index 4232e60827..ef9df8faf0 100644 --- a/jme3-android/src/main/java/com/jme3/input/android/AndroidSensorJoyInput.java +++ b/jme3-android/src/main/java/com/jme3/input/android/AndroidSensorJoyInput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2018 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -561,7 +561,7 @@ public void onSensorChanged(SensorEvent se) { } } } - } else if (sensorData != null) { + } else { if (!sensorData.haveData) { sensorData.haveData = true; } diff --git a/jme3-android/src/main/java/com/jme3/input/android/AndroidTouchInput.java b/jme3-android/src/main/java/com/jme3/input/android/AndroidTouchInput.java index 0a7fc38381..d02801d0e1 100644 --- a/jme3-android/src/main/java/com/jme3/input/android/AndroidTouchInput.java +++ b/jme3-android/src/main/java/com/jme3/input/android/AndroidTouchInput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -131,8 +131,8 @@ public void loadSettings(AppSettings settings) { // view width and height are 0 until the view is displayed on the screen if (androidInput.getView().getWidth() != 0 && androidInput.getView().getHeight() != 0) { - scaleX = (float)settings.getWidth() / (float)androidInput.getView().getWidth(); - scaleY = (float)settings.getHeight() / (float)androidInput.getView().getHeight(); + scaleX = settings.getWidth() / (float)androidInput.getView().getWidth(); + scaleY = settings.getHeight() / (float)androidInput.getView().getHeight(); } logger.log(Level.FINE, "Setting input scaling, scaleX: {0}, scaleY: {1}", new Object[]{scaleX, scaleY}); diff --git a/jme3-android/src/main/java/com/jme3/input/android/TouchEventPool.java b/jme3-android/src/main/java/com/jme3/input/android/TouchEventPool.java index 400a3bd38d..2bea5a8cd9 100644 --- a/jme3-android/src/main/java/com/jme3/input/android/TouchEventPool.java +++ b/jme3-android/src/main/java/com/jme3/input/android/TouchEventPool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -87,7 +87,7 @@ public TouchEvent getNextFreeEvent() { TouchEvent evt = null; int curSize = eventPool.size(); while (curSize > 0) { - evt = (TouchEvent)eventPool.pop(); + evt = eventPool.pop(); if (evt.isConsumed()) { break; } else { diff --git a/jme3-android/src/main/java/com/jme3/system/android/OGLESContext.java b/jme3-android/src/main/java/com/jme3/system/android/OGLESContext.java index bb64a68490..f1c99cebd2 100644 --- a/jme3-android/src/main/java/com/jme3/system/android/OGLESContext.java +++ b/jme3-android/src/main/java/com/jme3/system/android/OGLESContext.java @@ -255,7 +255,7 @@ public void setSettings(AppSettings settings) { } if (settings.getFrameRate() > 0) { - minFrameDuration = (long)(1000d / (double)settings.getFrameRate()); // ms + minFrameDuration = (long)(1000d / settings.getFrameRate()); // ms logger.log(Level.FINE, "Setting min tpf: {0}ms", minFrameDuration); } else { minFrameDuration = 0; diff --git a/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/file/Structure.java b/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/file/Structure.java index fac6597c5e..da3076e2ac 100644 --- a/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/file/Structure.java +++ b/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/file/Structure.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2018 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -252,7 +252,7 @@ public String getName() { Object fieldValue = this.getFieldValue("ID"); if (fieldValue instanceof Structure) { Structure id = (Structure) fieldValue; - return id == null ? null : id.getFieldValue("name").toString().substring(2);// blender adds 2-charactes as a name prefix + return id.getFieldValue("name").toString().substring(2);// blender adds 2-charactes as a name prefix } Object name = this.getFieldValue("name", null); return name == null ? null : name.toString().substring(2); diff --git a/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/meshes/MeshBuffers.java b/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/meshes/MeshBuffers.java index 0ec120bad3..a14d77004c 100644 --- a/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/meshes/MeshBuffers.java +++ b/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/meshes/MeshBuffers.java @@ -251,7 +251,7 @@ public void append(boolean smooth, Vector3f[] verts, Vector3f[] normals, Map 0) { + if (vertexGroups.size() > 0) { Map group = vertexGroups.get(i); maximumWeightsPerVertex = Math.max(maximumWeightsPerVertex, group.size()); boneWeightAndIndexes.add(new TreeMap(group)); diff --git a/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/textures/generating/NoiseGenerator.java b/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/textures/generating/NoiseGenerator.java index a600ff0759..7847f255fc 100644 --- a/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/textures/generating/NoiseGenerator.java +++ b/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/textures/generating/NoiseGenerator.java @@ -496,7 +496,7 @@ public static float turbulence(float x, float y, float z, float noiseSize, int n sum += t * amp; } - sum *= (float) (1 << noiseDepth) / (float) ((1 << noiseDepth + 1) - 1); + sum *= (1 << noiseDepth) / (float) ((1 << noiseDepth + 1) - 1); return sum; } diff --git a/jme3-bullet/src/common/java/com/jme3/bullet/control/KinematicRagdollControl.java b/jme3-bullet/src/common/java/com/jme3/bullet/control/KinematicRagdollControl.java index 40d9689233..93d6cc1d41 100644 --- a/jme3-bullet/src/common/java/com/jme3/bullet/control/KinematicRagdollControl.java +++ b/jme3-bullet/src/common/java/com/jme3/bullet/control/KinematicRagdollControl.java @@ -409,7 +409,7 @@ private void ikUpdate(float tpf){ while (it.hasNext()) { boneName = it.next(); - bone = (Bone) boneLinks.get(boneName).bone; + bone = boneLinks.get(boneName).bone; if (!bone.hasUserControl()) { Logger.getLogger(KinematicRagdollControl.class.getSimpleName()).log(Level.FINE, "{0} doesn't have user control", boneName); continue; @@ -421,7 +421,7 @@ private void ikUpdate(float tpf){ } int depth = 0; int maxDepth = ikChainDepth.get(bone.getName()); - updateBone(boneLinks.get(bone.getName()), tpf * (float) FastMath.sqrt(distance), vars, tmpRot1, tmpRot2, bone, ikTargets.get(boneName), depth, maxDepth); + updateBone(boneLinks.get(bone.getName()), tpf * FastMath.sqrt(distance), vars, tmpRot1, tmpRot2, bone, ikTargets.get(boneName), depth, maxDepth); Vector3f position = vars.vect1; @@ -693,10 +693,10 @@ protected void boneRecursion(Spatial model, Bone bone, PhysicsRigidBody parent, shape = RagdollUtils.makeShapeFromVerticeWeights(model, RagdollUtils.getBoneIndices(link.bone, skeleton, boneList), initScale, link.bone.getModelSpacePosition(), weightThreshold); } - PhysicsRigidBody shapeNode = new PhysicsRigidBody(shape, rootMass / (float) reccount); + PhysicsRigidBody shapeNode = new PhysicsRigidBody(shape, rootMass / reccount); shapeNode.setKinematic(mode == Mode.Kinematic); - totalMass += rootMass / (float) reccount; + totalMass += rootMass / reccount; link.rigidBody = shapeNode; link.initalWorldRotation = bone.getModelSpaceRotation().clone(); diff --git a/jme3-bullet/src/common/java/com/jme3/bullet/util/CollisionShapeFactory.java b/jme3-bullet/src/common/java/com/jme3/bullet/util/CollisionShapeFactory.java index 19e14d49be..9f3bc797aa 100644 --- a/jme3-bullet/src/common/java/com/jme3/bullet/util/CollisionShapeFactory.java +++ b/jme3-bullet/src/common/java/com/jme3/bullet/util/CollisionShapeFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2018 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -229,7 +229,7 @@ public static CollisionShape createDynamicMeshShape(Spatial spatial) { */ public static CollisionShape createBoxShape(Spatial spatial) { if (spatial instanceof Geometry) { - return createSingleBoxShape((Geometry) spatial, spatial); + return createSingleBoxShape(spatial, spatial); } else if (spatial instanceof Node) { return createBoxCompoundShape((Node) spatial); } else { diff --git a/jme3-bullet/src/main/java/com/jme3/bullet/PhysicsSpace.java b/jme3-bullet/src/main/java/com/jme3/bullet/PhysicsSpace.java index f2d709131b..fde793a873 100644 --- a/jme3-bullet/src/main/java/com/jme3/bullet/PhysicsSpace.java +++ b/jme3-bullet/src/main/java/com/jme3/bullet/PhysicsSpace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2019 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -539,7 +539,7 @@ public void add(Object obj) { Spatial node = (Spatial) obj; for (int i = 0; i < node.getNumControls(); i++) { if (node.getControl(i) instanceof PhysicsControl) { - add(((PhysicsControl) node.getControl(i))); + add(node.getControl(i)); } } } else if (obj instanceof PhysicsCollisionObject) { @@ -581,7 +581,7 @@ public void remove(Object obj) { Spatial node = (Spatial) obj; for (int i = 0; i < node.getNumControls(); i++) { if (node.getControl(i) instanceof PhysicsControl) { - remove(((PhysicsControl) node.getControl(i))); + remove(node.getControl(i)); } } } else if (obj instanceof PhysicsCollisionObject) { @@ -1129,7 +1129,7 @@ public List rayTestRaw(Vector3f from, Vector3f to, List sweepTest(CollisionShape shape, Transform start, Transform end) { List results = new LinkedList(); sweepTest(shape, start, end , results); - return (List) results; + return results; } /** diff --git a/jme3-core/src/main/java/com/jme3/anim/MorphTrack.java b/jme3-core/src/main/java/com/jme3/anim/MorphTrack.java index 4ae14dd55a..a6dc4a7d90 100644 --- a/jme3-core/src/main/java/com/jme3/anim/MorphTrack.java +++ b/jme3-core/src/main/java/com/jme3/anim/MorphTrack.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2019 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -122,7 +122,7 @@ public void setKeyframes(float[] times, float[] weights) { this.weights = weights; - assert times != null && times.length == weights.length; + assert times.length == weights.length; } } diff --git a/jme3-core/src/main/java/com/jme3/anim/tween/action/LinearBlendSpace.java b/jme3-core/src/main/java/com/jme3/anim/tween/action/LinearBlendSpace.java index 31d2931feb..c90764a907 100644 --- a/jme3-core/src/main/java/com/jme3/anim/tween/action/LinearBlendSpace.java +++ b/jme3-core/src/main/java/com/jme3/anim/tween/action/LinearBlendSpace.java @@ -17,7 +17,7 @@ public LinearBlendSpace(float minValue, float maxValue) { public void setBlendAction(BlendAction action) { this.action = action; Action[] actions = action.getActions(); - step = (maxValue - minValue) / (float) (actions.length - 1); + step = (maxValue - minValue) / (actions.length - 1); } @Override diff --git a/jme3-core/src/main/java/com/jme3/animation/AnimationFactory.java b/jme3-core/src/main/java/com/jme3/animation/AnimationFactory.java index 0b0a435c76..f8e1e77918 100644 --- a/jme3-core/src/main/java/com/jme3/animation/AnimationFactory.java +++ b/jme3-core/src/main/java/com/jme3/animation/AnimationFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2019 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -287,12 +287,12 @@ public void addKeyFrameRotationAngles(int keyFrameIndex, float x, float y, float //frames delta int dF = keyFrameIndex - prev; //angle per frame for x,y ,z - float dXAngle = (x - prevRot.eulerAngles.x) / (float) dF; - float dYAngle = (y - prevRot.eulerAngles.y) / (float) dF; - float dZAngle = (z - prevRot.eulerAngles.z) / (float) dF; + float dXAngle = (x - prevRot.eulerAngles.x) / dF; + float dYAngle = (y - prevRot.eulerAngles.y) / dF; + float dZAngle = (z - prevRot.eulerAngles.z) / dF; // the keyFrame step - int keyStep = (int) (((float) (dF)) / delta * (float) EULER_STEP); + int keyStep = (int) (dF / delta * EULER_STEP); // the current keyFrame int cursor = prev + keyStep; while (cursor < keyFrameIndex) { @@ -425,7 +425,7 @@ private void interpolate(Object[] keyFrames, Type type) { //interating over the frames for (int j = i; j <= key; j++) { // computing interpolation value - float val = (float) (j - i) / (float) span; + float val = (j - i) / (float) span; //interpolationg depending on the transform type switch (type) { case Translation: @@ -451,7 +451,7 @@ private void interpolate(Object[] keyFrames, Type type) { translations[j] = ((Vector3f) keyFrames[i]).clone(); break; case Rotation: - rotations[j] = ((Quaternion) ((Rotation) keyFrames[i]).rotation).clone(); + rotations[j] = ((Rotation) keyFrames[i]).rotation.clone(); break; case Scale: scales[j] = ((Vector3f) keyFrames[i]).clone(); diff --git a/jme3-core/src/main/java/com/jme3/app/DetailedProfiler.java b/jme3-core/src/main/java/com/jme3/app/DetailedProfiler.java index e5673df53c..8df40c1c4a 100644 --- a/jme3-core/src/main/java/com/jme3/app/DetailedProfiler.java +++ b/jme3-core/src/main/java/com/jme3/app/DetailedProfiler.java @@ -284,7 +284,7 @@ public double getAverageCpu() { if (nbFramesCpu == 0) { return 0; } - return (double) cpuSum / (double) Math.min(nbFramesCpu, MAX_FRAMES); + return cpuSum / (double) Math.min(nbFramesCpu, MAX_FRAMES); } public double getAverageGpu() { @@ -292,7 +292,7 @@ public double getAverageGpu() { return 0; } - return (double) gpuSum / (double) Math.min(nbFramesGpu, MAX_FRAMES); + return gpuSum / (double) Math.min(nbFramesGpu, MAX_FRAMES); } } diff --git a/jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java b/jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java index bc47182399..6816fceac6 100644 --- a/jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java +++ b/jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java @@ -401,12 +401,12 @@ public Object loadAsset(String name){ @Override public Texture loadTexture(TextureKey key){ - return (Texture) loadAsset(key); + return loadAsset(key); } @Override public Material loadMaterial(String name){ - return (Material) loadAsset(new MaterialKey(name)); + return loadAsset(new MaterialKey(name)); } @Override @@ -418,7 +418,7 @@ public Texture loadTexture(String name){ @Override public AudioData loadAudio(AudioKey key){ - return (AudioData) loadAsset(key); + return loadAsset(key); } @Override @@ -433,7 +433,7 @@ public BitmapFont loadFont(String name){ @Override public Spatial loadModel(ModelKey key){ - return (Spatial) loadAsset(key); + return loadAsset(key); } @Override @@ -443,7 +443,7 @@ public Spatial loadModel(String name){ @Override public FilterPostProcessor loadFilter(FilterKey key){ - return (FilterPostProcessor) loadAsset(key); + return loadAsset(key); } @Override diff --git a/jme3-core/src/main/java/com/jme3/audio/AudioNode.java b/jme3-core/src/main/java/com/jme3/audio/AudioNode.java index d8fa6eaf1e..5b56bee660 100644 --- a/jme3-core/src/main/java/com/jme3/audio/AudioNode.java +++ b/jme3-core/src/main/java/com/jme3/audio/AudioNode.java @@ -161,7 +161,7 @@ public AudioNode(AssetManager assetManager, String name, DataType type) { @Deprecated public AudioNode(AssetManager assetManager, String name, boolean stream, boolean streamCache) { this.audioKey = new AudioKey(name, stream, streamCache); - this.data = (AudioData) assetManager.loadAsset(audioKey); + this.data = assetManager.loadAsset(audioKey); } /** diff --git a/jme3-core/src/main/java/com/jme3/audio/openal/ALAudioRenderer.java b/jme3-core/src/main/java/com/jme3/audio/openal/ALAudioRenderer.java index ab76b36949..e127ac3c1a 100644 --- a/jme3-core/src/main/java/com/jme3/audio/openal/ALAudioRenderer.java +++ b/jme3-core/src/main/java/com/jme3/audio/openal/ALAudioRenderer.java @@ -827,7 +827,7 @@ private void clearChannel(int index) { al.alSourcei(sourceId, EFX.AL_DIRECT_FILTER, EFX.AL_FILTER_NULL); } if (src.isPositional()) { - AudioSource pas = (AudioSource) src; + AudioSource pas = src; if (pas.isReverbEnabled() && supportEfx) { al.alSource3i(sourceId, EFX.AL_AUXILIARY_SEND_FILTER, 0, 0, EFX.AL_FILTER_NULL); } diff --git a/jme3-core/src/main/java/com/jme3/bounding/BoundingBox.java b/jme3-core/src/main/java/com/jme3/bounding/BoundingBox.java index a621d3ea6d..37722efb26 100644 --- a/jme3-core/src/main/java/com/jme3/bounding/BoundingBox.java +++ b/jme3-core/src/main/java/com/jme3/bounding/BoundingBox.java @@ -813,7 +813,7 @@ public int collideWith(Collidable other, CollisionResults results) { } return 0; } else if (other instanceof Spatial) { - return ((Spatial)other).collideWith(this, results); + return other.collideWith(this, results); } else { throw new UnsupportedCollisionException("With: " + other.getClass().getSimpleName()); } diff --git a/jme3-core/src/main/java/com/jme3/bounding/BoundingSphere.java b/jme3-core/src/main/java/com/jme3/bounding/BoundingSphere.java index 0b0cb810fa..ba6fefb4aa 100644 --- a/jme3-core/src/main/java/com/jme3/bounding/BoundingSphere.java +++ b/jme3-core/src/main/java/com/jme3/bounding/BoundingSphere.java @@ -1016,7 +1016,7 @@ public int collideWith(Collidable other, CollisionResults results) { } return 0; } else if (other instanceof Spatial) { - return ((Spatial)other).collideWith(this, results); + return other.collideWith(this, results); } else { throw new UnsupportedCollisionException(); } diff --git a/jme3-core/src/main/java/com/jme3/cinematic/MotionPath.java b/jme3-core/src/main/java/com/jme3/cinematic/MotionPath.java index a0f978f0a1..1e6155d185 100644 --- a/jme3-core/src/main/java/com/jme3/cinematic/MotionPath.java +++ b/jme3-core/src/main/java/com/jme3/cinematic/MotionPath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2019 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -192,7 +192,7 @@ public Vector2f getWayPointIndexForDistance(float distance, Vector2f store) { int i = 0; for (Float len : spline.getSegmentsLength()) { if (sum + len >= distance) { - return new Vector2f((float) i, (distance - sum) / len); + return new Vector2f(i, (distance - sum) / len); } sum += len; i++; diff --git a/jme3-core/src/main/java/com/jme3/cinematic/TimeLine.java b/jme3-core/src/main/java/com/jme3/cinematic/TimeLine.java index c844226299..554d586819 100644 --- a/jme3-core/src/main/java/com/jme3/cinematic/TimeLine.java +++ b/jme3-core/src/main/java/com/jme3/cinematic/TimeLine.java @@ -93,7 +93,7 @@ public int getKeyFrameIndexFromTime(float time) { } public float getKeyFrameTime(KeyFrame keyFrame) { - return (float)keyFrame.getIndex()/(float)keyFramesPerSeconds; + return keyFrame.getIndex()/(float)keyFramesPerSeconds; } public Collection getAllKeyFrames() { diff --git a/jme3-core/src/main/java/com/jme3/environment/generation/PrefilteredEnvMapFaceGenerator.java b/jme3-core/src/main/java/com/jme3/environment/generation/PrefilteredEnvMapFaceGenerator.java index cd4f969981..6d37f90fb1 100644 --- a/jme3-core/src/main/java/com/jme3/environment/generation/PrefilteredEnvMapFaceGenerator.java +++ b/jme3-core/src/main/java/com/jme3/environment/generation/PrefilteredEnvMapFaceGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2019 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -211,7 +211,7 @@ private Vector3f prefilterEnvMapTexel(CubeMapWrapper envMapReader, float roughne nbRotations = numSamples == 1 ? 1 : 18; } - float rad = 2f * FastMath.PI / (float) nbRotations; + float rad = 2f * FastMath.PI / nbRotations; // offset rotation to avoid sampling pattern float gi = (float) (FastMath.abs(N.z + N.x) * 256.0); float offset = rad * (FastMath.cos((gi * 0.5f) % (2f * FastMath.PI)) * 0.5f + 0.5f); diff --git a/jme3-core/src/main/java/com/jme3/environment/generation/RunnableWithProgress.java b/jme3-core/src/main/java/com/jme3/environment/generation/RunnableWithProgress.java index dec5abd2a5..f47887e0ea 100644 --- a/jme3-core/src/main/java/com/jme3/environment/generation/RunnableWithProgress.java +++ b/jme3-core/src/main/java/com/jme3/environment/generation/RunnableWithProgress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2019 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -66,7 +66,7 @@ protected void setEnd(int end) { * @return fraction (≥0, ≤1) */ public double getProgress() { - return (double) progress / (double) end; + return progress / (double) end; } /** diff --git a/jme3-core/src/main/java/com/jme3/environment/util/CubeMapWrapper.java b/jme3-core/src/main/java/com/jme3/environment/util/CubeMapWrapper.java index d03dbe88c3..8ea7a19094 100644 --- a/jme3-core/src/main/java/com/jme3/environment/util/CubeMapWrapper.java +++ b/jme3-core/src/main/java/com/jme3/environment/util/CubeMapWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2019 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -148,7 +148,7 @@ public ColorRGBA getPixel(int x, int y, int face, ColorRGBA store) { store = new ColorRGBA(); } raster.setSlice(face); - return raster.getPixel((int) x, (int) y, store); + return raster.getPixel(x, y, store); } /** @@ -170,7 +170,7 @@ public ColorRGBA getPixel(int x, int y, int face, int mipLevel, ColorRGBA store) } mipMapRaster.setSlice(face); mipMapRaster.setMipLevel(mipLevel); - return mipMapRaster.getPixel((int) x, (int) y, store); + return mipMapRaster.getPixel(x, y, store); } /** @@ -209,7 +209,7 @@ public void setPixel(Vector3f vector, int mipLevel, ColorRGBA color) { */ public void setPixel(int x, int y, int face, ColorRGBA color) { raster.setSlice(face); - raster.setPixel((int) x, (int) y, color); + raster.setPixel(x, y, color); } /** @@ -227,7 +227,7 @@ public void setPixel(int x, int y, int face, int mipLevel, ColorRGBA color) { mipMapRaster.setSlice(face); mipMapRaster.setMipLevel(mipLevel); - mipMapRaster.setPixel((int) x, (int) y, color); + mipMapRaster.setPixel(x, y, color); } /** diff --git a/jme3-core/src/main/java/com/jme3/environment/util/EnvMapUtils.java b/jme3-core/src/main/java/com/jme3/environment/util/EnvMapUtils.java index 8f7ad841c6..1897539d3b 100644 --- a/jme3-core/src/main/java/com/jme3/environment/util/EnvMapUtils.java +++ b/jme3-core/src/main/java/com/jme3/environment/util/EnvMapUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2019 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -194,8 +194,8 @@ static float getSolidAngleAndVector(int x, int y, int mapSize, int face, Vector3 /* transform from [0..res - 1] to [- (1 - 1 / res) .. (1 - 1 / res)] (+ 0.5f is for texel center addressing) */ - float u = (2.0f * ((float) x + 0.5f) / (float) mapSize) - 1.0f; - float v = (2.0f * ((float) y + 0.5f) / (float) mapSize) - 1.0f; + float u = (2.0f * (x + 0.5f) / mapSize) - 1.0f; + float v = (2.0f * (y + 0.5f) / mapSize) - 1.0f; getVectorFromCubemapFaceTexCoord(x, y, mapSize, face, store, fixSeamsMethod); @@ -203,7 +203,7 @@ static float getSolidAngleAndVector(int x, int y, int mapSize, int face, Vector3 * U and V are the -1..1 texture coordinate on the current face. * Get projected area for this texel */ float x0, y0, x1, y1; - float invRes = 1.0f / (float) mapSize; + float invRes = 1.0f / mapSize; x0 = u - invRes; y0 = v - invRes; x1 = u + invRes; @@ -246,19 +246,19 @@ public static Vector3f getVectorFromCubemapFaceTexCoord(int x, int y, int mapSiz if (fixSeamsMethod == FixSeamsMethod.Stretch) { /* Code from Nvtt : https://github.com/castano/nvidia-texture-tools/blob/master/src/nvtt/CubeSurface.cpp#L77 * transform from [0..res - 1] to [-1 .. 1], match up edges exactly. */ - u = (2.0f * (float) x / ((float) mapSize - 1.0f)) - 1.0f; - v = (2.0f * (float) y / ((float) mapSize - 1.0f)) - 1.0f; + u = (2.0f * x / (mapSize - 1.0f)) - 1.0f; + v = (2.0f * y / (mapSize - 1.0f)) - 1.0f; } else { //Done if any other fix method or no fix method is set /* transform from [0..res - 1] to [- (1 - 1 / res) .. (1 - 1 / res)] * (+ 0.5f is for texel center addressing) */ - u = (2.0f * ((float) x + 0.5f) / (float) (mapSize)) - 1.0f; - v = (2.0f * ((float) y + 0.5f) / (float) (mapSize)) - 1.0f; + u = (2.0f * (x + 0.5f) / mapSize) - 1.0f; + v = (2.0f * (y + 0.5f) / mapSize) - 1.0f; } if (fixSeamsMethod == FixSeamsMethod.Wrap) { // Warp texel centers in the proximity of the edges. - float a = pow((float) mapSize, 2.0f) / pow(((float) mapSize - 1f), 3.0f); + float a = pow(mapSize, 2.0f) / pow(mapSize - 1f, 3.0f); u = a * pow(u, 3f) + u; v = a * pow(v, 3f) + v; } @@ -362,14 +362,14 @@ public static int getCubemapFaceTexCoordFromVector(Vector3f texelVect, int mapSi if (fixSeamsMethod == FixSeamsMethod.Stretch) { /* Code from Nvtt : http://code.google.com/p/nvidia-texture-tools/source/browse/trunk/src/nvtt/CubeSurface.cpp * transform from [0..res - 1] to [-1 .. 1], match up edges exactly. */ - u = Math.round((u + 1.0f) * ((float) mapSize - 1.0f) * 0.5f); - v = Math.round((v + 1.0f) * ((float) mapSize - 1.0f) * 0.5f); + u = Math.round((u + 1.0f) * (mapSize - 1.0f) * 0.5f); + v = Math.round((v + 1.0f) * (mapSize - 1.0f) * 0.5f); } else { //Done if any other fix method or no fix method is set /* transform from [0..res - 1] to [- (1 - 1 / res) .. (1 - 1 / res)] * (+ 0.5f is for texel center addressing) */ - u = Math.round((u + 1.0f) * ((float) mapSize) * 0.5f - 0.5f); - v = Math.round((v + 1.0f) * ((float) mapSize) * 0.5f - 0.5f); + u = Math.round((u + 1.0f) * mapSize * 0.5f - 0.5f); + v = Math.round((v + 1.0f) * mapSize * 0.5f - 0.5f); } @@ -533,7 +533,7 @@ public static Vector4f getHammersleyPoint(int i, final int nbrSample, Vector4f s } float phi; long ui = i; - store.setX((float) i / (float) nbrSample); + store.setX(i / (float) nbrSample); /* From http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html * Radical Inverse : Van der Corput */ @@ -544,7 +544,7 @@ public static Vector4f getHammersleyPoint(int i, final int nbrSample, Vector4f s ui = ((ui & 0x00FF00FF) << 8) | ((ui & 0xFF00FF00) >>> 8); ui = ui & 0xffffffff; - store.setY(2.3283064365386963e-10f * (float) (ui)); /* 0x100000000 */ + store.setY(2.3283064365386963e-10f * ui); /* 0x100000000 */ phi = 2.0f * PI * store.y; store.setZ(cos(phi)); @@ -611,7 +611,7 @@ public static Node getCubeMapCrossDebugView(TextureCubeMap cubeMap, AssetManager int size = cubeMap.getImage().getWidth(); Picture[] pics = new Picture[6]; - float ratio = 128f / (float) size; + float ratio = 128f / size; for (int i = 0; i < 6; i++) { pics[i] = new Picture("bla"); diff --git a/jme3-core/src/main/java/com/jme3/font/BitmapFont.java b/jme3-core/src/main/java/com/jme3/font/BitmapFont.java index 694278057d..fdf214e4b3 100644 --- a/jme3-core/src/main/java/com/jme3/font/BitmapFont.java +++ b/jme3-core/src/main/java/com/jme3/font/BitmapFont.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2019 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -215,7 +215,7 @@ public float getLineWidth(CharSequence text){ firstCharOfLine = true; continue; } - BitmapCharacter c = charSet.getCharacter((int) theChar); + BitmapCharacter c = charSet.getCharacter(theChar); if (c != null){ if (theChar == '\\' && i) in.readSavableArrayList("controlPoints", new ArrayList()); /* Empty List as default, prevents null pointers */ + controlPoints = in.readSavableArrayList("controlPoints", new ArrayList<>()); /* Empty List as default, prevents null pointers */ float list[] = in.readFloatArray("segmentsLength", null); if (list != null) { segmentsLength = new ArrayList(); @@ -468,7 +468,7 @@ public void read(JmeImporter im) throws IOException { } type = in.readEnum("pathSplineType", SplineType.class, SplineType.CatmullRom); totalLength = in.readFloat("totalLength", 0); - CRcontrolPoints = (ArrayList) in.readSavableArrayList("CRControlPoints", null); + CRcontrolPoints = in.readSavableArrayList("CRControlPoints", null); curveTension = in.readFloat("curveTension", 0.5f); cycle = in.readBoolean("cycle", false); knots = in.readSavableArrayList("knots", null); diff --git a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLTracer.java b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLTracer.java index ae3f17a8ca..204c962f4b 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLTracer.java +++ b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLTracer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2014 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -71,7 +71,7 @@ public final class GLTracer implements InvocationHandler { private static void noEnumArgs(String method, int... argSlots) { IntMap argSlotsMap = new IntMap(); for (int argSlot : argSlots) { - argSlotsMap.put(argSlot, (Void) null); + argSlotsMap.put(argSlot, null); } nonEnumArgMap.put(method, argSlotsMap); } diff --git a/jme3-core/src/main/java/com/jme3/scene/AssetLinkNode.java b/jme3-core/src/main/java/com/jme3/scene/AssetLinkNode.java index 82711ac6b2..fd6790f686 100644 --- a/jme3-core/src/main/java/com/jme3/scene/AssetLinkNode.java +++ b/jme3-core/src/main/java/com/jme3/scene/AssetLinkNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -167,7 +167,7 @@ public void read(JmeImporter e) throws IOException { final InputCapsule capsule = e.getCapsule(this); final AssetManager assetManager = e.getAssetManager(); - assetLoaderKeys = (ArrayList) capsule.readSavableArrayList("assetLoaderKeyList", new ArrayList()); + assetLoaderKeys = capsule.readSavableArrayList("assetLoaderKeyList", new ArrayList<>()); for (final Iterator iterator = assetLoaderKeys.iterator(); iterator.hasNext(); ) { diff --git a/jme3-core/src/main/java/com/jme3/scene/debug/WireSphere.java b/jme3-core/src/main/java/com/jme3/scene/debug/WireSphere.java index cf0244355b..3fa4f48637 100644 --- a/jme3-core/src/main/java/com/jme3/scene/debug/WireSphere.java +++ b/jme3-core/src/main/java/com/jme3/scene/debug/WireSphere.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2017 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -109,7 +109,7 @@ public void updatePositions(float radius) { /* * Update vertex positions for the great circle in the X-Y plane. */ - float rate = FastMath.TWO_PI / (float) samples; + float rate = FastMath.TWO_PI / samples; float angle = 0; for (int i = 0; i < samples; i++) { float x = radius * FastMath.cos(angle); @@ -130,7 +130,7 @@ public void updatePositions(float radius) { /* * Update vertex positions for 'zSamples' parallel circles. */ - float zRate = (radius * 2) / (float) (zSamples); + float zRate = (radius * 2) / zSamples; float zHeight = -radius + (zRate / 2f); float rb = 1f / zSamples; float b = rb / 2f; diff --git a/jme3-core/src/main/java/com/jme3/scene/shape/PQTorus.java b/jme3-core/src/main/java/com/jme3/scene/shape/PQTorus.java index fad5f731cc..09f230ab00 100644 --- a/jme3-core/src/main/java/com/jme3/scene/shape/PQTorus.java +++ b/jme3-core/src/main/java/com/jme3/scene/shape/PQTorus.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -141,7 +141,7 @@ public void updateGeometry(float p, float q, float radius, float width, int step // Move along the length of the pq torus for (int i = 0; i < steps; i++) { theta += thetaStep; - float circleFraction = ((float) i) / (float) steps; + float circleFraction = i / (float) steps; // Find the point on the torus r = (0.5f * (2.0f + FastMath.sin(q * theta)) * radius); diff --git a/jme3-core/src/main/java/com/jme3/shader/ShaderNode.java b/jme3-core/src/main/java/com/jme3/shader/ShaderNode.java index 5ef500ffd0..a33ee1cf0d 100644 --- a/jme3-core/src/main/java/com/jme3/shader/ShaderNode.java +++ b/jme3-core/src/main/java/com/jme3/shader/ShaderNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -199,8 +199,8 @@ public void read(JmeImporter im) throws IOException { name = ic.readString("name", ""); definition = (ShaderNodeDefinition) ic.readSavable("definition", null); condition = ic.readString("condition", null); - inputMapping = (List) ic.readSavableArrayList("inputMapping", new ArrayList()); - outputMapping = (List) ic.readSavableArrayList("outputMapping", new ArrayList()); + inputMapping = ic.readSavableArrayList("inputMapping", new ArrayList<>()); + outputMapping = ic.readSavableArrayList("outputMapping", new ArrayList<>()); } /** diff --git a/jme3-core/src/main/java/com/jme3/shader/ShaderNodeDefinition.java b/jme3-core/src/main/java/com/jme3/shader/ShaderNodeDefinition.java index 68a7b80d8f..6e46f0d7a1 100644 --- a/jme3-core/src/main/java/com/jme3/shader/ShaderNodeDefinition.java +++ b/jme3-core/src/main/java/com/jme3/shader/ShaderNodeDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2019 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -194,7 +194,7 @@ public void setPath(String path) { */ @Override public void write(JmeExporter ex) throws IOException { - OutputCapsule oc = (OutputCapsule) ex.getCapsule(this); + OutputCapsule oc = ex.getCapsule(this); oc.write(name, "name", ""); String[] str = new String[shadersLanguage.size()]; oc.write(shadersLanguage.toArray(str), "shadersLanguage", null); @@ -230,7 +230,7 @@ public void setNoOutput(boolean noOutput) { */ @Override public void read(JmeImporter im) throws IOException { - InputCapsule ic = (InputCapsule) im.getCapsule(this); + InputCapsule ic = im.getCapsule(this); name = ic.readString("name", ""); String[] str = ic.readStringArray("shadersLanguage", null); @@ -248,8 +248,8 @@ public void read(JmeImporter im) throws IOException { } type = ic.readEnum("type", Shader.ShaderType.class, null); - inputs = (List) ic.readSavableArrayList("inputs", new ArrayList()); - outputs = (List) ic.readSavableArrayList("outputs", new ArrayList()); + inputs = ic.readSavableArrayList("inputs", new ArrayList<>()); + outputs = ic.readSavableArrayList("outputs", new ArrayList<>()); } /** diff --git a/jme3-core/src/main/java/com/jme3/shadow/BasicShadowRenderer.java b/jme3-core/src/main/java/com/jme3/shadow/BasicShadowRenderer.java index 3729f40951..aa8702fdf5 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/BasicShadowRenderer.java +++ b/jme3-core/src/main/java/com/jme3/shadow/BasicShadowRenderer.java @@ -92,7 +92,7 @@ public BasicShadowRenderer(AssetManager manager, int size) { //DO NOT COMMENT THIS (it prevent the OSX incomplete read buffer crash) dummyTex = new Texture2D(size, size, Format.RGBA8); shadowFB.setColorTexture(dummyTex); - shadowMapSize = (float)size; + shadowMapSize = size; preshadowMat = new Material(manager, "Common/MatDefs/Shadow/PreShadow.j3md"); postshadowMat = new Material(manager, "Common/MatDefs/Shadow/BasicPostShadow.j3md"); postshadowMat.setTexture("ShadowMap", shadowMap); diff --git a/jme3-core/src/main/java/com/jme3/shadow/ShadowUtil.java b/jme3-core/src/main/java/com/jme3/shadow/ShadowUtil.java index 7cad0a54c1..b282272d78 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/ShadowUtil.java +++ b/jme3-core/src/main/java/com/jme3/shadow/ShadowUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2019 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -725,7 +725,7 @@ public static void getGeometriesInLightRadius(GeometryList inputGeometryList, */ public static void getLitGeometriesInViewPort(Spatial rootScene, Camera vpCamera, Camera[] cameras, RenderQueue.ShadowMode mode, GeometryList outputGeometryList) { if (rootScene != null && rootScene instanceof Node) { - addGeometriesInCamFrustumAndViewPortFromNode(vpCamera, cameras, (Node)rootScene, mode, outputGeometryList); + addGeometriesInCamFrustumAndViewPortFromNode(vpCamera, cameras, rootScene, mode, outputGeometryList); } } /** diff --git a/jme3-core/src/main/java/com/jme3/system/AppSettings.java b/jme3-core/src/main/java/com/jme3/system/AppSettings.java index bdd983ae60..319e5e9a33 100644 --- a/jme3-core/src/main/java/com/jme3/system/AppSettings.java +++ b/jme3-core/src/main/java/com/jme3/system/AppSettings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2019 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -418,16 +418,16 @@ public void load(String preferencesKey) throws BackingStoreException { // Try loading using new method switch (key.charAt(0)) { case 'I': - put(key.substring(2), prefs.getInt(key, (Integer) 0)); + put(key.substring(2), prefs.getInt(key, 0)); break; case 'F': - put(key.substring(2), prefs.getFloat(key, (Float) 0f)); + put(key.substring(2), prefs.getFloat(key, 0f)); break; case 'S': - put(key.substring(2), prefs.get(key, (String) null)); + put(key.substring(2), prefs.get(key, null)); break; case 'B': - put(key.substring(2), prefs.getBoolean(key, (Boolean) false)); + put(key.substring(2), prefs.getBoolean(key, false)); break; default: throw new UnsupportedOperationException("Undefined setting type: " + key.charAt(0)); diff --git a/jme3-core/src/main/java/com/jme3/texture/Image.java b/jme3-core/src/main/java/com/jme3/texture/Image.java index f14de5b9ac..26375b7740 100644 --- a/jme3-core/src/main/java/com/jme3/texture/Image.java +++ b/jme3-core/src/main/java/com/jme3/texture/Image.java @@ -1254,7 +1254,7 @@ public void read(JmeImporter e) throws IOException { depth = capsule.readInt("depth", 0); mipMapSizes = capsule.readIntArray("mipMapSizes", null); multiSamples = capsule.readInt("multiSamples", 1); - data = (ArrayList) capsule.readByteBufferArrayList("data", null); + data = capsule.readByteBufferArrayList("data", null); colorSpace = capsule.readEnum("colorSpace", ColorSpace.class, null); if (mipMapSizes != null) { diff --git a/jme3-core/src/main/java/com/jme3/texture/image/DefaultImageRaster.java b/jme3-core/src/main/java/com/jme3/texture/image/DefaultImageRaster.java index 2d70d53d72..1d6c68e25f 100644 --- a/jme3-core/src/main/java/com/jme3/texture/image/DefaultImageRaster.java +++ b/jme3-core/src/main/java/com/jme3/texture/image/DefaultImageRaster.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -130,16 +130,16 @@ public void setPixel(int x, int y, ColorRGBA color) { switch (codec.type) { case ImageCodec.FLAG_F16: - components[0] = (int) FastMath.convertFloatToHalf(color.a); - components[1] = (int) FastMath.convertFloatToHalf(color.r); - components[2] = (int) FastMath.convertFloatToHalf(color.g); - components[3] = (int) FastMath.convertFloatToHalf(color.b); + components[0] = FastMath.convertFloatToHalf(color.a); + components[1] = FastMath.convertFloatToHalf(color.r); + components[2] = FastMath.convertFloatToHalf(color.g); + components[3] = FastMath.convertFloatToHalf(color.b); break; case ImageCodec.FLAG_F32: - components[0] = (int) Float.floatToIntBits(color.a); - components[1] = (int) Float.floatToIntBits(color.r); - components[2] = (int) Float.floatToIntBits(color.g); - components[3] = (int) Float.floatToIntBits(color.b); + components[0] = Float.floatToIntBits(color.a); + components[1] = Float.floatToIntBits(color.r); + components[2] = Float.floatToIntBits(color.g); + components[3] = Float.floatToIntBits(color.b); break; case 0: // Convert color to bits by multiplying by size @@ -176,10 +176,10 @@ public ColorRGBA getPixel(int x, int y, ColorRGBA store) { FastMath.convertHalfToFloat((short)components[0])); break; case ImageCodec.FLAG_F32: - store.set(Float.intBitsToFloat((int)components[1]), - Float.intBitsToFloat((int)components[2]), - Float.intBitsToFloat((int)components[3]), - Float.intBitsToFloat((int)components[0])); + store.set(Float.intBitsToFloat(components[1]), + Float.intBitsToFloat(components[2]), + Float.intBitsToFloat(components[3]), + Float.intBitsToFloat(components[0])); break; case 0: // Convert to float and divide by bitsize to get into range 0.0 - 1.0. diff --git a/jme3-core/src/main/java/com/jme3/texture/image/MipMapImageRaster.java b/jme3-core/src/main/java/com/jme3/texture/image/MipMapImageRaster.java index 84ea1ea242..d37db00b67 100644 --- a/jme3-core/src/main/java/com/jme3/texture/image/MipMapImageRaster.java +++ b/jme3-core/src/main/java/com/jme3/texture/image/MipMapImageRaster.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -108,16 +108,16 @@ public void setPixel(int x, int y, ColorRGBA color) { switch (codec.type) { case ImageCodec.FLAG_F16: - components[0] = (int) FastMath.convertFloatToHalf(color.a); - components[1] = (int) FastMath.convertFloatToHalf(color.r); - components[2] = (int) FastMath.convertFloatToHalf(color.g); - components[3] = (int) FastMath.convertFloatToHalf(color.b); + components[0] = FastMath.convertFloatToHalf(color.a); + components[1] = FastMath.convertFloatToHalf(color.r); + components[2] = FastMath.convertFloatToHalf(color.g); + components[3] = FastMath.convertFloatToHalf(color.b); break; case ImageCodec.FLAG_F32: - components[0] = (int) Float.floatToIntBits(color.a); - components[1] = (int) Float.floatToIntBits(color.r); - components[2] = (int) Float.floatToIntBits(color.g); - components[3] = (int) Float.floatToIntBits(color.b); + components[0] = Float.floatToIntBits(color.a); + components[1] = Float.floatToIntBits(color.r); + components[2] = Float.floatToIntBits(color.g); + components[3] = Float.floatToIntBits(color.b); break; case 0: // Convert color to bits by multiplying by size @@ -154,10 +154,10 @@ public ColorRGBA getPixel(int x, int y, ColorRGBA store) { FastMath.convertHalfToFloat((short) components[0])); break; case ImageCodec.FLAG_F32: - store.set(Float.intBitsToFloat((int) components[1]), - Float.intBitsToFloat((int) components[2]), - Float.intBitsToFloat((int) components[3]), - Float.intBitsToFloat((int) components[0])); + store.set(Float.intBitsToFloat(components[1]), + Float.intBitsToFloat(components[2]), + Float.intBitsToFloat(components[3]), + Float.intBitsToFloat(components[0])); break; case 0: // Convert to float and divide by bitsize to get into range 0.0 - 1.0. diff --git a/jme3-core/src/main/java/com/jme3/util/BufferUtils.java b/jme3-core/src/main/java/com/jme3/util/BufferUtils.java index d4546b7e3f..172f9561af 100644 --- a/jme3-core/src/main/java/com/jme3/util/BufferUtils.java +++ b/jme3-core/src/main/java/com/jme3/util/BufferUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2018 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1289,22 +1289,22 @@ public static void destroyDirectBuffer(Buffer toBeDestroyed) { */ private static boolean isDirect(Buffer buf) { if (buf instanceof FloatBuffer) { - return ((FloatBuffer) buf).isDirect(); + return buf.isDirect(); } if (buf instanceof IntBuffer) { - return ((IntBuffer) buf).isDirect(); + return buf.isDirect(); } if (buf instanceof ShortBuffer) { - return ((ShortBuffer) buf).isDirect(); + return buf.isDirect(); } if (buf instanceof ByteBuffer) { - return ((ByteBuffer) buf).isDirect(); + return buf.isDirect(); } if (buf instanceof DoubleBuffer) { - return ((DoubleBuffer) buf).isDirect(); + return buf.isDirect(); } if (buf instanceof LongBuffer) { - return ((LongBuffer) buf).isDirect(); + return buf.isDirect(); } throw new UnsupportedOperationException(" BufferUtils.isDirect was called on " + buf.getClass().getName()); } diff --git a/jme3-core/src/main/java/com/jme3/util/ListMap.java b/jme3-core/src/main/java/com/jme3/util/ListMap.java index 5d721208bd..ea8b0f3638 100644 --- a/jme3-core/src/main/java/com/jme3/util/ListMap.java +++ b/jme3-core/src/main/java/com/jme3/util/ListMap.java @@ -158,7 +158,7 @@ private static boolean keyEq(Object keyA, Object keyB){ @Override public boolean containsKey(Object key) { - return backingMap.containsKey( (K) key); + return backingMap.containsKey(key); // if (key == null) // throw new IllegalArgumentException(); // @@ -172,7 +172,7 @@ public boolean containsKey(Object key) { @Override public boolean containsValue(Object value) { - return backingMap.containsValue( (V) value); + return backingMap.containsValue(value); // for (int i = 0; i < entries.size(); i++){ // if (valEq(entries.get(i).value, value)) // return true; @@ -182,7 +182,7 @@ public boolean containsValue(Object value) { @Override public V get(Object key) { - return backingMap.get( (K) key); + return backingMap.get(key); // if (key == null) // throw new IllegalArgumentException(); // @@ -237,7 +237,7 @@ public V put(K key, V value) { @Override public V remove(Object key) { - V element = backingMap.remove( (K) key); + V element = backingMap.remove(key); if (element != null){ // find removed element int size = size() + 1; // includes removed element diff --git a/jme3-core/src/main/java/com/jme3/util/clone/Cloner.java b/jme3-core/src/main/java/com/jme3/util/clone/Cloner.java index 1e10f33cfc..a64aff2656 100644 --- a/jme3-core/src/main/java/com/jme3/util/clone/Cloner.java +++ b/jme3-core/src/main/java/com/jme3/util/clone/Cloner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 jMonkeyEngine + * Copyright (c) 2016-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -298,7 +298,7 @@ public void setCloneFunction( Class type, CloneFunction function ) { */ @SuppressWarnings("unchecked") public CloneFunction getCloneFunction( Class type ) { - CloneFunction result = (CloneFunction)functions.get(type); + CloneFunction result = functions.get(type); if( result == null ) { // Do a more exhaustive search for( Map.Entry e : functions.entrySet() ) { diff --git a/jme3-core/src/main/java/com/jme3/util/mikktspace/MikktspaceTangentGenerator.java b/jme3-core/src/main/java/com/jme3/util/mikktspace/MikktspaceTangentGenerator.java index 48a13d6f4b..ea05321438 100644 --- a/jme3-core/src/main/java/com/jme3/util/mikktspace/MikktspaceTangentGenerator.java +++ b/jme3-core/src/main/java/com/jme3/util/mikktspace/MikktspaceTangentGenerator.java @@ -105,7 +105,7 @@ public static boolean genTangSpace(MikkTSpaceContext mikkTSpace, final float ang int iNrActiveGroups, index; final int iNrFaces = mikkTSpace.getNumFaces(); //boolean bRes = false; - final float fThresCos = (float) FastMath.cos((angularThreshold * (float) FastMath.PI) / 180.0f); + final float fThresCos = FastMath.cos((angularThreshold * FastMath.PI) / 180.0f); // count triangles on supported faces for (int f = 0; f < iNrFaces; f++) { diff --git a/jme3-core/src/plugins/java/com/jme3/audio/plugins/WAVLoader.java b/jme3-core/src/plugins/java/com/jme3/audio/plugins/WAVLoader.java index 6873f74db9..bcca3171cc 100644 --- a/jme3-core/src/plugins/java/com/jme3/audio/plugins/WAVLoader.java +++ b/jme3-core/src/plugins/java/com/jme3/audio/plugins/WAVLoader.java @@ -197,7 +197,7 @@ private AudioData load(AssetInfo info, InputStream inputStream, boolean stream) break; case i_data: // Compute duration based on data chunk size - duration = (float)(len / bytesPerSec); + duration = len / bytesPerSec; if (readStream) { readDataChunkForStream(inOffset, len); diff --git a/jme3-core/src/plugins/java/com/jme3/material/plugins/ShaderNodeLoaderDelegate.java b/jme3-core/src/plugins/java/com/jme3/material/plugins/ShaderNodeLoaderDelegate.java index 3e64d0d785..f79a77a90d 100644 --- a/jme3-core/src/plugins/java/com/jme3/material/plugins/ShaderNodeLoaderDelegate.java +++ b/jme3-core/src/plugins/java/com/jme3/material/plugins/ShaderNodeLoaderDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -152,7 +152,7 @@ public void readNodesDefinitions(List statements) throws IOException * @throws IOException */ protected void readShaderNodeDefinition(List statements, ShaderNodeDefinitionKey key) throws IOException { - boolean isLoadDoc = key instanceof ShaderNodeDefinitionKey && ((ShaderNodeDefinitionKey) key).isLoadDocumentation(); + boolean isLoadDoc = key instanceof ShaderNodeDefinitionKey && key.isLoadDocumentation(); for (Statement statement : statements) { try { String[] split = statement.getLine().split("[ \\{]"); diff --git a/jme3-core/src/plugins/java/com/jme3/texture/plugins/DXTFlipper.java b/jme3-core/src/plugins/java/com/jme3/texture/plugins/DXTFlipper.java index e460a75a63..3fe8cc633f 100644 --- a/jme3-core/src/plugins/java/com/jme3/texture/plugins/DXTFlipper.java +++ b/jme3-core/src/plugins/java/com/jme3/texture/plugins/DXTFlipper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -198,8 +198,8 @@ private static void flipDXT1orDXTA3Block(byte[] block, int h){ public static ByteBuffer flipDXT(ByteBuffer img, int w, int h, Format format){ int originalLimit = img.limit(); - int blocksX = (int) FastMath.ceil((float)w / 4f); - int blocksY = (int) FastMath.ceil((float)h / 4f); + int blocksX = (int) FastMath.ceil(w / 4f); + int blocksY = (int) FastMath.ceil(h / 4f); int type; switch (format){ diff --git a/jme3-core/src/test/java/com/jme3/scene/TestUserData.java b/jme3-core/src/test/java/com/jme3/scene/TestUserData.java index c228af8926..afd9d70e2b 100644 --- a/jme3-core/src/test/java/com/jme3/scene/TestUserData.java +++ b/jme3-core/src/test/java/com/jme3/scene/TestUserData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2019 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,36 +46,36 @@ public static void userDataTest(Spatial sp, Object v) { @Test public void testLong() throws Exception { Spatial sp = new Node("TestSpatial"); - userDataTest(sp, (Long) (long) (Math.random() * Long.MAX_VALUE)); + userDataTest(sp, Math.random() * Long.MAX_VALUE); } @Test public void testInt() throws Exception { Spatial sp = new Node("TestSpatial"); - userDataTest(sp, (Integer) (int) (Math.random() * Integer.MAX_VALUE)); + userDataTest(sp, Math.random() * Integer.MAX_VALUE); } @Test public void testShort() throws Exception { Spatial sp = new Node("TestSpatial"); - userDataTest(sp, (Short) (short) (Math.random() * Short.MAX_VALUE)); + userDataTest(sp, Math.random() * Short.MAX_VALUE); } @Test public void testByte() throws Exception { Spatial sp = new Node("TestSpatial"); - userDataTest(sp, (Byte) (byte) (Math.random() * Byte.MAX_VALUE)); + userDataTest(sp, Math.random() * Byte.MAX_VALUE); } @Test public void testDouble() throws Exception { Spatial sp = new Node("TestSpatial"); - userDataTest(sp, (Double) (double) (Math.random() * Double.MAX_VALUE)); + userDataTest(sp, Math.random() * Double.MAX_VALUE); } @Test public void testFloat() throws Exception { Spatial sp = new Node("TestSpatial"); - userDataTest(sp, (Float) (float) (Math.random() * Float.MAX_VALUE)); + userDataTest(sp, Math.random() * Float.MAX_VALUE); } } diff --git a/jme3-core/src/tools/java/jme3tools/optimize/TextureAtlas.java b/jme3-core/src/tools/java/jme3tools/optimize/TextureAtlas.java index 9ca7390149..c254580b26 100644 --- a/jme3-core/src/tools/java/jme3tools/optimize/TextureAtlas.java +++ b/jme3-core/src/tools/java/jme3tools/optimize/TextureAtlas.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -637,10 +637,10 @@ public TextureAtlasTile(int x, int y, int width, int height) { * @return The new texture coordinate inside the atlas. */ public Vector2f getLocation(Vector2f previousLocation) { - float x = (float) getX() / (float) atlasWidth; - float y = (float) getY() / (float) atlasHeight; - float w = (float) getWidth() / (float) atlasWidth; - float h = (float) getHeight() / (float) atlasHeight; + float x = getX() / (float) atlasWidth; + float y = getY() / (float) atlasHeight; + float w = getWidth() / (float) atlasWidth; + float h = getHeight() / (float) atlasHeight; Vector2f location = new Vector2f(x, y); float prevX = previousLocation.x; float prevY = previousLocation.y; diff --git a/jme3-desktop/src/main/java/com/jme3/app/SettingsDialog.java b/jme3-desktop/src/main/java/com/jme3/app/SettingsDialog.java index 91e0984d7b..c076798895 100644 --- a/jme3-desktop/src/main/java/com/jme3/app/SettingsDialog.java +++ b/jme3-desktop/src/main/java/com/jme3/app/SettingsDialog.java @@ -312,7 +312,7 @@ public void windowClosing(WindowEvent e) { }); if (source.getIcons() != null) { - safeSetIconImages( (List) Arrays.asList((BufferedImage[]) source.getIcons()) ); + safeSetIconImages( Arrays.asList((BufferedImage[]) source.getIcons()) ); } setTitle(MessageFormat.format(resourceBundle.getString("frame.title"), source.getTitle())); diff --git a/jme3-desktop/src/main/java/com/jme3/app/state/MjpegFileWriter.java b/jme3-desktop/src/main/java/com/jme3/app/state/MjpegFileWriter.java index b3d7514653..aa162e9f1a 100644 --- a/jme3-desktop/src/main/java/com/jme3/app/state/MjpegFileWriter.java +++ b/jme3-desktop/src/main/java/com/jme3/app/state/MjpegFileWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -470,7 +470,7 @@ public byte[] toBytes() throws Exception { baos.write(fcc); baos.write(intBytes(swapInt(cb))); for (int i = 0; i < ind.size(); i++) { - AVIIndex in = (AVIIndex) ind.get(i); + AVIIndex in = ind.get(i); baos.write(in.toBytes()); } diff --git a/jme3-desktop/src/main/java/com/jme3/app/state/VideoRecorderAppState.java b/jme3-desktop/src/main/java/com/jme3/app/state/VideoRecorderAppState.java index 750cf4d6c9..a85374abc5 100644 --- a/jme3-desktop/src/main/java/com/jme3/app/state/VideoRecorderAppState.java +++ b/jme3-desktop/src/main/java/com/jme3/app/state/VideoRecorderAppState.java @@ -343,7 +343,7 @@ public float getFrameRate() { @Override public float getTimePerFrame() { - return (float) (1.0f / this.framerate); + return 1.0f / this.framerate; } @Override diff --git a/jme3-desktop/src/main/java/com/jme3/cursors/plugins/CursorLoader.java b/jme3-desktop/src/main/java/com/jme3/cursors/plugins/CursorLoader.java index d5c8f7de26..1abb802855 100644 --- a/jme3-desktop/src/main/java/com/jme3/cursors/plugins/CursorLoader.java +++ b/jme3-desktop/src/main/java/com/jme3/cursors/plugins/CursorLoader.java @@ -74,11 +74,11 @@ public JmeCursor load(AssetInfo info) throws IOException { isAni = false; isCur = false; - isIco = ((AssetKey) info.getKey()).getExtension().equals("ico"); + isIco = info.getKey().getExtension().equals("ico"); if (!isIco) { - isCur = ((AssetKey) info.getKey()).getExtension().equals("cur"); + isCur = info.getKey().getExtension().equals("cur"); if (!isCur) { - isAni = ((AssetKey) info.getKey()).getExtension().equals("ani"); + isAni = info.getKey().getExtension().equals("ani"); } } if (!isAni && !isIco && !isCur) { diff --git a/jme3-desktop/src/main/java/jme3tools/navigation/MapModel2D.java b/jme3-desktop/src/main/java/jme3tools/navigation/MapModel2D.java index f3094071a3..2cd683a36d 100644 --- a/jme3-desktop/src/main/java/jme3tools/navigation/MapModel2D.java +++ b/jme3-desktop/src/main/java/jme3tools/navigation/MapModel2D.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -114,7 +114,7 @@ public int getViewportPixelHeight() { * @since 1.0 */ public void calculateMinutesPerPixel(double mapWidthInLongitude) { - minutesPerPixel = (mapWidthInLongitude * 60) / (double) viewportWidth; + minutesPerPixel = (mapWidthInLongitude * 60) / viewportWidth; } /** diff --git a/jme3-desktop/src/main/java/jme3tools/navigation/MapModel3D.java b/jme3-desktop/src/main/java/jme3tools/navigation/MapModel3D.java index 633d88bfcd..3450da797b 100644 --- a/jme3-desktop/src/main/java/jme3tools/navigation/MapModel3D.java +++ b/jme3-desktop/src/main/java/jme3tools/navigation/MapModel3D.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -120,7 +120,7 @@ public int getWorldHeight() { */ public void calculateMinutesPerWorldUnit(double mapWidthInLongitude) { // Multiply mapWidthInLongitude by 60 to convert it to minutes. - minutesPerWorldUnit = (mapWidthInLongitude * 60) / (double) worldWidth; + minutesPerWorldUnit = (mapWidthInLongitude * 60) / worldWidth; } /** diff --git a/jme3-desktop/src/main/java/jme3tools/navigation/NumUtil.java b/jme3-desktop/src/main/java/jme3tools/navigation/NumUtil.java index 4110f50963..40f5ce0c35 100644 --- a/jme3-desktop/src/main/java/jme3tools/navigation/NumUtil.java +++ b/jme3-desktop/src/main/java/jme3tools/navigation/NumUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -52,6 +52,6 @@ public float Round(float Rval, int Rpl) { float p = (float) Math.pow(10, Rpl); Rval = Rval * p; float tmp = Math.round(Rval); - return (float) tmp / p; + return tmp / p; } } diff --git a/jme3-effects/src/main/java/com/jme3/post/ssao/SSAOFilter.java b/jme3-effects/src/main/java/com/jme3/post/ssao/SSAOFilter.java index 611f9954f0..1e4aa3410f 100644 --- a/jme3-effects/src/main/java/com/jme3/post/ssao/SSAOFilter.java +++ b/jme3-effects/src/main/java/com/jme3/post/ssao/SSAOFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2018 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -140,7 +140,7 @@ protected void initFilter(AssetManager manager, RenderManager renderManager, Vie frustumNearFar = new Vector2f(); float farY = (vp.getCamera().getFrustumTop() / vp.getCamera().getFrustumNear()) * vp.getCamera().getFrustumFar(); - float farX = farY * ((float) screenWidth / (float) screenHeight); + float farX = farY * (screenWidth / (float) screenHeight); frustumCorner = new Vector3f(farX, farY, vp.getCamera().getFrustumFar()); frustumNearFar.x = vp.getCamera().getFrustumNear(); frustumNearFar.y = vp.getCamera().getFrustumFar(); diff --git a/jme3-examples/src/main/java/jme3test/audio/TestMusicPlayer.java b/jme3-examples/src/main/java/jme3test/audio/TestMusicPlayer.java index c28004c3bd..265e1ab74a 100644 --- a/jme3-examples/src/main/java/jme3test/audio/TestMusicPlayer.java +++ b/jme3-examples/src/main/java/jme3test/audio/TestMusicPlayer.java @@ -246,7 +246,7 @@ private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:even }//GEN-LAST:event_formWindowClosing private void sldVolumeStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_sldVolumeStateChanged - listener.setVolume( (float) sldVolume.getValue() / 100f); + listener.setVolume(sldVolume.getValue() / 100f); ar.setListener(listener); }//GEN-LAST:event_sldVolumeStateChanged diff --git a/jme3-examples/src/main/java/jme3test/bullet/BombControl.java b/jme3-examples/src/main/java/jme3test/bullet/BombControl.java index 180d8e1b5a..83cecdd77b 100644 --- a/jme3-examples/src/main/java/jme3test/bullet/BombControl.java +++ b/jme3-examples/src/main/java/jme3test/bullet/BombControl.java @@ -94,7 +94,7 @@ private void prepareEffect(AssetManager assetManager) { float COUNT_FACTOR_F = 1f; effect = new ParticleEmitter("Flame", Type.Triangle, 32 * COUNT_FACTOR); effect.setSelectRandomImage(true); - effect.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, (float) (1f / COUNT_FACTOR_F))); + effect.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, (1f / COUNT_FACTOR_F))); effect.setEndColor(new ColorRGBA(.4f, .22f, .12f, 0f)); effect.setStartSize(1.3f); effect.setEndSize(2f); diff --git a/jme3-examples/src/main/java/jme3test/bullet/TestWalkingChar.java b/jme3-examples/src/main/java/jme3test/bullet/TestWalkingChar.java index cf187c63b4..503f0bd519 100644 --- a/jme3-examples/src/main/java/jme3test/bullet/TestWalkingChar.java +++ b/jme3-examples/src/main/java/jme3test/bullet/TestWalkingChar.java @@ -202,7 +202,7 @@ private void prepareEffect() { float COUNT_FACTOR_F = 1f; effect = new ParticleEmitter("Flame", Type.Triangle, 32 * COUNT_FACTOR); effect.setSelectRandomImage(true); - effect.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, (float) (1f / COUNT_FACTOR_F))); + effect.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, (1f / COUNT_FACTOR_F))); effect.setEndColor(new ColorRGBA(.4f, .22f, .12f, 0f)); effect.setStartSize(1.3f); effect.setEndSize(2f); diff --git a/jme3-examples/src/main/java/jme3test/collision/TestRayCasting.java b/jme3-examples/src/main/java/jme3test/collision/TestRayCasting.java index 06b07e87b8..e3c1ba136b 100644 --- a/jme3-examples/src/main/java/jme3test/collision/TestRayCasting.java +++ b/jme3-examples/src/main/java/jme3test/collision/TestRayCasting.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -56,7 +56,7 @@ public void simpleInitApp() { // flyCam.setEnabled(false); // load material - Material mat = (Material) assetManager.loadMaterial("Interface/Logo/Logo.j3m"); + Material mat = assetManager.loadMaterial("Interface/Logo/Logo.j3m"); Mesh q = new Mesh(); q.setBuffer(Type.Position, 3, new float[] diff --git a/jme3-examples/src/main/java/jme3test/effect/TestExplosionEffect.java b/jme3-examples/src/main/java/jme3test/effect/TestExplosionEffect.java index ff5100ffed..04e5d23ab8 100644 --- a/jme3-examples/src/main/java/jme3test/effect/TestExplosionEffect.java +++ b/jme3-examples/src/main/java/jme3test/effect/TestExplosionEffect.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -66,7 +66,7 @@ public static void main(String[] args){ private void createFlame(){ flame = new ParticleEmitter("Flame", EMITTER_TYPE, 32 * COUNT_FACTOR); flame.setSelectRandomImage(true); - flame.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, (float) (1f / COUNT_FACTOR_F))); + flame.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, (1f / COUNT_FACTOR_F))); flame.setEndColor(new ColorRGBA(.4f, .22f, .12f, 0f)); flame.setStartSize(1.3f); flame.setEndSize(2f); @@ -89,7 +89,7 @@ private void createFlame(){ private void createFlash(){ flash = new ParticleEmitter("Flash", EMITTER_TYPE, 24 * COUNT_FACTOR); flash.setSelectRandomImage(true); - flash.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, (float) (1f / COUNT_FACTOR_F))); + flash.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, 1f / COUNT_FACTOR_F)); flash.setEndColor(new ColorRGBA(1f, 0.8f, 0.36f, 0f)); flash.setStartSize(.1f); flash.setEndSize(3.0f); @@ -113,7 +113,7 @@ private void createFlash(){ private void createRoundSpark(){ roundspark = new ParticleEmitter("RoundSpark", EMITTER_TYPE, 20 * COUNT_FACTOR); roundspark.setStartColor(new ColorRGBA(1f, 0.29f, 0.34f, (float) (1.0 / COUNT_FACTOR_F))); - roundspark.setEndColor(new ColorRGBA(0, 0, 0, (float) (0.5f / COUNT_FACTOR_F))); + roundspark.setEndColor(new ColorRGBA(0, 0, 0, 0.5f / COUNT_FACTOR_F)); roundspark.setStartSize(1.2f); roundspark.setEndSize(1.8f); roundspark.setShape(new EmitterSphereShape(Vector3f.ZERO, 2f)); @@ -135,7 +135,7 @@ private void createRoundSpark(){ private void createSpark(){ spark = new ParticleEmitter("Spark", Type.Triangle, 30 * COUNT_FACTOR); - spark.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, (float) (1.0f / COUNT_FACTOR_F))); + spark.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, 1.0f / COUNT_FACTOR_F)); spark.setEndColor(new ColorRGBA(1f, 0.8f, 0.36f, 0f)); spark.setStartSize(.5f); spark.setEndSize(.5f); @@ -156,7 +156,7 @@ private void createSpark(){ private void createSmokeTrail(){ smoketrail = new ParticleEmitter("SmokeTrail", Type.Triangle, 22 * COUNT_FACTOR); - smoketrail.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, (float) (1.0f / COUNT_FACTOR_F))); + smoketrail.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, 1.0f / COUNT_FACTOR_F)); smoketrail.setEndColor(new ColorRGBA(1f, 0.8f, 0.36f, 0f)); smoketrail.setStartSize(.2f); smoketrail.setEndSize(1f); @@ -183,7 +183,7 @@ private void createDebris(){ debris.setSelectRandomImage(true); debris.setRandomAngle(true); debris.setRotateSpeed(FastMath.TWO_PI * 4); - debris.setStartColor(new ColorRGBA(1f, 0.59f, 0.28f, (float) (1.0f / COUNT_FACTOR_F))); + debris.setStartColor(new ColorRGBA(1f, 0.59f, 0.28f, 1.0f / COUNT_FACTOR_F)); debris.setEndColor(new ColorRGBA(.5f, 0.5f, 0.5f, 0f)); debris.setStartSize(.2f); debris.setEndSize(.2f); @@ -208,7 +208,7 @@ private void createShockwave(){ shockwave = new ParticleEmitter("Shockwave", Type.Triangle, 1 * COUNT_FACTOR); // shockwave.setRandomAngle(true); shockwave.setFaceNormal(Vector3f.UNIT_Y); - shockwave.setStartColor(new ColorRGBA(.48f, 0.17f, 0.01f, (float) (.8f / COUNT_FACTOR_F))); + shockwave.setStartColor(new ColorRGBA(.48f, 0.17f, 0.01f, .8f / COUNT_FACTOR_F)); shockwave.setEndColor(new ColorRGBA(.48f, 0.17f, 0.01f, 0f)); shockwave.setStartSize(0f); diff --git a/jme3-examples/src/main/java/jme3test/export/TestAssetLinkNode.java b/jme3-examples/src/main/java/jme3test/export/TestAssetLinkNode.java index 0710a6843e..3e973bf2d6 100644 --- a/jme3-examples/src/main/java/jme3test/export/TestAssetLinkNode.java +++ b/jme3-examples/src/main/java/jme3test/export/TestAssetLinkNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2019 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -93,7 +93,7 @@ public void simpleInitApp() { rootNode.attachChild(loaderNode); lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f)); - lightMdl.setMaterial( (Material) assetManager.loadAsset(new MaterialKey("Common/Materials/RedColor.j3m"))); + lightMdl.setMaterial(assetManager.loadAsset(new MaterialKey("Common/Materials/RedColor.j3m"))); rootNode.attachChild(lightMdl); // flourescent main light diff --git a/jme3-examples/src/main/java/jme3test/gui/TestBitmapFontLayout.java b/jme3-examples/src/main/java/jme3test/gui/TestBitmapFontLayout.java index 7f03fb9b21..834e8062e9 100644 --- a/jme3-examples/src/main/java/jme3test/gui/TestBitmapFontLayout.java +++ b/jme3-examples/src/main/java/jme3test/gui/TestBitmapFontLayout.java @@ -240,8 +240,8 @@ protected Node createVisual( TestConfig test ) { float y1 = bb.getCenter().y - bb.getYExtent(); float y2 = bb.getCenter().y + bb.getYExtent(); System.out.println("xy1:" + x1 + ", " + y1 + " xy2:" + x2 + ", " + y2); - int width = (int)Math.round(x2 - Math.min(0, x1)); - int height = (int)Math.round(y2 - Math.min(0, y1)); + int width = Math.round(x2 - Math.min(0, x1)); + int height = Math.round(y2 - Math.min(0, y1)); Texture awtText = renderAwtFont(test, width, height, bitmapFont); Quad quad = new Quad(width, height); diff --git a/jme3-examples/src/main/java/jme3test/helloworld/HelloCollision.java b/jme3-examples/src/main/java/jme3test/helloworld/HelloCollision.java index 656108344f..2ab4bba45e 100644 --- a/jme3-examples/src/main/java/jme3test/helloworld/HelloCollision.java +++ b/jme3-examples/src/main/java/jme3test/helloworld/HelloCollision.java @@ -98,7 +98,7 @@ public void simpleInitApp() { // 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((Node) sceneModel); + CollisionShapeFactory.createMeshShape(sceneModel); landscape = new RigidBodyControl(sceneShape, 0); sceneModel.addControl(landscape); diff --git a/jme3-examples/src/main/java/jme3test/input/TestJoystick.java b/jme3-examples/src/main/java/jme3test/input/TestJoystick.java index afb269eca5..d3d1df31f6 100644 --- a/jme3-examples/src/main/java/jme3test/input/TestJoystick.java +++ b/jme3-examples/src/main/java/jme3test/input/TestJoystick.java @@ -471,7 +471,7 @@ private void pickGamePad(Vector2f mouseLoc){ for (CollisionResult cr : cresults) { Node n = cr.getGeometry().getParent(); if (n != null && (n instanceof ButtonView)) { - String b = ((ButtonView) n).getName().substring("Button:".length()); + String b = n.getName().substring("Button:".length()); String name = lastButton.getJoystick().getName().replaceAll(" ", "\\\\ "); String id = lastButton.getLogicalId().replaceAll(" ", "\\\\ "); System.out.println(name + "." + id + "=" + b); diff --git a/jme3-examples/src/main/java/jme3test/light/TestObbVsBounds.java b/jme3-examples/src/main/java/jme3test/light/TestObbVsBounds.java index c0c7d511a8..fc38fc6d8a 100644 --- a/jme3-examples/src/main/java/jme3test/light/TestObbVsBounds.java +++ b/jme3-examples/src/main/java/jme3test/light/TestObbVsBounds.java @@ -226,7 +226,7 @@ public void makeAreaGeom() { points[7].set(1, -1, -1); Mesh box = WireFrustum.makeFrustum(points); - areaGeom = new Geometry("light", (Mesh)box); + areaGeom = new Geometry("light", box); areaGeom.setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md")); areaGeom.getMaterial().setColor("Color", ColorRGBA.White); } diff --git a/jme3-examples/src/main/java/jme3test/light/TestPointDirectionalAndSpotLightShadows.java b/jme3-examples/src/main/java/jme3test/light/TestPointDirectionalAndSpotLightShadows.java index 473ba8dfe8..fe52e3c68b 100644 --- a/jme3-examples/src/main/java/jme3test/light/TestPointDirectionalAndSpotLightShadows.java +++ b/jme3-examples/src/main/java/jme3test/light/TestPointDirectionalAndSpotLightShadows.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -98,7 +98,7 @@ public void simpleInitApp() { rootNode.attachChild(box); box.setLocalTranslation(-1f, 0.5f, -2); - ((PointLight) scene.getLocalLightList().get(0)).setColor(ColorRGBA.Red); + scene.getLocalLightList().get(0).setColor(ColorRGBA.Red); plsr = new PointLightShadowRenderer(assetManager, SHADOWMAP_SIZE); plsr.setLight((PointLight) scene.getLocalLightList().get(0)); diff --git a/jme3-examples/src/main/java/jme3test/light/pbr/ConsoleProgressReporter.java b/jme3-examples/src/main/java/jme3test/light/pbr/ConsoleProgressReporter.java index f0d100ee23..52d2f0dd5e 100644 --- a/jme3-examples/src/main/java/jme3test/light/pbr/ConsoleProgressReporter.java +++ b/jme3-examples/src/main/java/jme3test/light/pbr/ConsoleProgressReporter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2015 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -65,7 +65,7 @@ public void step(String message) { @Override public void done(LightProbe result) { long end = System.currentTimeMillis(); - logger.log(Level.INFO, "Generation done in {0}", ((float)(end - time) / 1000f)); + logger.log(Level.INFO, "Generation done in {0}", (end - time) / 1000f); } } diff --git a/jme3-examples/src/main/java/jme3test/light/pbr/RefEnv.java b/jme3-examples/src/main/java/jme3test/light/pbr/RefEnv.java index 051202cdac..40bb183beb 100644 --- a/jme3-examples/src/main/java/jme3test/light/pbr/RefEnv.java +++ b/jme3-examples/src/main/java/jme3test/light/pbr/RefEnv.java @@ -127,7 +127,7 @@ public void done(LightProbe result) { rootNode.getChild(0).setCullHint(Spatial.CullHint.Dynamic); } }); - ((SphereProbeArea) probe.getArea()).setRadius(100); + probe.getArea().setRadius(100); rootNode.addLight(probe); } diff --git a/jme3-examples/src/main/java/jme3test/light/pbr/TestPBRLighting.java b/jme3-examples/src/main/java/jme3test/light/pbr/TestPBRLighting.java index 9ebd1a8264..7de1e456c7 100644 --- a/jme3-examples/src/main/java/jme3test/light/pbr/TestPBRLighting.java +++ b/jme3-examples/src/main/java/jme3test/light/pbr/TestPBRLighting.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2015 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -79,7 +79,7 @@ public void simpleInitApp() { assetManager.registerLoader(KTXLoader.class, "ktx"); viewPort.setBackgroundColor(ColorRGBA.White); - modelNode = (Node) new Node("modelNode"); + modelNode = new Node("modelNode"); model = (Geometry) assetManager.loadModel("Models/Tank/tank.j3o"); MikktspaceTangentGenerator.generate(model); modelNode.attachChild(model); @@ -207,7 +207,7 @@ public void done(LightProbe result) { tex = EnvMapUtils.getCubeMapCrossDebugViewWithMipMaps(result.getPrefilteredEnvMap(), assetManager); } }); - ((SphereProbeArea) probe.getArea()).setRadius(100); + probe.getArea().setRadius(100); rootNode.addLight(probe); //getStateManager().getState(EnvironmentManager.class).addEnvProbe(probe); diff --git a/jme3-examples/src/main/java/jme3test/material/TestBumpModel.java b/jme3-examples/src/main/java/jme3test/material/TestBumpModel.java index 49028ba7ed..ba7ced2ab6 100644 --- a/jme3-examples/src/main/java/jme3test/material/TestBumpModel.java +++ b/jme3-examples/src/main/java/jme3test/material/TestBumpModel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -58,13 +58,13 @@ public static void main(String[] args){ @Override public void simpleInitApp() { - Spatial signpost = (Spatial) assetManager.loadAsset(new OgreMeshKey("Models/Sign Post/Sign Post.mesh.xml")); - signpost.setMaterial( (Material) assetManager.loadMaterial("Models/Sign Post/Sign Post.j3m")); + Spatial signpost = assetManager.loadAsset(new OgreMeshKey("Models/Sign Post/Sign Post.mesh.xml")); + signpost.setMaterial(assetManager.loadMaterial("Models/Sign Post/Sign Post.j3m")); TangentBinormalGenerator.generate(signpost); rootNode.attachChild(signpost); lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f)); - lightMdl.setMaterial( (Material) assetManager.loadMaterial("Common/Materials/RedColor.j3m")); + lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); rootNode.attachChild(lightMdl); // flourescent main light diff --git a/jme3-examples/src/main/java/jme3test/model/TestMonkeyHead.java b/jme3-examples/src/main/java/jme3test/model/TestMonkeyHead.java index c75e221f0f..adeee2e285 100644 --- a/jme3-examples/src/main/java/jme3test/model/TestMonkeyHead.java +++ b/jme3-examples/src/main/java/jme3test/model/TestMonkeyHead.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -57,7 +57,7 @@ public static void main(String[] args){ public void simpleInitApp() { viewPort.setBackgroundColor(ColorRGBA.DarkGray); - Spatial bumpy = (Spatial) assetManager.loadModel("Models/MonkeyHead/MonkeyHead.mesh.xml"); + Spatial bumpy = assetManager.loadModel("Models/MonkeyHead/MonkeyHead.mesh.xml"); rootNode.attachChild(bumpy); lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f)); diff --git a/jme3-examples/src/main/java/jme3test/model/TestOgreLoading.java b/jme3-examples/src/main/java/jme3test/model/TestOgreLoading.java index bcd4a5dc94..b553a062f0 100644 --- a/jme3-examples/src/main/java/jme3test/model/TestOgreLoading.java +++ b/jme3-examples/src/main/java/jme3test/model/TestOgreLoading.java @@ -90,7 +90,7 @@ public void simpleInitApp() { // create the geometry and attach it - Spatial elephant = (Spatial) assetManager.loadModel("Models/Elephant/Elephant.mesh.xml"); + Spatial elephant = assetManager.loadModel("Models/Elephant/Elephant.mesh.xml"); float scale = 0.05f; elephant.scale(scale, scale, scale); rootNode.attachChild(elephant); diff --git a/jme3-examples/src/main/java/jme3test/model/anim/TestBlenderAnim.java b/jme3-examples/src/main/java/jme3test/model/anim/TestBlenderAnim.java index 0fea65ae99..e2c4e725c0 100644 --- a/jme3-examples/src/main/java/jme3test/model/anim/TestBlenderAnim.java +++ b/jme3-examples/src/main/java/jme3test/model/anim/TestBlenderAnim.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -66,7 +66,7 @@ public void simpleInitApp() { BlenderKey blenderKey = new BlenderKey("Blender/2.4x/BaseMesh_249.blend"); - Spatial scene = (Spatial) assetManager.loadModel(blenderKey); + Spatial scene = assetManager.loadModel(blenderKey); rootNode.attachChild(scene); Spatial model = this.findNode(rootNode, "BaseMesh_01"); diff --git a/jme3-examples/src/main/java/jme3test/model/anim/TestBlenderObjectAnim.java b/jme3-examples/src/main/java/jme3test/model/anim/TestBlenderObjectAnim.java index 68855176a0..0b90805448 100644 --- a/jme3-examples/src/main/java/jme3test/model/anim/TestBlenderObjectAnim.java +++ b/jme3-examples/src/main/java/jme3test/model/anim/TestBlenderObjectAnim.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -66,7 +66,7 @@ public void simpleInitApp() { BlenderKey blenderKey = new BlenderKey("Blender/2.4x/animtest.blend"); - Spatial scene = (Spatial) assetManager.loadModel(blenderKey); + Spatial scene = assetManager.loadModel(blenderKey); rootNode.attachChild(scene); Spatial model = this.findNode(rootNode, "Cube"); diff --git a/jme3-examples/src/main/java/jme3test/model/anim/TestHWSkinning.java b/jme3-examples/src/main/java/jme3test/model/anim/TestHWSkinning.java index 6eca8a9a2a..29b63ba4f1 100644 --- a/jme3-examples/src/main/java/jme3test/model/anim/TestHWSkinning.java +++ b/jme3-examples/src/main/java/jme3test/model/anim/TestHWSkinning.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -86,8 +86,8 @@ public void simpleInitApp() { Node model = (Node)models[(i + j) % 4]; Spatial s = model.getChild(0).clone(); model.attachChild(s); - float x = (float)(i - SIZE / 2) / 0.1f; - float z = (float)(j - SIZE / 2) / 0.1f; + float x = (i - SIZE / 2) / 0.1f; + float z = (j - SIZE / 2) / 0.1f; s.setLocalTranslation(x, 0, z); } } diff --git a/jme3-examples/src/main/java/jme3test/model/anim/TestHWSkinningOld.java b/jme3-examples/src/main/java/jme3test/model/anim/TestHWSkinningOld.java index f0fa27d8fe..2063c2e663 100644 --- a/jme3-examples/src/main/java/jme3test/model/anim/TestHWSkinningOld.java +++ b/jme3-examples/src/main/java/jme3test/model/anim/TestHWSkinningOld.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,7 +75,7 @@ public void simpleInitApp() { for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { - Spatial model = (Spatial) assetManager.loadModel("Models/Oto/OtoOldAnim.j3o"); + 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); diff --git a/jme3-examples/src/main/java/jme3test/model/anim/TestOgreAnim.java b/jme3-examples/src/main/java/jme3test/model/anim/TestOgreAnim.java index 5e1274c8a5..0c6010beae 100644 --- a/jme3-examples/src/main/java/jme3test/model/anim/TestOgreAnim.java +++ b/jme3-examples/src/main/java/jme3test/model/anim/TestOgreAnim.java @@ -66,7 +66,7 @@ public void simpleInitApp() { dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f)); rootNode.addLight(dl); - Spatial model = (Spatial) assetManager.loadModel("Models/Oto/OtoOldAnim.j3o"); + Spatial model = assetManager.loadModel("Models/Oto/OtoOldAnim.j3o"); model.center(); control = model.getControl(AnimControl.class); diff --git a/jme3-examples/src/main/java/jme3test/model/anim/TestSkeletonControlRefresh.java b/jme3-examples/src/main/java/jme3test/model/anim/TestSkeletonControlRefresh.java index bbc727af39..3b30c0417e 100644 --- a/jme3-examples/src/main/java/jme3test/model/anim/TestSkeletonControlRefresh.java +++ b/jme3-examples/src/main/java/jme3test/model/anim/TestSkeletonControlRefresh.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -92,7 +92,7 @@ public void simpleInitApp() { for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { - Spatial model = (Spatial) assetManager.loadModel("Models/Oto/OtoOldAnim.j3o"); + Spatial model = assetManager.loadModel("Models/Oto/OtoOldAnim.j3o"); //setting a different material model.setMaterial(m.clone()); model.setLocalScale(0.1f); diff --git a/jme3-examples/src/main/java/jme3test/network/MovingAverage.java b/jme3-examples/src/main/java/jme3test/network/MovingAverage.java index 991b5e5f61..1544f244cb 100644 --- a/jme3-examples/src/main/java/jme3test/network/MovingAverage.java +++ b/jme3-examples/src/main/java/jme3test/network/MovingAverage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -57,7 +57,7 @@ public long getAverage(){ if (count == 0) return 0; else - return (long) ((float) sum / (float) count); + return (long) (sum / (float) count); } } \ No newline at end of file diff --git a/jme3-examples/src/main/java/jme3test/network/TestThroughput.java b/jme3-examples/src/main/java/jme3test/network/TestThroughput.java index c261ec0b9e..c87064f47f 100644 --- a/jme3-examples/src/main/java/jme3test/network/TestThroughput.java +++ b/jme3-examples/src/main/java/jme3test/network/TestThroughput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 jMonkeyEngine + * Copyright (c) 2011-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -83,7 +83,7 @@ public void messageReceived(MessageConnection source, Message msg) { //System.out.println( "sending:" + msg + " back to client:" + source ); // The 'reliable' flag is transient and the server doesn't // (yet) reset this value for us. - ((com.jme3.network.Message) msg).setReliable(testReliable); + msg.setReliable(testReliable); source.send(msg); } } diff --git a/jme3-examples/src/main/java/jme3test/stress/TestShaderNodesStress.java b/jme3-examples/src/main/java/jme3test/stress/TestShaderNodesStress.java index 0635c2b16a..34ab16f550 100644 --- a/jme3-examples/src/main/java/jme3test/stress/TestShaderNodesStress.java +++ b/jme3-examples/src/main/java/jme3test/stress/TestShaderNodesStress.java @@ -82,7 +82,7 @@ public void appStep(AppStep step) { renderTime = System.nanoTime(); sum += renderTime - updateTime; System.err.println("render time : " + (renderTime - updateTime)); - System.err.println("Average render time : " + ((float)sum / (float)(nbFrames-150))); + System.err.println("Average render time : " + (sum / (float)(nbFrames-150))); } break; diff --git a/jme3-examples/src/main/java/jme3test/terrain/TerrainTest.java b/jme3-examples/src/main/java/jme3test/terrain/TerrainTest.java index 0cf8ed7a26..4903401090 100644 --- a/jme3-examples/src/main/java/jme3test/terrain/TerrainTest.java +++ b/jme3-examples/src/main/java/jme3test/terrain/TerrainTest.java @@ -205,9 +205,9 @@ public void onAction(String name, boolean pressed, float tpf) { // planar textures don't use the mesh's texture coordinates but real world coordinates, // so we need to convert these texture coordinate scales into real world scales so it looks // the same when we switch to/from tri-planar mode - matRock.setFloat("Tex1Scale", 1f / (float) (512f / grassScale)); - matRock.setFloat("Tex2Scale", 1f / (float) (512f / dirtScale)); - matRock.setFloat("Tex3Scale", 1f / (float) (512f / rockScale)); + matRock.setFloat("Tex1Scale", 1f / (512f / grassScale)); + matRock.setFloat("Tex2Scale", 1f / (512f / dirtScale)); + matRock.setFloat("Tex3Scale", 1f / (512f / rockScale)); } else { matRock.setBoolean("useTriPlanarMapping", false); matRock.setFloat("Tex1Scale", grassScale); diff --git a/jme3-examples/src/main/java/jme3test/terrain/TerrainTestAdvanced.java b/jme3-examples/src/main/java/jme3test/terrain/TerrainTestAdvanced.java index 33964af1be..e6ece01d8b 100644 --- a/jme3-examples/src/main/java/jme3test/terrain/TerrainTestAdvanced.java +++ b/jme3-examples/src/main/java/jme3test/terrain/TerrainTestAdvanced.java @@ -267,13 +267,13 @@ public void onAction(String name, boolean pressed, float tpf) { // planar textures don't use the mesh's texture coordinates but real world coordinates, // so we need to convert these texture coordinate scales into real world scales so it looks // the same when we switch to/from tr-planar mode (1024f is the alphamap size) - matTerrain.setFloat("DiffuseMap_0_scale", 1f / (float) (1024f / dirtScale)); - matTerrain.setFloat("DiffuseMap_1_scale", 1f / (float) (1024f / darkRockScale)); - matTerrain.setFloat("DiffuseMap_2_scale", 1f / (float) (1024f / pinkRockScale)); - matTerrain.setFloat("DiffuseMap_3_scale", 1f / (float) (1024f / riverRockScale)); - matTerrain.setFloat("DiffuseMap_4_scale", 1f / (float) (1024f / grassScale)); - matTerrain.setFloat("DiffuseMap_5_scale", 1f / (float) (1024f / brickScale)); - matTerrain.setFloat("DiffuseMap_6_scale", 1f / (float) (1024f / roadScale)); + matTerrain.setFloat("DiffuseMap_0_scale", 1f / (1024f / dirtScale)); + matTerrain.setFloat("DiffuseMap_1_scale", 1f / (1024f / darkRockScale)); + matTerrain.setFloat("DiffuseMap_2_scale", 1f / (1024f / pinkRockScale)); + matTerrain.setFloat("DiffuseMap_3_scale", 1f / (1024f / riverRockScale)); + matTerrain.setFloat("DiffuseMap_4_scale", 1f / (1024f / grassScale)); + matTerrain.setFloat("DiffuseMap_5_scale", 1f / (1024f / brickScale)); + matTerrain.setFloat("DiffuseMap_6_scale", 1f / (1024f / roadScale)); } else { matTerrain.setBoolean("useTriPlanarMapping", false); diff --git a/jme3-examples/src/main/java/jme3test/terrain/TerrainTestAndroid.java b/jme3-examples/src/main/java/jme3test/terrain/TerrainTestAndroid.java index d1c525576c..2ce1ba9275 100644 --- a/jme3-examples/src/main/java/jme3test/terrain/TerrainTestAndroid.java +++ b/jme3-examples/src/main/java/jme3test/terrain/TerrainTestAndroid.java @@ -186,9 +186,9 @@ public void onAction(String name, boolean pressed, float tpf) { // planar textures don't use the mesh's texture coordinates but real world coordinates, // so we need to convert these texture coordinate scales into real world scales so it looks // the same when we switch to/from tr-planar mode - matRock.setFloat("Tex1Scale", 1f / (float) (512f / grassScale)); - matRock.setFloat("Tex2Scale", 1f / (float) (512f / dirtScale)); - matRock.setFloat("Tex3Scale", 1f / (float) (512f / rockScale)); + matRock.setFloat("Tex1Scale", 1f / (512f / grassScale)); + matRock.setFloat("Tex2Scale", 1f / (512f / dirtScale)); + matRock.setFloat("Tex3Scale", 1f / (512f / rockScale)); } else { matRock.setBoolean("useTriPlanarMapping", false); matRock.setFloat("Tex1Scale", grassScale); diff --git a/jme3-examples/src/main/java/jme3test/tools/TestSaveGame.java b/jme3-examples/src/main/java/jme3test/tools/TestSaveGame.java index e0200247ca..69d937868d 100644 --- a/jme3-examples/src/main/java/jme3test/tools/TestSaveGame.java +++ b/jme3-examples/src/main/java/jme3test/tools/TestSaveGame.java @@ -60,7 +60,7 @@ public void simpleInitApp() { myPlayer.setUserData("points", 0); //the actual model would be attached to this node - Spatial model = (Spatial) assetManager.loadModel("Models/Oto/Oto.mesh.xml"); + Spatial model = assetManager.loadModel("Models/Oto/Oto.mesh.xml"); myPlayer.attachChild(model); //before saving the game, the model should be detached so it's not saved along with the node diff --git a/jme3-examples/src/main/java/jme3test/water/TestSimpleWater.java b/jme3-examples/src/main/java/jme3test/water/TestSimpleWater.java index cbb5006237..4380ced037 100644 --- a/jme3-examples/src/main/java/jme3test/water/TestSimpleWater.java +++ b/jme3-examples/src/main/java/jme3test/water/TestSimpleWater.java @@ -81,7 +81,7 @@ public void simpleInitApp() { //create water quad //waterPlane = waterProcessor.createWaterGeometry(100, 100); - waterPlane=(Spatial) assetManager.loadModel("Models/WaterTest/WaterTest.mesh.xml"); + waterPlane = assetManager.loadModel("Models/WaterTest/WaterTest.mesh.xml"); waterPlane.setMaterial(waterProcessor.getMaterial()); waterPlane.setLocalScale(40); waterPlane.setLocalTranslation(-5, 0, 5); diff --git a/jme3-ios/src/main/java/com/jme3/input/ios/TouchEventPool.java b/jme3-ios/src/main/java/com/jme3/input/ios/TouchEventPool.java index f986db1551..5ef260a24c 100644 --- a/jme3-ios/src/main/java/com/jme3/input/ios/TouchEventPool.java +++ b/jme3-ios/src/main/java/com/jme3/input/ios/TouchEventPool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -87,7 +87,7 @@ public TouchEvent getNextFreeEvent() { TouchEvent evt = null; int curSize = eventPool.size(); while (curSize > 0) { - evt = (TouchEvent)eventPool.pop(); + evt = eventPool.pop(); if (evt.isConsumed()) { break; } else { diff --git a/jme3-jbullet/src/main/java/com/jme3/bullet/PhysicsSpace.java b/jme3-jbullet/src/main/java/com/jme3/bullet/PhysicsSpace.java index 819eb578ba..dc97db8c10 100644 --- a/jme3-jbullet/src/main/java/com/jme3/bullet/PhysicsSpace.java +++ b/jme3-jbullet/src/main/java/com/jme3/bullet/PhysicsSpace.java @@ -435,7 +435,7 @@ public void add(Object obj) { Spatial node = (Spatial) obj; for (int i = 0; i < node.getNumControls(); i++) { if (node.getControl(i) instanceof PhysicsControl) { - add(((PhysicsControl) node.getControl(i))); + add(node.getControl(i)); } } } else if (obj instanceof PhysicsCollisionObject) { @@ -472,7 +472,7 @@ public void remove(Object obj) { Spatial node = (Spatial) obj; for (int i = 0; i < node.getNumControls(); i++) { if (node.getControl(i) instanceof PhysicsControl) { - remove(((PhysicsControl) node.getControl(i))); + remove(node.getControl(i)); } } } else if (obj instanceof PhysicsCollisionObject) { diff --git a/jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglDisplay.java b/jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglDisplay.java index a8bb164eff..bbf02adacd 100644 --- a/jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglDisplay.java +++ b/jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglDisplay.java @@ -113,15 +113,11 @@ protected void createContext(AppSettings settings) throws LWJGLException{ Display.setTitle(settings.getTitle()); Display.setResizable(settings.isResizable()); - if (displayMode != null) { - if (settings.isFullscreen()) { - Display.setDisplayModeAndFullscreen(displayMode); - } else { - Display.setFullscreen(false); - Display.setDisplayMode(displayMode); - } + if (settings.isFullscreen()) { + Display.setDisplayModeAndFullscreen(displayMode); } else { - Display.setFullscreen(settings.isFullscreen()); + Display.setFullscreen(false); + Display.setDisplayMode(displayMode); } if (settings.getIcons() != null) { diff --git a/jme3-lwjgl3/src/main/java/com/jme3/input/lwjgl/GlfwMouseInput.java b/jme3-lwjgl3/src/main/java/com/jme3/input/lwjgl/GlfwMouseInput.java index f198234a6c..fea4ee7c11 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/input/lwjgl/GlfwMouseInput.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/input/lwjgl/GlfwMouseInput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -234,7 +234,7 @@ private void initCurrentMousePosition(long window) { DoubleBuffer y = BufferUtils.createDoubleBuffer(1); glfwGetCursorPos(window, x, y); mouseX = (int) Math.round(x.get()); - mouseY = (int) currentHeight - (int) Math.round(y.get()); + mouseY = currentHeight - (int) Math.round(y.get()); } /** diff --git a/jme3-networking/src/main/java/com/jme3/network/base/DefaultServer.java b/jme3-networking/src/main/java/com/jme3/network/base/DefaultServer.java index 3040fdcdae..e2241b538f 100644 --- a/jme3-networking/src/main/java/com/jme3/network/base/DefaultServer.java +++ b/jme3-networking/src/main/java/com/jme3/network/base/DefaultServer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -287,7 +287,7 @@ public boolean hasConnections() @Override public Collection getConnections() { - return Collections.unmodifiableCollection((Collection)connections.values()); + return Collections.unmodifiableCollection(connections.values()); } @Override diff --git a/jme3-networking/src/main/java/com/jme3/network/serializing/serializers/FieldSerializer.java b/jme3-networking/src/main/java/com/jme3/network/serializing/serializers/FieldSerializer.java index b4abceaa8a..bbe2db2780 100644 --- a/jme3-networking/src/main/java/com/jme3/network/serializing/serializers/FieldSerializer.java +++ b/jme3-networking/src/main/java/com/jme3/network/serializing/serializers/FieldSerializer.java @@ -146,7 +146,7 @@ public T readObject(ByteBuffer data, Class c) throws IOException { T object; try { - Constructor ctor = (Constructor)savedCtors.get(c); + Constructor ctor = savedCtors.get(c); object = ctor.newInstance(); } catch (Exception e) { throw new SerializerException( "Error creating object of type:" + c, e ); diff --git a/jme3-niftygui/src/main/java/com/jme3/niftygui/InputSystemJme.java b/jme3-niftygui/src/main/java/com/jme3/niftygui/InputSystemJme.java index 0934e969d6..3954ebc8ef 100644 --- a/jme3-niftygui/src/main/java/com/jme3/niftygui/InputSystemJme.java +++ b/jme3-niftygui/src/main/java/com/jme3/niftygui/InputSystemJme.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2018 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -231,8 +231,8 @@ private void onMouseMotionEventQueued(MouseMotionEvent evt, NiftyInputConsumer n } private void onMouseButtonEventQueued(MouseButtonEvent evt, NiftyInputConsumer nic) { - x = (int) evt.getX(); - y = (int) (height - evt.getY()); + x = evt.getX(); + y = height - evt.getY(); handleMouseEvent(evt.getButtonIndex(), evt.isPressed(), nic, evt); } diff --git a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/SceneLoader.java b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/SceneLoader.java index 43565837ae..b7167d2226 100644 --- a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/SceneLoader.java +++ b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/SceneLoader.java @@ -355,7 +355,7 @@ private void buildAnimations() { int firstKeyIndex = 0; int lastKeyIndex = keyTimes.length - 1; for(int i = 0; i < keyTimes.length; ++i) { - float time = (float) (((double) keyTimes[i]) * secondsPerUnit); // Translate into seconds + float time = (float) (keyTimes[i] * secondsPerUnit); // Translate into seconds if(time <= animStart) firstKeyIndex = i; if(time >= animStop && animStop >= 0) { @@ -373,7 +373,7 @@ private void buildAnimations() { // Calculate keyframes times for(int i = 0; i < keysCount; ++i) { int keyIndex = firstKeyIndex + i; - float time = (float) (((double) keyTimes[keyIndex]) * secondsPerUnit); // Translate into seconds + float time = (float) (keyTimes[keyIndex] * secondsPerUnit); // Translate into seconds times[i] = time - animStart; realLength = Math.max(realLength, times[i]); } diff --git a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/file/FbxDump.java b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/file/FbxDump.java index 00619dce7b..68b4d2403a 100644 --- a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/file/FbxDump.java +++ b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/file/FbxDump.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2015 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -148,9 +148,9 @@ protected static void dumpProperty(String id, char propertyType, case 'F': // Double, Float. if (property instanceof Double) { - ps.print(DECIMAL_FORMAT.format((Double)property)); + ps.print(DECIMAL_FORMAT.format(property)); } else if (property instanceof Float) { - ps.print(DECIMAL_FORMAT.format((Float)property)); + ps.print(DECIMAL_FORMAT.format(property)); } else { ps.print(property); } diff --git a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/node/FbxNode.java b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/node/FbxNode.java index c0ce06d4b9..bc0294c8c8 100644 --- a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/node/FbxNode.java +++ b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/node/FbxNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2015 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -280,9 +280,9 @@ public void fromElement(FbxElement element) { Object userDataValue; if (userDataType.equals("KString")) { - userDataValue = (String) e2.properties.get(4); + userDataValue = e2.properties.get(4); } else if (userDataType.equals("int")) { - userDataValue = (Integer) e2.properties.get(4); + userDataValue = e2.properties.get(4); } else if (userDataType.equals("double")) { // NOTE: jME3 does not support doubles in UserData. // Need to convert to float. diff --git a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxAnimCurve.java b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxAnimCurve.java index 3952161569..90d7897c6c 100644 --- a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxAnimCurve.java +++ b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxAnimCurve.java @@ -36,8 +36,8 @@ public float getValue(long time) { return defaultValue;//keyValues[0]; } else { // Interpolate between two keyframes - float dt = (float) (keyTimes[i] - keyTimes[i - 1]); - float dtInt = (float) (time - keyTimes[i - 1]); + float dt = keyTimes[i] - keyTimes[i - 1]; + float dtInt = time - keyTimes[i - 1]; float dv = keyValues[i] - keyValues[i - 1]; return keyValues[i - 1] + dv * (dtInt / dt); } diff --git a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxImage.java b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxImage.java index 0b50aa163e..21ca597f5a 100644 --- a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxImage.java +++ b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxImage.java @@ -117,7 +117,7 @@ private Image createImage() { } } if(image == null) - return new Image(Image.Format.RGB8, 1, 1, BufferUtils.createByteBuffer((int) ((long) 1 * (long) 1 * (long) Image.Format.RGB8.getBitsPerPixel() / 8L)), ColorSpace.Linear); + return new Image(Image.Format.RGB8, 1, 1, BufferUtils.createByteBuffer((int) (Image.Format.RGB8.getBitsPerPixel() / 8L)), ColorSpace.Linear); return image; } } diff --git a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxNode.java b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxNode.java index ebb2094928..41a2022d26 100644 --- a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxNode.java +++ b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxNode.java @@ -92,9 +92,9 @@ public FbxNode(SceneLoader scene, FbxElement element) { String userDataType = (String) prop.properties.get(1); Object userDataValue; if(userDataType.equals("KString")) { - userDataValue = (String) prop.properties.get(4); + userDataValue = prop.properties.get(4); } else if(userDataType.equals("int")) { - userDataValue = (Integer) prop.properties.get(4); + userDataValue = prop.properties.get(4); } else if(userDataType.equals("double")) { // NOTE: jME3 does not support doubles in UserData. // Need to convert to float. diff --git a/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/GltfUtils.java b/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/GltfUtils.java index f6200f533b..a16fb7733d 100644 --- a/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/GltfUtils.java +++ b/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/GltfUtils.java @@ -350,16 +350,16 @@ public static float readAsFloat(LittleEndien stream, VertexBuffer.Format format) switch (format) { case Byte: b = stream.readByte(); - return Math.max((float) b / 127f, -1f); + return Math.max(b / 127f, -1f); case UnsignedByte: b = stream.readByte(); - return (float) b / 255f; + return b / 255f; case Short: b = stream.readByte(); - return Math.max((float) b / 32767f, -1f); + return Math.max(b / 32767f, -1f); case UnsignedShort: b = stream.readByte(); - return (float) b / 65535f; + return b / 65535f; default: //we have a regular float return stream.readFloat(); diff --git a/jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/MeshLoader.java b/jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/MeshLoader.java index bf354afd2d..1ef446b8fc 100644 --- a/jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/MeshLoader.java +++ b/jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/MeshLoader.java @@ -841,7 +841,7 @@ public Object load(AssetInfo info) throws IOException { if (materialList == null && materialName != null) { OgreMaterialKey materialKey = new OgreMaterialKey(folderName + materialName + ".material"); try { - materialList = (MaterialList) assetManager.loadAsset(materialKey); + materialList = assetManager.loadAsset(materialKey); } catch (AssetNotFoundException e) { logger.log(Level.WARNING, "Cannot locate {0} for model {1}", new Object[]{materialKey, key}); } @@ -858,7 +858,7 @@ public Object load(AssetInfo info) throws IOException { if (materialList == null) { OgreMaterialKey materialKey = new OgreMaterialKey(folderName + meshName + ".material"); try { - materialList = (MaterialList) assetManager.loadAsset(materialKey); + materialList = assetManager.loadAsset(materialKey); } catch (AssetNotFoundException e) { logger.log(Level.WARNING, "Cannot locate {0} for model {1}", new Object[]{materialKey, key}); } diff --git a/jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/SceneLoader.java b/jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/SceneLoader.java index 5ae8a4f2d5..13205817b7 100644 --- a/jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/SceneLoader.java +++ b/jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/SceneLoader.java @@ -510,7 +510,7 @@ public Object load(AssetInfo info) throws IOException { // (Backward compatibility only!) OgreMaterialKey materialKey = new OgreMaterialKey(sceneName + ".material"); try { - materialList = (MaterialList) assetManager.loadAsset(materialKey); + materialList = assetManager.loadAsset(materialKey); } catch (AssetNotFoundException ex) { logger.log(Level.WARNING, "Cannot locate {0} for scene {1}", new Object[]{materialKey, key}); materialList = null; diff --git a/jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/SceneMaterialLoader.java b/jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/SceneMaterialLoader.java index 3507de2f7c..63b528905c 100644 --- a/jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/SceneMaterialLoader.java +++ b/jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/SceneMaterialLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -100,7 +100,7 @@ public void startElement(String uri, String localName, String qName, Attributes String materialName = new File(materialPath).getName(); String matFile = folderName + materialName; try { - MaterialList loadedMaterialList = (MaterialList) assetManager.loadAsset(new OgreMaterialKey(matFile)); + MaterialList loadedMaterialList = assetManager.loadAsset(new OgreMaterialKey(matFile)); materialList.putAll(loadedMaterialList); } catch (AssetNotFoundException ex) { logger.log(Level.WARNING, "Cannot locate material file: {0}", matFile); diff --git a/jme3-terrain/src/main/java/com/jme3/terrain/GeoMap.java b/jme3-terrain/src/main/java/com/jme3/terrain/GeoMap.java index d0db8082a1..a060617c50 100644 --- a/jme3-terrain/src/main/java/com/jme3/terrain/GeoMap.java +++ b/jme3-terrain/src/main/java/com/jme3/terrain/GeoMap.java @@ -239,9 +239,9 @@ public FloatBuffer writeVertexArray(FloatBuffer store, Vector3f scale, boolean c int i = 0; for (int z = 0; z < height; z++){ for (int x = 0; x < width; x++){ - store.put( (float)x*scale.x + offset.x ); - store.put( (float)hdata[i++]*scale.y ); - store.put( (float)z*scale.z + offset.z ); + store.put( x*scale.x + offset.x ); + store.put( hdata[i++]*scale.y ); + store.put( z*scale.z + offset.z ); } } @@ -249,8 +249,8 @@ public FloatBuffer writeVertexArray(FloatBuffer store, Vector3f scale, boolean c } public Vector2f getUV(int x, int y, Vector2f store){ - store.set( (float)x / (float)getWidth(), - (float)y / (float)getHeight() ); + store.set( x / (float)getWidth(), + y / (float)getHeight() ); return store; } diff --git a/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/LODGeomap.java b/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/LODGeomap.java index 0f18af88ef..ccffca1c89 100644 --- a/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/LODGeomap.java +++ b/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/LODGeomap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2019 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -141,8 +141,8 @@ public Vector2f getUV(int x, int y, Vector2f store, Vector2f offset, float offse float offsetX = offset.x + (offsetAmount * 1.0f); float offsetY = -offset.y + (offsetAmount * 1.0f);//note the -, we flip the tex coords - store.set((((float) x) + offsetX) / (float) (totalSize - 1), // calculates percentage of texture here - (((float) y) + offsetY) / (float) (totalSize - 1)); + store.set((x + offsetX) / (totalSize - 1), // calculates percentage of texture here + (y + offsetY) / (totalSize - 1)); return store; } diff --git a/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/TerrainPatch.java b/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/TerrainPatch.java index 36c44ea462..a4e8179471 100644 --- a/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/TerrainPatch.java +++ b/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/TerrainPatch.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2019 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -200,11 +200,7 @@ public void generateLodEntropies() { for (int i = 0; i <= getMaxLod(); i++){ int curLod = (int) Math.pow(2, i); IndexBuffer idxB = geomap.writeIndexArrayLodDiff(curLod, false, false, false, false, totalSize); - Buffer ib; - if (idxB.getBuffer() instanceof IntBuffer) - ib = (IntBuffer)idxB.getBuffer(); - else - ib = (ShortBuffer)idxB.getBuffer(); + Buffer ib = idxB.getBuffer(); entropies[i] = EntropyComputeUtil.computeLodEntropy(mesh, ib); } @@ -253,11 +249,7 @@ protected void reIndexGeometry(HashMap updated, bool else idxB = geomap.writeIndexArrayLodDiff(pow, right, top, left, bottom, totalSize); - Buffer b; - if (idxB.getBuffer() instanceof IntBuffer) - b = (IntBuffer)idxB.getBuffer(); - else - b = (ShortBuffer)idxB.getBuffer(); + Buffer b = idxB.getBuffer(); utp.setNewIndexBuffer(b); } diff --git a/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/TerrainQuad.java b/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/TerrainQuad.java index ad90e76615..7f2ebb3dc6 100644 --- a/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/TerrainQuad.java +++ b/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/TerrainQuad.java @@ -1056,8 +1056,8 @@ private QuadrantChild findMatchingChild(int x, int z) { @Override public float getHeight(Vector2f xz) { // offset - float x = (float)(((xz.x - getWorldTranslation().x) / getWorldScale().x) + (float)(totalSize-1) / 2f); - float z = (float)(((xz.y - getWorldTranslation().z) / getWorldScale().z) + (float)(totalSize-1) / 2f); + float x = ((xz.x - getWorldTranslation().x) / getWorldScale().x) + (totalSize-1) / 2f; + float z = ((xz.y - getWorldTranslation().z) / getWorldScale().z) + (totalSize-1) / 2f; if (!isInside((int)x, (int)z)) return Float.NaN; float height = getHeight((int)x, (int)z, (x%1f), (z%1f)); @@ -1084,8 +1084,8 @@ protected float getHeight(int x, int z, float xm, float zm) { @Override public Vector3f getNormal(Vector2f xz) { // offset - float x = (float)(((xz.x - getWorldTranslation().x) / getWorldScale().x) + (float)(totalSize-1) / 2f); - float z = (float)(((xz.y - getWorldTranslation().z) / getWorldScale().z) + (float)(totalSize-1) / 2f); + float x = ((xz.x - getWorldTranslation().x) / getWorldScale().x) + (totalSize-1) / 2f; + float z = ((xz.y - getWorldTranslation().z) / getWorldScale().z) + (totalSize-1) / 2f; Vector3f normal = getNormal(x, z, xz); return normal; @@ -1589,10 +1589,10 @@ protected void fixNormals(BoundingBox affectedArea) { for (int x = children.size(); --x >= 0;) { Spatial child = children.get(x); if (child instanceof TerrainQuad) { - if (affectedArea != null && affectedArea.intersects(((TerrainQuad) child).getWorldBound()) ) + if (affectedArea != null && affectedArea.intersects( child.getWorldBound()) ) ((TerrainQuad) child).fixNormals(affectedArea); } else if (child instanceof TerrainPatch) { - if (affectedArea != null && affectedArea.intersects(((TerrainPatch) child).getWorldBound()) ) + if (affectedArea != null && affectedArea.intersects(child.getWorldBound()) ) ((TerrainPatch) child).updateNormals(); // recalculate the patch's normals } } @@ -1608,10 +1608,10 @@ protected void fixNormalEdges(BoundingBox affectedArea) { for (int x = children.size(); --x >= 0;) { Spatial child = children.get(x); if (child instanceof TerrainQuad) { - if (affectedArea != null && affectedArea.intersects(((TerrainQuad) child).getWorldBound()) ) + if (affectedArea != null && affectedArea.intersects(child.getWorldBound()) ) ((TerrainQuad) child).fixNormalEdges(affectedArea); } else if (child instanceof TerrainPatch) { - if (affectedArea != null && !affectedArea.intersects(((TerrainPatch) child).getWorldBound()) ) // if doesn't intersect, continue + if (affectedArea != null && !affectedArea.intersects(child.getWorldBound()) ) // if doesn't intersect, continue continue; TerrainPatch tp = (TerrainPatch) child; @@ -1677,7 +1677,7 @@ public void findPick(Ray toTest, List results) { if (tp.getWorldBound().intersects(toTest)) { CollisionResults cr = new CollisionResults(); toTest.collideWith(tp.getWorldBound(), cr); - if (cr != null && cr.getClosestCollision() != null) { + if (cr.getClosestCollision() != null) { cr.getClosestCollision().getDistance(); results.add(new TerrainPickData(tp, cr.getClosestCollision())); } diff --git a/jme3-terrain/src/main/java/com/jme3/terrain/heightmap/FluidSimHeightMap.java b/jme3-terrain/src/main/java/com/jme3/terrain/heightmap/FluidSimHeightMap.java index 63b4881d1f..14b39bcd8b 100644 --- a/jme3-terrain/src/main/java/com/jme3/terrain/heightmap/FluidSimHeightMap.java +++ b/jme3-terrain/src/main/java/com/jme3/terrain/heightmap/FluidSimHeightMap.java @@ -212,7 +212,7 @@ public boolean load() { // put the normalized heightmap into the range [0...255] and into the heightmap for (int y = 0; y < size; y++) { for (int x = 0; x < size; x++) { - heightData[x + y * size] = (float) (tempBuffer[curBuf][x + y * size]); + heightData[x + y * size] = tempBuffer[curBuf][x + y * size]; } } normalizeTerrain(NORMALIZE_RANGE); diff --git a/jme3-terrain/src/main/java/com/jme3/terrain/heightmap/HillHeightMap.java b/jme3-terrain/src/main/java/com/jme3/terrain/heightmap/HillHeightMap.java index c9373296e4..f25932cf5c 100644 --- a/jme3-terrain/src/main/java/com/jme3/terrain/heightmap/HillHeightMap.java +++ b/jme3-terrain/src/main/java/com/jme3/terrain/heightmap/HillHeightMap.java @@ -135,7 +135,7 @@ public boolean load() { // transfer temporary buffer to final heightmap for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { - setHeightAtPoint((float) tempBuffer[i][j], j, i); + setHeightAtPoint(tempBuffer[i][j], j, i); } } diff --git a/jme3-terrain/src/main/java/com/jme3/terrain/heightmap/MidpointDisplacementHeightMap.java b/jme3-terrain/src/main/java/com/jme3/terrain/heightmap/MidpointDisplacementHeightMap.java index acfbc9881d..95db0ab186 100644 --- a/jme3-terrain/src/main/java/com/jme3/terrain/heightmap/MidpointDisplacementHeightMap.java +++ b/jme3-terrain/src/main/java/com/jme3/terrain/heightmap/MidpointDisplacementHeightMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2019 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -144,7 +144,7 @@ public boolean load() { for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { - setHeightAtPoint((float) tempBuffer[i][j], j, i); + setHeightAtPoint(tempBuffer[i][j], j, i); } } diff --git a/jme3-terrain/src/main/java/com/jme3/terrain/heightmap/ParticleDepositionHeightMap.java b/jme3-terrain/src/main/java/com/jme3/terrain/heightmap/ParticleDepositionHeightMap.java index d32489928f..1540fc7435 100644 --- a/jme3-terrain/src/main/java/com/jme3/terrain/heightmap/ParticleDepositionHeightMap.java +++ b/jme3-terrain/src/main/java/com/jme3/terrain/heightmap/ParticleDepositionHeightMap.java @@ -313,7 +313,7 @@ public boolean load() { //transfer the new terrain into the height map. for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { - setHeightAtPoint((float) tempBuffer[i][j], j, i); + setHeightAtPoint(tempBuffer[i][j], j, i); } } erodeTerrain(); diff --git a/jme3-vr/src/main/java/com/jme3/app/VREnvironment.java b/jme3-vr/src/main/java/com/jme3/app/VREnvironment.java index 3ed87b6960..21ee5eb9d0 100644 --- a/jme3-vr/src/main/java/com/jme3/app/VREnvironment.java +++ b/jme3-vr/src/main/java/com/jme3/app/VREnvironment.java @@ -169,7 +169,7 @@ public void setSeatedExperience(boolean isSeated) { ((OpenVR)hardware).getCompositor().SetTrackingSpace.apply(JOpenVRLibrary.ETrackingUniverseOrigin.ETrackingUniverseOrigin_TrackingUniverseStanding); } } else if (hardware instanceof LWJGLOpenVR) { - if( ((LWJGLOpenVR)hardware).isInitialized() ) { + if( hardware.isInitialized() ) { ((LWJGLOpenVR)hardware).setTrackingSpace(seated); } } diff --git a/jme3-vr/src/main/java/com/jme3/input/vr/lwjgl_openvr/LWJGLOpenVR.java b/jme3-vr/src/main/java/com/jme3/input/vr/lwjgl_openvr/LWJGLOpenVR.java index 7615ae8449..6447396f21 100644 --- a/jme3-vr/src/main/java/com/jme3/input/vr/lwjgl_openvr/LWJGLOpenVR.java +++ b/jme3-vr/src/main/java/com/jme3/input/vr/lwjgl_openvr/LWJGLOpenVR.java @@ -170,7 +170,7 @@ public boolean initialize() { VR.k_unTrackedDeviceIndex_Hmd, VR.ETrackedDeviceProperty_Prop_SerialNumber_String, hmdErrorStore)); hmdDisplayFrequency = BufferUtils.createIntBuffer(1); - hmdDisplayFrequency.put( (int) VR.ETrackedDeviceProperty_Prop_DisplayFrequency_Float); + hmdDisplayFrequency.put(VR.ETrackedDeviceProperty_Prop_DisplayFrequency_Float); trackedDevicePose = TrackedDevicePose.create(VR.k_unMaxTrackedDeviceCount); hmdTrackedDevicePoses = new TrackedDevicePose[VR.k_unMaxTrackedDeviceCount]; diff --git a/jme3-vr/src/main/java/com/jme3/input/vr/lwjgl_openvr/LWJGLOpenVRInput.java b/jme3-vr/src/main/java/com/jme3/input/vr/lwjgl_openvr/LWJGLOpenVRInput.java index d0f49594d5..a44410eb4e 100644 --- a/jme3-vr/src/main/java/com/jme3/input/vr/lwjgl_openvr/LWJGLOpenVRInput.java +++ b/jme3-vr/src/main/java/com/jme3/input/vr/lwjgl_openvr/LWJGLOpenVRInput.java @@ -404,7 +404,7 @@ public Quaternion getFinalObserverRotation(int index) { public Vector3f getFinalObserverPosition(int index) { if (environment != null) { - VRViewManager vrvm = (VRViewManager) environment.getVRViewManager(); + VRViewManager vrvm = environment.getVRViewManager(); if (vrvm != null) { if (isInputDeviceTracking(index) == false) { diff --git a/jme3-vr/src/main/java/com/jme3/input/vr/lwjgl_openvr/LWJGLOpenVRViewManager.java b/jme3-vr/src/main/java/com/jme3/input/vr/lwjgl_openvr/LWJGLOpenVRViewManager.java index 78be2565fd..af9e98a7ed 100644 --- a/jme3-vr/src/main/java/com/jme3/input/vr/lwjgl_openvr/LWJGLOpenVRViewManager.java +++ b/jme3-vr/src/main/java/com/jme3/input/vr/lwjgl_openvr/LWJGLOpenVRViewManager.java @@ -74,7 +74,7 @@ public LWJGLOpenVRViewManager(VREnvironment environment) { * @see #getFullTexId() */ protected int getLeftTexId() { - return (int) getLeftTexture().getImage().getId(); + return getLeftTexture().getImage().getId(); } /** @@ -85,7 +85,7 @@ protected int getLeftTexId() { * @see #getFullTexId() */ protected int getRightTexId() { - return (int) getRightTexture().getImage().getId(); + return getRightTexture().getImage().getId(); } /** @@ -96,7 +96,7 @@ protected int getRightTexId() { * @see #getRightTexId() */ private int getFullTexId() { - return (int) dualEyeTex.getImage().getId(); + return dualEyeTex.getImage().getId(); } /** @@ -482,7 +482,7 @@ private ViewPort setupMirrorBuffers(Camera cam, Texture2D tex, boolean expand) { pic.setLocalScale(1.5f, 1f, 1f); } pic.setQueueBucket(Bucket.Opaque); - pic.setTexture(environment.getApplication().getAssetManager(), (Texture2D) tex, false); + pic.setTexture(environment.getApplication().getAssetManager(), tex, false); viewPort.attachScene(pic); viewPort.setOutputFrameBuffer(null); diff --git a/jme3-vr/src/main/java/com/jme3/input/vr/openvr/OpenVR.java b/jme3-vr/src/main/java/com/jme3/input/vr/openvr/OpenVR.java index a4d76018be..1c5a9449bd 100644 --- a/jme3-vr/src/main/java/com/jme3/input/vr/openvr/OpenVR.java +++ b/jme3-vr/src/main/java/com/jme3/input/vr/openvr/OpenVR.java @@ -206,7 +206,7 @@ public boolean initialize() { _tframeCount = new LongByReference(); hmdDisplayFrequency = IntBuffer.allocate(1); - hmdDisplayFrequency.put( (int) JOpenVRLibrary.ETrackedDeviceProperty.ETrackedDeviceProperty_Prop_DisplayFrequency_Float); + hmdDisplayFrequency.put(JOpenVRLibrary.ETrackedDeviceProperty.ETrackedDeviceProperty_Prop_DisplayFrequency_Float); hmdTrackedDevicePoseReference = new TrackedDevicePose_t.ByReference(); hmdTrackedDevicePoses = (TrackedDevicePose_t[])hmdTrackedDevicePoseReference.toArray(JOpenVRLibrary.k_unMaxTrackedDeviceCount); poseMatrices = new Matrix4f[JOpenVRLibrary.k_unMaxTrackedDeviceCount]; diff --git a/jme3-vr/src/main/java/com/jme3/input/vr/openvr/OpenVRViewManager.java b/jme3-vr/src/main/java/com/jme3/input/vr/openvr/OpenVRViewManager.java index f4bdc920ba..b9c8eb1f21 100644 --- a/jme3-vr/src/main/java/com/jme3/input/vr/openvr/OpenVRViewManager.java +++ b/jme3-vr/src/main/java/com/jme3/input/vr/openvr/OpenVRViewManager.java @@ -75,7 +75,7 @@ public OpenVRViewManager(VREnvironment environment){ * @see #getFullTexId() */ protected int getLeftTexId() { - return (int)getLeftTexture().getImage().getId(); + return getLeftTexture().getImage().getId(); } /** @@ -85,7 +85,7 @@ protected int getLeftTexId() { * @see #getFullTexId() */ protected int getRightTexId() { - return (int)getRightTexture().getImage().getId(); + return getRightTexture().getImage().getId(); } /** @@ -95,7 +95,7 @@ protected int getRightTexId() { * @see #getRightTexId() */ private int getFullTexId() { - return (int)dualEyeTex.getImage().getId(); + return dualEyeTex.getImage().getId(); } /** diff --git a/jme3-vr/src/main/java/com/jme3/input/vr/osvr/OSVRViewManager.java b/jme3-vr/src/main/java/com/jme3/input/vr/osvr/OSVRViewManager.java index dd4a2a6bdf..e4475397b5 100644 --- a/jme3-vr/src/main/java/com/jme3/input/vr/osvr/OSVRViewManager.java +++ b/jme3-vr/src/main/java/com/jme3/input/vr/osvr/OSVRViewManager.java @@ -93,7 +93,7 @@ public OSVRViewManager(VREnvironment environment){ * @see #getFullTexId() */ protected int getLeftTexId() { - return (int)leftEyeTexture.getImage().getId(); + return leftEyeTexture.getImage().getId(); } /** @@ -103,7 +103,7 @@ protected int getLeftTexId() { * @see #getFullTexId() */ protected int getRightTexId() { - return (int)rightEyeTexture.getImage().getId(); + return rightEyeTexture.getImage().getId(); } /** @@ -113,7 +113,7 @@ protected int getRightTexId() { * @see #getRightTexId() */ private int getFullTexId() { - return (int)dualEyeTex.getImage().getId(); + return dualEyeTex.getImage().getId(); } /** @@ -295,7 +295,7 @@ public void initialize() { int origHeight = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getHeight(); long window = ((LwjglWindow)environment.getApplication().getContext()).getWindowHandle(); Vector2f windowSize = new Vector2f(); - ((OSVR)environment.getVRHardware()).getRenderSize(windowSize); + environment.getVRHardware().getRenderSize(windowSize); windowSize.x = Math.max(windowSize.x * 2f, leftCamera.getWidth()); org.lwjgl.glfw.GLFW.glfwSetWindowSize(window, (int)windowSize.x, (int)windowSize.y); environment.getApplication().getContext().getSettings().setResolution((int)windowSize.x, (int)windowSize.y); diff --git a/jme3-vr/src/main/java/com/jme3/post/CartoonSSAO.java b/jme3-vr/src/main/java/com/jme3/post/CartoonSSAO.java index 35b2cd95b6..699e13ecd8 100644 --- a/jme3-vr/src/main/java/com/jme3/post/CartoonSSAO.java +++ b/jme3-vr/src/main/java/com/jme3/post/CartoonSSAO.java @@ -140,7 +140,7 @@ protected void initFilter(AssetManager manager, RenderManager renderManager, Vie frustumNearFar = new Vector2f(); float farY = (vp.getCamera().getFrustumTop() / vp.getCamera().getFrustumNear()) * vp.getCamera().getFrustumFar(); - float farX = farY * ((float) screenWidth / (float) screenHeight); + float farX = farY * (screenWidth / (float) screenHeight); frustumCorner = new Vector3f(farX, farY, vp.getCamera().getFrustumFar()); frustumNearFar.x = vp.getCamera().getFrustumNear(); frustumNearFar.y = vp.getCamera().getFrustumFar(); diff --git a/jme3-vr/src/main/java/com/jme3/shadow/AbstractShadowRendererVR.java b/jme3-vr/src/main/java/com/jme3/shadow/AbstractShadowRendererVR.java index b7586b0f3d..6fcbbd85a6 100644 --- a/jme3-vr/src/main/java/com/jme3/shadow/AbstractShadowRendererVR.java +++ b/jme3-vr/src/main/java/com/jme3/shadow/AbstractShadowRendererVR.java @@ -813,7 +813,7 @@ public boolean isRenderBackFacesShadows() { */ @Override public void read(JmeImporter im) throws IOException { - InputCapsule ic = (InputCapsule) im.getCapsule(this); + InputCapsule ic = im.getCapsule(this); assetManager = im.getAssetManager(); nbShadowMaps = ic.readInt("nbShadowMaps", 1); shadowMapSize = ic.readFloat("shadowMapSize", 0f); @@ -833,7 +833,7 @@ public void read(JmeImporter im) throws IOException { */ @Override public void write(JmeExporter ex) throws IOException { - OutputCapsule oc = (OutputCapsule) ex.getCapsule(this); + OutputCapsule oc = ex.getCapsule(this); oc.write(nbShadowMaps, "nbShadowMaps", 1); oc.write(shadowMapSize, "shadowMapSize", 0); oc.write(shadowIntensity, "shadowIntensity", 0.7f); diff --git a/jme3-vr/src/main/java/com/jme3/shadow/DirectionalLightShadowRendererVR.java b/jme3-vr/src/main/java/com/jme3/shadow/DirectionalLightShadowRendererVR.java index c4a1336d35..9c8cae716d 100644 --- a/jme3-vr/src/main/java/com/jme3/shadow/DirectionalLightShadowRendererVR.java +++ b/jme3-vr/src/main/java/com/jme3/shadow/DirectionalLightShadowRendererVR.java @@ -1,7 +1,7 @@ package com.jme3.shadow; /* - * Copyright (c) 2009-2019 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -270,7 +270,7 @@ public void setEnabledStabilization(boolean stabilize) { @Override public void read(JmeImporter im) throws IOException { super.read(im); - InputCapsule ic = (InputCapsule) im.getCapsule(this); + InputCapsule ic = im.getCapsule(this); lambda = ic.readFloat("lambda", 0.65f); zFarOverride = ic.readInt("zFarOverride", 0); light = (DirectionalLight) ic.readSavable("light", null); @@ -282,7 +282,7 @@ public void read(JmeImporter im) throws IOException { @Override public void write(JmeExporter ex) throws IOException { super.write(ex); - OutputCapsule oc = (OutputCapsule) ex.getCapsule(this); + OutputCapsule oc = ex.getCapsule(this); oc.write(lambda, "lambda", 0.65f); oc.write(zFarOverride, "zFarOverride", 0); oc.write(light, "light", null); diff --git a/jme3-vr/src/main/java/com/jme3/system/osvr/osvrclientreporttypes/OsvrClientReportTypesLibrary.java b/jme3-vr/src/main/java/com/jme3/system/osvr/osvrclientreporttypes/OsvrClientReportTypesLibrary.java index 9f8f1ea765..4289cb200f 100644 --- a/jme3-vr/src/main/java/com/jme3/system/osvr/osvrclientreporttypes/OsvrClientReportTypesLibrary.java +++ b/jme3-vr/src/main/java/com/jme3/system/osvr/osvrclientreporttypes/OsvrClientReportTypesLibrary.java @@ -14,12 +14,12 @@ public class OsvrClientReportTypesLibrary implements Library { static { Native.register(OsvrClientReportTypesLibrary.class, OsvrClientReportTypesLibrary.JNA_NATIVE_LIB); } - public static final int OSVR_TRUE = (int)(1); - public static final int OSVR_FALSE = (int)(0); - public static final int OSVR_BUTTON_PRESSED = (int)(1); - public static final int OSVR_BUTTON_NOT_PRESSED = (int)(0); - public static final int OSVR_EYE_BLINK = (int)(1); - public static final int OSVR_EYE_NO_BLINK = (int)(0); + public static final int OSVR_TRUE = 1; + public static final int OSVR_FALSE = 0; + public static final int OSVR_BUTTON_PRESSED = 1; + public static final int OSVR_BUTTON_NOT_PRESSED = 0; + public static final int OSVR_EYE_BLINK = 1; + public static final int OSVR_EYE_NO_BLINK = 0; /** Original signature : double osvrVec3GetX(const OSVR_Vec3*) */ public static native double osvrVec3GetX(OSVR_Vec3 v); /** Original signature : void osvrVec3SetX(OSVR_Vec3*, double) */ diff --git a/jme3-vr/src/main/java/com/jme3/system/osvr/osvrmatrixconventions/OsvrMatrixConventionsLibrary.java b/jme3-vr/src/main/java/com/jme3/system/osvr/osvrmatrixconventions/OsvrMatrixConventionsLibrary.java index dde9fe4102..384dd827ce 100644 --- a/jme3-vr/src/main/java/com/jme3/system/osvr/osvrmatrixconventions/OsvrMatrixConventionsLibrary.java +++ b/jme3-vr/src/main/java/com/jme3/system/osvr/osvrmatrixconventions/OsvrMatrixConventionsLibrary.java @@ -30,26 +30,26 @@ public static interface OSVR_MatrixMasks { /** enum values */ public static interface OSVR_MatrixOrderingFlags { public static final int OSVR_MATRIX_COLMAJOR = 0x0; - public static final int OSVR_MATRIX_ROWMAJOR = (int)OsvrMatrixConventionsLibrary.OSVR_MatrixMasks.OSVR_MATRIX_MASK_ROWMAJOR; + public static final int OSVR_MATRIX_ROWMAJOR = OsvrMatrixConventionsLibrary.OSVR_MatrixMasks.OSVR_MATRIX_MASK_ROWMAJOR; }; /** enum values */ public static interface OSVR_MatrixVectorFlags { public static final int OSVR_MATRIX_COLVECTORS = 0x0; - public static final int OSVR_MATRIX_ROWVECTORS = (int)OsvrMatrixConventionsLibrary.OSVR_MatrixMasks.OSVR_MATRIX_MASK_ROWVECTORS; + public static final int OSVR_MATRIX_ROWVECTORS = OsvrMatrixConventionsLibrary.OSVR_MatrixMasks.OSVR_MATRIX_MASK_ROWVECTORS; }; /** enum values */ public static interface OSVR_ProjectionMatrixInputFlags { public static final int OSVR_MATRIX_RHINPUT = 0x0; - public static final int OSVR_MATRIX_LHINPUT = (int)OsvrMatrixConventionsLibrary.OSVR_MatrixMasks.OSVR_MATRIX_MASK_LHINPUT; + public static final int OSVR_MATRIX_LHINPUT = OsvrMatrixConventionsLibrary.OSVR_MatrixMasks.OSVR_MATRIX_MASK_LHINPUT; }; /** enum values */ public static interface OSVR_ProjectionMatrixZFlags { public static final int OSVR_MATRIX_SIGNEDZ = 0x0; - public static final int OSVR_MATRIX_UNSIGNEDZ = (int)OsvrMatrixConventionsLibrary.OSVR_MatrixMasks.OSVR_MATRIX_MASK_UNSIGNEDZ; + public static final int OSVR_MATRIX_UNSIGNEDZ = OsvrMatrixConventionsLibrary.OSVR_MatrixMasks.OSVR_MATRIX_MASK_UNSIGNEDZ; }; public static final int OSVR_MATRIX_SIZE = 16; - public static final int OSVR_RETURN_SUCCESS = (int)(0); - public static final int OSVR_RETURN_FAILURE = (int)(1); + public static final int OSVR_RETURN_SUCCESS = 0; + public static final int OSVR_RETURN_FAILURE = 1; /** Original signature : double osvrVec3GetX(const OSVR_Vec3*) */ public static native double osvrVec3GetX(OSVR_Vec3 v); /** Original signature : void osvrVec3SetX(OSVR_Vec3*, double) */ diff --git a/jme3-vr/src/main/java/com/jme3/system/osvr/osvrtimevalue/OsvrTimeValueLibrary.java b/jme3-vr/src/main/java/com/jme3/system/osvr/osvrtimevalue/OsvrTimeValueLibrary.java index 9af6a39af2..eb2731b5c0 100644 --- a/jme3-vr/src/main/java/com/jme3/system/osvr/osvrtimevalue/OsvrTimeValueLibrary.java +++ b/jme3-vr/src/main/java/com/jme3/system/osvr/osvrtimevalue/OsvrTimeValueLibrary.java @@ -16,8 +16,8 @@ public class OsvrTimeValueLibrary implements Library { static { Native.register(OsvrTimeValueLibrary.class, OsvrTimeValueLibrary.JNA_NATIVE_LIB); } - public static final int OSVR_TRUE = (int)(1); - public static final int OSVR_FALSE = (int)(0); + public static final int OSVR_TRUE = 1; + public static final int OSVR_FALSE = 0; /** * Gets the current time in the TimeValue. Parallel to gettimeofday. * Original signature : void osvrTimeValueGetNow(OSVR_TimeValue*)