Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ private boolean checkClassName(String className) {
private boolean checkClassType(String className) {
boolean include = true;
try {
Class<?> clazz = (Class<?>) Class.forName(className);
Class<?> clazz = Class.forName(className);
if (Application.class.isAssignableFrom(clazz)) {
Log.d(TAG, "Class " + className + " is a jME Application");
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -684,10 +684,10 @@ public void onLayoutChange(View v,
if (viewWidth > viewHeight && viewWidth > maxResolutionDimension) {
// landscape
fixedSizeWidth = maxResolutionDimension;
fixedSizeHeight = (int)(maxResolutionDimension * ((float)viewHeight / (float)viewWidth));
fixedSizeHeight = (int)(maxResolutionDimension * (viewHeight / (float)viewWidth));
} else if (viewHeight > viewWidth && viewHeight > maxResolutionDimension) {
// portrait
fixedSizeWidth = (int)(maxResolutionDimension * ((float)viewWidth / (float)viewHeight));
fixedSizeWidth = (int)(maxResolutionDimension * (viewWidth / (float)viewHeight));
fixedSizeHeight = maxResolutionDimension;
} else if (viewWidth == viewHeight && viewWidth > maxResolutionDimension) {
fixedSizeWidth = maxResolutionDimension;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -478,7 +478,7 @@ public byte[] toBytes() throws Exception {
baos.write(fcc);
baos.write(intBytes(swapInt(cb)));
for (int i = 0; i < ind.size(); i++) {
AVIIndex in = (AVIIndex) ind.get(i);
AVIIndex in = ind.get(i);
baos.write(in.toBytes());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public float getFrameRate() {

@Override
public float getTimePerFrame() {
return (float) (1.0f / this.framerate);
return 1.0f / this.framerate;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -561,7 +561,7 @@ public void onSensorChanged(SensorEvent se) {
}
}
}
} else if (sensorData != null) {
} else {
if (!sensorData.haveData) {
sensorData.haveData = true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -131,8 +131,8 @@ public void loadSettings(AppSettings settings) {

// view width and height are 0 until the view is displayed on the screen
if (androidInput.getView().getWidth() != 0 && androidInput.getView().getHeight() != 0) {
scaleX = (float)settings.getWidth() / (float)androidInput.getView().getWidth();
scaleY = (float)settings.getHeight() / (float)androidInput.getView().getHeight();
scaleX = settings.getWidth() / (float)androidInput.getView().getWidth();
scaleY = settings.getHeight() / (float)androidInput.getView().getHeight();
}
logger.log(Level.FINE, "Setting input scaling, scaleX: {0}, scaleY: {1}",
new Object[]{scaleX, scaleY});
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -87,7 +87,7 @@ public TouchEvent getNextFreeEvent() {
TouchEvent evt = null;
int curSize = eventPool.size();
while (curSize > 0) {
evt = (TouchEvent)eventPool.pop();
evt = eventPool.pop();
if (evt.isConsumed()) {
break;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public void setSettings(AppSettings settings) {
}

if (settings.getFrameRate() > 0) {
minFrameDuration = (long)(1000d / (double)settings.getFrameRate()); // ms
minFrameDuration = (long)(1000d / settings.getFrameRate()); // ms
logger.log(Level.FINE, "Setting min tpf: {0}ms", minFrameDuration);
} else {
minFrameDuration = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -252,7 +252,7 @@ public String getName() {
Object fieldValue = this.getFieldValue("ID");
if (fieldValue instanceof Structure) {
Structure id = (Structure) fieldValue;
return id == null ? null : id.getFieldValue("name").toString().substring(2);// blender adds 2-charactes as a name prefix
return id.getFieldValue("name").toString().substring(2);// blender adds 2-charactes as a name prefix
}
Object name = this.getFieldValue("name", null);
return name == null ? null : name.toString().substring(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public void append(boolean smooth, Vector3f[] verts, Vector3f[] normals, Map<Str
}
}

if (vertexGroups != null && vertexGroups.size() > 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IDE suggested this, because an Exception would be thrown in Line 222.
That being said, can we verify if vertexGroups should be non null? If not, that if belongs in Line 222, much like it is in Line 219.
I suspect that only the Vertex Colors are optional, though, and thus the author just wanted to be sure.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm... blender importer. Took me a sec to figure out what the heck was going on here but it all makes sense now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If vertexGroups can be null, then I think fixing the resulting NPE should be a separate PR, right?

if (vertexGroups.size() > 0) {
Map<Float, Integer> group = vertexGroups.get(i);
maximumWeightsPerVertex = Math.max(maximumWeightsPerVertex, group.size());
boneWeightAndIndexes.add(new TreeMap<Float, Integer>(group));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ public static float turbulence(float x, float y, float z, float noiseSize, int n
sum += t * amp;
}

sum *= (float) (1 << noiseDepth) / (float) ((1 << noiseDepth + 1) - 1);
sum *= (1 << noiseDepth) / (float) ((1 << noiseDepth + 1) - 1);
return sum;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ private void ikUpdate(float tpf){
while (it.hasNext()) {

boneName = it.next();
bone = (Bone) boneLinks.get(boneName).bone;
bone = boneLinks.get(boneName).bone;
if (!bone.hasUserControl()) {
Logger.getLogger(KinematicRagdollControl.class.getSimpleName()).log(Level.FINE, "{0} doesn't have user control", boneName);
continue;
Expand All @@ -421,7 +421,7 @@ private void ikUpdate(float tpf){
}
int depth = 0;
int maxDepth = ikChainDepth.get(bone.getName());
updateBone(boneLinks.get(bone.getName()), tpf * (float) FastMath.sqrt(distance), vars, tmpRot1, tmpRot2, bone, ikTargets.get(boneName), depth, maxDepth);
updateBone(boneLinks.get(bone.getName()), tpf * FastMath.sqrt(distance), vars, tmpRot1, tmpRot2, bone, ikTargets.get(boneName), depth, maxDepth);

Vector3f position = vars.vect1;

Expand Down Expand Up @@ -693,10 +693,10 @@ protected void boneRecursion(Spatial model, Bone bone, PhysicsRigidBody parent,
shape = RagdollUtils.makeShapeFromVerticeWeights(model, RagdollUtils.getBoneIndices(link.bone, skeleton, boneList), initScale, link.bone.getModelSpacePosition(), weightThreshold);
}

PhysicsRigidBody shapeNode = new PhysicsRigidBody(shape, rootMass / (float) reccount);
PhysicsRigidBody shapeNode = new PhysicsRigidBody(shape, rootMass / reccount);

shapeNode.setKinematic(mode == Mode.Kinematic);
totalMass += rootMass / (float) reccount;
totalMass += rootMass / reccount;

link.rigidBody = shapeNode;
link.initalWorldRotation = bone.getModelSpaceRotation().clone();
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -229,7 +229,7 @@ public static CollisionShape createDynamicMeshShape(Spatial spatial) {
*/
public static CollisionShape createBoxShape(Spatial spatial) {
if (spatial instanceof Geometry) {
return createSingleBoxShape((Geometry) spatial, spatial);
return createSingleBoxShape(spatial, spatial);
} else if (spatial instanceof Node) {
return createBoxCompoundShape((Node) spatial);
} else {
Expand Down
8 changes: 4 additions & 4 deletions jme3-bullet/src/main/java/com/jme3/bullet/PhysicsSpace.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -539,7 +539,7 @@ public void add(Object obj) {
Spatial node = (Spatial) obj;
for (int i = 0; i < node.getNumControls(); i++) {
if (node.getControl(i) instanceof PhysicsControl) {
add(((PhysicsControl) node.getControl(i)));
add(node.getControl(i));
}
}
} else if (obj instanceof PhysicsCollisionObject) {
Expand Down Expand Up @@ -581,7 +581,7 @@ public void remove(Object obj) {
Spatial node = (Spatial) obj;
for (int i = 0; i < node.getNumControls(); i++) {
if (node.getControl(i) instanceof PhysicsControl) {
remove(((PhysicsControl) node.getControl(i)));
remove(node.getControl(i));
}
}
} else if (obj instanceof PhysicsCollisionObject) {
Expand Down Expand Up @@ -1129,7 +1129,7 @@ public List<PhysicsRayTestResult> rayTestRaw(Vector3f from, Vector3f to, List<Ph
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;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions jme3-core/src/main/java/com/jme3/anim/MorphTrack.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -122,7 +122,7 @@ public void setKeyframes(float[] times, float[] weights) {

this.weights = weights;

assert times != null && times.length == weights.length;
assert times.length == weights.length;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public LinearBlendSpace(float minValue, float maxValue) {
public void setBlendAction(BlendAction action) {
this.action = action;
Action[] actions = action.getActions();
step = (maxValue - minValue) / (float) (actions.length - 1);
step = (maxValue - minValue) / (actions.length - 1);
}

@Override
Expand Down
14 changes: 7 additions & 7 deletions jme3-core/src/main/java/com/jme3/animation/AnimationFactory.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -287,12 +287,12 @@ public void addKeyFrameRotationAngles(int keyFrameIndex, float x, float y, float
//frames delta
int dF = keyFrameIndex - prev;
//angle per frame for x,y ,z
float dXAngle = (x - prevRot.eulerAngles.x) / (float) dF;
float dYAngle = (y - prevRot.eulerAngles.y) / (float) dF;
float dZAngle = (z - prevRot.eulerAngles.z) / (float) dF;
float dXAngle = (x - prevRot.eulerAngles.x) / dF;
float dYAngle = (y - prevRot.eulerAngles.y) / dF;
float dZAngle = (z - prevRot.eulerAngles.z) / dF;

// the keyFrame step
int keyStep = (int) (((float) (dF)) / delta * (float) EULER_STEP);
int keyStep = (int) (dF / delta * EULER_STEP);
// the current keyFrame
int cursor = prev + keyStep;
while (cursor < keyFrameIndex) {
Expand Down Expand Up @@ -425,7 +425,7 @@ private void interpolate(Object[] keyFrames, Type type) {
//interating over the frames
for (int j = i; j <= key; j++) {
// computing interpolation value
float val = (float) (j - i) / (float) span;
float val = (j - i) / (float) span;
//interpolationg depending on the transform type
switch (type) {
case Translation:
Expand All @@ -451,7 +451,7 @@ private void interpolate(Object[] keyFrames, Type type) {
translations[j] = ((Vector3f) keyFrames[i]).clone();
break;
case Rotation:
rotations[j] = ((Quaternion) ((Rotation) keyFrames[i]).rotation).clone();
rotations[j] = ((Rotation) keyFrames[i]).rotation.clone();
break;
case Scale:
scales[j] = ((Vector3f) keyFrames[i]).clone();
Expand Down
4 changes: 2 additions & 2 deletions jme3-core/src/main/java/com/jme3/app/DetailedProfiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,15 @@ public double getAverageCpu() {
if (nbFramesCpu == 0) {
return 0;
}
return (double) cpuSum / (double) Math.min(nbFramesCpu, MAX_FRAMES);
return cpuSum / (double) Math.min(nbFramesCpu, MAX_FRAMES);
}

public double getAverageGpu() {
if (nbFramesGpu == 0) {
return 0;
}

return (double) gpuSum / (double) Math.min(nbFramesGpu, MAX_FRAMES);
return gpuSum / (double) Math.min(nbFramesGpu, MAX_FRAMES);
}
}

Expand Down
10 changes: 5 additions & 5 deletions jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,12 @@ public Object loadAsset(String name){

@Override
public Texture loadTexture(TextureKey key){
return (Texture) loadAsset(key);
return loadAsset(key);
}

@Override
public Material loadMaterial(String name){
return (Material) loadAsset(new MaterialKey(name));
return loadAsset(new MaterialKey(name));
}

@Override
Expand All @@ -418,7 +418,7 @@ public Texture loadTexture(String name){

@Override
public AudioData loadAudio(AudioKey key){
return (AudioData) loadAsset(key);
return loadAsset(key);
}

@Override
Expand All @@ -433,7 +433,7 @@ public BitmapFont loadFont(String name){

@Override
public Spatial loadModel(ModelKey key){
return (Spatial) loadAsset(key);
return loadAsset(key);
}

@Override
Expand All @@ -443,7 +443,7 @@ public Spatial loadModel(String name){

@Override
public FilterPostProcessor loadFilter(FilterKey key){
return (FilterPostProcessor) loadAsset(key);
return loadAsset(key);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion jme3-core/src/main/java/com/jme3/audio/AudioNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public AudioNode(AssetManager assetManager, String name, DataType type) {
@Deprecated
public AudioNode(AssetManager assetManager, String name, boolean stream, boolean streamCache) {
this.audioKey = new AudioKey(name, stream, streamCache);
this.data = (AudioData) assetManager.loadAsset(audioKey);
this.data = assetManager.loadAsset(audioKey);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ private void clearChannel(int index) {
al.alSourcei(sourceId, EFX.AL_DIRECT_FILTER, EFX.AL_FILTER_NULL);
}
if (src.isPositional()) {
AudioSource pas = (AudioSource) src;
AudioSource pas = src;
if (pas.isReverbEnabled() && supportEfx) {
al.alSource3i(sourceId, EFX.AL_AUXILIARY_SEND_FILTER, 0, 0, EFX.AL_FILTER_NULL);
}
Expand Down
2 changes: 1 addition & 1 deletion jme3-core/src/main/java/com/jme3/bounding/BoundingBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ public int collideWith(Collidable other, CollisionResults results) {
}
return 0;
} else if (other instanceof Spatial) {
return ((Spatial)other).collideWith(this, results);
return other.collideWith(this, results);
} else {
throw new UnsupportedCollisionException("With: " + other.getClass().getSimpleName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ public int collideWith(Collidable other, CollisionResults results) {
}
return 0;
} else if (other instanceof Spatial) {
return ((Spatial)other).collideWith(this, results);
return other.collideWith(this, results);
} else {
throw new UnsupportedCollisionException();
}
Expand Down
Loading