Skip to content
Snippets Groups Projects
Commit f944c34d authored by Terry D. Norbraten's avatar Terry D. Norbraten
Browse files

consolidate methods

parent 13e22a17
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,6 @@
* purpose. Use it at your own risk. If there's a problem you get to fix it.
*
****************************************************************************/
package org.web3d.vrml.renderer.common.input.dis;
// External imports
......@@ -31,7 +30,6 @@ import org.xj3d.core.eventmodel.NetworkProtocolHandler;
/**
* The handler for DIS protocol network traffic.
* <p>
*
* @author Alan Hudson
* @version $Revision: 1.26 $
......@@ -118,7 +116,7 @@ public class DISProtocolHandler
"org.web3d.vrml.renderer.common.dis.input.deadreckonPosition";
/** The value read from the system property for MIPMAPS */
protected static final boolean deadreckonPosition;
protected static final boolean DEAD_RECKON_POSITION;
/** The default dead reckon position value */
protected static final boolean DEFAULT_DEADRECKON_ROTATION = true;
......@@ -128,7 +126,7 @@ public class DISProtocolHandler
"org.web3d.vrml.renderer.common.dis.input.deadreckonRotation";
/** The value read from the system property for deadReckonRotation */
protected static final boolean deadreckonRotation;
protected static final boolean DEAD_RECKON_ROTATION;
// Scratch matrixes for smoothing
Matrix3d rotationMatrix;
......@@ -152,10 +150,10 @@ public class DISProtocolHandler
AxisAngle4d axisTemp;
static {
deadreckonPosition = PropertyTools.fetchSystemProperty(DEADRECKON_POSITION_PROP,
DEAD_RECKON_POSITION = PropertyTools.fetchSystemProperty(DEADRECKON_POSITION_PROP,
DEFAULT_DEADRECKON_POSITION);
deadreckonRotation = PropertyTools.fetchSystemProperty(DEADRECKON_ROTATION_PROP,
DEAD_RECKON_ROTATION = PropertyTools.fetchSystemProperty(DEADRECKON_ROTATION_PROP,
DEFAULT_DEADRECKON_ROTATION);
}
......@@ -346,7 +344,7 @@ public class DISProtocolHandler
}
}
if ((deadreckonPosition || deadreckonRotation) && !node.closeEnough) {
if ((DEAD_RECKON_POSITION || DEAD_RECKON_ROTATION) && !node.closeEnough) {
// Handle dead reckoning
dt = (currTime - node.lastTime) * 0.001f;
// dt = (currTime - node.lastTime) * 0.01f;
......@@ -364,7 +362,7 @@ public class DISProtocolHandler
int idx;
if (deadreckonPosition) {
if (DEAD_RECKON_POSITION) {
node.translationConverger.getValue(currTime, translationVec);
tempPositionArray[0] = (float) translationVec.x;
tempPositionArray[1] = (float) translationVec.y;
......@@ -373,7 +371,7 @@ public class DISProtocolHandler
di.setValue(idx, tempPositionArray, 3);
}
if (deadreckonRotation) {
if (DEAD_RECKON_ROTATION) {
node.rotationConverger.getValue(currTime, rotationQuat);
rotationQuat.normalize();
......@@ -470,35 +468,24 @@ public class DISProtocolHandler
di.addNetworkRoleListener(this);
switch (di.getRole()) {
case VRMLNetworkInterfaceNodeType.ROLE_MANAGER:
address = di.getAddress();
port = di.getPort();
address = di.getAddress();
port = di.getPort();
id = new DISConnectionId(address, port);
conn = connections.get(id);
id = new DISConnectionId(address, port);
conn = connections.get(id);
if (conn == null) {
conn = new DISConnectionHandler(nodeMap, liveList, managerList, notifiedSet, address, port);
connections.put(id, conn);
}
if (conn == null) {
// TODO: When do we get rid of these?
conn = new DISConnectionHandler(nodeMap, liveList, managerList, notifiedSet, address, port);
connections.put(id, conn);
}
switch (di.getRole()) {
case VRMLNetworkInterfaceNodeType.ROLE_MANAGER:
managerList.add(di);
break;
case VRMLNetworkInterfaceNodeType.ROLE_READER:
address = di.getAddress();
port = di.getPort();
id = new DISConnectionId(address, port);
conn = connections.get(id);
if (conn == null) {
// TODO: When do we get rid of these?
conn = new DISConnectionHandler(nodeMap, liveList, managerList, notifiedSet, address, port);
connections.put(id, conn);
}
siteID = di.getSiteID();
appID = di.getAppID();
......@@ -520,19 +507,6 @@ public class DISProtocolHandler
break;
case VRMLNetworkInterfaceNodeType.ROLE_WRITER:
address = di.getAddress();
port = di.getPort();
id = new DISConnectionId(address, port);
conn = connections.get(id);
if (conn == null) {
// TODO: When do we get rid of these?
conn = new DISConnectionHandler(nodeMap, liveList, managerList, notifiedSet, address, port);
connections.put(id, conn);
}
siteID = di.getSiteID();
appID = di.getAppID();
entityID = di.getEntityID();
......@@ -589,6 +563,7 @@ public class DISProtocolHandler
//----------------------------------------------------------
// Methods required for NetworkRoleListener
//----------------------------------------------------------
/**
* The role of this node has changed.
*
......@@ -669,6 +644,7 @@ public class DISProtocolHandler
//----------------------------------------------------------
// Local convenience methods
//----------------------------------------------------------
/**
* Calculate the dead reckoning position of a EntityStatePDU
* @param espdu
......@@ -790,4 +766,4 @@ public class DISProtocolHandler
rotMatrix.mul(psiMat);
}
} // end class file DISProtocolHandler.java
\ No newline at end of file
} // end class file DISProtocolHandler.java
......@@ -24,7 +24,6 @@ package org.web3d.vrml.renderer.common.input.dis;
* @author Alan Hudson
* @version $Revision: 1.2 $
*/
class LinkedList {
public ListEntry head;
public ListEntry tail;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment