#X3D V3.0 utf8
# X3D-to-ClassicVRML XSL translation autogenerated by X3dToVrml97.xslt
# https://www.web3d.org/x3d/content/X3dToVrml97.xslt
# Generated using XSLT processor: Saxonica
PROFILE Immersive
# [X3D] version=3.0
# [X3D] noNamespaceSchemaLocation=https://www.web3d.org/specifications/x3d-3.0.xsd
# [head]
COMPONENT DIS:1
META "title" "EspduTransformPrototypes.x3d"
META "description" "Prototype definition for EspduTransform which handles network communications for multiple DIS Prototype Data Units (PDUs): EntityState, Collision, Detonate, Fire, CreateEntity and RemoveEntity. Also contains EspduTransformTrace which compatibly adds billboarded text-trace capabilities for run-time debugging inside a scene."
META "creator" "Don Brutzman, Don McGregor, and Duane Davis"
META "created" "7 December 2001"
META "modified" "14 October 2023"
META "warning" "under development but mostly complete. need articulationParameters and miscellany fields connected. ROUTE firstFired1/2 to sound node?"
META "reference" "/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl"
META "reference" "/vrtp/mil/navy/nps/dis/EspduTransform.java"
META "reference" "https://www.web3d.org/WorkingGroups/vrtp/mil/navy/nps/dis/EspduTransform.java"
META "reference" "https://www.web3d.org/x3d/content/examples/Basic/DistributedInteractiveSimulation/ExternProtoDeclareDefinitions.x3d"
META "reference" "DIS Find-It-Fast Guide at Simulation Interoperability Standards Organization (SISO)"
META "reference" "available via https://www.sisostds.org/DigitalLibrary.aspx?EntryId=16568"
META "identifier" "https://www.web3d.org/x3d/content/examples/Basic/DistributedInteractiveSimulation/EspduTransformPrototypes.x3d"
META "generator" "X3D-Edit 4.0, https://savage.nps.edu/X3D-Edit"
META "license" "../license.html"
# [Scene] ========== ========== ==========
# ============================================================
# Why a prototype rather than an Inline file? Prototyping allows replacement of standard VRML nodes (e.g. Transform) and can also expose events and fields to the encapsulating top-level scene.
# ============================================================
PROTO EspduTransform [
# [appinfo] EspduTransform is a networked Grouping node that can contain most nodes. Prototype definition for EspduTransform which handles network communications for multiple DIS Prototype Data Units (PDUs): EntityState Collision Detonate Fire CreateEntity and RemoveEntity.
outputOnly SFVec3d geoCoords_changed # [appinfo] Double precision output for 64-bit Espdu translation usable by georeferenced nodes.
# Standard Transform fields
inputOnly MFNode addChildren # [appinfo] Adding a node to the children field will add that node to the EspduTransform's set of children. Warning: adding any node to the EspduTransform's children field that is already in that child list is illegal. Warning: adding any node to the EspduTransform's children that is an ancestor of that grouping is illegal.
inputOnly MFNode removeChildren # [appinfo] The removeChildren event removes nodes from the EspduTransform's children field. Any nodes in the removeChildren event that are not in the EspduTransform's children list are ignored.
inputOutput MFNode children [ ] # [appinfo] Children nodes within translation and rotation coordinate system of EspduTransform. Hint: XML encoding can include child node(s) directly.
# default initialization is NULL node array
inputOutput SFVec3f translation 0 0 0 # [appinfo] Position of children relative to local coordinate system usually read from (or written to) remote networked EspduTransform nodes.
inputOutput SFRotation rotation 0 0 1 0 # [appinfo] Orientation of children relative to local coordinate system usually read from (or written to) remote networked EspduTransform nodes.
inputOutput SFVec3f center 0 0 0 # [appinfo] Translation offset from origin of local coordinate system.
inputOutput SFVec3f scale 1 1 1 # [appinfo] Non-uniform x-y-z scale of child coordinate system adjusted by center and scaleOrientation.
inputOutput SFRotation scaleOrientation 0 0 1 0 # [appinfo] Non-uniform x-y-z scale of child coordinate system adjusted by center and scaleOrientation.
initializeOnly SFVec3f bboxCenter 0 0 0 # [appinfo] Bounding box center: position offset from origin of local coordinate system.
initializeOnly SFVec3f bboxSize -1 -1 -1 # [appinfo] Bounding box size: automatically calculated can be specified as an optimization or constraint.
# Entity identity
inputOutput SFString marking "" # [appinfo] 0-to-11 character label for entity.
inputOutput SFInt32 siteID 0 # [appinfo] [065535] EntityID: unique ID for that site.
inputOutput SFInt32 applicationID 1 # [appinfo] [065535] EntityID: application ID unique ID for application at that site.
inputOutput SFInt32 entityID 0 # [appinfo] [065535] EntityID: unique ID for entity within that application.
# Networking configuration parameters
inputOutput SFString address "localhost" # [appinfo] multicast address or else "localhost" listens to local defaultBridge
inputOutput SFInt32 port 0 # [appinfo] [065535] multicast port or else listen to local defaultBridge
inputOutput SFString multicastRelayHost "" # [appinfo] Host name of multicast relay server to provide alternative connectivity if local native multicast traffic not heard.
inputOutput SFInt32 multicastRelayPort 0 # [appinfo] Connection port on multicast relay server.
inputOutput SFString networkMode "standAlone" # [appinfo] networkMode: standAlone (ignore network but still respond to local events), networkReader (listen to network as ghost entity), networkWriter (output to network as master entity at writeInterval)
outputOnly SFBool isStandAlone # [appinfo] Whether networkMode standAlone (ignore network but still respond to local events) is true/false
outputOnly SFBool isMaster # [appinfo] Whether networkMode 'networkWriter' (output to network as master entity at writeInterval) is true/false
outputOnly SFBool isRemote # [appinfo] Whether networkMode 'networkReader' (listen to network as ghost entity) is true/false
inputOutput SFTime readInterval 0.1 # [appinfo] seconds between read updates
inputOutput SFTime writeInterval 1.0 # [appinfo] seconds between write updates
outputOnly SFBool isActive # [appinfo] Indicates if the node has received a DIS message (isActive=true) or not (isActive=false). Since DIS entities can be considered inactive after some period of time (typically five seconds) either event may be received by listening nodes.
outputOnly SFTime timestamp # [appinfo] DIS timestamp in VRML units
initializeOnly SFBool rtpHeaderExpected FALSE # [appinfo] whether RTP header is expected to be prepended to DIS packet
outputOnly SFBool isRtpHeaderHeard # [appinfo] whether RTP header was found prepended to DIS packet
# Further identification
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFInt32 forceID 0 # [appinfo] [0255]
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFInt32 entityKind 0 # [appinfo] [0255]
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFInt32 entityDomain 0 # [appinfo] [0255]
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFInt32 entityCountry 0 # [appinfo] [065535]
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFInt32 entityCategory 0 # [appinfo] [0255]
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFInt32 entitySubCategory 0 # [appinfo] [0255]
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFInt32 entitySpecific 0 # [appinfo] [0255]
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFInt32 entityExtra 0 # [appinfo] [0255]
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFVec3f linearVelocity 0 0 0
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFVec3f linearAcceleration 0 0 0
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFInt32 deadReckoning 0 # [appinfo] Dead reckoning algorithm being used to project position/orientation with velocities/accelerations.
# Collision PDU events
outputOnly SFBool isCollided
outputOnly SFTime collideTime
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
outputOnly SFInt32 eventApplicationID # [appinfo] [065535]
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
outputOnly SFInt32 eventSiteID # [appinfo] [065535]
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
outputOnly SFInt32 eventEntityID # [appinfo] [065535]
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
outputOnly SFInt32 collisionType # [appinfo] [0255]
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
outputOnly SFInt32 eventNumber # [appinfo] [065535]
# Fire, Detonate PDU events
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFBool fired1 FALSE
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFBool fired2 FALSE
outputOnly SFTime firedTime
inputOutput SFVec3f munitionStartPoint 0 0 0
inputOutput SFVec3f munitionEndPoint 0 0 0
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFInt32 munitionApplicationID 0 # [appinfo] [065535]
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFInt32 munitionSiteID 0 # [appinfo] [065535]
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFInt32 munitionEntityID 0 # [appinfo] [065535]
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFInt32 fireMissionIndex 0 # [appinfo] [065535]
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFInt32 warhead 0 # [appinfo] [065535]
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFInt32 fuse 0 # [appinfo] [065535]
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFInt32 munitionQuantity 1 # [appinfo] [065535]
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFInt32 firingRate 1 # [appinfo] [065535]
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput SFFloat firingRange 0
outputOnly SFBool isDetonated
outputOnly SFTime detonateTime
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
outputOnly SFVec3f detonationLocation
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
outputOnly SFVec3f detonationRelativeLocation
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
outputOnly SFInt32 detonationResult
# Articulation parameters are extra blocks of information, appended one by one to end of regular Espdu.
inputOutput SFInt32 articulationParameterCount 0 # [appinfo] range [078]. Indicates the number of appended parameters that are being used to describe articulation of various segments of the entity model.
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput MFInt32 articulationParameterDesignatorArray [ ] # [appinfo] range [0255]. The Parameter Type Designator entries in the articulationParameterDesignatorArray indicate if the the parameter record is for an articulated or attached part. It is represented by an 8-bit enumeration.
# default initialization is NULL node array
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput MFInt32 articulationParameterChangeIndicatorArray [ ] # [appinfo] range [0255]. The Change Indicator entries in the articulationChangeIndicatorArray indicate the change of any parameter for the associated articulated part. This is specified by an 8-bit unsigned integer. The value is initially set to zero for each exercise and is sequentially incremented by one for each change in the articulation parameters. The proper indicator is updated automatically by an X3D DIS implementation upon receipt of a set_articulationParameterValue event.
# default initialization is NULL node array
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput MFInt32 articulationParameterIdPartAttachedToArray [ ] # [appinfo] range [065535]. The ID - Part Attached To entries in the articulationParameterIdPartAttachedToArray identify the articulated part to which this articulation parameter is attached. The value is specified by a 16-bit unsigned integer and is set to zero if the articulated part is attached directly to the entity.
# default initialization is NULL node array
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
inputOutput MFInt32 articulationParameterTypeArray [ ] # [appinfo] range [0255]. The Parameter Type entries in the articulationParameterTypeArray are specified by 32-bit enumeration values.
# default initialization is NULL node array
inputOutput MFFloat articulationParameterArray [ ] # [appinfo] The Parameter Value entries in the articulationParameterArray are specified by a 64-bit field. The definition of the 64 bits is determined based on the type of parameter indicated above.
# default initialization is NULL node array
inputOnly SFFloat set_articulationParameterValue0
inputOnly SFFloat set_articulationParameterValue1
inputOnly SFFloat set_articulationParameterValue2
inputOnly SFFloat set_articulationParameterValue3
inputOnly SFFloat set_articulationParameterValue4
inputOnly SFFloat set_articulationParameterValue5
inputOnly SFFloat set_articulationParameterValue6
inputOnly SFFloat set_articulationParameterValue7
outputOnly SFFloat articulationParameterValue0_changed
outputOnly SFFloat articulationParameterValue1_changed
outputOnly SFFloat articulationParameterValue2_changed
outputOnly SFFloat articulationParameterValue3_changed
outputOnly SFFloat articulationParameterValue4_changed
outputOnly SFFloat articulationParameterValue5_changed
outputOnly SFFloat articulationParameterValue6_changed
outputOnly SFFloat articulationParameterValue7_changed
] {
DEF DisTransformNode Transform {
addChildren IS addChildren
removeChildren IS removeChildren
children IS children
translation IS translation
rotation IS rotation
center IS center
scale IS scale
scaleOrientation IS scaleOrientation
bboxCenter IS bboxCenter
bboxSize IS bboxSize
}
DEF CacheExposedFieldNodes Group {
children [
# This first set of nodes are not rendered and only hold exposedField state. This hack is necessary to work around the restriction on exposedFields directly in Script nodes.
DEF MarkingState Anchor {
description IS marking
}
DEF SiteIdState Switch {
whichChoice -1
whichChoice IS siteID
}
DEF ApplicationIdState Switch {
whichChoice -1
whichChoice IS applicationID
}
DEF EntityIdState Switch {
whichChoice -1
whichChoice IS entityID
}
DEF NetworkModeState Anchor {
description IS networkMode
}
DEF ReaderState NavigationInfo {
headlight IS isRemote
}
DEF MasterState NavigationInfo {
headlight IS isMaster
}
DEF LocalState NavigationInfo {
headlight IS isStandAlone
}
DEF ReadWriteIntervalState TimeSensor {
startTime IS readInterval
stopTime IS writeInterval
}
DEF MunitionPointNode Transform {
translation IS munitionStartPoint
center IS munitionEndPoint
}
Switch {
whichChoice -1
children [
DEF AddressHolder Anchor {
description IS address
}
DEF MulticastAddressHolder Anchor {
description IS multicastRelayHost
}
DEF PortHolder Switch {
whichChoice -1
whichChoice IS port
}
DEF MulticastPortHolder Switch {
whichChoice -1
whichChoice IS multicastRelayPort
}
DEF ArticulationParameterCountHolder Switch {
whichChoice -1
whichChoice IS articulationParameterCount
}
DEF ArticulationParameterArrayHolder ScalarInterpolator {
keyValue IS articulationParameterArray
}
]
}
]
}
DEF NetworkingScriptAndReadWriteClocks Group {
children [
# Fields in the Script are directly mapped to the PrototypeDeclare field-tag interfaces by using the IS construct
# Warning: VRML97-style scripting, not X3D Scene Authoring Interface (SAI)
DEF EspduScriptNode Script {
# Generic events
outputOnly SFVec3d geoCoords_changed IS geoCoords_changed # [appinfo] Double precision outputs for 64-bit Espdu translation.
initializeOnly SFBool traceJava FALSE
inputOnly SFTime update # [appinfo] Used by TimeSensor clocks to trigger processEvents() method.
initializeOnly SFNode transformNode USE DisTransformNode
initializeOnly SFNode markingNode USE MarkingState
# Initialization fields
initializeOnly SFNode siteIdNode USE SiteIdState
initializeOnly SFNode applicationIdNode USE ApplicationIdState
initializeOnly SFNode entityIdNode USE EntityIdState
initializeOnly SFNode addressNode USE AddressHolder
initializeOnly SFNode multicastAddressNode USE MulticastAddressHolder
initializeOnly SFNode portNode USE PortHolder
initializeOnly SFNode multicastPortNode USE MulticastPortHolder
initializeOnly SFNode networkModeNode USE NetworkModeState
initializeOnly SFNode readWriteIntervalNode USE ReadWriteIntervalState
outputOnly SFBool isActive IS isActive
outputOnly SFTime timestamp IS timestamp
initializeOnly SFBool rtpHeaderExpected IS rtpHeaderExpected
outputOnly SFBool isRtpHeaderHeard IS isRtpHeaderHeard
outputOnly SFBool isCollided IS isCollided
outputOnly SFTime collideTime IS collideTime
outputOnly SFBool isDetonated IS isDetonated
outputOnly SFTime detonateTime IS detonateTime
outputOnly SFTime firedTime IS firedTime
initializeOnly SFNode munitionPointNode USE MunitionPointNode
initializeOnly SFNode articulationParameterCountNode USE ArticulationParameterCountHolder
initializeOnly SFNode articulationParameterArrayNode USE ArticulationParameterArrayHolder
inputOnly SFFloat set_articulationParameterValue0 IS set_articulationParameterValue0
inputOnly SFFloat set_articulationParameterValue1 IS set_articulationParameterValue1
inputOnly SFFloat set_articulationParameterValue2 IS set_articulationParameterValue2
inputOnly SFFloat set_articulationParameterValue3 IS set_articulationParameterValue3
inputOnly SFFloat set_articulationParameterValue4 IS set_articulationParameterValue4
inputOnly SFFloat set_articulationParameterValue5 IS set_articulationParameterValue5
inputOnly SFFloat set_articulationParameterValue6 IS set_articulationParameterValue6
inputOnly SFFloat set_articulationParameterValue7 IS set_articulationParameterValue7
outputOnly SFFloat articulationParameterValue0_changed IS articulationParameterValue0_changed
outputOnly SFFloat articulationParameterValue1_changed IS articulationParameterValue1_changed
outputOnly SFFloat articulationParameterValue2_changed IS articulationParameterValue2_changed
outputOnly SFFloat articulationParameterValue3_changed IS articulationParameterValue3_changed
outputOnly SFFloat articulationParameterValue4_changed IS articulationParameterValue4_changed
outputOnly SFFloat articulationParameterValue5_changed IS articulationParameterValue5_changed
outputOnly SFFloat articulationParameterValue6_changed IS articulationParameterValue6_changed
outputOnly SFFloat articulationParameterValue7_changed IS articulationParameterValue7_changed
directOutput TRUE
mustEvaluate TRUE
# Generic events
# Initialization fields
# Generic events
# Initialization fields
url [ "EspduTransform.class" "/vrtp/mil/navy/nps/dis/EspduTransform.class" "dis-java-vrml.jar#EspduTransform.class" "/vrtp/dis-java-vrml.jar#EspduTransform.class" "file:///c:/vrtp/mil/navy/nps/dis/EspduTransform.class" "https://www.web3d.org/x3d/content/examples/Basic/DistributedInteractiveSimulation/EspduTransform.class"
]
}
# Clocks stimulate the processEvents() method in the Script code, resulting in DIS PDU reads/writes. The 'update' eventIn is implicit (i.e. no corresponding Java method is needed).
DEF ReadIntervalClock TimeSensor {
loop TRUE
cycleInterval IS readInterval
}
DEF WriteIntervalClock TimeSensor {
loop TRUE
cycleInterval IS writeInterval
}
]
ROUTE ReadIntervalClock.cycleTime TO EspduScriptNode.update
ROUTE WriteIntervalClock.cycleTime TO EspduScriptNode.update
}
}
# ============================================================
PROTO EspduTransformTrace [
# [appinfo] EspduTransformTrace provides 3D trace values for a corresponding EspduTransorm usually as a child so that it stays local to an entity's position. EspduTransformTrace compatibly adds billboarded text-trace capabilities for run-time debugging inside a scene.
# Special trace fields (beyond regular EspduTransform signature)
initializeOnly SFNode espduTransformNode NULL # [appinfo] initialize with so that networked data is passed by reference
# provide i.e. copy-by=reference node to initialize
initializeOnly SFColor traceColor 1 0.4 0.05 # [appinfo] Trace text color
initializeOnly SFVec3f traceOffset 0 2.5 0 # [appinfo] Trace text position relative to entity
initializeOnly SFFloat traceFontSize 0.8 # [appinfo] Trace text scale
initializeOnly SFBool traceJava FALSE # [appinfo] whether or not to include verbose trace comments in Java console in order to help debug network connectivity
initializeOnly SFBool localTraceEnabled FALSE # [appinfo] Whether EspduTransformTrace debug scripting is visible inside the X3D scene
] {
Group {
children [
DEF PrimaryControlScripts Group {
children [
# Warning: VRML97-style scripting, not X3D Scene Authoring Interface (SAI)
# OverriddenDefaultEspduTransformNode
DEF TraceScript Script {
initializeOnly SFNode espduTransformNode IS espduTransformNode # [appinfo] initialize with
initializeOnly SFColor traceColor IS traceColor # [appinfo] Trace text color
initializeOnly SFVec3f traceOffset IS traceOffset # [appinfo] Trace text position relative to entity
initializeOnly SFFloat traceFontSize IS traceFontSize # [appinfo] Trace text scale
initializeOnly SFBool traceJava IS traceJava # [appinfo] (not passable???) whether or not to include verbose trace comments in Java console in order to help debug network connectivity
initializeOnly SFBool localTraceEnabled IS localTraceEnabled # [appinfo] Whether EspduTransformTrace debug scripting has verbose output
inputOnly SFBool touched
inputOnly SFTime update # [appinfo] Used by TimeSensor clocks to trigger processEvents() method.
# Changed-value outputs
outputOnly SFString marking
outputOnly SFTime readInterval
outputOnly SFTime writeInterval
outputOnly SFBool fired1
outputOnly SFBool fired2
outputOnly SFTime fireTime
outputOnly MFString traceString
# other internal state variables
initializeOnly SFString prior_marking ""
initializeOnly SFTime prior_readInterval -1
initializeOnly SFTime prior_writeInterval -1
initializeOnly SFBool prior_fired1 FALSE
initializeOnly SFBool prior_fired2 FALSE
initializeOnly SFVec3f prior_translation 0 0 0
initializeOnly SFVec3d prior_geoCoords_changed 0 0 0 # unknown type!
directOutput TRUE
mustEvaluate TRUE
# Changed-value outputs
# other internal state variables
# Changed-value outputs
# other internal state variables
url [ "ecmascript: // ### X3D Browser.print() not supported by all VRML97 viewers, instead simply using print()
function initialize ()
{
tracePrint('TraceScript initialize() start...');
tracePrint('traceColor=' + traceColor);
tracePrint('traceOffset=' + traceOffset);
tracePrint('traceFontSize=' + traceFontSize);
tracePrint('traceJava=' + traceJava);
tracePrint('marking=' + espduTransformNode.marking);
tracePrint('address=' + espduTransformNode.address);
tracePrint(' port=' + espduTransformNode.port);
tracePrint('networkMode=' + espduTransformNode.networkMode);
if (espduTransformNode.networkMode == 'networkReader')
{
readInterval = espduTransformNode.readInterval;
writeInterval = 0;
}
if (espduTransformNode.networkMode == 'networkWriter')
{
readInterval = 0;
writeInterval = espduTransformNode.writeInterval;
}
tracePrint('readInterval=' + espduTransformNode.readInterval);
tracePrint('writeInterval=' + espduTransformNode.writeInterval);
prior_marking = espduTransformNode.marking;
prior_readInterval = espduTransformNode.readInterval;
prior_writeInterval = espduTransformNode.writeInterval;
prior_translation = espduTransformNode.translation;
prior_geoCoords_changed = espduTransformNode.geoCoords_changed;
prior_fired1 = espduTransformNode.fired1;
prior_fired2 = espduTransformNode.fired2;
outputString1 = espduTransformNode.marking + ' (' +
espduTransformNode.siteID + ', ' +
espduTransformNode.applicationID + ', ' +
espduTransformNode.entityID + ')';
outputString2 = 'awaiting PDUs...';
traceString = new MFString (outputString1, outputString2);
tracePrint ('traceString=' + traceString);
// if (offsetFollowsEspduTransform)
// {
// // create ROUTEs to connect parent EspduTransform
// }
tracePrint('TraceScript initialize() finish.');
}
function touched (isActiveValue, timestamp)
{
tracePrint ('touched=' + isActiveValue + ', no action');
}
function update (value, timestamp)
{
// tracePrint('begin update() ...');
changed = false; // only send output events when changed
if (prior_marking != espduTransformNode.marking)
{
tracePrint('update() changed marking');
marking = espduTransformNode.marking;
prior_marking = marking;
changed = true;
}
if (prior_readInterval != espduTransformNode.readInterval)
{
tracePrint('update() changed readInterval');
readInterval = espduTransformNode.readInterval;
prior_readInterval = espduTransformNode.readInterval;
changed = true;
}
if (prior_writeInterval != espduTransformNode.writeInterval)
{
tracePrint('update() changed writeInterval');
writeInterval = espduTransformNode.writeInterval;
prior_writeInterval = espduTransformNode.writeInterval;
changed = true;
}
if ( (prior_translation.x != espduTransformNode.translation.x) ||
(prior_translation.y != espduTransformNode.translation.y) ||
(prior_translation.z != espduTransformNode.translation.z))
{
tracePrint('update() changed translation');
prior_translation = espduTransformNode.translation;
changed = true;
}
if (prior_geoCoords_changed != espduTransformNode.geoCoords_changed)
{
tracePrint('update() changed geoCoords_changed');
prior_geoCoords_changed = espduTransformNode.geoCoords_changed;
changed = true;
}
// tracePrint('espduTransformNode.translation=' + espduTransformNode.translation);
// tracePrint('prior_translation=' + prior_translation);
// tracePrint('prior_geoCoords_changed=' + prior_geoCoords_changed);
if (prior_fired1 != espduTransformNode.fired1)
{
tracePrint('update() changed fired1');
fired1 = espduTransformNode.fired1;
fireTime = timestamp;
prior_fired1 = espduTransformNode.fired1;
changed = true;
}
if (prior_fired2 != espduTransformNode.fired2)
{
tracePrint('update() changed fired2');
fired2 = espduTransformNode.fired2;
fireTime = timestamp;
prior_fired2 = espduTransformNode.fired2;
changed = true;
}
if (changed == true) // produce, then send trace text
{
tracePrint('update() changed == true');
outputString1 = espduTransformNode.marking + ' (' +
espduTransformNode.siteID + ', ' +
espduTransformNode.applicationID + ', ' +
espduTransformNode.entityID + ')';
outputString2 = prior_geoCoords_changed;
traceString = new MFString (outputString1, outputString2);
}
tracePrint('end update() changed=' + changed);
}
function roundoff (x)
{
return Math.round(x * 10) / 10;
}
function tracePrint(outputString)
{
if (localTraceEnabled)
Browser.println ('[EspduTransformTrace ' + espduTransformNode.marking + '] ' + outputString);
}
function alwaysPrint(outputString)
{
Browser.println ('[EspduTransformTrace ' + espduTransformNode.marking + '] ' + outputString);
}
" ]
}
# Clocks stimulate the processEvents() method
DEF ReadIntervalTraceClock TimeSensor {
loop TRUE
}
DEF WriteIntervalTraceClock TimeSensor {
loop TRUE
}
# Warning: VRML97-style scripting, not X3D Scene Authoring Interface (SAI)
DEF DEBUG_JAVASCRIPT Script {
initializeOnly SFNode espduTransformNode IS espduTransformNode # [appinfo] initialize with
initializeOnly SFBool localTraceEnabled IS localTraceEnabled # [appinfo] Whether EspduTransformTrace debug scripting has verbose output
inputOnly SFInt32 articulationParameterCount
outputOnly MFString MFmarking
inputOnly SFRotation set_rotation
inputOnly SFTime timestamp
inputOnly SFVec3f set_translation
inputOnly SFBool detonated
outputOnly MFString marking_address_text
outputOnly SFBool result
initializeOnly SFInt32 entityID 0
outputOnly MFString translation_text
initializeOnly SFInt32 port 0
inputOnly SFBool collided
inputOnly SFBool rtpHeaderHeard
outputOnly MFString rotation_text
initializeOnly SFInt32 applicationID 0
initializeOnly SFString address ""
initializeOnly SFBool active TRUE
inputOnly SFTime touch
initializeOnly SFString marking ""
initializeOnly SFInt32 siteID 0
directOutput TRUE
url [ "ecmascript: // ### X3D Browser.print() not supported by all VRML97 viewers, instead simply using print()
function initialize ( )
{
tracePrint ('DEBUG_JAVASCRIPT initialize() start...');
translation_text[0] = espduTransformNode.marking + ' awaiting DIS';
// rotation_text [0] = 'translation and rotation updates';
// marking_address_text[0] = 'multicast group: ' + address +'/' + port + ', ID:'// + siteID + ',' + applicationID + ',' + entityID;
MFmarking[0] = espduTransformNode.marking;
tracePrint ('DEBUG_JAVASCRIPT initialize() finish.');
}
function set_translation ( translation, ts )
{
if (active) {
// round to nearest tenth
translation.x = Math.round (translation.x * 10.0) / 10.0;
translation.y = Math.round (translation.y * 10.0) / 10.0;
translation.z = Math.round (translation.z * 10.0) / 10.0;
translation_text[0] = marking + ' translation ' + translation;
}
}
function set_rotation ( rotation, ts )
{
if (active) {
// round terms to nearest thousandth
rotation.x = Math.round (rotation.x * 1000.0) / 1000.0;
rotation.y = Math.round (rotation.y * 1000.0) / 1000.0;
rotation.z = Math.round (rotation.z * 1000.0) / 1000.0;
rotation.angle = (rotation.angle * 180.0) / 3.141592653;
rotation.angle = Math.round (rotation.angle * 10.0) / 10.0;
// rotation_text [0] = 'rotation ' + rotation + ' axis/degrees';
}
}
function touch (value, time)
{
active = !active;
result = active;
if (result) {
translation_text[0] = marking + ' awaiting DIS';
// rotation_text [0] = 'translation and rotation updates';
// marking_address_text[0] = 'multicast group: ' + address +'/' + port + ', ID:'// + siteID + ',' + applicationID + ',' + entityID;
MFmarking[0] = marking;
} else {
translation_text[0] = '';
rotation_text [0] = '';
marking_address_text[0] = '';
MFmarking[0] = '';
}
}
function timestamp ( value, ts ) {
tracePrint ('DIS timestamp=' + value + ', event timestamp=' + ts);
}
function collided ( value, ts ) {
tracePrint ('collided=' + value);
}
function detonated ( value, ts ) {
tracePrint ('detonated=' + value);
}
function articulationParameterCount ( value, ts ) {
tracePrint ('articulationParameterCount=' + value);
}
function articulationParameterValue0 ( value, ts ) {
tracePrint ('articulationParameterValue0=' + value);
}
function articulationParameterValue1 ( value, ts ) {
tracePrint ('articulationParameterValue1=' + value);
}
function articulationParameterValue2 ( value, ts ) {
tracePrint ('articulationParameterValue2=' + value);
}
function articulationParameterValue3 ( value, ts ) {
tracePrint ('articulationParameterValue3=' + value);
}
function articulationParameterValue4 ( value, ts ) {
tracePrint ('articulationParameterValue4=' + value);
}
function articulationParameterValue5 ( value, ts ) {
tracePrint ('articulationParameterValue5=' + value);
}
function articulationParameterValue6 ( value, ts ) {
tracePrint ('articulationParameterValue6=' + value);
}
function articulationParameterValue7 ( value, ts ) {
tracePrint ('articulationParameterValue7=' + value);
}
function articulationParameterValue8 ( value, ts ) {
tracePrint ('articulationParameterValue8=' + value);
}
function articulationParameterValue9 ( value, ts ) {
tracePrint ('articulationParameterValue9=' + value);
}
function articulationParameterValue10 ( value, ts ) {
tracePrint ('articulationParameterValue10=' + value);
}
function articulationParameterValue11 ( value, ts ) {
tracePrint ('articulationParameterValue11=' + value);
}
function articulationParameterValue12 ( value, ts ) {
tracePrint ('articulationParameterValue12=' + value);
}
function articulationParameterValue13 ( value, ts ) {
tracePrint ('articulationParameterValue13=' + value);
}
function articulationParameterValue14 ( value, ts ) {
tracePrint ('articulationParameterValue14=' + value);
}
function munitionStartPoint ( value, ts ) {
tracePrint ('munitionStartPoint=' + value);
}
function munitionEndPoint ( value, ts ) {
tracePrint ('munitionEndPoint=' + value);
}
function rtpHeaderHeard ( value, ts ) {
tracePrint ('unexpected RTP header status, rtpHeaderHeard=' + value);
}
function tracePrint(outputString)
{
if (localTraceEnabled)
Browser.println ('[EspduTransformTrace ' + espduTransformNode.marking + '] ' + outputString);
}
function alwaysPrint(outputString)
{
Browser.println ('[EspduTransformTrace ' + espduTransformNode.marking + '] ' + outputString);
}
" ]
}
]
ROUTE TraceScript.readInterval TO ReadIntervalTraceClock.cycleInterval
ROUTE ReadIntervalTraceClock.cycleTime TO TraceScript.update
ROUTE TraceScript.writeInterval TO WriteIntervalTraceClock.cycleInterval
ROUTE WriteIntervalTraceClock.cycleTime TO TraceScript.update
}
DEF TouchToActivateGroup Group {
children [
DEF ActivationTouchSensor TouchSensor {
description "Touch trace text to toggle simple or verbose"
}
LOD {
range [ 300.0 3000.0 40000.0 ]
children [
Transform {
translation IS traceOffset
children [
Billboard {
children [
Shape {
appearance Appearance {
material DEF TextColor Material {
diffuseColor 0 0 0
emissiveColor IS traceColor
}
}
geometry DEF TraceText Text {
fontStyle DEF TraceFont FontStyle {
justify [ "MIDDLE" "MIDDLE" ]
size IS traceFontSize
}
}
}
Transform {
translation 0.0 -0.25 0.0
children [
Shape {
appearance Appearance {
material USE TextColor
}
geometry DEF DEBUG_ROTATION Text {
fontStyle USE TraceFont
}
}
]
}
Transform {
translation 0.0 -0.5 0.0
children [
Shape {
appearance Appearance {
material USE TextColor
}
geometry DEF DEBUG_MARKING_ADDRESS Text {
fontStyle USE TraceFont
}
}
]
}
]
ROUTE TraceScript.traceString TO TraceText.string
}
]
}
WorldInfo {
}
Billboard {
axisOfRotation 0.0 0.0 0.0
children [
Transform {
translation 0.0 800.0 0.0
children [
Shape {
appearance Appearance {
material USE TextColor
}
geometry DEF LONG_RANGE_MARKING Text {
fontStyle FontStyle {
justify [ "MIDDLE" "MIDDLE" ]
size 125.0
### style='BOLD'
}
}
}
]
}
Transform {
translation 0.0 40.0 0.0
children [
Shape {
appearance Appearance {
material USE TextColor
}
geometry Box {
size 50.0 50.0 50.0
}
}
]
}
]
}
WorldInfo {
}
]
}
]
ROUTE ActivationTouchSensor.isActive TO TraceScript.touched
}
DEF LineOfFireGroup Group {
children [
Shape {
appearance Appearance {
material Material {
emissiveColor 0.3 0.15 0.15
}
}
geometry IndexedLineSet {
colorIndex [ 0 1 -1 ]
coordIndex [ 0 1 -1 ]
color Color {
color [ 0.0 1.0 0.0 1.0 0.0 0.0 ]
}
coord DEF LineOfFireCoordinateNode Coordinate {
point [ 0.0 0.0 0.0 0.0 0.0 20.0 ]
}
}
}
# Warning: VRML97-style scripting, not X3D Scene Authoring Interface (SAI)
DEF SetFireLineEndpoints Script {
inputOnly SFVec3f set_munitionStartPoint
inputOnly SFVec3f set_munitionEndPoint
initializeOnly MFVec3f holdArray [ ]
# default initialization is NULL node array
outputOnly MFVec3f pointArray
# default initialization is NULL node array
initializeOnly SFBool localTraceEnabled IS localTraceEnabled # [appinfo] Whether EspduTransformTrace debug scripting has verbose output
url [ "ecmascript: // ### X3D Browser.print() not supported by all VRML97 viewers, instead simply using print()
function initialize ( )
{
tracePrint ('SetFireLineEndpoints initialize() start...');
holdArray [0] = new SFVec3f (0.0, 0.0, 0.0);
holdArray [1] = new SFVec3f (0.0, 0.0, 0.0);
pointArray = holdArray;
tracePrint ('SetFireLineEndpoints initialize() start...');
}
function set_munitionStartPoint ( value, timestamp )
{
holdArray [0] = value;
}
function set_munitionEndPoint ( value, timestamp )
{
holdArray [1] = value;
pointArray = holdArray;
// tracePrint ('fire line endpoints=' + holdArray);
}
function tracePrint(outputString)
{
if (localTraceEnabled)
Browser.println ('[EspduTransformTrace SetFireLineEndpoints] ' + outputString);
}
function alwaysPrint(outputString)
{
Browser.println ('[EspduTransformTrace SetFireLineEndpoints] ' + outputString);
}
" ]
}
# Needed?
# Warning: VRML97-style scripting, not X3D Scene Authoring Interface (SAI)
DEF FireSequenceScript Script {
inputOnly SFBool set_fired1
inputOnly SFBool set_fired2
inputOnly SFTime fireTime
outputOnly SFBool firstFired1
outputOnly SFBool firstFired2
initializeOnly SFBool localTraceEnabled IS localTraceEnabled # [appinfo] Whether EspduTransformTrace debug scripting has verbose output
mustEvaluate TRUE
url [ "ecmascript: // ### X3D Browser.print() not supported by all VRML97 viewers, instead simply using print()
function initialize ( )
{
tracePrint ('FireSequenceScript initialize() start...');
firstFired1 = false;
firstFired2 = false;
tracePrint ('FireSequenceScript initialize() finish.');
}
function fireTime (value, timestamp)
{
// no action
}
function set_fired1 (value, timestamp)
{
if ((value == true) && (firstFired1 == false))
{
firstFired1 = true;
tracePrint ('EspduTransformPROTO.wrl: fired1 FIRE_SEQUENCE_SCRIPT timestamp ' + fireTime);
}
}
function set_fired2 (value, timestamp)
{
if ((value == true) && (firstFired1 == false))
{
firstFired2 = true;
tracePrint ('EspduTransformPROTO.wrl: fired2 FIRE_SEQUENCE_SCRIPT timestamp ' + fireTime);
}
}
function tracePrint(outputString)
{
if (localTraceEnabled)
Browser.println ('[EspduTransformTrace FireSequenceScript] ' + outputString);
}
function alwaysPrint(outputString)
{
Browser.println ('[EspduTransformTrace FireSequenceScript] ' + outputString);
}
" ]
}
# ROUTE firstFired1/2 to sound node?
]
ROUTE SetFireLineEndpoints.pointArray TO LineOfFireCoordinateNode.set_point
ROUTE TraceScript.fired1 TO FireSequenceScript.set_fired1
ROUTE TraceScript.fired2 TO FireSequenceScript.set_fired2
ROUTE TraceScript.fireTime TO FireSequenceScript.fireTime
}
]
}
}
# ============================================================
# Begin rendered scene
# Ensure that instances of this node are placed at the top-most level and are not translated away from the local world coordinates origin.
DEF EspduTrans EspduTransform {
address "224.2.181.145"
marking "Example PDU"
networkMode "networkReader"
port 62040
readInterval 10
writeInterval 10
children [
Viewpoint {
description "moving viewpoint"
}
Shape {
geometry Text {
string [ "EspduTransform body goes here" ]
fontStyle DEF FontJustifyMiddle FontStyle {
justify [ "MIDDLE" "MIDDLE" ]
}
}
appearance Appearance {
material Material {
diffuseColor 0 0.6 0.6
}
}
}
# Typically place EspduTransformTrace as a child of corresponding EspduTransform so that outputs are positioned relatively.
]
}
DEF TraceTransform Transform {
children [
# EspduTransformTrace cannot be a direct child of EspduTransform or a directed-acyclic graph (DAG) error occurs
# EspduTransformTrace must be translated for trace text to stay local to parent EspduTransform
EspduTransformTrace {
espduTransformNode [
USE EspduTrans
]
traceColor 0.9 0.4 0.2
traceFontSize 0.8
traceJava TRUE
localTraceEnabled TRUE
}
]
ROUTE EspduTrans.translation TO TraceTransform.set_translation
ROUTE EspduTrans.rotation TO TraceTransform.set_rotation
}