remove unnecessary casts and tests for null, discovered using NetBeans (#1285)

* remove unnecessary tests for null, discovered using NetBeans

* jme3-core: remove unnecessary casts

* jme3-examples: remove unnecessary casts

* jme3-vr: remove unnecessary casts

* jme-plugins: remove unnecessary casts

* jme3-terrain: remove unnecessary casts

* jme3-desktop: remove unnecessary casts

* jme3-android: remove unnecessary casts

* remove unnecessary casts, discovered using NetBeans

* TerrainQuad: back out one casting delta that's not a removal

* TerrainPatch: simplify generateLodEntropies() after removal of the cast

* TerrainPatch: simplify reIndexGeometry() after removal of the cast
master
Stephen Gold 5 years ago committed by GitHub
parent ab96460853
commit f652591281
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      jme3-android-examples/src/main/java/org/jmonkeyengine/jme3androidexamples/MainActivity.java
  2. 6
      jme3-android/src/main/java/com/jme3/app/AndroidHarnessFragment.java
  3. 4
      jme3-android/src/main/java/com/jme3/app/state/MjpegFileWriter.java
  4. 2
      jme3-android/src/main/java/com/jme3/app/state/VideoRecorderAppState.java
  5. 4
      jme3-android/src/main/java/com/jme3/input/android/AndroidSensorJoyInput.java
  6. 6
      jme3-android/src/main/java/com/jme3/input/android/AndroidTouchInput.java
  7. 4
      jme3-android/src/main/java/com/jme3/input/android/TouchEventPool.java
  8. 2
      jme3-android/src/main/java/com/jme3/system/android/OGLESContext.java
  9. 4
      jme3-blender/src/main/java/com/jme3/scene/plugins/blender/file/Structure.java
  10. 2
      jme3-blender/src/main/java/com/jme3/scene/plugins/blender/meshes/MeshBuffers.java
  11. 2
      jme3-blender/src/main/java/com/jme3/scene/plugins/blender/textures/generating/NoiseGenerator.java
  12. 8
      jme3-bullet/src/common/java/com/jme3/bullet/control/KinematicRagdollControl.java
  13. 4
      jme3-bullet/src/common/java/com/jme3/bullet/util/CollisionShapeFactory.java
  14. 8
      jme3-bullet/src/main/java/com/jme3/bullet/PhysicsSpace.java
  15. 4
      jme3-core/src/main/java/com/jme3/anim/MorphTrack.java
  16. 2
      jme3-core/src/main/java/com/jme3/anim/tween/action/LinearBlendSpace.java
  17. 14
      jme3-core/src/main/java/com/jme3/animation/AnimationFactory.java
  18. 4
      jme3-core/src/main/java/com/jme3/app/DetailedProfiler.java
  19. 10
      jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java
  20. 2
      jme3-core/src/main/java/com/jme3/audio/AudioNode.java
  21. 2
      jme3-core/src/main/java/com/jme3/audio/openal/ALAudioRenderer.java
  22. 2
      jme3-core/src/main/java/com/jme3/bounding/BoundingBox.java
  23. 2
      jme3-core/src/main/java/com/jme3/bounding/BoundingSphere.java
  24. 4
      jme3-core/src/main/java/com/jme3/cinematic/MotionPath.java
  25. 2
      jme3-core/src/main/java/com/jme3/cinematic/TimeLine.java
  26. 4
      jme3-core/src/main/java/com/jme3/environment/generation/PrefilteredEnvMapFaceGenerator.java
  27. 4
      jme3-core/src/main/java/com/jme3/environment/generation/RunnableWithProgress.java
  28. 10
      jme3-core/src/main/java/com/jme3/environment/util/CubeMapWrapper.java
  29. 32
      jme3-core/src/main/java/com/jme3/environment/util/EnvMapUtils.java
  30. 4
      jme3-core/src/main/java/com/jme3/font/BitmapFont.java
  31. 4
      jme3-core/src/main/java/com/jme3/input/InputManager.java
  32. 4
      jme3-core/src/main/java/com/jme3/light/LightProbe.java
  33. 4
      jme3-core/src/main/java/com/jme3/material/MatParamTexture.java
  34. 4
      jme3-core/src/main/java/com/jme3/math/FastMath.java
  35. 2
      jme3-core/src/main/java/com/jme3/math/Line.java
  36. 2
      jme3-core/src/main/java/com/jme3/math/Matrix3f.java
  37. 2
      jme3-core/src/main/java/com/jme3/math/Matrix4f.java
  38. 6
      jme3-core/src/main/java/com/jme3/math/Spline.java
  39. 4
      jme3-core/src/main/java/com/jme3/renderer/opengl/GLTracer.java
  40. 4
      jme3-core/src/main/java/com/jme3/scene/AssetLinkNode.java
  41. 6
      jme3-core/src/main/java/com/jme3/scene/debug/WireSphere.java
  42. 4
      jme3-core/src/main/java/com/jme3/scene/shape/PQTorus.java
  43. 6
      jme3-core/src/main/java/com/jme3/shader/ShaderNode.java
  44. 10
      jme3-core/src/main/java/com/jme3/shader/ShaderNodeDefinition.java
  45. 2
      jme3-core/src/main/java/com/jme3/shadow/BasicShadowRenderer.java
  46. 4
      jme3-core/src/main/java/com/jme3/shadow/ShadowUtil.java
  47. 10
      jme3-core/src/main/java/com/jme3/system/AppSettings.java
  48. 2
      jme3-core/src/main/java/com/jme3/texture/Image.java
  49. 26
      jme3-core/src/main/java/com/jme3/texture/image/DefaultImageRaster.java
  50. 26
      jme3-core/src/main/java/com/jme3/texture/image/MipMapImageRaster.java
  51. 14
      jme3-core/src/main/java/com/jme3/util/BufferUtils.java
  52. 8
      jme3-core/src/main/java/com/jme3/util/ListMap.java
  53. 4
      jme3-core/src/main/java/com/jme3/util/clone/Cloner.java
  54. 2
      jme3-core/src/main/java/com/jme3/util/mikktspace/MikktspaceTangentGenerator.java
  55. 2
      jme3-core/src/plugins/java/com/jme3/audio/plugins/WAVLoader.java
  56. 4
      jme3-core/src/plugins/java/com/jme3/material/plugins/ShaderNodeLoaderDelegate.java
  57. 6
      jme3-core/src/plugins/java/com/jme3/texture/plugins/DXTFlipper.java
  58. 14
      jme3-core/src/test/java/com/jme3/scene/TestUserData.java
  59. 10
      jme3-core/src/tools/java/jme3tools/optimize/TextureAtlas.java
  60. 2
      jme3-desktop/src/main/java/com/jme3/app/SettingsDialog.java
  61. 4
      jme3-desktop/src/main/java/com/jme3/app/state/MjpegFileWriter.java
  62. 2
      jme3-desktop/src/main/java/com/jme3/app/state/VideoRecorderAppState.java
  63. 6
      jme3-desktop/src/main/java/com/jme3/cursors/plugins/CursorLoader.java
  64. 4
      jme3-desktop/src/main/java/jme3tools/navigation/MapModel2D.java
  65. 4
      jme3-desktop/src/main/java/jme3tools/navigation/MapModel3D.java
  66. 4
      jme3-desktop/src/main/java/jme3tools/navigation/NumUtil.java
  67. 4
      jme3-effects/src/main/java/com/jme3/post/ssao/SSAOFilter.java
  68. 2
      jme3-examples/src/main/java/jme3test/audio/TestMusicPlayer.java
  69. 2
      jme3-examples/src/main/java/jme3test/bullet/BombControl.java
  70. 2
      jme3-examples/src/main/java/jme3test/bullet/TestWalkingChar.java
  71. 4
      jme3-examples/src/main/java/jme3test/collision/TestRayCasting.java
  72. 16
      jme3-examples/src/main/java/jme3test/effect/TestExplosionEffect.java
  73. 4
      jme3-examples/src/main/java/jme3test/export/TestAssetLinkNode.java
  74. 4
      jme3-examples/src/main/java/jme3test/gui/TestBitmapFontLayout.java
  75. 2
      jme3-examples/src/main/java/jme3test/helloworld/HelloCollision.java
  76. 2
      jme3-examples/src/main/java/jme3test/input/TestJoystick.java
  77. 2
      jme3-examples/src/main/java/jme3test/light/TestObbVsBounds.java
  78. 4
      jme3-examples/src/main/java/jme3test/light/TestPointDirectionalAndSpotLightShadows.java
  79. 4
      jme3-examples/src/main/java/jme3test/light/pbr/ConsoleProgressReporter.java
  80. 2
      jme3-examples/src/main/java/jme3test/light/pbr/RefEnv.java
  81. 6
      jme3-examples/src/main/java/jme3test/light/pbr/TestPBRLighting.java
  82. 8
      jme3-examples/src/main/java/jme3test/material/TestBumpModel.java
  83. 4
      jme3-examples/src/main/java/jme3test/model/TestMonkeyHead.java
  84. 2
      jme3-examples/src/main/java/jme3test/model/TestOgreLoading.java
  85. 4
      jme3-examples/src/main/java/jme3test/model/anim/TestBlenderAnim.java
  86. 4
      jme3-examples/src/main/java/jme3test/model/anim/TestBlenderObjectAnim.java
  87. 6
      jme3-examples/src/main/java/jme3test/model/anim/TestHWSkinning.java
  88. 4
      jme3-examples/src/main/java/jme3test/model/anim/TestHWSkinningOld.java
  89. 2
      jme3-examples/src/main/java/jme3test/model/anim/TestOgreAnim.java
  90. 4
      jme3-examples/src/main/java/jme3test/model/anim/TestSkeletonControlRefresh.java
  91. 4
      jme3-examples/src/main/java/jme3test/network/MovingAverage.java
  92. 4
      jme3-examples/src/main/java/jme3test/network/TestThroughput.java
  93. 2
      jme3-examples/src/main/java/jme3test/stress/TestShaderNodesStress.java
  94. 6
      jme3-examples/src/main/java/jme3test/terrain/TerrainTest.java
  95. 14
      jme3-examples/src/main/java/jme3test/terrain/TerrainTestAdvanced.java
  96. 6
      jme3-examples/src/main/java/jme3test/terrain/TerrainTestAndroid.java
  97. 2
      jme3-examples/src/main/java/jme3test/tools/TestSaveGame.java
  98. 2
      jme3-examples/src/main/java/jme3test/water/TestSimpleWater.java
  99. 4
      jme3-ios/src/main/java/com/jme3/input/ios/TouchEventPool.java
  100. 4
      jme3-jbullet/src/main/java/com/jme3/bullet/PhysicsSpace.java
  101. Some files were not shown because too many files have changed in this diff Show More

@ -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 {

@ -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;

@ -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());
}

