X3D Model Documentation: TimeSensorChaining.x3d

  1  <?xml version="1.0" encoding="UTF-8"?>
  2  <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
  3  <X3D profile='Immersive' version='3.3 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.3.xsd'>
  4       <head>
  5            <meta name='titlecontent='TimeSensorChaining.x3d'/>
  6            <meta name='descriptioncontent='Connecting TimeSensor nodes so that the completion of one behavior chain triggers another.'/>
  7            <meta name='creatorcontent='Don Brutzman and MV3204 class'/>
  8            <meta name='createdcontent='2 September 2009'/>
  9            <meta name='modifiedcontent='27 August 2023'/>
 10            <meta name=' warning content=' under development '/>
 11            <meta name='identifiercontent='https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter07EventAnimationInterpolation/TimeSensorChaining.x3d'/>
 12            <meta name='generatorcontent='X3D-Edit 4.0, https://savage.nps.edu/X3D-Edit'/>
 13            <meta name='licensecontent='../license.html'/>
 14       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->

<!-- to top Index for DEF nodes: Clock1, Clock2, Clock3, Clock3CompleteTrigger, ClockReversal, DoorColor, DoorColorInterpolator, DoorHingeTransform, DoorOpenComplete, DoorOpener, MiddleJustify, SetTextClosed, SetTextInMotion, SetTextOpen, TextAppearance, TextSwitcher, TriggerOpeningAnimation, UserSelectDoor

