X3D Model Documentation: HeadsUpDisplayPrototype.x3d

  1  <?xml version="1.0" encoding="UTF-8"?>
  2 
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
  3  <X3D profile='Immersive' version='3.0 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.0.xsd'>
  4       <head>
  5            <meta name='titlecontent=' HeadsUpDisplayPrototype.x3d '/>
  6            <meta name='descriptioncontent='Generic Heads Up Display (HUD) prototype to keep children on screen.'/>
  7            <meta name='creatorcontent='Don Brutzman'/>
  8            <meta name='createdcontent='9 November 2003'/>
  9            <meta name='modifiedcontent='28 November 2019'/>
 10            <meta name='subjectcontent='HUD Heads Up Display'/>
 11            <meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/HeadsUpDisplayPrototype.x3d '/>
 12            <meta name='generatorcontent='X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit'/>
 13            <meta name='licensecontent='../../license.html'/>
 14       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top DEF nodes index: DragGeometry, FixedLocation, LocationOffset, MovableLocation, MovementVisibilitySensor, PlaneMovementSensor, PlaneMovementSensorGroup, VisibilityControlScript, WhereSensor

Index for ProtoDeclare definition: HeadsUpDisplay
-->
 15       <Scene>
 16            <WorldInfo title='HeadsUpDisplayPrototype.x3d'/>
 17            <ProtoDeclare name='HeadsUpDisplayappinfo='HeadsUpDisplay positions child geometry in screen space, movable by the user'>
 18                 <ProtoInterface>
 19                      <field name='childrentype='MFNodeaccessType='inputOutput'
                     appinfo='Displayed subscene positioned as a HUD.'>
 20                           <!-- default is null array of nodes -->
 21                      </field>
 22                      <field name='dragChildrentype='MFNodeaccessType='inputOutput'
                     appinfo='Additional HUD geometry which can be touched and dragged for repositioning. If this geometry goes offscreen (perhaps due to screen resizing) then it snaps back to original position.'>
 23                           <!-- default is null array of nodes -->
 24                      </field>
 25                      <field name='locationOffsettype='SFVec3fvalue='-2 -2 0accessType='initializeOnly'
                     appinfo='Modified screen location and distance (for size).'/>
 26                      <field name='traceEnabledtype='SFBoolvalue='falseaccessType='initializeOnly'
                     appinfo='Enable/disable console output for troubleshooting.'/>
 27                 </ProtoInterface>
 28                 <ProtoBody>
 29                      <Group>
 30 
                         <!-- ROUTE information for WhereSensor node:  [from position_changed to FixedLocation.set_translation ] [from orientation_changed to FixedLocation.set_rotation ] -->
                         <ProximitySensor DEF='WhereSensorsize='1000000000 1000000000 1000000000'>
 31                                <IS>
 32                                     <connect nodeField='centerprotoField='locationOffset'/>
 33                                </IS>
 34                           </ProximitySensor>
 35 
                         <!-- ROUTE information for FixedLocation node:  [from WhereSensor.position_changed to set_translation ] [from WhereSensor.orientation_changed to set_rotation ] -->
                         <Transform DEF='FixedLocation'>
 36 
                              <!-- ROUTE information for MovableLocation node:  [from PlaneMovementSensor.translation_changed to set_translation ] [from VisibilityControlScript.translationChanged to set_translation ] -->
                              <Transform DEF='MovableLocation'>
 37                                     <Transform DEF='LocationOffset'>
 38                                          <IS>
 39                                               <connect nodeField='translationprotoField='locationOffset'/>
 40                                          </IS>
 41                                          <Transform translation='0 0 -10'>
 42                                               <Group>
 43                                                    <IS>
 44                                                         <connect nodeField='childrenprotoField='children'/>
 45                                                    </IS>
 46                                               </Group>
 47                                               <Group DEF='PlaneMovementSensorGroup'>
 48                                                    <Group DEF='DragGeometry'>
 49                                                         <IS>
 50                                                              <connect nodeField='childrenprotoField='dragChildren'/>
 51                                                         </IS>
 52                                                    </Group>
 53 
                                                  <!-- ROUTE information for PlaneMovementSensor node:  [from VisibilityControlScript.translationOffsetChanged to set_offset ] [from isActive to VisibilityControlScript.setPlaneSensorIsActive ] [from translation_changed to VisibilityControlScript.setPlaneSensorTranslation ] [from translation_changed to MovableLocation.set_translation ] -->
                                                  <PlaneSensor DEF='PlaneMovementSensordescription='click and drag to move interface'>
 54                                                         <IS>
 55                                                              <connect nodeField='offsetprotoField='locationOffset'/>
 56                                                         </IS>
 57                                                    </PlaneSensor>
 58 
                                                  <!-- ROUTE information for MovementVisibilitySensor node:  [from isActive to VisibilityControlScript.setIsVisible ] -->
                                                  <VisibilitySensor DEF='MovementVisibilitySensor'/>
 59 
                                                  <!-- ROUTE information for VisibilityControlScript node:  [from PlaneMovementSensor.isActive to setPlaneSensorIsActive ] [from PlaneMovementSensor.translation_changed to setPlaneSensorTranslation ] [from MovementVisibilitySensor.isActive to setIsVisible ] [from translationChanged to MovableLocation.set_translation ] [from translationOffsetChanged to PlaneMovementSensor.set_offset ] -->
                                                  <Script DEF='VisibilityControlScript'>
 60                                                         <field name='traceEnabledtype='SFBoolaccessType='initializeOnly'/>
 61                                                         <field name='isVisibletype='SFBoolvalue='trueaccessType='initializeOnly'/>
 62                                                         <field name='planeSensorTranslationtype='SFVec3fvalue='0 0 0accessType='initializeOnly'/>
 63                                                         <field name='setIsVisibletype='SFBoolaccessType='inputOnly'/>
 64                                                         <field name='setPlaneSensorIsActivetype='SFBoolaccessType='inputOnly'/>
 65                                                         <field name='setPlaneSensorTranslationtype='SFVec3faccessType='inputOnly'/>
 66                                                         <field name='translationChangedtype='SFVec3faccessType='outputOnly'/>
 67                                                         <field name='translationOffsetChangedtype='SFVec3faccessType='outputOnly'/>
 68                                                         <IS>
 69                                                              <connect nodeField='traceEnabledprotoField='traceEnabled'/>
 70                                                         </IS>
  <![CDATA[
                      
ecmascript:

function tracePrint (text)
{
	if (traceEnabled) Browser.println ('[HeadsUpDisplayPrototype VisibilityControlScript] ' + text);
}
function setIsVisible (value, timeStamp)
{
	isVisible = value;
	tracePrint('isVisible=' + value);
}
function setPlaneSensorIsActive (value, timeStamp)
{
	tracePrint('PlaneSensor isActive=' + value);

	if (value == false)
	{
		tracePrint('planeSensorTranslation=' + planeSensorTranslation);
		if (isVisible)
		{
			translationChanged = planeSensorTranslation;
		}
		else
		{
			// fell off screen, reset to center
			translationChanged = new SFVec3f(0, 0, 0);
			translationOffsetChanged  = new SFVec3f(0, 0, 0);
		}
	}
}
function setPlaneSensorTranslation (value, timeStamp)
{
	planeSensorTranslation = value;
	tracePrint('planeSensorTranslation=' + value);
}

                    
]]>
 72                                                    </Script>
 73                                                    < ROUTE  fromNode='PlaneMovementSensor' fromField='isActive' toNode='VisibilityControlScript' toField='setPlaneSensorIsActive'/>
 74                                                    < ROUTE  fromNode='PlaneMovementSensor' fromField='translation_changed' toNode='VisibilityControlScript' toField='setPlaneSensorTranslation'/>
 75                                                    < ROUTE  fromNode='MovementVisibilitySensor' fromField='isActive' toNode='VisibilityControlScript' toField='setIsVisible'/>
 76                                               </Group>
 77                                          </Transform>
 78                                     </Transform>
 79                                     < ROUTE  fromNode='PlaneMovementSensor' fromField='translation_changed' toNode='MovableLocation' toField='set_translation'/>
 80                                     < ROUTE  fromNode='VisibilityControlScript' fromField='translationChanged' toNode='MovableLocation' toField='set_translation'/>
 81                                     < ROUTE  fromNode='VisibilityControlScript' fromField='translationOffsetChanged' toNode='PlaneMovementSensor' toField='set_offset'/>
 82                                </Transform>
 83                           </Transform>
 84                           < ROUTE  fromNode='WhereSensor' fromField='position_changed' toNode='FixedLocation' toField='set_translation'/>
 85                           < ROUTE  fromNode='WhereSensor' fromField='orientation_changed' toNode='FixedLocation' toField='set_rotation'/>
 86                      </Group>
 87                 </ProtoBody>
 88            </ProtoDeclare>
 89            <!-- ==================== -->
 90            <Background groundColor='0.1 0.1 0.3skyColor='0.5 0.5 0.1'/>
 91            <Anchor description='HeadsUpDisplayExampleparameter='"target=_blank"'   url=' "HeadsUpDisplayExample.x3d" "https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/HeadsUpDisplayrExample.x3d" "HeadsUpDisplayExample.wrl" "https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/HeadsUpDisplayExample.wrl" '>
 92                 <Shape>
 93                      <Appearance>
 94                           <Material diffuseColor='0 1 1emissiveColor='0 1 1'/>
 95                      </Appearance>
 96                      <Text string=' "../../../X3dForWebAuthors/Chapter14Prototypes/HeadsUpDisplayPrototype.x3d" "is a Prototype definition file." "" "To see an example scene using this node" "click this text to view" "HeadsUpDisplayExample.x3d"'>
 97                           <FontStyle justify='"MIDDLE" "MIDDLE"size='0.8'/>
 98                      </Text>
 99                 </Shape>
