X3D Model Documentation: EventUtilityExamples.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='EventUtilityExamples.x3d'/>
  6            <meta name='descriptioncontent='Event utility node examples for boolean filtering and other event utility nodes.'/>
  7            <meta name='creatorcontent='Don Brutzman'/>
  8            <meta name='createdcontent='3 November 2002'/>
  9            <meta name='modifiedcontent='20 January 2020'/>
 10            <meta name='subjectcontent='BooleanFilter BooleanToggle BooleanTrigger IntegerTrigger TimeTrigger'/>
 11            <meta name='identifiercontent='https://www.web3d.org/x3d/content/examples/Basic/development/EventUtilityExamples.x3d'/>
 12            <meta name='generatorcontent='X3D-Edit 3.3, 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: TextFont, TimeTriggerNode, TimeTriggerOrientationInterpolator, TimeTriggerTimeSensor, TimeTriggerTouchSensor, TimeTriggerTransform

Index for ExternProtoDeclare definitions: BooleanFilter, BooleanToggle, BooleanTrigger, IntegerTrigger, TimeTrigger
-->
 15       <Scene>
 16            <!-- ======================================== -->
 17            <!-- ExternProtoDeclare definitions are used here only for language development - do not copy into other scenes! -->
 18            <!-- ExternProtoDeclare node support is provided either by X3D-compliant browser or X3dToVrml97.xslt ExternProtoDeclare definitions. -->
 19            <!-- ======================================== -->
 20            <WorldInfo title='EventUtilityExamples.x3d'/>
 21            <ExternProtoDeclare name='BooleanFilterappinfo='BooleanFilter selectively passes true false or negated events.'   url=' "EventUtilityPrototypes.x3d#BooleanFilter" "https://www.web3d.org/x3d/content/examples/Basic/development/EventUtilityPrototypes.x3d#BooleanFilter" "EventUtilityPrototypes.wrl#BooleanFilter" "https://www.web3d.org/x3d/content/examples/Basic/development/EventUtilityPrototypes.wrl#BooleanFilter" '>
 22                 <field name='set_booleantype='SFBoolaccessType='inputOnly'
                appinfo='set_boolean is the input value to be filtered.'/>
 23                 <field name='inputTruetype='SFBoolaccessType='outputOnly'
                appinfo='inputTrue only passes a true value when set_boolean input is true.'/>
 24                 <field name='inputFalsetype='SFBoolaccessType='outputOnly'
                appinfo='inputFalse only passes a false value when set_boolean is false.'/>
 25                 <field name='inputNegatetype='SFBoolaccessType='outputOnly'
                appinfo='inputNegate provides opposite value by negating set_boolean input.'/>
 26            </ExternProtoDeclare>
 27            <!-- ======================================== -->
 28            <ExternProtoDeclare name='BooleanToggleappinfo='BooleanToggle maintains state and negates output when a true input is provided.'   url=' "EventUtilityPrototypes.x3d#BooleanToggle" "https://www.web3d.org/x3d/content/examples/Basic/development/EventUtilityPrototypes.x3d#BooleanToggle" "EventUtilityPrototypes.wrl#BooleanToggle" "https://www.web3d.org/x3d/content/examples/Basic/development/EventUtilityPrototypes.wrl#BooleanToggle" '>
 29                 <field name='set_booleantype='SFBoolaccessType='inputOnly'
                appinfo='If set_boolean input is true toggle state.'/>
 30                 <field name='set_toggletype='SFBoolaccessType='inputOnly'
                appinfo='Reset persistent state value.'/>
 31                 <field name='toggletype='SFBoolaccessType='initializeOnly'
                appinfo='Persistent state value that gets toggled or reset.'/>
 32                 <field name='toggle_changedtype='SFBoolaccessType='outputOnly'
                appinfo='Output toggled persistent state value.'/>
 33                 <!-- warning: toggle depends on exposedField functionality in Script node, not compatible with VRML 97. implemented as inputOnly/initializeOnly/outputOnly triplet. -->
 34            </ExternProtoDeclare>
 35            <!-- ======================================== -->
 36            <ExternProtoDeclare name='BooleanTriggerappinfo='BooleanTrigger converts time events to boolean true events.'   url=' "EventUtilityPrototypes.x3d#BooleanTrigger" "https://www.web3d.org/x3d/content/examples/Basic/development/EventUtilityPrototypes.x3d#BooleanTrigger" "EventUtilityPrototypes.wrl#BooleanTrigger" "https://www.web3d.org/x3d/content/examples/Basic/development/EventUtilityPrototypes.wrl#BooleanTrigger" '>
 37                 <field name='set_triggerTimetype='SFTimeaccessType='inputOnly'
                appinfo='set_triggerTime provides input time event typical event sent is TouchSensor touchTime.'/>
 38                 <field name='triggerTruetype='SFBoolaccessType='outputOnly'
                appinfo='triggerTrue outputs a true value whenever a triggerTime event is received.'/>
 39            </ExternProtoDeclare>
 40            <!-- ======================================== -->
 41            <ExternProtoDeclare name='IntegerTriggerappinfo='IntegerTrigger converts boolean true or time input events to integer value (suitable for Switch node).'   url=' "EventUtilityPrototypes.x3d#IntegerTrigger" "https://www.web3d.org/x3d/content/examples/Basic/development/EventUtilityPrototypes.x3d#IntegerTrigger" "EventUtilityPrototypes.wrl#IntegerTrigger" "https://www.web3d.org/x3d/content/examples/Basic/development/EventUtilityPrototypes.wrl#IntegerTrigger" '>
 42                 <field name='set_booleantype='SFBoolaccessType='inputOnly'
                appinfo='If set_boolean input is true trigger output of integer value.'/>
 43                 <field name='set_integerKeytype='SFInt32accessType='inputOnly'
                appinfo='Resets value used for output when triggered later.'/>
 44                 <field name='integerKeytype='SFInt32accessType='inputOutput'
                appinfo='integerKey is value for output when triggered.'/>
 45                 <field name='integerKey_changedtype='SFInt32accessType='outputOnly'
                appinfo='Reports change in integerKey value.'/>
 46                 <field name='triggerValuetype='SFInt32accessType='outputOnly'
                appinfo='triggerValue provides integer event output matching integerKey when true set_boolean received.'/>
 47            </ExternProtoDeclare>
 48            <!-- ======================================== -->
 49            <ExternProtoDeclare name='TimeTriggerappinfo='TimeTrigger converts boolean true events to time events.'   url=' "EventUtilityPrototypes.x3d#TimeTrigger" "https://www.web3d.org/x3d/content/examples/Basic/development/EventUtilityPrototypes.x3d#TimeTrigger" "EventUtilityPrototypes.wrl#TimeTrigger" "https://www.web3d.org/x3d/content/examples/Basic/development/EventUtilityPrototypes.wrl#TimeTrigger" '>
 50                 <field name='set_booleantype='SFBoolaccessType='inputOnly'
                appinfo='If set_boolean input is true trigger output time value.'/>
 51                 <field name='triggerTimetype='SFTimeaccessType='outputOnly'
                appinfo='triggerTime is output time event sent when set_boolean input is true.'/>
 52            </ExternProtoDeclare>
 53            <!-- ======================================== -->
 54            <Group>
 55                 <Transform translation='0 3 0'>
 56                      <Anchor description='Click for BooleanFilter exampleparameter='"target=_blank"'   url=' "../../Savage/Tools/HeadsUpDisplays/CrossHairExample.x3d" "https://savage.nps.edu/Savage/Tools/HeadsUpDisplays/CrossHairExample.x3d" "../../Savage/Tools/HeadsUpDisplays/CrossHairExample.wrl" "https://savage.nps.edu/Savage/Tools/HeadsUpDisplays/CrossHairExample.wrl" '>
 57                           <Shape>
 58                                <Appearance>
 59                                     <Material diffuseColor='0.6 0.6 0.2'/>
 60                                </Appearance>
 61                                <Text string='"BooleanFilter example"'>
 62 
                                   <!-- FontStyle TextFont is a DEF node that has 4 USE nodes: USE_1, USE_2, USE_3, USE_4 -->
                                   <FontStyle DEF='TextFontjustify='"MIDDLE" "MIDDLE"size='0.8style='BOLD'/>
 63                                </Text>
 64                           </Shape>
 65                      </Anchor>
 66                 </Transform>
 67                 <Transform translation='0 1.5 0'>
 68                      <Anchor description='Click for BooleanToggle exampleparameter='"target=_blank"'   url=' "../../Savage/Tools/HeadsUpDisplays/CrossHairExample.x3d" "https://savage.nps.edu/Savage/Tools/HeadsUpDisplays/CrossHairExample.x3d" "../../Savage/Tools/HeadsUpDisplays/CrossHairExample.wrl" "https://savage.nps.edu/Savage/Tools/HeadsUpDisplays/CrossHairExample.wrl" '>
 69                           <Shape>
 70                                <Appearance>
 71                                     <Material diffuseColor='0.6 0.6 0.2'/>
 72                                </Appearance>
 73                                <Text string='"BooleanToggle example"'>
 74                                     <FontStyle USE='TextFont'/>
 75                                </Text>
 76                           </Shape>
 77                      </Anchor>
 78                 </Transform>
 79                 <Transform>
 80                      <Anchor description='Click for BooleanTrigger exampleparameter='"target=_blank"'   url=' "../../Savage/Tools/HeadsUpDisplays/CrossHairExample.x3d" "https://savage.nps.edu/Savage/Tools/HeadsUpDisplays/CrossHairExample.x3d" "../../Savage/Tools/HeadsUpDisplays/CrossHairExample.wrl" "https://savage.nps.edu/Savage/Tools/HeadsUpDisplays/CrossHairExample.wrl" '>
 81                           <Shape>
 82                                <Appearance>
 83                                     <Material diffuseColor='0.6 0.6 0.2'/>
 84                                </Appearance>
 85                                <Text string='"BooleanTrigger example"'>
 86                                     <FontStyle USE='TextFont'/>
 87                                </Text>
 88                           </Shape>
 89                      </Anchor>
 90                 </Transform>
 91                 <Transform translation='0 -1.5 0'>
 92                      <Anchor description='Click for IntegerTrigger exampleparameter='"target=_blank"'   url=' "../../Savage/Tools/Animation/MaterialChoiceExample.x3d" "https://savage.nps.edu/Savage/Tools/Animation/MaterialChoiceExample.x3d" "../../Savage/Tools/Animation/MaterialChoiceExample.wrl" "https://savage.nps.edu/Savage/Tools/Animation/MaterialChoiceExample.wrl" '>
 93                           <Shape>
 94                                <Appearance>
 95                                     <Material diffuseColor='0.6 0.6 0.2'/>
 96                                </Appearance>
 97                                <Text string='"IntegerTrigger example"'>
 98                                     <FontStyle USE='TextFont'/>
 99                                </Text>