Index for Viewpoint node: Viewpoint_1
-->
 15       <Scene>
 16            <WorldInfo title='TimeSensorChaining.x3d'/>
 17            <Viewpoint description='TimeSensor chaining exampleposition='0 1 6'/>
 18 
          <!-- ROUTE information for DoorHingeTransform node:  [from DoorOpener.value_changed to rotation ] -->
          <Transform DEF='DoorHingeTransformcenter='-0.65 0 0translation='0 1 0'>
 19 
               <!-- ROUTE information for UserSelectDoor node:  [from touchTime to Clock1.startTime ] [from isActive to SetTextInMotion.set_boolean ] [from touchTime to Clock3.startTime ] -->
               <TouchSensor DEF='UserSelectDoordescription='click to operate door'/>
 20                 <Shape>
 21                      <Box size='1.3 2.5 0.08'/>
 22                      <Appearance>
 23 
                         <!-- ROUTE information for DoorColor node:  [from DoorColorInterpolator.value_changed to diffuseColor ] -->
                         <Material DEF='DoorColordiffuseColor='1 0 0'/>
 24                      </Appearance>
 25                 </Shape>
 26            </Transform>
 27            <Transform scale='0.6 0.6 0.6translation='0 -1 0'>
 28 
               <!-- ROUTE information for TextSwitcher node:  [from SetTextInMotion.triggerValue to whichChoice ] [from SetTextOpen.triggerValue to whichChoice ] [from SetTextClosed.triggerValue to whichChoice ] -->
               <Switch DEF='TextSwitcherwhichChoice='0'>
 29                      <Group>
 30                           <Shape>
 31                                <Text string='"Door is closed"'>
 32 
                                   <!-- FontStyle MiddleJustify is a DEF node that has 2 USE nodes: USE_1, USE_2 -->
                                   <FontStyle DEF='MiddleJustifyjustify='"MIDDLE" "MIDDLE"'/>
 33                                </Text>
 34 
                              <!-- Appearance TextAppearance is a DEF node that has 2 USE nodes: USE_1, USE_2 -->
                              <Appearance DEF='TextAppearance'>
 35                                     <Material/>
 36                                </Appearance>
 37                           </Shape>
 38                      </Group>
 39                      <Group>
 40                           <Shape>
 41                                <Text string='"Door in motion..."'>
 42                                     <FontStyle USE='MiddleJustify'/>
 43                                </Text>
 44                                <Appearance USE='TextAppearance'/>
 45                           </Shape>
 46                      </Group>
 47                      <Group>
 48                           <Shape>
 49                                <Text string='"Door is open"'>
 50                                     <FontStyle USE='MiddleJustify'/>
 51                                </Text>
 52                                <Appearance USE='TextAppearance'/>
 53                           </Shape>
 54                      </Group>
 55                 </Switch>
 56            </Transform>
 57            <!-- ===== open the door ===== -->
 58 
          <!-- ROUTE information for Clock1 node:  [from UserSelectDoor.touchTime to startTime ] [from fraction_changed to DoorOpener.set_fraction ] [from isActive to DoorOpenComplete.set_boolean ] [self-route from isActive to enabled ] -->
          <TimeSensor DEF='Clock1cycleInterval='2'/>
 59            < ROUTE  fromNode='UserSelectDoor' fromField='touchTime' toNode='Clock1' toField='startTime'/>
 60 
          <!-- ROUTE information for DoorOpener node:  [from Clock1.fraction_changed to set_fraction ] [from ClockReversal.value_changed to set_fraction ] [from value_changed to DoorHingeTransform.rotation ] -->
          <OrientationInterpolator DEF='DoorOpenerkey='0 0.5 1keyValue='0 1 0 0 0 1 0 4.7124 0 1 0 3'/>
 61            < ROUTE  fromNode='Clock1' fromField='fraction_changed' toNode='DoorOpener' toField='set_fraction'/>
 62            < ROUTE  fromNode='DoorOpener' fromField='value_changed' toNode='DoorHingeTransform' toField='rotation'/>
 63 
          <!-- ROUTE information for SetTextInMotion node:  [from UserSelectDoor.isActive to set_boolean ] [from triggerValue to TextSwitcher.whichChoice ] -->
          <IntegerTrigger DEF='SetTextInMotionintegerKey='1'/>
 64            < ROUTE  fromNode='UserSelectDoor' fromField='isActive' toNode='SetTextInMotion' toField='set_boolean'/>
 65            < ROUTE  fromNode='SetTextInMotion' fromField='triggerValue' toNode='TextSwitcher' toField='whichChoice'/>
 66            <!-- ===== door is now open ===== -->
 67 
 68            < ROUTE  fromNode='Clock1' fromField='isActive' toNode='DoorOpenComplete' toField='set_boolean'/>
 69            <!-- disable Clock1 by turning itself off when complete -->
 70            < ROUTE  fromNode='Clock1' fromField='isActive' toNode='Clock1' toField='enabled'/>
 71 
          <!-- ROUTE information for TriggerOpeningAnimation node:  [from DoorOpenComplete.inputFalse to set_boolean ] [from triggerTime to Clock2.startTime ] -->
          <TimeTrigger DEF='TriggerOpeningAnimation'/>
 72            < ROUTE  fromNode='DoorOpenComplete' fromField='inputFalse' toNode='TriggerOpeningAnimation' toField='set_boolean'/>
 73 
          <!-- ROUTE information for Clock2 node:  [from TriggerOpeningAnimation.triggerTime to startTime ] [from fraction_changed to DoorColorInterpolator.set_fraction ] -->
          <TimeSensor DEF='Clock2cycleInterval='0.5'/>
 74            < ROUTE  fromNode='TriggerOpeningAnimation' fromField='triggerTime' toNode='Clock2' toField='startTime'/>
 75 
          <!-- ROUTE information for SetTextOpen node:  [from DoorOpenComplete.inputFalse to set_boolean ] [from triggerValue to TextSwitcher.whichChoice ] -->
          <IntegerTrigger DEF='SetTextOpenintegerKey='2'/>
 76            < ROUTE  fromNode='DoorOpenComplete' fromField='inputFalse' toNode='SetTextOpen' toField='set_boolean'/>
 77            < ROUTE  fromNode='SetTextOpen' fromField='triggerValue' toNode='TextSwitcher' toField='whichChoice'/>
 78 
          <!-- ROUTE information for DoorColorInterpolator node:  [from Clock2.fraction_changed to set_fraction ] [from ClockReversal.value_changed to set_fraction ] [from value_changed to DoorColor.diffuseColor ] -->
          <ColorInterpolator DEF='DoorColorInterpolatorkey='0 0.5 1keyValue='1 0 0 0.1 0.1 0.1 0.203922 0.701961 0'/>
 79            < ROUTE  fromNode='Clock2' fromField='fraction_changed' toNode='DoorColorInterpolator' toField='set_fraction'/>
 80            < ROUTE  fromNode='DoorColorInterpolator' fromField='value_changed' toNode='DoorColor' toField='diffuseColor'/>
 81            <!-- ===== close the door ===== -->
 82 
 83            < ROUTE  fromNode='UserSelectDoor' fromField='touchTime' toNode='Clock3' toField='startTime'/>
 84            <!-- enable Clock3 once door is fully open -->
 85            < ROUTE  fromNode='DoorOpenComplete' fromField='inputFalse' toNode='Clock3' toField='enabled'/>
 86            <!-- disable Clock3 by turning itself off when complete -->
 87            < ROUTE  fromNode='Clock3' fromField='isActive' toNode='Clock3' toField='enabled'/>
 88 
          <!-- ROUTE information for ClockReversal node:  [from Clock3.fraction_changed to set_fraction ] [from value_changed to DoorOpener.set_fraction ] [from value_changed to DoorColorInterpolator.set_fraction ] -->
          <ScalarInterpolator DEF='ClockReversalkey='0 1keyValue='1 0'/>
 89            < ROUTE  fromNode='Clock3' fromField='fraction_changed' toNode='ClockReversal' toField='set_fraction'/>
 90            < ROUTE  fromNode='ClockReversal' fromField='value_changed' toNode='DoorOpener' toField='set_fraction'/>
 91            < ROUTE  fromNode='ClockReversal' fromField='value_changed' toNode='DoorColorInterpolator' toField='set_fraction'/>
 92            <!-- enable Clock1 when door is fully closed -->
 93 
          <!-- ROUTE information for Clock3CompleteTrigger node:  [from Clock3.stopTime to set_triggerTime ] [from triggerTrue to SetTextClosed.set_boolean ] -->
          <BooleanTrigger DEF='Clock3CompleteTrigger'/>
 94            < ROUTE  fromNode='Clock3' fromField='stopTime' toNode='Clock3CompleteTrigger' toField='set_triggerTime'/>
 95 
          <!-- ROUTE information for SetTextClosed node:  [from Clock3CompleteTrigger.triggerTrue to set_boolean ] [from triggerValue to TextSwitcher.whichChoice ] -->
          <IntegerTrigger DEF='SetTextClosedintegerKey='0'/>
 96            < ROUTE  fromNode='Clock3CompleteTrigger' fromField='triggerTrue' toNode='SetTextClosed' toField='set_boolean'/>
 97            < ROUTE  fromNode='SetTextClosed' fromField='triggerValue' toNode='TextSwitcher' toField='whichChoice'/>
 98       </Scene>
 99  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->