100            </Anchor>
101       </Scene>
102  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top DEF nodes index: DragGeometry, FixedLocation, LocationOffset, MovableLocation, MovementVisibilitySensor, PlaneMovementSensor, PlaneMovementSensorGroup, VisibilityControlScript, WhereSensor

Index for ProtoDeclare definition: HeadsUpDisplay
-->
X3D Tooltips element index: Anchor, Appearance, Background, connect, field, FontStyle, Group, head, IS, Material, meta, PlaneSensor, ProtoBody, ProtoDeclare, ProtoInterface, ProximitySensor, ROUTE, Scene, Script, Shape, Text, Transform, VisibilitySensor, WorldInfo, X3D, plus documentation for accessType definitions, type definitions, XML data types, and field types

Event Graph ROUTE Table entries with 8 ROUTE connections total, showing X3D event-model relationships for this scene.

Each row shows an event cascade that may occur during a single timestamp interval between frame renderings, as part of the X3D execution model.

The following ROUTE chain begins an event-routing loop! Loop occurs at nodeDepth=2.
 
ROUTE VisibilityControlScript.translationOffsetChanged TO PlaneMovementSensor.set_offset
MovementVisibilitySensor
VisibilitySensor
isActive
SFBool

ROUTE
event to
(1)
VisibilityControlScript
Script
setIsVisible
SFBool
then
 
 
 
