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