X3D Model Documentation: DoubleClickTouchSensorExample.x3d

  1  <?xml version="1.0" encoding="UTF-8"?>
  2  <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.2//EN" "https://www.web3d.org/specifications/x3d-3.2.dtd">
  3  <X3D profile='Immersive' version='3.2'  xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.2.xsd'>
  4       <head>
  5            <meta name='title' content='DoubleClickTouchSensorExample.x3d'/>
  6            <meta name='description' content='Double-click TouchSensor design pattern, showing example use.'/>
  7            <meta name='creator' content='Don Brutzman'/>
  8            <meta name='created' content='26 May 2003'/>
  9            <meta name='modified' content='17 June 2020'/>
 10            <meta name='reference' content='DoubleClickTouchSensorPrototype.x3d'/>
 11            <meta name='reference' content='https://www.web3d.org/x3d/specifications/ISO-IEC-19775-FDIS-X3dAbstractSpecification/Part01/components/pointingsensor.html#TouchSensor'/>
 12            <meta name='subject' content='DoubleClickTouchSensor'/>
 13            <meta name='identifier' content='https://savage.nps.edu/Savage/Tools/Animation/DoubleClickTouchSensorExample.x3d'/>
 14            <meta name='generator' content='X3D-Edit 3.2, https://savage.nps.edu/X3D-Edit'/>
 15            <meta name='license' content='../../license.html'/>
 16       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top Index for DEF nodes: AnimationClock, ColorChangerRGB, DelayTimer, TextAnimationGroup, TextColor, TextTouchGroup, TouchSensorActive

Index for ExternProtoDeclare definitions: DoubleClickTouchSensor, TimeDelaySensor
-->
 17       <Scene>
 18            <WorldInfo title='DoubleClickTouchSensorExample.x3d'/>
 19            <ExternProtoDeclare name='TimeDelaySensor' appinfo='TimeSensor functionality commences after delayInterval pause'   url=' "TimeDelaySensorPrototype.x3d#TimeDelaySensor" "../../../Savage/Tools/Animation/TimeDelaySensorPrototype.x3d#TimeDelaySensor" "https://savage.nps.edu/Savage/Tools/Animation/TimeDelaySensorPrototype.x3d#TimeDelaySensor" "TimeDelaySensorPrototype.wrl#TimeDelaySensor" "../../../Savage/Tools/Animation/TimeDelaySensorPrototype.wrl#TimeDelaySensor" "https://savage.nps.edu/Savage/Tools/Animation/TimeDelaySensorPrototype.wrl#TimeDelaySensor" '>
 20                 <field name='description' type='SFString' accessType='inputOutput'
                appinfo='describe the purpose of this sensor'/>
 21                 <field name='startTime' type='SFTime' accessType='inputOutput'/>
 22                 <field name='enabled' type='SFBool' accessType='inputOutput'/>
 23                 <field name='delayInterval' type='SFTime' accessType='inputOutput'
                appinfo='seconds'/>
 24                 <field name='delayCompleteTime' type='SFTime' accessType='outputOnly'/>
 25                 <field name='traceEnabled' type='SFBool' accessType='initializeOnly'/>
 26            </ExternProtoDeclare>
 27            <ExternProtoDeclare name='DoubleClickTouchSensor' appinfo='DoubleClickTouchSensor functionality activates when user double clicks (or double selects) within maxDelayInterval'   url=' "DoubleClickTouchSensorPrototype.x3d#DoubleClickTouchSensor" "../../../Savage/Tools/Animation/DoubleClickTouchSensorPrototype.x3d#DoubleClickTouchSensor" "https://savage.nps.edu/Savage/Tools/Animation/DoubleClickTouchSensorPrototype.x3d#DoubleClickTouchSensor" "DoubleClickTouchSensorPrototype.wrl#DoubleClickTouchSensor" "../../../Savage/Tools/Animation/DoubleClickTouchSensorPrototype.wrl#DoubleClickTouchSensor" "https://savage.nps.edu/Savage/Tools/Animation/DoubleClickTouchSensorPrototype.wrl#DoubleClickTouchSensor" '>
 28                 <field name='description' type='SFString' accessType='inputOutput'
                appinfo='describe the purpose of this sensor'/>
 29                 <field name='maxDelayInterval' type='SFTime' accessType='initializeOnly'
                appinfo='seconds'/>
 30                 <field name='enabled' type='SFBool' accessType='inputOutput'/>
 31                 <field name='isActive' type='SFBool' accessType='outputOnly'/>
 32                 <field name='isOver' type='SFBool' accessType='outputOnly'/>
 33                 <field name='touchTime' type='SFTime' accessType='outputOnly'
                appinfo='seconds'/>
 34                 <field name='hitPoint_changed' type='SFVec3f' accessType='outputOnly'/>
 35                 <field name='hitNormal_changed' type='SFVec3f' accessType='outputOnly'/>
 36                 <field name='hitTexCoord_changed' type='SFVec2f' accessType='outputOnly'/>
 37                 <field name='metadata' type='SFNode' accessType='initializeOnly'
                appinfo='can contain one of Metadata nodes'>
 38                      <!-- initialization node (if any) goes here -->
 39                 </field>
 40                 <field name='traceEnabled' type='SFBool' accessType='initializeOnly'/>
 41            </ExternProtoDeclare>
 42            <!-- ==================== -->
 43            <Group DEF='TextTouchGroup'>
 44                 <Shape>
 45                      <Text string='"Double-click text then" "wait for 1-second time delay" "before color changes"'>
 46                           <FontStyle justify='"MIDDLE" "MIDDLE"'/>
 47                      </Text>
 48                      <Appearance>
 49 
                         <!-- ROUTE information for TextColor node:  [from ColorChangerRGB.value_changed to diffuseColor ] -->
                         <Material DEF='TextColor'/>
 50                      </Appearance>
 51                 </Shape>
 52 
               <!-- ROUTE information for TouchSensorActive node:  [from touchTime to DelayTimer.startTime ] -->
               <ProtoInstance name='DoubleClickTouchSensor' DEF='TouchSensorActive'>
 53                      <fieldValue name='description' value='double click to initiate time delay and color change'/>
 54                      <fieldValue name='traceEnabled' value='true'/>
 55                      <fieldValue name='metadata'>
 56                           <MetadataString name='exampleTerm' value='"exampleValue"'/>
 57                      </fieldValue>
 58                 </ProtoInstance>
 59                 <!-- ==================== -->
 60                 <Group DEF='TextAnimationGroup'>
 61 
                    <!-- ROUTE information for DelayTimer node:  [from TouchSensorActive.touchTime to startTime ] [from delayCompleteTime to AnimationClock.set_startTime ] -->
                    <ProtoInstance name='TimeDelaySensor' DEF='DelayTimer'>
 62                           <fieldValue name='delayInterval' value='1'/>
 63                           <fieldValue name='traceEnabled' value='true'/>
 64                      </ProtoInstance>
 65 
                    <!-- ROUTE information for AnimationClock node:  [from DelayTimer.delayCompleteTime to set_startTime ] [from fraction_changed to ColorChangerRGB.set_fraction ] -->
                    <TimeSensor DEF='AnimationClock' cycleInterval='2'/>
 66                      < ROUTE  fromNode='TouchSensorActive' fromField='touchTime' toNode='DelayTimer' toField='startTime'/>
 67                      < ROUTE  fromNode='DelayTimer' fromField='delayCompleteTime' toNode='AnimationClock' toField='set_startTime'/>
 68 
                    <!-- ROUTE information for ColorChangerRGB node:  [from AnimationClock.fraction_changed to set_fraction ] [from value_changed to TextColor.diffuseColor ] -->
                    <ColorInterpolator DEF='ColorChangerRGB' key='0 0.5 1' keyValue='1 0 0 0 1 0 0 0 1'/>
 69                      < ROUTE  fromNode='ColorChangerRGB' fromField='value_changed' toNode='TextColor' toField='diffuseColor'/>
 70                      < ROUTE  fromNode='AnimationClock' fromField='fraction_changed' toNode='ColorChangerRGB' toField='set_fraction'/>
 71                 </Group>
 72            </Group>
 73       </Scene>
 74  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top Index for DEF nodes: AnimationClock, ColorChangerRGB, DelayTimer, TextAnimationGroup, TextColor, TextTouchGroup, TouchSensorActive