<!-- to top Index for DEF nodes: Clock1, Clock2, Clock3, Clock3CompleteTrigger, ClockReversal, DoorColor, DoorColorInterpolator, DoorHingeTransform, DoorOpenComplete, DoorOpener, MiddleJustify, SetTextClosed, SetTextInMotion, SetTextOpen, TextAppearance, TextSwitcher, TriggerOpeningAnimation, UserSelectDoor

Index for Viewpoint node: Viewpoint_1
-->
X3D Tooltips element index: Appearance, BooleanFilter, BooleanTrigger, Box, ColorInterpolator, FontStyle, Group, head, IntegerTrigger, Material, meta, OrientationInterpolator, ROUTE, ScalarInterpolator, Scene, Shape, Switch, Text, TimeSensor, TimeTrigger, TouchSensor, Transform, Viewpoint, WorldInfo, X3D, accessType and type, XML data types, field types

Event Graph ROUTE Table entries with 22 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.

UserSelectDoor
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
Clock1
TimeSensor
startTime
SFTime
then
 
 
 
Clock1
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(2)
DoorOpener
OrientationInterpolator
set_fraction
SFFloat
then
 
 
 
DoorOpener
OrientationInterpolator
value_changed
SFRotation

ROUTE
event to
(3)
DoorHingeTransform
Transform
rotation
SFRotation
  then
 
 
 
Clock1
TimeSensor
isActive
SFBool

ROUTE
event to
(2)
DoorOpenComplete
BooleanFilter
set_boolean
SFBool
then
 
 
 
DoorOpenComplete
BooleanFilter
inputFalse
SFBool

ROUTE
event to
(3)
TriggerOpeningAnimation
TimeTrigger
set_boolean
SFBool
then
 
 
 
TriggerOpeningAnimation
TimeTrigger
triggerTime
SFTime

ROUTE
event to
(4)
Clock2
TimeSensor
startTime
SFTime
then
 
 
 
