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='title' content='EventUtilityExamples.x3d'/> |
6 | <meta name='description' content='Event utility node examples for boolean filtering and other event utility nodes.'/> |
7 | <meta name='creator' content='Don Brutzman'/> |
8 | <meta name='created' content='3 November 2002'/> |
9 | <meta name='modified' content='20 January 2020'/> |
10 | <meta name='subject' content='BooleanFilter BooleanToggle BooleanTrigger IntegerTrigger TimeTrigger'/> |
11 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/Basic/development/EventUtilityExamples.x3d'/> |
12 | <meta name='generator' content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/> |
13 | <meta name='license' content='../license.html'/> |
14 | </head> |
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='BooleanFilter' appinfo='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_boolean' type='SFBool' accessType='inputOnly'
appinfo='set_boolean is the input value to be filtered.'/> |
23 |
<field name='inputTrue' type='SFBool' accessType='outputOnly'
appinfo='inputTrue only passes a true value when set_boolean input is true.'/> |
24 |
<field name='inputFalse' type='SFBool' accessType='outputOnly'
appinfo='inputFalse only passes a false value when set_boolean is false.'/> |
25 |
<field name='inputNegate' type='SFBool' accessType='outputOnly'
appinfo='inputNegate provides opposite value by negating set_boolean input.'/> |
26 | </ExternProtoDeclare> |
27 | <!-- ======================================== --> |
28 | <ExternProtoDeclare name='BooleanToggle' appinfo='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_boolean' type='SFBool' accessType='inputOnly'
appinfo='If set_boolean input is true toggle state.'/> |
30 |
<field name='set_toggle' type='SFBool' accessType='inputOnly'
appinfo='Reset persistent state value.'/> |
31 |
<field name='toggle' type='SFBool' accessType='initializeOnly'
appinfo='Persistent state value that gets toggled or reset.'/> |
32 |
<field name='toggle_changed' type='SFBool' accessType='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='BooleanTrigger' appinfo='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_triggerTime' type='SFTime' accessType='inputOnly'
appinfo='set_triggerTime provides input time event typical event sent is TouchSensor touchTime.'/> |
38 |
<field name='triggerTrue' type='SFBool' accessType='outputOnly'
appinfo='triggerTrue outputs a true value whenever a triggerTime event is received.'/> |
39 | </ExternProtoDeclare> |
40 | <!-- ======================================== --> |
41 | <ExternProtoDeclare name='IntegerTrigger' appinfo='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_boolean' type='SFBool' accessType='inputOnly'
appinfo='If set_boolean input is true trigger output of integer value.'/> |
43 |
<field name='set_integerKey' type='SFInt32' accessType='inputOnly'
appinfo='Resets value used for output when triggered later.'/> |
44 |
<field name='integerKey' type='SFInt32' accessType='inputOutput'
appinfo='integerKey is value for output when triggered.'/> |
45 |
<field name='integerKey_changed' type='SFInt32' accessType='outputOnly'
appinfo='Reports change in integerKey value.'/> |
46 |
<field name='triggerValue' type='SFInt32' accessType='outputOnly'
appinfo='triggerValue provides integer event output matching integerKey when true set_boolean received.'/> |
47 | </ExternProtoDeclare> |
48 | <!-- ======================================== --> |
49 | <ExternProtoDeclare name='TimeTrigger' appinfo='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_boolean' type='SFBool' accessType='inputOnly'
appinfo='If set_boolean input is true trigger output time value.'/> |
51 |
<field name='triggerTime' type='SFTime' accessType='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 example' parameter='"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 | |
63 | </Text> |
64 | </Shape> |
65 | </Anchor> |
66 | </Transform> |
67 | <Transform translation='0 1.5 0'> |
68 | <Anchor description='Click for BooleanToggle example' parameter='"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 example' parameter='"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 example' parameter='"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='TimeTriggerTransform' translation='0 -3 0'> |
104 |
<!-- ROUTE information for TimeTriggerTouchSensor node:
[from isActive to TimeTriggerNode.set_boolean
]
-->
<TouchSensor DEF='TimeTriggerTouchSensor' description='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='TimeTriggerTimeSensor' cycleInterval='2'/> |
116 |
<!-- ROUTE information for TimeTriggerOrientationInterpolator node:
[from TimeTriggerTimeSensor.fraction_changed to set_fraction
]
[from value_changed to TimeTriggerTransform.set_rotation
]
-->
<OrientationInterpolator DEF='TimeTriggerOrientationInterpolator' key='0 0.5 1' keyValue='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 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 |
TimeTriggerNode
TimeTrigger set_boolean SFBool |
then
|
TimeTriggerNode
TimeTrigger triggerTime SFTime |
TimeTriggerTimeSensor
TimeSensor startTime SFTime |
then
|
TimeTriggerTimeSensor
TimeSensor fraction_changed SFFloat |
TimeTriggerOrientationInterpolator
OrientationInterpolator set_fraction SFFloat |
then
|
TimeTriggerOrientationInterpolator
OrientationInterpolator value_changed SFRotation |
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. |
<!--
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>
-->
<!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->