@ -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

@ -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;
}

@ -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});

@ -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 {

@ -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;

@ -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);

@ -251,7 +251,7 @@ import com.jme3.util.BufferUtils;
}
}
if (vertexGroups != null && vertexGroups.size() > 0) {
if (vertexGroups.size() > 0) {
Map<Float, Integer> group = vertexGroups.get(i);
maximumWeightsPerVertex = Math.max(maximumWeightsPerVertex, group.size());
boneWeightAndIndexes.add(new TreeMap<Float, Integer>(group));

@ -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;
}

@ -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();

@ -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 {

@ -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<PhysicsSweepTestResult> sweepTest(CollisionShape shape, Transform start, Transform end) {
List results = new LinkedList();
sweepTest(shape, start, end , results);
return (List<PhysicsSweepTestResult>) results;
return results;
}
/**

@ -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<float[]> {
this.weights = weights;
assert times != null && times.length == weights.length;
assert times.length == weights.length;
}
}

@ -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

@ -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();

@ -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);
}
}

@ -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

@ -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);
}
/**

@ -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);
}

@ -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());
}

@ -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();
}

@ -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++;

@ -93,7 +93,7 @@ public class TimeLine extends HashMap<Integer, KeyFrame> implements Savable {
}
public float getKeyFrameTime(KeyFrame keyFrame) {
return (float)keyFrame.getIndex()/(float)keyFramesPerSeconds;
return keyFrame.getIndex()/(float)keyFramesPerSeconds;
}
public Collection<KeyFrame> getAllKeyFrames() {

@ -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);

@ -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 (&ge;0, &le;1)
*/
public double getProgress() {
return (double) progress / (double) end;
return progress / (double) end;
}
/**

@ -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);
}
/**

@ -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");

@ -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<text.length()-1 && text.charAt(i+1)=='#'){
if (i+5<text.length() && text.charAt(i+5)=='#'){

@ -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
@ -178,7 +178,7 @@ public class InputManager implements RawInputListener {
if (safeMode || frameDelta == 0) {
return 1f;
} else {
return FastMath.clamp((float) timeDelta / (float) frameDelta, 0, 1);
return FastMath.clamp(timeDelta / (float) frameDelta, 0, 1);
}
}

@ -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
@ -206,7 +206,7 @@ public class LightProbe extends Light implements Savable {
*/
@Deprecated
public BoundingVolume getBounds() {
return new BoundingSphere(((SphereProbeArea)area).getRadius(), ((SphereProbeArea)area).getCenter());
return new BoundingSphere(area.getRadius(), ((SphereProbeArea)area).getCenter());
}
/**

@ -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
@ -104,6 +104,6 @@ public class MatParamTexture extends MatParam {
super.read(im);
InputCapsule ic = im.getCapsule(this);
texture = (Texture) value;
colorSpace = (ColorSpace) ic.readEnum("colorSpace", ColorSpace.class, null);
colorSpace = ic.readEnum("colorSpace", ColorSpace.class, null);
}
}

@ -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
@ -250,7 +250,7 @@ final public class FastMath {
c3 = 2 * T * p0 + (T - 3) * p1 + (3 - 2 * T) * p2 + -T * p3;
c4 = -T * p0 + (2 - T) * p1 + (T - 2) * p2 + T * p3;
return (float) (((c4 * u + c3) * u + c2) * u + c1);
return ((c4 * u + c3) * u + c2) * u + c1;
}
/**Interpolate a spline between at least 4 control points following the Catmull-Rom equation.

@ -150,7 +150,7 @@ public class Line implements Savable, Cloneable, java.io.Serializable {
origin.addLocal(compVec1);
}
origin.multLocal(1f / (float) length);
origin.multLocal(1f / length);
// compute sums of products
float sumXX = 0.0f, sumXY = 0.0f, sumXZ = 0.0f;

@ -1210,7 +1210,7 @@ public final class Matrix3f implements Savable, Cloneable, java.io.Serializable
*/
@Override
public boolean equals(Object o) {
if (!(o instanceof Matrix3f) || o == null) {
if (!(o instanceof Matrix3f)) {
return false;
}

@ -2161,7 +2161,7 @@ public final class Matrix4f implements Savable, Cloneable, java.io.Serializable
*/
@Override
public boolean equals(Object o) {
if (!(o instanceof Matrix4f) || o == null) {
if (!(o instanceof Matrix4f)) {
return false;
}

@ -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
@ -458,7 +458,7 @@ public class Spline implements Savable {
public void read(JmeImporter im) throws IOException {
InputCapsule in = im.getCapsule(this);
controlPoints = (ArrayList<Vector3f>) in.readSavableArrayList("controlPoints", new ArrayList<Vector3f>()); /* 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<Float>();
@ -468,7 +468,7 @@ public class Spline implements Savable {
}
type = in.readEnum("pathSplineType", SplineType.class, SplineType.CatmullRom);
totalLength = in.readFloat("totalLength", 0);
CRcontrolPoints = (ArrayList<Vector3f>) 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);

@ -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<Void> argSlotsMap = new IntMap<Void>();
for (int argSlot : argSlots) {
argSlotsMap.put(argSlot, (Void) null);
argSlotsMap.put(argSlot, null);
}
nonEnumArgMap.put(method, argSlotsMap);
}

@ -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<ModelKey>) capsule.readSavableArrayList("assetLoaderKeyList", new ArrayList<ModelKey>());
assetLoaderKeys = capsule.readSavableArrayList("assetLoaderKeyList", new ArrayList<>());
for (final Iterator<ModelKey> iterator = assetLoaderKeys.iterator(); iterator.hasNext(); ) {

@ -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;

@ -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);

@ -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<VariableMapping>) ic.readSavableArrayList("inputMapping", new ArrayList<VariableMapping>());
outputMapping = (List<VariableMapping>) ic.readSavableArrayList("outputMapping", new ArrayList<VariableMapping>());
inputMapping = ic.readSavableArrayList("inputMapping", new ArrayList<>());
outputMapping = ic.readSavableArrayList("outputMapping", new ArrayList<>());
}
/**

@ -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<ShaderNodeVariable>) ic.readSavableArrayList("inputs", new ArrayList<ShaderNodeVariable>());
outputs = (List<ShaderNodeVariable>) ic.readSavableArrayList("outputs", new ArrayList<ShaderNodeVariable>());
inputs = ic.readSavableArrayList("inputs", new ArrayList<>());
outputs = ic.readSavableArrayList("outputs", new ArrayList<>());
}
/**

@ -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);

@ -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);
}
}
/**

@ -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<String, Object> {
// 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));

@ -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<ByteBuffer>) capsule.readByteBufferArrayList("data", null);
data = capsule.readByteBufferArrayList("data", null);
colorSpace = capsule.readEnum("colorSpace", ColorSpace.class, null);
if (mipMapSizes != null) {

@ -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.

@ -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.

@ -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());
}

@ -158,7 +158,7 @@ public final class ListMap<K, V> extends AbstractMap<K, V> 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<K, V> extends AbstractMap<K, V> 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<K, V> extends AbstractMap<K, V> 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<K, V> extends AbstractMap<K, V> 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

@ -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 <T> CloneFunction<T> getCloneFunction( Class<T> type ) {
CloneFunction<T> result = (CloneFunction<T>)functions.get(type);
CloneFunction<T> result = functions.get(type);
if( result == null ) {
// Do a more exhaustive search
for( Map.Entry<Class, CloneFunction> e : functions.entrySet() ) {

@ -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++) {

@ -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);

@ -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<Statement> 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("[ \\{]");

@ -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){

@ -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);
}
}

@ -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;

@ -312,7 +312,7 @@ public final class SettingsDialog extends JFrame {
});
if (source.getIcons() != null) {
safeSetIconImages( (List<BufferedImage>) Arrays.asList((BufferedImage[]) source.getIcons()) );
safeSetIconImages( Arrays.asList((BufferedImage[]) source.getIcons()) );
}
setTitle(MessageFormat.format(resourceBundle.getString("frame.title"), source.getTitle()));

@ -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());
}

@ -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

@ -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) {

@ -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;
}
/**

@ -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;
}
/**

@ -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;
}
}

@ -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();

@ -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

@ -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);

@ -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);

@ -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[]

@ -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);

@ -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

@ -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);

@ -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);

@ -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);

@ -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);
}

@ -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));

@ -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<LightProbe>{
@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);
}
}

@ -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);
}

@ -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);

@ -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

@ -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));

@ -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);

@ -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");

@ -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");

@ -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);
}
}

@ -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);

@ -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);

@ -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);

@ -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);
}
}

@ -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<MessageConnection> { //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);
}
}

@ -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;

@ -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);

@ -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);

@ -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);

@ -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

@ -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);

@ -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 {

@ -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) {

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

Loading…
Cancel
Save