Clock2
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(5)
DoorColorInterpolator
ColorInterpolator
set_fraction
SFFloat
then
 
 
 
DoorColorInterpolator
ColorInterpolator
value_changed
SFColor

ROUTE
event to
(6)
DoorColor
Material
diffuseColor
SFColor
  then
 
 
 
DoorOpenComplete
BooleanFilter
inputFalse
SFBool

ROUTE
event to
(3)
SetTextOpen
IntegerTrigger
set_boolean
SFBool
then
 
 
 
SetTextOpen
IntegerTrigger
triggerValue
SFInt32

ROUTE
event to
(4)
TextSwitcher
Switch
whichChoice
SFInt32
  then
 
 
 
DoorOpenComplete
BooleanFilter
inputFalse
SFBool

ROUTE
event to
(3)
Clock3
TimeSensor
enabled
SFBool
then
 
 
 
Clock3
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(4)
ClockReversal
ScalarInterpolator
set_fraction
SFFloat
then
 
 
 
ClockReversal
ScalarInterpolator
value_changed
SFFloat

ROUTE
event to
(5)
DoorOpener
OrientationInterpolator
set_fraction
SFFloat
then
 
 
 
DoorOpener
OrientationInterpolator
value_changed
SFRotation

ROUTE
event to
(6)
DoorHingeTransform
Transform
rotation
SFRotation
  then
 
 
 
ClockReversal
ScalarInterpolator
value_changed
SFFloat

ROUTE
event to
(5)
DoorColorInterpolator
ColorInterpolator
set_fraction
SFFloat
then
 
 
 
DoorColorInterpolator
ColorInterpolator
value_changed
SFColor

ROUTE
event to
(6)
DoorColor
Material
diffuseColor
SFColor
  then
 
 
 
Clock3
TimeSensor
stopTime
SFTime

ROUTE
event to
(4)
Clock3CompleteTrigger
BooleanTrigger
set_triggerTime
SFTime
then
 
 
 
Clock3CompleteTrigger
BooleanTrigger
triggerTrue
SFBool

ROUTE
event to
(5)
SetTextClosed
IntegerTrigger
set_boolean
SFBool
then
 
 
 
SetTextClosed
IntegerTrigger
triggerValue
SFInt32

ROUTE
event to
(6)
TextSwitcher
Switch
whichChoice
SFInt32
UserSelectDoor
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
SetTextInMotion
IntegerTrigger
set_boolean
SFBool
then
 
 
 
SetTextInMotion
IntegerTrigger
triggerValue
SFInt32

ROUTE
event to
(2)
TextSwitcher
Switch
whichChoice
SFInt32
UserSelectDoor
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
Clock3
TimeSensor
startTime
SFTime
then
 
 
 
Clock3
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(2)
ClockReversal
ScalarInterpolator
set_fraction
SFFloat
then
 
 
 
ClockReversal
ScalarInterpolator
value_changed
SFFloat

ROUTE
event to
(3)
DoorOpener
OrientationInterpolator
set_fraction
SFFloat
then
 
 
 
DoorOpener
OrientationInterpolator
value_changed
SFRotation

ROUTE
event to
(4)
DoorHingeTransform
Transform
rotation
SFRotation
  then
 
 
 
ClockReversal
ScalarInterpolator
value_changed
SFFloat

ROUTE
event to
(3)
DoorColorInterpolator
ColorInterpolator
set_fraction
SFFloat
then
 
 
 
DoorColorInterpolator
ColorInterpolator
value_changed
SFColor

ROUTE
event to
(4)
DoorColor
Material
diffuseColor
SFColor
  then
 
 
 
Clock3
TimeSensor
stopTime
SFTime

ROUTE
event to
(2)
Clock3CompleteTrigger
BooleanTrigger
set_triggerTime
SFTime
then
 
 
 
Clock3CompleteTrigger
BooleanTrigger
triggerTrue
SFBool

ROUTE
event to
(3)
SetTextClosed
IntegerTrigger
set_boolean
SFBool
then
 
 
 
SetTextClosed
IntegerTrigger
triggerValue
SFInt32

ROUTE
event to
(4)
TextSwitcher
Switch
whichChoice
SFInt32

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/X3dForWebAuthors/Chapter07EventAnimationInterpolation/TimeSensorChainingIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter07EventAnimationInterpolation/TimeSensorChaining.x3d -->

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

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