VisibilityControlScript
Script
translationChanged
SFVec3f

ROUTE
event to
(2)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
VisibilityControlScript
Script
translationOffsetChanged
SFVec3f

ROUTE
event to
(2)
PlaneMovementSensor
PlaneSensor
set_offset
SFVec3f
then
 
 
 
PlaneMovementSensor
PlaneSensor
isActive
SFBool

ROUTE
event to
(3)
VisibilityControlScript
Script
setPlaneSensorIsActive
SFBool
then
 
 
 
VisibilityControlScript
Script
translationChanged
SFVec3f

ROUTE
event to
(4)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
VisibilityControlScript
Script
translationOffsetChanged
SFVec3f

ROUTE
event to
(4)
PlaneMovementSensor
PlaneSensor
set_offset
SFVec3f
then
 
 
 
PlaneMovementSensor
PlaneSensor
isActive
SFBool

ROUTE
event to
(5)
VisibilityControlScript
Script
setPlaneSensorIsActive
SFBool
then
 
 
 
VisibilityControlScript
Script
translationChanged
SFVec3f

ROUTE
event to
(6)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
VisibilityControlScript
Script
translationOffsetChanged
SFVec3f

ROUTE
event to
(6)
PlaneMovementSensor
PlaneSensor
set_offset
SFVec3f
then
 
 
 