Index for ExternProtoDeclare definitions: DoubleClickTouchSensor, TimeDelaySensor
-->
X3D Tooltips element index: Appearance, ColorInterpolator, ExternProtoDeclare, field, fieldValue, FontStyle, Group, head, Material, meta, MetadataString, ProtoInstance, ROUTE, Scene, Shape, Text, TimeSensor, WorldInfo, X3D, plus documentation for accessType definitions, type definitions, XML data types, and field types

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

      DelayTimer
ProtoInstance
delayCompleteTime
SFTime
→
ROUTE
event to
(1)
AnimationClock
TimeSensor
set_startTime
SFTime
then
 
 
 
AnimationClock
TimeSensor
fraction_changed
SFFloat
→
ROUTE
event to
(2)
ColorChangerRGB
ColorInterpolator
set_fraction
SFFloat
then
 
 
 
ColorChangerRGB
ColorInterpolator
value_changed
SFColor
→
ROUTE
event to
(3)
TextColor
Material
diffuseColor
SFColor

TouchSensorActive
ProtoInstance
touchTime
SFTime
→
ROUTE
event to
(1)
DelayTimer
ProtoInstance
startTime
SFTime
then
 
 
 
DelayTimer
ProtoInstance
delayCompleteTime
SFTime
→
ROUTE
event to
(2)
AnimationClock
TimeSensor
set_startTime
SFTime
then
 
 
 
AnimationClock
TimeSensor
fraction_changed
SFFloat
→
ROUTE
event to
(3)
ColorChangerRGB
ColorInterpolator
set_fraction
SFFloat
then
 
 
 
ColorChangerRGB
ColorInterpolator
value_changed
SFColor
→
ROUTE
event to
(4)
TextColor
Material
diffuseColor
SFColor

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://savage.nps.edu/Savage/Tools/Animation/DoubleClickTouchSensorExampleIndex.html -->
<!-- Version control at
https://gitlab.nps.edu/Savage/Savage/Tools/Animation/DoubleClickTouchSensorExample.x3d -->

<!-- Color-coding 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)
    <ProtoInstance name='ProtoName'> <field name='fieldName'/> </ProtoInstance> -->

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