Skip to content

Commit

Permalink
whitespace changes in jme3-core (#1760)
Browse files Browse the repository at this point in the history
* jme3-core:  whitespace

* jme3-core:  whitespace again

* jme3-core:  whitespace some more

* Tweens:  tweak whitespace in javadoc

* BoneTrack:  correct indentation

* Pose:  delete extra whitespace

* Skeleton.java:  horizontal whitespace per style guide

* SkeletonControl:  delete excess whitespace

* BasicProfiler:  whitespace

* BasicProfilerState:  whitespace

* FlyCamAppState:  whitespace in javadoc

* LegacyApplication:  add space per 4.6.2.5

* SimpleApplication:  indentation

* StatsAppState:  whitespace

* AssetConfig:  add whitespace

* AssetKey:  whitespace in cast per 4.6.2.5

* AssetLoadException:  add vertical whitespace required by 4.6.1

* AssetNotFoundException:  add vertical whitespace required by 4.6.1.1

* DesktopAssetManager:  whitespace

* ImplHandler:  whitespace per the style guide

* ThreadingManager:  indentation

* WeakRefAssetCache:  cast spacing per 4.6.2.5

* WeakRefCloneAssetCache:  whitespace

* AudioBuffer:  whitespace

* AudioKey:  line wrapping

* AudioNode:  whitespace

* Filter:  whitespace per 4.6.2.5

* Listener:  delete trailing whitespace

* AlAudioRenderer:  whitespace per perferred style

* BoundingSphere:  whitespace per perferred style

* Intersection:  whitespace per perferred style

* KeyFrame:  whitespace

* MotionPath:  whitespace

* TimeLine:  delete excess vertical whitespace

* AbstractCinematicEvent:  whitespace

* AnimationEvent:  whitespace

* MotionEvent:  tweak the whitespace

* SoundEvent:  tweak the whitespace

* CollisionResult:  space after closing parenthesis of a cast

* CollisionResults:  space on both sides of a binary operator

* SweepSphere:  whitespace

* BIHTree:  space before {

* TriangleAxisComparator:  one statement per line

* ParticleEmitter:  whitespace

* ParticlePointMesh:  whitespace

* ParticleTriMesh:  misc whitespace

* ReadialParticleInfluencer:  delete extra vertical whitespace
  • Loading branch information
stephengold authored Jan 23, 2022
1 parent e908655 commit ac8c101
Show file tree
Hide file tree
Showing 156 changed files with 2,806 additions and 2,823 deletions.
57 changes: 28 additions & 29 deletions jme3-core/src/main/java/com/jme3/anim/AnimComposer.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,10 @@
/**
* AnimComposer is a Spatial control that allows manipulation of
* {@link Armature armature} (skeletal) animation.
*
*
* @author Nehon
*/
public class AnimComposer extends AbstractControl {

/**
* The name of the default layer.
*/
Expand All @@ -72,7 +71,7 @@ public AnimComposer() {

/**
* Tells if an animation is contained in the list of animations.
*
*
* @param name The name of the animation.
* @return true, if the named animation is in the list of animations.
*/
Expand Down Expand Up @@ -117,17 +116,17 @@ public void removeAnimClip(AnimClip anim) {

/**
* Run an action on the default layer.
*
*
* @param name The name of the action to run.
* @return The action corresponding to the given name.
*/
public Action setCurrentAction(String name) {
return setCurrentAction(name, DEFAULT_LAYER);
}

/**
* Run an action on specified layer.
*
*
* @param actionName The name of the action to run.
* @param layerName The layer on which action should run.
* @return The action corresponding to the given name.
Expand All @@ -139,19 +138,19 @@ public Action setCurrentAction(String actionName, String layerName) {

return currentAction;
}

/**
* Return the current action on the default layer.
*
* @return The action corresponding to the given name.
*
* @return The action corresponding to the given name.
*/
public Action getCurrentAction() {
return getCurrentAction(DEFAULT_LAYER);
}

/**
* Return current action on specified layer.
*
*
* @param layerName The layer on which action should run.
* @return The action corresponding to the given name.
*/
Expand All @@ -161,14 +160,14 @@ public Action getCurrentAction(String layerName) {

return result;
}

/**
* Remove current action on default layer.
*/
public void removeCurrentAction() {
removeCurrentAction(DEFAULT_LAYER);
}

/**
* Remove current action on specified layer.
*
Expand All @@ -178,19 +177,19 @@ public void removeCurrentAction(String layerName) {
AnimLayer l = getLayer(layerName);
l.setCurrentAction(null);
}

/**
* Returns current time of the default layer.
*
*
* @return The current time.
*/
public double getTime() {
return getTime(DEFAULT_LAYER);
}

/**
* Returns current time of the specified layer.
*
*
* @param layerName The layer from which to get the time.
* @return the time (in seconds)
*/
Expand All @@ -200,7 +199,7 @@ public double getTime(String layerName) {

return result;
}

/**
* Sets current time on the default layer.
*
Expand All @@ -226,7 +225,7 @@ public void setTime(String layerName, double time) {
}

/**
*
*
* @param name The name of the action to return.
* @return The action registered with specified name. It will make a new action if there isn't any.
* @see #makeAction(java.lang.String)
Expand All @@ -239,29 +238,29 @@ public Action action(String name) {
}
return action;
}

/**
*
*
* @param name The name of the action to return.
* @return The action registered with specified name or null if nothing is registered.
*/
public Action getAction(String name){
public Action getAction(String name) {
return actions.get(name);
}

/**
* Register given action with specified name.
*
*
* @param name The name of the action.
* @param action The action to add.
*/
public void addAction(String name, Action action){
public void addAction(String name, Action action) {
actions.put(name, action);
}

/**
* Create a new ClipAction with specified clip name.
*
*
* @param name The name of the clip.
* @return a new action
* @throws IllegalArgumentException if clip with specified name not found.
Expand All @@ -275,17 +274,17 @@ public Action makeAction(String name) {
action = new ClipAction(clip);
return action;
}

/**
* Tells if an action is contained in the list of actions.
*
*
* @param name The name of the action.
* @return true, if the named action is in the list of actions.
*/
public boolean hasAction(String name) {
return actions.containsKey(name);
}

/**
* Remove specified action.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
* Created by nehon on 15/04/17.
*/
public class FrameInterpolator {

public static final FrameInterpolator DEFAULT = new FrameInterpolator();

private AnimInterpolator<Float> timeInterpolator;
Expand All @@ -51,23 +50,23 @@ public class FrameInterpolator {
final private TrackDataReader<Vector3f> scaleReader = new TrackDataReader<>();
final private TrackTimeReader timesReader = new TrackTimeReader();


final private Transform transforms = new Transform();

public Transform interpolate(float t, int currentIndex, CompactVector3Array translations, CompactQuaternionArray rotations, CompactVector3Array scales, float[] times){
public Transform interpolate(float t, int currentIndex, CompactVector3Array translations,
CompactQuaternionArray rotations, CompactVector3Array scales, float[] times) {
timesReader.setData(times);
if( timeInterpolator != null){
t = timeInterpolator.interpolate(t,currentIndex, null, timesReader, null );
if (timeInterpolator != null) {
t = timeInterpolator.interpolate(t, currentIndex, null, timesReader, null);
}
if(translations != null) {
if (translations != null) {
translationReader.setData(translations);
translationInterpolator.interpolate(t, currentIndex, translationReader, timesReader, transforms.getTranslation());
}
if(rotations != null) {
if (rotations != null) {
rotationReader.setData(rotations);
rotationInterpolator.interpolate(t, currentIndex, rotationReader, timesReader, transforms.getRotation());
}
if(scales != null){
if (scales != null) {
scaleReader.setData(scales);
scaleInterpolator.interpolate(t, currentIndex, scaleReader, timesReader, transforms.getScale());
}
Expand All @@ -83,7 +82,7 @@ public void interpolateWeights(float t, int currentIndex, float[] weights, int n
next = current;
}

float val = FastMath.interpolateLinear(t, weights[current], weights[next]);
float val = FastMath.interpolateLinear(t, weights[current], weights[next]);
store[i] = val;
}
}
Expand All @@ -104,7 +103,6 @@ public void setScaleInterpolator(AnimInterpolator<Vector3f> scaleInterpolator) {
this.scaleInterpolator = scaleInterpolator;
}


public static class TrackTimeReader {
private float[] data;

Expand All @@ -122,7 +120,6 @@ public int getLength() {
}

public static class TrackDataReader<T> {

private CompactArray<T> data;

protected void setData(CompactArray<T> data) {
Expand All @@ -148,7 +145,6 @@ public T getEntryModSkip(int index, T store) {

index = mod(index, total);


return data.get(index, store);
}
}
Expand All @@ -163,5 +159,4 @@ public T getEntryModSkip(int index, T store) {
private static int mod(int val, int n) {
return ((val % n) + n) % n;
}

}
16 changes: 8 additions & 8 deletions jme3-core/src/main/java/com/jme3/anim/tween/Tweens.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,11 @@ public static Tween callMethod(Object target, String method, Object... args) {
* <pre>Tweens.callTweenMethod(1, myObject, "foo", "bar")</pre>
* <p>Would work for any of the following method signatures:</p>
* <pre>
* void foo( float t, String arg )
* void foo( double t, String arg )
* void foo( String arg, float t )
* void foo( String arg, double t )
* </pre>
* void foo(float t, String arg)
* void foo(double t, String arg)
* void foo(String arg, float t)
* void foo(String arg, double t)
* </pre>
*
* @param length the desired duration (in seconds)
* @param target object on which the method is to be invoked
Expand Down Expand Up @@ -208,7 +208,7 @@ public double curve(double t) {
} else if (t > 1) {
return 1;
}
// Sine starting at -90 will go from -1 to 1 through 0
// Sine starting at -90 will go from -1 to 1 through 0
double result = Math.sin(t * Math.PI - Math.PI * 0.5);
return (result + 1) * 0.5;
}
Expand Down Expand Up @@ -575,7 +575,7 @@ private Method findMethod(Class type, String name, Object... args) {
// We accept the 't' parameter as either first or last,
// so we'll see which one matches.
if (isFloatType(paramTypes[0]) || isDoubleType(paramTypes[0])) {
// Try it as the first parameter
// Try it as the first parameter
int matches = 0;

for (int i = 1; i < paramTypes.length; i++) {
Expand All @@ -597,7 +597,7 @@ private Method findMethod(Class type, String name, Object... args) {
return m;
}

// Else try it at the end
// Else try it at the end
int last = paramTypes.length - 1;
if (isFloatType(paramTypes[last]) || isDoubleType(paramTypes[last])) {
int matches = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.util.List;

public class ClipAction extends BlendableAction {

private AnimClip clip;
private Transform transform = new Transform();

Expand All @@ -25,7 +24,7 @@ public void doInterpolate(double t) {
for (AnimTrack track : tracks) {
if (track instanceof TransformTrack) {
TransformTrack tt = (TransformTrack) track;
if(getMask() != null && !getMask().contains(tt.getTarget())){
if (getMask() != null && !getMask().contains(tt.getTarget())) {
continue;
}
interpolateTransformTrack(t, tt);
Expand All @@ -46,6 +45,7 @@ private void interpolateTransformTrack(double t, TransformTrack track) {
this.collectTransform(target, transform, getTransitionWeight(), this);
}
}

private void interpolateMorphTrack(double t, MorphTrack track) {
Geometry target = track.getTarget();
float[] weights = target.getMorphState();
Expand Down
Loading

0 comments on commit ac8c101

Please sign in to comment.