100                           </Shape>
101                      </Anchor>
102                 </Transform>
103 
               <!-- ROUTE information for TimeTriggerTransform node:  [from TimeTriggerOrientationInterpolator.value_changed to set_rotation ] -->
               <Transform DEF='TimeTriggerTransformtranslation='0 -3 0'>
104 
                    <!-- ROUTE information for TimeTriggerTouchSensor node:  [from isActive to TimeTriggerNode.set_boolean ] -->
                    <TouchSensor DEF='TimeTriggerTouchSensordescription='Click forTimeTrigger example'/>
105                      <Shape>
106                           <Appearance>
107                                <Material diffuseColor='0.6 0.6 0.2'/>
108                           </Appearance>
109                           <Text string='"TimeTrigger example"'>
110                                <FontStyle USE='TextFont'/>
111                           </Text>
112                      </Shape>
113                 </Transform>
114 
               <!-- ROUTE information for TimeTriggerNode node:  [from TimeTriggerTouchSensor.isActive to set_boolean ] [from triggerTime to TimeTriggerTimeSensor.startTime ] -->
               <TimeTrigger DEF='TimeTriggerNode'/>
115 
               <!-- ROUTE information for TimeTriggerTimeSensor node:  [from TimeTriggerNode.triggerTime to startTime ] [from fraction_changed to TimeTriggerOrientationInterpolator.set_fraction ] -->
               <TimeSensor DEF='TimeTriggerTimeSensorcycleInterval='2'/>