PlaneMovementSensor
PlaneSensor
isActive
SFBool

ROUTE
event to
(7)
VisibilityControlScript
Script
setPlaneSensorIsActive
SFBool
then
 
 
 
VisibilityControlScript
Script
translationChanged
SFVec3f

ROUTE
event to
(8)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
VisibilityControlScript
Script
translationOffsetChanged
SFVec3f

ROUTE
event to
(8)
PlaneMovementSensor
PlaneSensor
set_offset
SFVec3f
  then
 
 
 
PlaneMovementSensor
PlaneSensor
translation_changed
SFVec3f

ROUTE
event to
(7)
VisibilityControlScript
Script
setPlaneSensorTranslation
SFVec3f
then
 
 
 
VisibilityControlScript
Script
translationChanged
SFVec3f

ROUTE
event to
(8)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
VisibilityControlScript
Script
translationOffsetChanged
SFVec3f

ROUTE
event to
(8)
PlaneMovementSensor
PlaneSensor
set_offset
SFVec3f
  then
 
 
 
PlaneMovementSensor
PlaneSensor
translation_changed
SFVec3f

ROUTE
event to
(7)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
PlaneMovementSensor
PlaneSensor
translation_changed
SFVec3f

ROUTE
event to
(5)
VisibilityControlScript
Script
setPlaneSensorTranslation
SFVec3f
then
 
 
 
VisibilityControlScript
Script
translationChanged
SFVec3f

ROUTE
event to
(6)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
VisibilityControlScript
Script
translationOffsetChanged
SFVec3f

ROUTE
event to
(6)
PlaneMovementSensor
PlaneSensor
set_offset
SFVec3f
then
 
 
 
PlaneMovementSensor
PlaneSensor
isActive
SFBool

ROUTE
event to
(7)
VisibilityControlScript
Script
setPlaneSensorIsActive
SFBool
then
 
 
 
VisibilityControlScript
Script
translationChanged
SFVec3f

ROUTE
event to
(8)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
VisibilityControlScript
Script
translationOffsetChanged
SFVec3f

ROUTE
event to
(8)
PlaneMovementSensor
PlaneSensor
set_offset
SFVec3f
  then
 
 
 
PlaneMovementSensor
PlaneSensor
translation_changed
SFVec3f

ROUTE
event to
(7)
VisibilityControlScript
Script
setPlaneSensorTranslation
SFVec3f
then
 
 
 
VisibilityControlScript
Script
translationChanged
SFVec3f

ROUTE
event to
(8)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
VisibilityControlScript
Script
translationOffsetChanged
SFVec3f

ROUTE
event to
(8)
PlaneMovementSensor
PlaneSensor
set_offset
SFVec3f
  then
 
 
 
PlaneMovementSensor
PlaneSensor
translation_changed
SFVec3f

ROUTE
event to
(7)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
PlaneMovementSensor
PlaneSensor
translation_changed
SFVec3f

ROUTE
event to
(5)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
PlaneMovementSensor
PlaneSensor
translation_changed
SFVec3f

ROUTE
event to
(3)
VisibilityControlScript
Script
setPlaneSensorTranslation
SFVec3f
then
 
 
 
VisibilityControlScript
Script
translationChanged
SFVec3f

ROUTE
event to
(4)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
VisibilityControlScript
Script
translationOffsetChanged
SFVec3f

ROUTE
event to
(4)
PlaneMovementSensor
PlaneSensor
set_offset
SFVec3f
then
 
 
 
PlaneMovementSensor
PlaneSensor
isActive
SFBool

ROUTE
event to
(5)
VisibilityControlScript
Script
setPlaneSensorIsActive
SFBool
then
 
 
 
VisibilityControlScript
Script
translationChanged
SFVec3f

ROUTE
event to
(6)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
VisibilityControlScript
Script
translationOffsetChanged
SFVec3f

ROUTE
event to
(6)
PlaneMovementSensor
PlaneSensor
set_offset
SFVec3f
then
 
 
 
PlaneMovementSensor
PlaneSensor
isActive
SFBool

