diff --git a/examples/src/OpenDis7Examples/ExampleTrackInterpolation.java b/examples/src/OpenDis7Examples/ExampleTrackInterpolation.java index 2e0a322d24bf675a3701237a0d1c1b285856e29b..70e6bcb39ee00a73ff71268b2e332e2076b0d4b5 100644 --- a/examples/src/OpenDis7Examples/ExampleTrackInterpolation.java +++ b/examples/src/OpenDis7Examples/ExampleTrackInterpolation.java @@ -85,6 +85,10 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram PduTrack pduTrack_1 = new PduTrack(); pduTrack_1.setDescriptor("testing 123"); pduTrack_1.setDefaultWaypointInterval(1.0f); // overrides timestamps + pduTrack_1.setAddLineBreaksWithinKeyValues(true); + pduTrack_1.setAuthor("Don Brutzman"); + pduTrack_1.setX3dModelName("ExampleTrackInterpolation.x3d"); + pduTrack_1.setX3dModelIdentifier("https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/src/OpenDis7Examples/ExampleTrackInterpolation.x3d"); pduTrack_1.addPdu(espdu_1); // initial location // OK send initial PDUs prior to loop diff --git a/examples/src/OpenDis7Examples/ExampleTrackInterpolation.x3d b/examples/src/OpenDis7Examples/ExampleTrackInterpolation.x3d new file mode 100644 index 0000000000000000000000000000000000000000..4d55ca27db4a3674bed404c402dec87e453e2292 --- /dev/null +++ b/examples/src/OpenDis7Examples/ExampleTrackInterpolation.x3d @@ -0,0 +1,169 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 4.0//EN" "https://www.web3d.org/specifications/x3d-4.0.dtd"> +<X3D profile='Interchange' version='4.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-4.0.xsd'> + <head> + <meta content='ExampleTrackInterpolation.x3d' name='title'/> + <meta content='Don Brutzman' name='creator'/> + <meta content='https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/src/OpenDis7Examples/ExampleTrackInterpolation.x3d' name='identifier'/> + <meta content='Conversion of ESPDU track into X3D animation interpolators and LineSet.' name='description'/> + <meta content='PduTrack utility, open-dis7-java Library https://github.com/open-dis/open-dis7-java' name='generator'/> + <meta content='NPS MOVES MV3500 Networked Graphics https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500' name='reference'/> + <meta content='X3D Resources https://www.web3d.org/x3d/content/examples/X3dResources.html' name='reference'/> + <meta content='X3D Scene Authoring Hints https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html' name='reference'/> + <meta content='X3D Tooltips https://www.web3d.org/x3d/tooltips/X3dTooltips.html' name='reference'/> + <meta content='X3D Validator https://savage.nps.edu/X3dValidator' name='reference'/> + <meta content='Open source https://raw.githubusercontent.com/open-dis/open-dis7-java/master/license.html' name='license'/> + </head> + <Scene> + <WorldInfo title='PduTrackInterpolation.x3d'/> + <TimeSensor DEF='testing123Clock' cycleInterval='42.0' loop='true'/> + <PositionInterpolator DEF='testing123Positions' key='0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0' keyValue=' +0.0 0.0 0.0, +0.0 1.0 0.0, +0.0 2.0 0.0, +0.0 3.0 0.0, +0.0 4.0 0.0, +0.0 5.0 0.0, +0.0 6.0 0.0, +0.0 7.0 0.0, +0.0 8.0 0.0, +0.0 9.0 0.0, +0.0 10.0 0.0, +1.0 10.0 0.0, +2.0 10.0 0.0, +3.0 10.0 0.0, +4.0 10.0 0.0, +5.0 10.0 0.0, +6.0 10.0 0.0, +7.0 10.0 0.0, +8.0 10.0 0.0, +9.0 10.0 0.0, +10.0 10.0 0.0, +10.0 9.0 0.0, +10.0 8.0 0.0, +10.0 7.0 0.0, +10.0 6.0 0.0, +10.0 5.0 0.0, +10.0 4.0 0.0, +10.0 3.0 0.0, +10.0 2.0 0.0, +10.0 1.0 0.0, +10.0 0.0 0.0, +9.0 0.0 0.0, +8.0 0.0 0.0, +7.0 0.0 0.0, +6.0 0.0 0.0, +5.0 0.0 0.0, +4.0 0.0 0.0, +3.0 0.0 0.0, +2.0 0.0 0.0, +1.0 0.0 0.0, +0.0 0.0 0.0, +-1.0 0.0 0.0'/> + <OrientationInterpolator DEF='testing123Orientations' key='0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0' keyValue=' +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0'/> + <ROUTE fromField='fraction_changed' fromNode='testing123Clock' toField='set_fraction' toNode='testing123Positions'/> + <ROUTE fromField='fraction_changed' fromNode='testing123Clock' toField='set_fraction' toNode='testing123Orientations'/> + <Shape> + <Appearance DEF='TrackAppearance'> + <Material emissiveColor='0.2 0.8 0.8'/> + </Appearance> + <LineSet vertexCount='42'> + <Coordinate point=' +0.0 0.0 0.0, +0.0 1.0 0.0, +0.0 2.0 0.0, +0.0 3.0 0.0, +0.0 4.0 0.0, +0.0 5.0 0.0, +0.0 6.0 0.0, +0.0 7.0 0.0, +0.0 8.0 0.0, +0.0 9.0 0.0, +0.0 10.0 0.0, +1.0 10.0 0.0, +2.0 10.0 0.0, +3.0 10.0 0.0, +4.0 10.0 0.0, +5.0 10.0 0.0, +6.0 10.0 0.0, +7.0 10.0 0.0, +8.0 10.0 0.0, +9.0 10.0 0.0, +10.0 10.0 0.0, +10.0 9.0 0.0, +10.0 8.0 0.0, +10.0 7.0 0.0, +10.0 6.0 0.0, +10.0 5.0 0.0, +10.0 4.0 0.0, +10.0 3.0 0.0, +10.0 2.0 0.0, +10.0 1.0 0.0, +10.0 0.0 0.0, +9.0 0.0 0.0, +8.0 0.0 0.0, +7.0 0.0 0.0, +6.0 0.0 0.0, +5.0 0.0 0.0, +4.0 0.0 0.0, +3.0 0.0 0.0, +2.0 0.0 0.0, +1.0 0.0 0.0, +0.0 0.0 0.0, +-1.0 0.0 0.0'/> + </LineSet> + </Shape> + <Transform DEF='AnimationTransform'> + <Transform rotation='0 0 1 1.57'> + <Shape> + <Appearance USE='TrackAppearance'/> + <Cone bottomRadius='0.5'/> + </Shape> + </Transform> + </Transform> + <ROUTE fromField='value_changed' fromNode='testing123Positions' toField='translation' toNode='AnimationTransform'/> + <ROUTE fromField='value_changed' fromNode='testing123Orientations' toField='rotation' toNode='AnimationTransform'/> + </Scene> +</X3D> \ No newline at end of file diff --git a/examples/src/OpenDis7Examples/ExampleTrackInterpolationLog.txt b/examples/src/OpenDis7Examples/ExampleTrackInterpolationLog.txt index 9e974477ca8503b2515cd116771b71edcc28a63b..22e69a53749bc95df8884fe264b27704a29d877a 100644 --- a/examples/src/OpenDis7Examples/ExampleTrackInterpolationLog.txt +++ b/examples/src/OpenDis7Examples/ExampleTrackInterpolationLog.txt @@ -13,7 +13,7 @@ run-single: [DisThreadedNetworkInterface] createThreads() sendingThread.isAlive()=true Network confirmation: address=239.1.2.3 port=3000 Beginning pdu save to directory ./pduLog -Recorder log file open: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\PduCaptureLog171.dislog +Recorder log file open: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\PduCaptureLog175.dislog [DisThreadedNetworkInterface] using network interface Intel(R) Wi-Fi 6E AX210 160MHz [DisThreadedNetworkInterface] datagramSocket.joinGroup address=239.1.2.3 port=3000 isConnected()=false createDatagramSocket() complete. [DisThreadedNetworkInterface] createThreads() receiveThread.isAlive()=true @@ -69,22 +69,171 @@ pduTrack_1 duration = 42.0 seconds = 0 ticks ================================= <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 4.0//EN" "https://www.web3d.org/specifications/x3d-4.0.dtd"> -<X3D profile='Immersive' version='4.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-4.0.xsd'> +<X3D profile='Interchange' version='4.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-4.0.xsd'> <head> - <meta content='PduTrackInterpolator.x3d' name='title'/> - <meta content='PduTrack utility open-dis7-java Library https://github.com/open-dis/open-dis7-java' name='generator'/> + <meta content='ExampleTrackInterpolation.x3d' name='title'/> + <meta content='Don Brutzman' name='creator'/> + <meta content='https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/src/OpenDis7Examples/ExampleTrackInterpolation.x3d' name='identifier'/> + <meta content='Conversion of ESPDU track into X3D animation interpolators and LineSet.' name='description'/> + <meta content='PduTrack utility, open-dis7-java Library https://github.com/open-dis/open-dis7-java' name='generator'/> <meta content='NPS MOVES MV3500 Networked Graphics https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500' name='reference'/> + <meta content='X3D Resources https://www.web3d.org/x3d/content/examples/X3dResources.html' name='reference'/> + <meta content='X3D Scene Authoring Hints https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html' name='reference'/> + <meta content='X3D Tooltips https://www.web3d.org/x3d/tooltips/X3dTooltips.html' name='reference'/> + <meta content='X3D Validator https://savage.nps.edu/X3dValidator' name='reference'/> <meta content='Open source https://raw.githubusercontent.com/open-dis/open-dis7-java/master/license.html' name='license'/> </head> <Scene> + <WorldInfo title='PduTrackInterpolation.x3d'/> <TimeSensor DEF='testing123Clock' cycleInterval='42.0' loop='true'/> - <PositionInterpolator DEF='testing123Positions' key='0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0' keyValue='0.0 0.0 0.0,0.0 1.0 0.0,0.0 2.0 0.0,0.0 3.0 0.0,0.0 4.0 0.0,0.0 5.0 0.0,0.0 6.0 0.0,0.0 7.0 0.0,0.0 8.0 0.0,0.0 9.0 0.0,0.0 10.0 0.0,1.0 10.0 0.0,2.0 10.0 0.0,3.0 10.0 0.0,4.0 10.0 0.0,5.0 10.0 0.0,6.0 10.0 0.0,7.0 10.0 0.0,8.0 10.0 0.0,9.0 10.0 0.0,10.0 10.0 0.0,10.0 9.0 0.0,10.0 8.0 0.0,10.0 7.0 0.0,10.0 6.0 0.0,10.0 5.0 0.0,10.0 4.0 0.0,10.0 3.0 0.0,10.0 2.0 0.0,10.0 1.0 0.0,10.0 0.0 0.0,9.0 0.0 0.0,8.0 0.0 0.0,7.0 0.0 0.0,6.0 0.0 0.0,5.0 0.0 0.0,4.0 0.0 0.0,3.0 0.0 0.0,2.0 0.0 0.0,1.0 0.0 0.0,0.0 0.0 0.0,-1.0 0.0 0.0'/> - <OrientationInterpolator DEF='testing123Orientations' key='0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0' keyValue='0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0,0.0 1.0 0.0 0.0'/> + <PositionInterpolator DEF='testing123Positions' key='0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0' keyValue=' +0.0 0.0 0.0, +0.0 1.0 0.0, +0.0 2.0 0.0, +0.0 3.0 0.0, +0.0 4.0 0.0, +0.0 5.0 0.0, +0.0 6.0 0.0, +0.0 7.0 0.0, +0.0 8.0 0.0, +0.0 9.0 0.0, +0.0 10.0 0.0, +1.0 10.0 0.0, +2.0 10.0 0.0, +3.0 10.0 0.0, +4.0 10.0 0.0, +5.0 10.0 0.0, +6.0 10.0 0.0, +7.0 10.0 0.0, +8.0 10.0 0.0, +9.0 10.0 0.0, +10.0 10.0 0.0, +10.0 9.0 0.0, +10.0 8.0 0.0, +10.0 7.0 0.0, +10.0 6.0 0.0, +10.0 5.0 0.0, +10.0 4.0 0.0, +10.0 3.0 0.0, +10.0 2.0 0.0, +10.0 1.0 0.0, +10.0 0.0 0.0, +9.0 0.0 0.0, +8.0 0.0 0.0, +7.0 0.0 0.0, +6.0 0.0 0.0, +5.0 0.0 0.0, +4.0 0.0 0.0, +3.0 0.0 0.0, +2.0 0.0 0.0, +1.0 0.0 0.0, +0.0 0.0 0.0, +-1.0 0.0 0.0'/> + <OrientationInterpolator DEF='testing123Orientations' key='0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0' keyValue=' +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0, +0.0 1.0 0.0 0.0'/> <ROUTE fromField='fraction_changed' fromNode='testing123Clock' toField='set_fraction' toNode='testing123Positions'/> <ROUTE fromField='fraction_changed' fromNode='testing123Clock' toField='set_fraction' toNode='testing123Orientations'/> - <LineSet vertexCount='42'> - <Coordinate point='0.0 0.0 0.0,0.0 1.0 0.0,0.0 2.0 0.0,0.0 3.0 0.0,0.0 4.0 0.0,0.0 5.0 0.0,0.0 6.0 0.0,0.0 7.0 0.0,0.0 8.0 0.0,0.0 9.0 0.0,0.0 10.0 0.0,1.0 10.0 0.0,2.0 10.0 0.0,3.0 10.0 0.0,4.0 10.0 0.0,5.0 10.0 0.0,6.0 10.0 0.0,7.0 10.0 0.0,8.0 10.0 0.0,9.0 10.0 0.0,10.0 10.0 0.0,10.0 9.0 0.0,10.0 8.0 0.0,10.0 7.0 0.0,10.0 6.0 0.0,10.0 5.0 0.0,10.0 4.0 0.0,10.0 3.0 0.0,10.0 2.0 0.0,10.0 1.0 0.0,10.0 0.0 0.0,9.0 0.0 0.0,8.0 0.0 0.0,7.0 0.0 0.0,6.0 0.0 0.0,5.0 0.0 0.0,4.0 0.0 0.0,3.0 0.0 0.0,2.0 0.0 0.0,1.0 0.0 0.0,0.0 0.0 0.0,-1.0 0.0 0.0'/> - </LineSet> + <Shape> + <Appearance DEF='TrackAppearance'> + <Material emissiveColor='0.2 0.8 0.8'/> + </Appearance> + <LineSet vertexCount='42'> + <Coordinate point=' +0.0 0.0 0.0, +0.0 1.0 0.0, +0.0 2.0 0.0, +0.0 3.0 0.0, +0.0 4.0 0.0, +0.0 5.0 0.0, +0.0 6.0 0.0, +0.0 7.0 0.0, +0.0 8.0 0.0, +0.0 9.0 0.0, +0.0 10.0 0.0, +1.0 10.0 0.0, +2.0 10.0 0.0, +3.0 10.0 0.0, +4.0 10.0 0.0, +5.0 10.0 0.0, +6.0 10.0 0.0, +7.0 10.0 0.0, +8.0 10.0 0.0, +9.0 10.0 0.0, +10.0 10.0 0.0, +10.0 9.0 0.0, +10.0 8.0 0.0, +10.0 7.0 0.0, +10.0 6.0 0.0, +10.0 5.0 0.0, +10.0 4.0 0.0, +10.0 3.0 0.0, +10.0 2.0 0.0, +10.0 1.0 0.0, +10.0 0.0 0.0, +9.0 0.0 0.0, +8.0 0.0 0.0, +7.0 0.0 0.0, +6.0 0.0 0.0, +5.0 0.0 0.0, +4.0 0.0 0.0, +3.0 0.0 0.0, +2.0 0.0 0.0, +1.0 0.0 0.0, +0.0 0.0 0.0, +-1.0 0.0 0.0'/> + </LineSet> + </Shape> + <Transform DEF='AnimationTransform'> + <Transform rotation='0 0 1 1.57'> + <Shape> + <Appearance USE='TrackAppearance'/> + <Cone bottomRadius='0.5'/> + </Shape> + </Transform> + </Transform> + <ROUTE fromField='value_changed' fromNode='testing123Positions' toField='translation' toNode='AnimationTransform'/> + <ROUTE fromField='value_changed' fromNode='testing123Orientations' toField='rotation' toNode='AnimationTransform'/> </Scene> </X3D> @@ -95,6 +244,6 @@ pduTrack_1 duration = 42.0 seconds = 0 ticks *** killThread() status: receiveThread.isAlive()=false receiveThread.isInterrupted()=true *** Thread close status: sendingThread.isAlive()=false receiveThread.isAlive()=false -PduRecorder.stop() closing recorder log file: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\PduCaptureLog171.dislog +PduRecorder.stop() closing recorder log file: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\PduCaptureLog175.dislog [OpenDis7Examples.ExampleTrackInterpolation] complete. BUILD SUCCESSFUL (total time: 12 seconds) diff --git a/examples/src/OpenDis7Examples/PduTrack.java b/examples/src/OpenDis7Examples/PduTrack.java index ce2c54d83e59a94b949fbc24641f48dfadab71df..3a2a5cd9ff0a8949d3ee1cce005c457ec2495004 100644 --- a/examples/src/OpenDis7Examples/PduTrack.java +++ b/examples/src/OpenDis7Examples/PduTrack.java @@ -1,5 +1,5 @@ /* -Copyright (c) 1995-2021 held by the author(s). All rights reserved. +Copyright (c) 1995-2022 held by the author(s). All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -60,6 +60,9 @@ public class PduTrack /** timelineList in seconds */ private ArrayList<Float> timelineList = new ArrayList<>(); + private String author = new String(); + private String x3dModelIdentifier = new String(); + private String x3dModelName = "PduTrackInterpolation.x3d"; private float defaultWaypointInterval = -1; private float durationSeconds = -1; private String x3dTimeSensorDEF = new String(); @@ -402,7 +405,7 @@ public class PduTrack sb.append(" keyValue='"); for (int i = 0; i < waypointsList.size(); i++) { - if (addLineBreaksWithinKeyValues) + if (hasAddLineBreaksWithinKeyValues()) sb.append("\n"); Vector3Double nextPosition = waypointsList.get(i); sb.append(String.valueOf(nextPosition.getX())).append(" ") @@ -438,7 +441,7 @@ public class PduTrack sb.append(" keyValue='"); for (int i = 0; i < eulerAnglesList.size(); i++) { - if (addLineBreaksWithinKeyValues) + if (hasAddLineBreaksWithinKeyValues()) sb.append("\n"); EulerAngles nextEulerAngle = new EulerAngles(); float axisX = 0.0f; @@ -461,15 +464,80 @@ public class PduTrack return sb.toString(); } + /** - * Create full X3D interpolator model from Pdu list, assembling sections of scene graph - * @param addLineBreaksWithinKeyValues whether to insert line breaks in output arrays - * @return X3D model as string + * Get name of author used as creator of X3D model + * @return the author */ - public String createX3dModel(boolean addLineBreaksWithinKeyValues) - { + public String getAuthor() { + return author; + } + + /** + * Set name of author used as creator of X3D model + * @param author the author to set + */ + public void setAuthor(String author) { + if (author == null) + author = new String(); + author = author.trim(); + this.author = author; + } + + /** + * Get name of online url identifier for X3D model + * @return the x3dModelIdentifier + */ + public String getX3dModelIdentifier() { + return x3dModelIdentifier; + } + + /** + * Set name of online url identifier for X3D model + * @param x3dModelIdentifier the x3dModelIdentifier to set + */ + public void setX3dModelIdentifier(String x3dModelIdentifier) { + if (x3dModelIdentifier == null) + x3dModelIdentifier = new String(); + x3dModelIdentifier = x3dModelIdentifier.trim(); + if (!x3dModelIdentifier.startsWith("http://") && !x3dModelIdentifier.startsWith("https://")) + System.out.println(TRACE_PREFIX + "warning, identifier typically begins with https:// or http://"); + else this.x3dModelIdentifier = x3dModelIdentifier; + } + + /** + * File name for X3D model production + * @return the x3dModelName + */ + public String getX3dModelName() { + return x3dModelName; + } + + /** + * File name for X3D model production + * @param x3dModelName the x3dModelName to set + */ + public void setX3dModelName(String x3dModelName) { + if (x3dModelName == null) + x3dModelName = new String(); + x3dModelName = x3dModelName.trim(); + this.x3dModelName = x3dModelName; + } + + /** + * Verbose (but more readable) output of numeric arrays in X3D model + * @return the addLineBreaksWithinKeyValues + */ + public boolean hasAddLineBreaksWithinKeyValues() { + return addLineBreaksWithinKeyValues; + } + + /** + * Verbose (but more readable) output of numeric arrays in X3D model + * @param addLineBreaksWithinKeyValues the addLineBreaksWithinKeyValues to set + */ + public void setAddLineBreaksWithinKeyValues(boolean addLineBreaksWithinKeyValues) { this.addLineBreaksWithinKeyValues = addLineBreaksWithinKeyValues; - return createX3dModel(); } /** * Create full X3D interpolator model from Pdu list, assembling sections of scene graph @@ -478,39 +546,50 @@ public class PduTrack public String createX3dModel() { StringBuilder sb = new StringBuilder(); - sb.append(createX3dHeaderString()); + sb.append(createX3dModelHeaderString()); sb.append(createX3dTimeSensorString()); sb.append(createX3dPositionInterpolatorString()); sb.append(createX3dOrientationInterpolatorString()); - sb.append(createX3dRoutesFooterString()); + sb.append(createX3dRoutesGeometryFooterString()); return sb.toString(); } /** * Create PositionInterpolator from Pdu list * @return X3D PositionInterpolator as string */ - public String createX3dHeaderString() + public String createX3dModelHeaderString() { StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>").append("\n"); sb.append("<!DOCTYPE X3D PUBLIC \"ISO//Web3D//DTD X3D 4.0//EN\" \"https://www.web3d.org/specifications/x3d-4.0.dtd\">").append("\n"); - sb.append("<X3D profile='Immersive' version='4.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-4.0.xsd'>").append("\n"); + sb.append("<X3D profile='Interchange' version='4.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-4.0.xsd'>").append("\n"); sb.append(" <head>").append("\n"); - sb.append(" <meta content='PduTrackInterpolator.x3d' name='title'/>").append("\n"); - sb.append(" <meta content='PduTrack utility open-dis7-java Library https://github.com/open-dis/open-dis7-java' name='generator'/>").append("\n"); + if (!getX3dModelName().isEmpty()) + sb.append(" <meta content='").append(getX3dModelName()).append("' name='title'/>").append("\n"); + if (!getAuthor().isEmpty()) + sb.append(" <meta content='").append(getAuthor()).append("' name='creator'/>").append("\n"); + if (!getX3dModelIdentifier().isEmpty()) + sb.append(" <meta content='").append(getX3dModelIdentifier()).append("' name='identifier'/>").append("\n"); + sb.append(" <meta content='Conversion of ESPDU track into X3D animation interpolators and LineSet.' name='description'/>").append("\n"); + sb.append(" <meta content='PduTrack utility, open-dis7-java Library https://github.com/open-dis/open-dis7-java' name='generator'/>").append("\n"); sb.append(" <meta content='NPS MOVES MV3500 Networked Graphics https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500' name='reference'/>").append("\n"); + sb.append(" <meta content='X3D Resources https://www.web3d.org/x3d/content/examples/X3dResources.html' name='reference'/>").append("\n"); + sb.append(" <meta content='X3D Scene Authoring Hints https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html' name='reference'/>").append("\n"); + sb.append(" <meta content='X3D Tooltips https://www.web3d.org/x3d/tooltips/X3dTooltips.html' name='reference'/>").append("\n"); + sb.append(" <meta content='X3D Validator https://savage.nps.edu/X3dValidator' name='reference'/>").append("\n"); sb.append(" <meta content='Open source https://raw.githubusercontent.com/open-dis/open-dis7-java/master/license.html' name='license'/>").append("\n"); sb.append(" </head>").append("\n"); sb.append(" <Scene>").append("\n"); - - return sb.toString(); + sb.append(" <WorldInfo title='PduTrackInterpolation.x3d'/>").append("\n"); + + return sb.toString(); } /** * Create X3D ROUTEs and footer to connect TimeSensor to interpolators * @return X3D PositionInterpolator as string */ - public String createX3dRoutesFooterString() + public String createX3dRoutesGeometryFooterString() { StringBuilder sb = new StringBuilder(); @@ -525,11 +604,15 @@ public class PduTrack .append(getX3dOrientationInterpolatorDEF()) .append("'/>").append("\n"); - sb.append(" <LineSet vertexCount='").append(waypointsList.size()).append("'>").append("\n"); - sb.append(" <Coordinate point='"); + sb.append(" <Shape>").append("\n"); + sb.append(" <Appearance DEF='TrackAppearance'>").append("\n"); + sb.append(" <Material emissiveColor='0.2 0.8 0.8'/>").append("\n"); + sb.append(" </Appearance>").append("\n"); + sb.append(" <LineSet vertexCount='").append(waypointsList.size()).append("'>").append("\n"); + sb.append(" <Coordinate point='"); for (int i = 0; i < waypointsList.size(); i++) { - if (addLineBreaksWithinKeyValues) + if (hasAddLineBreaksWithinKeyValues()) sb.append("\n"); Vector3Double nextPosition = waypointsList.get(i); sb.append(String.valueOf(nextPosition.getX())).append(" ") @@ -539,7 +622,22 @@ public class PduTrack sb.append(","); } sb.append("'/>").append("\n"); - sb.append(" </LineSet>").append("\n"); + sb.append(" </LineSet>").append("\n"); + sb.append(" </Shape>").append("\n"); + sb.append(" <Transform DEF='AnimationTransform'>").append("\n"); + sb.append(" <Transform rotation='0 0 1 1.57'>").append("\n"); + sb.append(" <Shape>").append("\n"); + sb.append(" <Appearance USE='TrackAppearance'/>").append("\n"); + sb.append(" <Cone bottomRadius='0.5'/>").append("\n"); + sb.append(" </Shape>").append("\n"); + sb.append(" </Transform>").append("\n"); + sb.append(" </Transform>").append("\n"); + sb.append(" <ROUTE fromField='value_changed' fromNode='") + .append(getX3dPositionInterpolatorDEF()) + .append("' toField='translation' toNode='AnimationTransform'/>").append("\n"); + sb.append(" <ROUTE fromField='value_changed' fromNode='") + .append(getX3dOrientationInterpolatorDEF()) + .append("' toField='rotation' toNode='AnimationTransform'/>").append("\n"); sb.append(" </Scene>").append("\n"); sb.append("</X3D>").append("\n"); @@ -590,6 +688,8 @@ public class PduTrack PduTrack pduTrack = new PduTrack(); pduTrack.setDescriptor("PduTrack Self Test"); pduTrack.setDefaultWaypointInterval(1.0f); + pduTrack.setAuthor("Don Brutzman"); + pduTrack.setX3dModelIdentifier("https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/src/OpenDis7Examples/PduTrackInterpolation.x3d"); EntityStatePdu espdu = new EntityStatePdu(); espdu.setMarking("PduTrack"); @@ -605,7 +705,8 @@ public class PduTrack System.out.println(TRACE_PREFIX + "getDefaultWaypointInterval()=" + pduTrack.getDefaultWaypointInterval()); System.out.println(TRACE_PREFIX + "getTotalDurationSeconds()=" + pduTrack.getTotalDurationSeconds()); System.out.println("================================="); - System.out.println(pduTrack.createX3dModel(true)); // addLineBreaksWithinKeyValues + pduTrack.setAddLineBreaksWithinKeyValues(true); + System.out.println(pduTrack.createX3dModel()); // System.out.println("================================="); System.out.println(TRACE_PREFIX + "selfTest() complete."); diff --git a/examples/src/OpenDis7Examples/PduTrackInterpolation.x3d b/examples/src/OpenDis7Examples/PduTrackInterpolation.x3d new file mode 100644 index 0000000000000000000000000000000000000000..b6ea1ad27ca0324662303ae6c49b854de56c976e --- /dev/null +++ b/examples/src/OpenDis7Examples/PduTrackInterpolation.x3d @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 4.0//EN" "https://www.web3d.org/specifications/x3d-4.0.dtd"> +<X3D profile='Interchange' version='4.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-4.0.xsd'> + <head> + <meta content='PduTrackInterpolation.x3d' name='title'/> + <meta content='Don Brutzman' name='creator'/> + <meta content='https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/src/OpenDis7Examples/PduTrackInterpolation.x3d' name='identifier'/> + <meta content='Conversion of ESPDU track into X3D animation interpolators and LineSet.' name='description'/> + <meta content='PduTrack utility, open-dis7-java Library https://github.com/open-dis/open-dis7-java' name='generator'/> + <meta content='NPS MOVES MV3500 Networked Graphics https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500' name='reference'/> + <meta content='X3D Resources https://www.web3d.org/x3d/content/examples/X3dResources.html' name='reference'/> + <meta content='X3D Scene Authoring Hints https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html' name='reference'/> + <meta content='X3D Tooltips https://www.web3d.org/x3d/tooltips/X3dTooltips.html' name='reference'/> + <meta content='X3D Validator https://savage.nps.edu/X3dValidator' name='reference'/> + <meta content='Open source https://raw.githubusercontent.com/open-dis/open-dis7-java/master/license.html' name='license'/> + </head> + <Scene> + <WorldInfo title='PduTrackInterpolation.x3d'/> + <TimeSensor DEF='PduTrackSelfTestClock' cycleInterval='5.0' loop='true'/> + <PositionInterpolator DEF='PduTrackSelfTestPositions' key='0.0 1.0 2.0 3.0 4.0' keyValue=' +0.0 0.0 0.0, +1.0 1.0 1.0, +2.0 2.0 2.0, +3.0 3.0 3.0, +4.0 4.0 4.0'/> + <OrientationInterpolator DEF='PduTrackSelfTestOrientations' key='0.0 1.0 2.0 3.0 4.0' keyValue=' +0.0 1.0 0.0 0.7853982, +0.0 1.0 0.0 0.7853982, +0.0 1.0 0.0 0.7853982, +0.0 1.0 0.0 0.7853982, +0.0 1.0 0.0 0.7853982'/> + <ROUTE fromField='fraction_changed' fromNode='PduTrackSelfTestClock' toField='set_fraction' toNode='PduTrackSelfTestPositions'/> + <ROUTE fromField='fraction_changed' fromNode='PduTrackSelfTestClock' toField='set_fraction' toNode='PduTrackSelfTestOrientations'/> + <Shape> + <Appearance DEF='TrackAppearance'> + <Material emissiveColor='0.2 0.8 0.8'/> + </Appearance> + <LineSet vertexCount='5'> + <Coordinate point=' +0.0 0.0 0.0, +1.0 1.0 1.0, +2.0 2.0 2.0, +3.0 3.0 3.0, +4.0 4.0 4.0'/> + </LineSet> + </Shape> + <Transform DEF='AnimationTransform'> + <Transform rotation='0 0 1 1.57'> + <Shape> + <Appearance USE='TrackAppearance'/> + <Cone bottomRadius='0.5'/> + </Shape> + </Transform> + </Transform> + <ROUTE fromField='value_changed' fromNode='PduTrackSelfTestPositions' toField='translation' toNode='AnimationTransform'/> + <ROUTE fromField='value_changed' fromNode='PduTrackSelfTestOrientations' toField='rotation' toNode='AnimationTransform'/> + </Scene> +</X3D> \ No newline at end of file diff --git a/examples/src/OpenDis7Examples/PduTrackLog.txt b/examples/src/OpenDis7Examples/PduTrackLog.txt index f4fa5841b51a0a787b5b417068917ec18814be2c..0b2504b53a2c34fe63025c896b08a51b02a2b563 100644 --- a/examples/src/OpenDis7Examples/PduTrackLog.txt +++ b/examples/src/OpenDis7Examples/PduTrackLog.txt @@ -14,14 +14,22 @@ run-single: ================================= <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 4.0//EN" "https://www.web3d.org/specifications/x3d-4.0.dtd"> -<X3D profile='Immersive' version='4.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-4.0.xsd'> +<X3D profile='Interchange' version='4.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-4.0.xsd'> <head> - <meta content='PduTrackInterpolator.x3d' name='title'/> - <meta content='PduTrack utility open-dis7-java Library https://github.com/open-dis/open-dis7-java' name='generator'/> + <meta content='PduTrackInterpolation.x3d' name='title'/> + <meta content='Don Brutzman' name='creator'/> + <meta content='https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/src/OpenDis7Examples/PduTrackInterpolation.x3d' name='identifier'/> + <meta content='Conversion of ESPDU track into X3D animation interpolators and LineSet.' name='description'/> + <meta content='PduTrack utility, open-dis7-java Library https://github.com/open-dis/open-dis7-java' name='generator'/> <meta content='NPS MOVES MV3500 Networked Graphics https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500' name='reference'/> + <meta content='X3D Resources https://www.web3d.org/x3d/content/examples/X3dResources.html' name='reference'/> + <meta content='X3D Scene Authoring Hints https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html' name='reference'/> + <meta content='X3D Tooltips https://www.web3d.org/x3d/tooltips/X3dTooltips.html' name='reference'/> + <meta content='X3D Validator https://savage.nps.edu/X3dValidator' name='reference'/> <meta content='Open source https://raw.githubusercontent.com/open-dis/open-dis7-java/master/license.html' name='license'/> </head> <Scene> + <WorldInfo title='PduTrackInterpolation.x3d'/> <TimeSensor DEF='PduTrackSelfTestClock' cycleInterval='5.0' loop='true'/> <PositionInterpolator DEF='PduTrackSelfTestPositions' key='0.0 1.0 2.0 3.0 4.0' keyValue=' 0.0 0.0 0.0, @@ -30,13 +38,36 @@ run-single: 3.0 3.0 3.0, 4.0 4.0 4.0'/> <OrientationInterpolator DEF='PduTrackSelfTestOrientations' key='0.0 1.0 2.0 3.0 4.0' keyValue=' -0.0 1.0 0.0 0.0, -0.0 1.0 0.0 0.0, -0.0 1.0 0.0 0.0, -0.0 1.0 0.0 0.0, -0.0 1.0 0.0 0.0'/> +0.0 1.0 0.0 0.7853982, +0.0 1.0 0.0 0.7853982, +0.0 1.0 0.0 0.7853982, +0.0 1.0 0.0 0.7853982, +0.0 1.0 0.0 0.7853982'/> <ROUTE fromField='fraction_changed' fromNode='PduTrackSelfTestClock' toField='set_fraction' toNode='PduTrackSelfTestPositions'/> <ROUTE fromField='fraction_changed' fromNode='PduTrackSelfTestClock' toField='set_fraction' toNode='PduTrackSelfTestOrientations'/> + <Shape> + <Appearance DEF='TrackAppearance'> + <Material emissiveColor='0.2 0.8 0.8'/> + </Appearance> + <LineSet vertexCount='5'> + <Coordinate point=' +0.0 0.0 0.0, +1.0 1.0 1.0, +2.0 2.0 2.0, +3.0 3.0 3.0, +4.0 4.0 4.0'/> + </LineSet> + </Shape> + <Transform DEF='AnimationTransform'> + <Transform rotation='0 0 1 1.57'> + <Shape> + <Appearance USE='TrackAppearance'/> + <Cone bottomRadius='0.5'/> + </Shape> + </Transform> + </Transform> + <ROUTE fromField='value_changed' fromNode='PduTrackSelfTestPositions' toField='translation' toNode='AnimationTransform'/> + <ROUTE fromField='value_changed' fromNode='PduTrackSelfTestOrientations' toField='rotation' toNode='AnimationTransform'/> </Scene> </X3D>