116 
               <!-- ROUTE information for TimeTriggerOrientationInterpolator node:  [from TimeTriggerTimeSensor.fraction_changed to set_fraction ] [from value_changed to TimeTriggerTransform.set_rotation ] -->
               <OrientationInterpolator DEF='TimeTriggerOrientationInterpolatorkey='0 0.5 1keyValue='0 1 0 0 0 1 0 3.14159 0 1 0 6.2432'/>
117                 < ROUTE  fromNode='TimeTriggerTouchSensor' fromField='isActive' toNode='TimeTriggerNode' toField='set_boolean'/>
118                 < ROUTE  fromNode='TimeTriggerNode' fromField='triggerTime' toNode='TimeTriggerTimeSensor' toField='startTime'/>
119                 < ROUTE  fromNode='TimeTriggerTimeSensor' fromField='fraction_changed' toNode='TimeTriggerOrientationInterpolator' toField='set_fraction'/>
120                 < ROUTE  fromNode='TimeTriggerOrientationInterpolator' fromField='value_changed' toNode='TimeTriggerTransform' toField='set_rotation'/>
121            </Group>
122       </Scene>
123  </X3D>
<!--

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

<!-- to top Index for DEF nodes: TextFont, TimeTriggerNode, TimeTriggerOrientationInterpolator, TimeTriggerTimeSensor, TimeTriggerTouchSensor, TimeTriggerTransform

Index for ExternProtoDeclare definitions: BooleanFilter, BooleanToggle, BooleanTrigger, IntegerTrigger, TimeTrigger
-->
X3D Tooltips element index: Anchor, Appearance, ExternProtoDeclare, field, FontStyle, Group, head, Material, meta, OrientationInterpolator, ROUTE, Scene, Shape, Text, TimeSensor, TimeTrigger, TouchSensor, Transform, WorldInfo, X3D, accessType and type, XML data types, 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.

TimeTriggerTouchSensor
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
TimeTriggerNode
TimeTrigger
set_boolean
SFBool
then
 
 
 
TimeTriggerNode
TimeTrigger
triggerTime
SFTime

ROUTE
event to
(2)
TimeTriggerTimeSensor
TimeSensor
startTime
SFTime
then
 
 
 
TimeTriggerTimeSensor
TimeSensor
fraction_changed
SFFloat

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

ROUTE
event to
(4)
TimeTriggerTransform
Transform
set_rotation
SFRotation


Anchor
description='Click for BooleanFilter example' 
User-interaction hint for this node. 


Anchor
description='Click for BooleanToggle example' 
User-interaction hint for this node. 


Anchor
description='Click for BooleanTrigger example' 
User-interaction hint for this node. 


Anchor
description='Click for IntegerTrigger example' 
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/Basic/development/EventUtilityExamplesIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Basic/development/EventUtilityExamples.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)
    <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. -->