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 81cb3f856..fcebf70f8 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 @@ public class MainActivity extends AppCompatActivity implements OnItemClickListen 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 ed8976955..073feb3fe 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 class AndroidHarnessFragment extends Fragment implements 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 9a8361f44..61a1a5a39 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 class MjpegFileWriter { 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 e8774a3db..22e15c961 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 class VideoRecorderAppState extends AbstractAppState { @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 4232e6082..ef9df8faf 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 class AndroidSensorJoyInput implements SensorEventListener { } } } - } 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 0a7fc3838..d02801d0e 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 class AndroidTouchInput implements TouchInput { // 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 400a3bd38..2bea5a8cd 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 class TouchEventPool { 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 bb64a6849..f1c99cebd 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 class OGLESContext implements JmeContext, GLSurfaceView.Renderer, SoftTex } 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 fac6597c5..da3076e2a 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 class Structure implements Cloneable { 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 0ec120bad..a14d77004 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 @@ import com.jme3.util.BufferUtils; } } - if (vertexGroups != null && vertexGroups.size() > 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 a600ff075..7847f255f 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 @@ import com.jme3.scene.plugins.blender.textures.generating.TextureGeneratorMusgra 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 40d968923..93d6cc1d4 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 @@ public class KinematicRagdollControl extends AbstractPhysicsControl implements P 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 @@ public class KinematicRagdollControl extends AbstractPhysicsControl implements P } 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 @@ public class KinematicRagdollControl extends AbstractPhysicsControl implements P 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 19e14d49b..9f3bc797a 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 class CollisionShapeFactory { */ 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 f2d709131..fde793a87 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 class PhysicsSpace { 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 class PhysicsSpace { 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 class PhysicsSpace { public 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 4ae14dd55..a6dc4a7d9 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 class MorphTrack implements AnimTrack { 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 31d2931fe..c90764a90 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 class LinearBlendSpace implements BlendSpace { 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 0b0a435c7..f8e1e7791 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 class AnimationFactory { //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 @@ public class AnimationFactory { //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 @@ public class AnimationFactory { 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 e5673df53..8df40c1c4 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 class DetailedProfiler implements AppProfiler { 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 class DetailedProfiler implements AppProfiler { 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 bc4718239..6816fceac 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 class DesktopAssetManager implements AssetManager { @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 class DesktopAssetManager implements AssetManager { @Override public AudioData loadAudio(AudioKey key){ - return (AudioData) loadAsset(key); + return loadAsset(key); } @Override @@ -433,7 +433,7 @@ public class DesktopAssetManager implements AssetManager { @Override public Spatial loadModel(ModelKey key){ - return (Spatial) loadAsset(key); + return loadAsset(key); } @Override @@ -443,7 +443,7 @@ public class DesktopAssetManager implements AssetManager { @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 d8fa6eaf1..5b56bee66 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 class AudioNode extends Node implements AudioSource { @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 ab76b3694..e127ac3c1 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 @@ public class ALAudioRenderer implements AudioRenderer, Runnable { 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 a621d3ea6..37722efb2 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 class BoundingBox extends BoundingVolume { } 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 0b0cb810f..ba6fefb4a 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 class BoundingSphere extends BoundingVolume { } 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 a0f978f0a..1e6155d18 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 class MotionPath implements Savable { 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 c84422629..554d58681 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 class TimeLine extends HashMap implements Savable { } 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 cd4f96998..6d37f90fb 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 @@ public class PrefilteredEnvMapFaceGenerator extends RunnableWithProgress { 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 dec5abd2a..f47887e0e 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 @@ public abstract class RunnableWithProgress implements Runnable { * @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 d03dbe88c..8ea7a1909 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 class CubeMapWrapper { 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 class CubeMapWrapper { } 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 class CubeMapWrapper { */ 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 class CubeMapWrapper { 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 8f7ad841c..1897539d3 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 @@ public class EnvMapUtils { /* 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 @@ public class EnvMapUtils { * 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 class EnvMapUtils { 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 class EnvMapUtils { 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 class EnvMapUtils { } 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 class EnvMapUtils { 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 class EnvMapUtils { 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 694278057..fdf214e4b 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 class BitmapFont implements Savable { 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 class Spline implements Savable { } 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 ae3f17a8c..204c962f4 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 82711ac6b..fd6790f68 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 class AssetLinkNode extends Node { 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 cf0244355..3fa4f4863 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 class WireSphere extends Mesh { /* * 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 class WireSphere extends Mesh { /* * 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 fad5f731c..09f230ab0 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 class PQTorus extends Mesh { // 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 5ef500ffd..a33ee1cf0 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 class ShaderNode implements Savable, Cloneable { 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 68a7b80d8..6e46f0d7a 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 class ShaderNodeDefinition implements Savable { */ @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 class ShaderNodeDefinition implements Savable { */ @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 class ShaderNodeDefinition implements Savable { } 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 3729f4095..aa8702fdf 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 class BasicShadowRenderer implements SceneProcessor { //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 7cad0a54c..b282272d7 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 class ShadowUtil { */ 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 bdd983ae6..319e5e9a3 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 final class AppSettings extends HashMap { // 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 f14de5b9a..26375b774 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 class Image extends NativeObject implements Savable /*, Cloneable*/ { 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 2d70d53d7..1d6c68e25 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 class DefaultImageRaster extends ImageRaster { 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 class DefaultImageRaster extends ImageRaster { 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 84ea1ea24..d37db00b6 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 class MipMapImageRaster extends ImageRaster { 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 class MipMapImageRaster extends ImageRaster { 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 d4546b7e3..172f9561a 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 final class BufferUtils { */ 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 5d721208b..ea8b0f363 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 @@ public final class ListMap extends AbstractMap implements Cloneable, @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 final class ListMap extends AbstractMap implements Cloneable, @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 final class ListMap extends AbstractMap implements Cloneable, @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 final class ListMap extends AbstractMap implements Cloneable, @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 1e10f33cf..a64aff265 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 class Cloner { */ @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 48a13d6f4..ea0532143 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 class MikktspaceTangentGenerator { 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 6873f74db..bcca3171c 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 @@ public class WAVLoader implements AssetLoader { 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 3e64d0d78..f79a77a90 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 class ShaderNodeLoaderDelegate { * @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 e460a75a6..3fe8cc633 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 @@ public class DXTFlipper { 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 c228af892..afd9d70e2 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 class TestUserData extends TestCase { @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 9ca739014..c254580b2 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 class TextureAtlas { * @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 91e0984d7..c07679889 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 final class SettingsDialog extends JFrame { }); 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 b3d751465..aa162e9f1 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 class MjpegFileWriter { 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 750cf4d6c..a85374abc 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 class VideoRecorderAppState extends AbstractAppState { @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 d5c8f7de2..1abb80285 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 class CursorLoader implements AssetLoader { 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 f3094071a..2cd683a36 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 class MapModel2D { * @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 633d88bfc..3450da797 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 class MapModel3D { */ 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 4110f5096..40f5ce0c3 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 class NumUtil { 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 611f9954f..1e4aa3410 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 @@ public class SSAOFilter extends Filter { 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 c28004c3b..265e1ab74 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 @@ public class TestMusicPlayer extends javax.swing.JFrame { }//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 180d8e1b5..83cecdd77 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 @@ public class BombControl extends RigidBodyControl implements PhysicsCollisionLis 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 cf187c63b..503f0bd51 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 @@ public class TestWalkingChar extends SimpleApplication implements ActionListener 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 06b07e87b..e3c1ba136 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 class TestRayCasting extends SimpleApplication { // 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 ff5100ffe..04e5d23ab 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 class TestExplosionEffect extends SimpleApplication { 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 @@ public class TestExplosionEffect extends SimpleApplication { 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 @@ public class TestExplosionEffect extends SimpleApplication { 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 @@ public class TestExplosionEffect extends SimpleApplication { 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 @@ public class TestExplosionEffect extends SimpleApplication { 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 @@ public class TestExplosionEffect extends SimpleApplication { 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 @@ public class TestExplosionEffect extends SimpleApplication { 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 0710a6843..3e973bf2d 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 class TestAssetLinkNode extends SimpleApplication { 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 7f03fb9b2..834e8062e 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 @@ public class TestBitmapFontLayout extends SimpleApplication { 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 656108344..2ab4bba45 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 class HelloCollision extends SimpleApplication // 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 afb269eca..d3d1df31f 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 @@ public class TestJoystick extends SimpleApplication { 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 c0c7d511a..fc38fc6d8 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 class TestObbVsBounds extends SimpleApplication { 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 473ba8dfe..fe52e3c68 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 class TestPointDirectionalAndSpotLightShadows extends SimpleApplication { 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 f0d100ee2..52d2f0dd5 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 class ConsoleProgressReporter extends JobProgressAdapter{ @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 051202cda..40bb183be 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 class RefEnv extends SimpleApplication { 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 9ebd1a826..7de1e456c 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 class TestPBRLighting extends SimpleApplication { 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 class TestPBRLighting extends SimpleApplication { 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 49028ba7e..ba7ced2ab 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 class TestBumpModel extends SimpleApplication { @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 c75e221f0..adeee2e28 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 class TestMonkeyHead extends SimpleApplication { 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 bcd4a5dc9..b553a062f 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 class TestOgreLoading extends SimpleApplication { // 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 0fea65ae9..e2c4e725c 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 class TestBlenderAnim extends SimpleApplication { 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 68855176a..0b9080544 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 class TestBlenderObjectAnim extends SimpleApplication { 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 6eca8a9a2..29b63ba4f 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 class TestHWSkinning extends SimpleApplication implements ActionListener{ 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 f0fa27d8f..2063c2e66 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 class TestHWSkinningOld extends SimpleApplication implements ActionListen 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 5e1274c8a..0c6010bea 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 class TestOgreAnim extends SimpleApplication 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 bbc727af3..3b30c0417 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 class TestSkeletonControlRefresh extends SimpleApplication implements Act 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 991b5e5f6..1544f244c 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 @@ class MovingAverage { 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 c261ec0b9..c87064f47 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 class TestThroughput implements MessageListener { //ex //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 0635c2b16..34ab16f55 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 class TestShaderNodesStress extends SimpleApplication { 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 0cf8ed7a2..490340109 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 class TerrainTest extends SimpleApplication { // 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 33964af1b..e6ece01d8 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 class TerrainTestAdvanced extends SimpleApplication { // 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 d1c525576..2ce1ba927 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 class TerrainTestAndroid extends SimpleApplication { // 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 e0200247c..69d937868 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 class TestSaveGame extends SimpleApplication { 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 cbb500623..4380ced03 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 class TestSimpleWater extends SimpleApplication implements ActionListener //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 f986db155..5ef260a24 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 class TouchEventPool { 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 819eb578b..dc97db8c1 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 class PhysicsSpace { 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 class PhysicsSpace { 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 a8bb164ef..bbf02adac 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 @@ public class LwjglDisplay extends LwjglAbstractDisplay { 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 f198234a6..fea4ee7c1 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 @@ public class GlfwMouseInput implements MouseInput { 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 3040fdcda..e2241b538 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 class DefaultServer implements Server @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 b4abceaa8..bbe2db278 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 class FieldSerializer extends Serializer { 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 0934e969d..3954ebc8e 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 @@ public class InputSystemJme implements InputSystem, RawInputListener { } 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 43565837a..b7167d222 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 @@ public class SceneLoader implements AssetLoader { 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 @@ public class SceneLoader implements AssetLoader { // 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 00619dce7..68b4d2403 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 @@ public final class FbxDump { 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 c0ce06d4b..bc0294c8c 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 class FbxNode extends FbxObject { 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 395216156..90d7897c6 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 class FbxAnimCurve extends FbxObject { 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 0b50aa163..21ca597f5 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 @@ public class FbxImage extends FbxObject { } } 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 ebb209492..41a2022d2 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 class FbxNode extends FbxObject { 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 f6200f533..a16fb7733 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 class GltfUtils { 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 bf354afd2..1ef446b8f 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 class MeshLoader extends DefaultHandler implements AssetLoader { 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 class MeshLoader extends DefaultHandler implements AssetLoader { 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 5ae8a4f2d..13205817b 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 class SceneLoader extends DefaultHandler implements AssetLoader { // (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 3507de2f7..63b528905 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 @@ class SceneMaterialLoader extends DefaultHandler { 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 d0db8082a..a060617c5 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 class GeoMap implements Savable { 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 class GeoMap implements Savable { } 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 0f18af88e..ccffca1c8 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 class LODGeomap extends GeoMap { 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 36c44ea46..a4e817947 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 class TerrainPatch extends Geometry { 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 @@ public class TerrainPatch extends Geometry { 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 ad90e7661..7f2ebb3dc 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 @@ public class TerrainQuad extends Node implements Terrain { @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 @@ public class TerrainQuad extends Node implements Terrain { @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 @@ public class TerrainQuad extends Node implements Terrain { 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 @@ public class TerrainQuad extends Node implements Terrain { 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 class TerrainQuad extends Node implements Terrain { 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 63b4881d1..14b39bcd8 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 class FluidSimHeightMap extends AbstractHeightMap { // 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 c9373296e..f25932cf5 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 class HillHeightMap extends AbstractHeightMap { // 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 acfbc9881..95db0ab18 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 class MidpointDisplacementHeightMap extends AbstractHeightMap { 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 d32489928..1540fc743 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 class ParticleDepositionHeightMap extends AbstractHeightMap { //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 3ed87b696..21ee5eb9d 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 class VREnvironment { ((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 7615ae844..6447396f2 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 class LWJGLOpenVR implements VRAPI { 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 d0f49594d..a44410eb4 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 class LWJGLOpenVRInput implements VRInputAPI { 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 78be2565f..af9e98a7e 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 class LWJGLOpenVRViewManager extends AbstractVRViewManager { * @see #getFullTexId() */ protected int getLeftTexId() { - return (int) getLeftTexture().getImage().getId(); + return getLeftTexture().getImage().getId(); } /** @@ -85,7 +85,7 @@ public class LWJGLOpenVRViewManager extends AbstractVRViewManager { * @see #getFullTexId() */ protected int getRightTexId() { - return (int) getRightTexture().getImage().getId(); + return getRightTexture().getImage().getId(); } /** @@ -96,7 +96,7 @@ public class LWJGLOpenVRViewManager extends AbstractVRViewManager { * @see #getRightTexId() */ private int getFullTexId() { - return (int) dualEyeTex.getImage().getId(); + return dualEyeTex.getImage().getId(); } /** @@ -482,7 +482,7 @@ public class LWJGLOpenVRViewManager extends AbstractVRViewManager { 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 a4d76018b..1c5a9449b 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 class OpenVR implements VRAPI { _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 f4bdc920b..b9c8eb1f2 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 class OpenVRViewManager extends AbstractVRViewManager { * @see #getFullTexId() */ protected int getLeftTexId() { - return (int)getLeftTexture().getImage().getId(); + return getLeftTexture().getImage().getId(); } /** @@ -85,7 +85,7 @@ public class OpenVRViewManager extends AbstractVRViewManager { * @see #getFullTexId() */ protected int getRightTexId() { - return (int)getRightTexture().getImage().getId(); + return getRightTexture().getImage().getId(); } /** @@ -95,7 +95,7 @@ public class OpenVRViewManager extends AbstractVRViewManager { * @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 dd4a2a6bd..e4475397b 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 class OSVRViewManager extends AbstractVRViewManager{ * @see #getFullTexId() */ protected int getLeftTexId() { - return (int)leftEyeTexture.getImage().getId(); + return leftEyeTexture.getImage().getId(); } /** @@ -103,7 +103,7 @@ public class OSVRViewManager extends AbstractVRViewManager{ * @see #getFullTexId() */ protected int getRightTexId() { - return (int)rightEyeTexture.getImage().getId(); + return rightEyeTexture.getImage().getId(); } /** @@ -113,7 +113,7 @@ public class OSVRViewManager extends AbstractVRViewManager{ * @see #getRightTexId() */ private int getFullTexId() { - return (int)dualEyeTex.getImage().getId(); + return dualEyeTex.getImage().getId(); } /** @@ -295,7 +295,7 @@ public class OSVRViewManager extends AbstractVRViewManager{ 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 35b2cd95b..699e13ecd 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 @@ public class CartoonSSAO extends Filter{ 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 b7586b0f3..6fcbbd85a 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 abstract class AbstractShadowRendererVR implements SceneProcessor, Savabl */ @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 abstract class AbstractShadowRendererVR implements SceneProcessor, Savabl */ @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 c4a1336d3..9c8cae716 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 class DirectionalLightShadowRendererVR extends AbstractShadowRendererVR { @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 class DirectionalLightShadowRendererVR extends AbstractShadowRendererVR { @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 9f8f1ea76..4289cb200 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 dde9fe410..384dd827c 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 class OsvrMatrixConventionsLibrary implements Library { /** 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 9af6a39af..eb2731b5c 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*)