Skip to content

Commit

Permalink
jme3-core: delete useless fields and variables
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Mar 22, 2021
1 parent b0d8e76 commit feffbdb
Show file tree
Hide file tree
Showing 13 changed files with 11 additions and 78 deletions.
3 changes: 1 addition & 2 deletions jme3-core/src/main/java/com/jme3/anim/AnimComposer.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2020 jMonkeyEngine
* Copyright (c) 2009-2021 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -462,7 +462,6 @@ private static class Layer implements JmeCloneable {
private AnimComposer ac;
private Action currentAction;
private AnimationMask mask;
private float weight;
private double time;

public Layer(AnimComposer ac) {
Expand Down
4 changes: 1 addition & 3 deletions jme3-core/src/main/java/com/jme3/app/BasicProfiler.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014 jMonkeyEngine
* Copyright (c) 2014-2021 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -67,7 +67,6 @@ public class BasicProfiler implements AppProfiler {
private long[] frames;
private long startTime;
private long renderTime;
private long previousFrame;
private long updateInterval = 1000000L; // once a millisecond
private long lastUpdate = 0;

Expand Down Expand Up @@ -174,7 +173,6 @@ public void appStep( AppStep step ) {
case EndFrame:
long time = System.nanoTime();
frames[frameIndex * 2 + 1] = time - renderTime;
previousFrame = startTime;
frameIndex++;
if( frameIndex >= size ) {
frameIndex = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public class AppStateManager {
// is that they are all modified from the same thread anyway.

private final Application app;
private AppState[] stateArray;

public AppStateManager(Application app){
this.app = app;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2020 jMonkeyEngine
* Copyright (c) 2009-2021 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -67,7 +67,6 @@ public class ScreenshotAppState extends AbstractAppState implements ActionListen
private String shotName;
private long shotIndex = 0;
private int width, height;
private AppProfiler prof;
/**
* InputManager to which the ActionListener and the mapping are added
*/
Expand Down Expand Up @@ -312,7 +311,6 @@ public void postFrame(FrameBuffer out) {

@Override
public void setProfiler(AppProfiler profiler) {
this.prof = profiler;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public class MotionEvent extends AbstractCinematicEvent implements Control, JmeC
protected Direction directionType = Direction.None;
protected MotionPath path;
private boolean isControl = true;
final private int travelDirection = 1;
/**
* the distance traveled by the spatial on the path
*/
Expand Down
9 changes: 1 addition & 8 deletions jme3-core/src/main/java/com/jme3/collision/bih/BIHTree.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2020 jMonkeyEngine
* Copyright (c) 2009-2021 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -72,13 +72,6 @@ public class BIHTree implements CollisionData {
// private transient CollisionResults boundResults = new CollisionResults();
private transient float[] bihSwapTmp;

private static final TriangleAxisComparator[] comparators = new TriangleAxisComparator[]
{
new TriangleAxisComparator(0),
new TriangleAxisComparator(1),
new TriangleAxisComparator(2)
};

private void initTriList(FloatBuffer vb, IndexBuffer ib) {
pointData = new float[numTris * 3 * 3];
int p = 0;
Expand Down
3 changes: 1 addition & 2 deletions jme3-core/src/main/java/com/jme3/input/InputManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public class InputManager implements RawInputListener {
private long lastLastUpdateTime = 0;
private long lastUpdateTime = 0;
private long frameDelta = 0;
private long firstTime = 0;
private boolean eventsPermitted = false;
private boolean mouseVisible = true;
private boolean safeMode = false;
Expand Down Expand Up @@ -151,7 +150,7 @@ public InputManager(MouseInput mouse, KeyInput keys, JoyInput joystick, TouchInp
touch.setInputListener(this);
}

firstTime = keys.getInputTimeNanos();
keys.getInputTimeNanos();

This comment has been minimized.

Copy link
@Ali-RS

Ali-RS Mar 23, 2021

Member

@stephengold should this line be removed as well?

This comment has been minimized.

Copy link
@stephengold

stephengold Mar 23, 2021

Author Member

Yes, unless it has side effects.

}

private void invokeActions(int hash, boolean pressed) {
Expand Down
5 changes: 1 addition & 4 deletions jme3-core/src/main/java/com/jme3/post/PreDepthProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,10 @@ public class PreDepthProcessor implements SceneProcessor {

private RenderManager rm;
private ViewPort vp;
final private AssetManager assetManager;
final private Material preDepth;
final private RenderState forcedRS;
private AppProfiler prof;

public PreDepthProcessor(AssetManager assetManager){
this.assetManager = assetManager;
preDepth = new Material(assetManager, "Common/MatDefs/Shadow/PreShadow.j3md");
preDepth.getAdditionalRenderState().setPolyOffset(0, 0);
preDepth.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Back);
Expand Down Expand Up @@ -107,7 +104,7 @@ public void cleanup() {

@Override
public void setProfiler(AppProfiler profiler) {
this.prof = profiler;
// not implemented
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ public final class GLRenderer implements Renderer {
private final StringBuilder stringBuf = new StringBuilder(250);
private final IntBuffer intBuf1 = BufferUtils.createIntBuffer(1);
private final IntBuffer intBuf16 = BufferUtils.createIntBuffer(16);
private final FloatBuffer floatBuf16 = BufferUtils.createFloatBuffer(16);
private final RenderContext context = new RenderContext();
private final NativeObjectManager objManager = new NativeObjectManager();
private final EnumSet<Caps> caps = EnumSet.noneOf(Caps.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,12 @@ public final class GLTracer implements InvocationHandler {

private static final String ANSI_RESET = "\u001B[0m";
private static final String ANSI_BRIGHT = "\u001B[1m";
private static final String ANSI_BLACK = "\u001B[30m";
private static final String ANSI_RED = "\u001B[31m";
private static final String ANSI_GREEN = "\u001B[32m";
private static final String ANSI_YELLOW = "\u001B[33m";
private static final String ANSI_BLUE = "\u001B[34m";
private static final String ANSI_MAGENTA = "\u001B[35m";
private static final String ANSI_CYAN = "\u001B[36m";
private static final String ANSI_WHITE = "\u001B[37m";

private static void noEnumArgs(String method, int... argSlots) {
IntMap<Void> argSlotsMap = new IntMap<>();
Expand Down
35 changes: 1 addition & 34 deletions jme3-core/src/main/java/com/jme3/util/SortUtil.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2020 jMonkeyEngine
* Copyright (c) 2009-2021 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -40,39 +40,6 @@
*/
public class SortUtil {

/**
* The size at or below which we will use insertion sort because it's
* probably faster.
*/
private static final int INSERTION_SORT_THRESHOLD = 7;


/*
procedure optimizedGnomeSort(a[])
pos := 1
last := 0
while pos < length(a)
if (a[pos] >= a[pos-1])
if (last != 0)
pos := last
last := 0
end if
pos := pos + 1
else
swap a[pos] and a[pos-1]
if (pos > 1)
if (last == 0)
last := pos
end if
pos := pos - 1
else
pos := pos + 1
end if
end if
end while
end procedure
*/

@SuppressWarnings("unchecked")
public static void gsort(Object[] a, Comparator comp) {
int pos = 1;
Expand Down
18 changes: 3 additions & 15 deletions jme3-core/src/plugins/java/com/jme3/texture/plugins/DDSLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,10 @@
public class DDSLoader implements AssetLoader {

private static final Logger logger = Logger.getLogger(DDSLoader.class.getName());
private static final boolean forceRGBA = false;
private static final int DDSD_MANDATORY = 0x1007;
private static final int DDSD_MANDATORY_DX10 = 0x6;
private static final int DDSD_MIPMAPCOUNT = 0x20000;
private static final int DDSD_LINEARSIZE = 0x80000;
private static final int DDSD_DEPTH = 0x800000;
private static final int DDPF_ALPHAPIXELS = 0x1;
private static final int DDPF_FOURCC = 0x4;
private static final int DDPF_RGB = 0x40;
Expand All @@ -76,8 +74,6 @@ public class DDSLoader implements AssetLoader {
private static final int DDPF_ALPHA = 0x2;
// used by NVTextureTools to mark normal images.
private static final int DDPF_NORMAL = 0x80000000;
private static final int SWIZZLE_xGxR = 0x78477852;
private static final int DDSCAPS_COMPLEX = 0x8;
private static final int DDSCAPS_TEXTURE = 0x1000;
private static final int DDSCAPS_MIPMAP = 0x400000;
private static final int DDSCAPS2_CUBEMAP = 0x200;
Expand All @@ -88,12 +84,8 @@ public class DDSLoader implements AssetLoader {
private static final int PF_ATI1 = 0x31495441;
private static final int PF_ATI2 = 0x32495441; // 0x41544932;
private static final int PF_DX10 = 0x30315844; // a DX10 format
private static final int DX10DIM_BUFFER = 0x1,
DX10DIM_TEXTURE1D = 0x2,
DX10DIM_TEXTURE2D = 0x3,
DX10DIM_TEXTURE3D = 0x4;
private static final int DX10MISC_GENERATE_MIPS = 0x1,
DX10MISC_TEXTURECUBE = 0x4;
private static final int DX10DIM_TEXTURE3D = 0x4;
private static final int DX10MISC_TEXTURECUBE = 0x4;
private static final double LOG2 = Math.log(2);
private int width;
private int height;
Expand All @@ -107,7 +99,6 @@ public class DDSLoader implements AssetLoader {
private boolean compressed;
private boolean texture3D;
private boolean grayscaleOrAlpha;
private boolean normal;
private Format pixelFormat;
private int bpp;
private int[] sizes;
Expand Down Expand Up @@ -253,7 +244,7 @@ private void readPixelFormat() throws IOException {
}

int pfFlags = in.readInt();
normal = is(pfFlags, DDPF_NORMAL);
is(pfFlags, DDPF_NORMAL);

This comment has been minimized.

Copy link
@Ali-RS

Ali-RS Mar 23, 2021

Member

@stephengold should this line be removed as well?

This comment has been minimized.

Copy link
@stephengold

stephengold Mar 23, 2021

Author Member

Yes, unless it has side effects.


if (is(pfFlags, DDPF_FOURCC)) {
compressed = true;
Expand All @@ -277,9 +268,6 @@ private void readPixelFormat() throws IOException {
case PF_DXT5:
bpp = 8;
pixelFormat = Image.Format.DXT5;
if (swizzle == SWIZZLE_xGxR) {
normal = true;
}
break;
case PF_ATI1:
bpp = 4;
Expand Down
3 changes: 1 addition & 2 deletions jme3-core/src/test/java/com/jme3/shader/DefineListTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2015 jMonkeyEngine
* Copyright (c) 2009-2021 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -47,7 +47,6 @@ public class DefineListTest {
private static final int BOOL_VAR = 0;
private static final int INT_VAR = 1;
private static final int FLOAT_VAR = 2;
private static final DefineList EMPTY = new DefineList(NUM_DEFINES);

@Test
public void testHashCollision() {
Expand Down

0 comments on commit feffbdb

Please sign in to comment.