ROUTE
event to
(7)
VisibilityControlScript
Script
setPlaneSensorIsActive
SFBool
then
 
 
 
VisibilityControlScript
Script
translationChanged
SFVec3f

ROUTE
event to
(8)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
VisibilityControlScript
Script
translationOffsetChanged
SFVec3f

ROUTE
event to
(8)
PlaneMovementSensor
PlaneSensor
set_offset
SFVec3f
  then
 
 
 
PlaneMovementSensor
PlaneSensor
translation_changed
SFVec3f

ROUTE
event to
(7)
VisibilityControlScript
Script
setPlaneSensorTranslation
SFVec3f
then
 
 
 
VisibilityControlScript
Script
translationChanged
SFVec3f

ROUTE
event to
(8)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
VisibilityControlScript
Script
translationOffsetChanged
SFVec3f

ROUTE
event to
(8)
PlaneMovementSensor
PlaneSensor
set_offset
SFVec3f
  then
 
 
 
PlaneMovementSensor
PlaneSensor
translation_changed
SFVec3f

ROUTE
event to
(7)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
PlaneMovementSensor
PlaneSensor
translation_changed
SFVec3f

ROUTE
event to
(5)
VisibilityControlScript
Script
setPlaneSensorTranslation
SFVec3f
then
 
 
 
VisibilityControlScript
Script
translationChanged
SFVec3f

ROUTE
event to
(6)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
VisibilityControlScript
Script
translationOffsetChanged
SFVec3f

ROUTE
event to
(6)
PlaneMovementSensor
PlaneSensor
set_offset
SFVec3f
then
 
 
 
PlaneMovementSensor
PlaneSensor
isActive
SFBool

ROUTE
event to
(7)
VisibilityControlScript
Script
setPlaneSensorIsActive
SFBool
then
 
 
 
VisibilityControlScript
Script
translationChanged
SFVec3f

ROUTE
event to
(8)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
VisibilityControlScript
Script
translationOffsetChanged
SFVec3f

ROUTE
event to
(8)
PlaneMovementSensor
PlaneSensor
set_offset
SFVec3f
  then
 
 
 
PlaneMovementSensor
PlaneSensor
translation_changed
SFVec3f

ROUTE
event to
(7)
VisibilityControlScript
Script
setPlaneSensorTranslation
SFVec3f
then
 
 
 
VisibilityControlScript
Script
translationChanged
SFVec3f

ROUTE
event to
(8)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
VisibilityControlScript
Script
translationOffsetChanged
SFVec3f

ROUTE
event to
(8)
PlaneMovementSensor
PlaneSensor
set_offset
SFVec3f
  then
 
 
 
PlaneMovementSensor
PlaneSensor
translation_changed
SFVec3f

ROUTE
event to
(7)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
PlaneMovementSensor
PlaneSensor
translation_changed
SFVec3f

ROUTE
event to
(5)
MovableLocation
Transform
set_translation
SFVec3f
  then
 
 
 
PlaneMovementSensor
PlaneSensor
translation_changed
SFVec3f

ROUTE
event to
(3)
MovableLocation
Transform
set_translation
SFVec3f

WhereSensor
ProximitySensor
position_changed
SFVec3f

ROUTE
event to
(1)
FixedLocation
Transform
set_translation
SFVec3f
WhereSensor
ProximitySensor
orientation_changed
SFRotation

ROUTE
event to
(1)
FixedLocation
Transform
set_rotation
SFRotation

line 91
Anchor
description='HeadsUpDisplayExample' 
User-interaction hint for this node. 

Additional guidance on X3D animation can be found in the 10-Step Animation Design Process and Event Tracing hint sheets. Have fun with X3D! 😀

-->
<!-- Online at
https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/HeadsUpDisplayPrototypeIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/HeadsUpDisplayPrototype.x3d -->

<!-- Color-coding legend: X3D terminology <X3dNode  DEF='idNamefield='value'/> matches XML terminology <XmlElement  DEF='idNameattribute='value'/>
(Light-blue background: event-based behavior node or statement) (Grey background inside box: inserted documentation) (Magenta background: X3D Extensibility)
    <ProtoDeclare name='ProtoName'> <field name='fieldName'/> </ProtoDeclare> -->

to top <!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->