| 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='title' content=' EventMonitorTest.x3d '/> |
| 6 | <meta name='description' content='This scene demonstrates how to receive a simple event and report it graphically, repeating every few seconds. Scene conversion from the XML encoding (.x3d) is then used to demonstrate X3DOM event handling within a web page (.xhtml).'/> |
| 7 | <meta name='creator' content='Don Brutzman'/> |
| 8 | <meta name='acknowledgements' content='Chris Peri, Dave Arendash and Damon Hernandez'/> |
| 9 | <meta name='created' content='15 March 2014'/> |
| 10 | <meta name='modified' content='31 October 2021'/> |
| 11 | <meta name=' TODO ' content=' record log outputs, compare various X3D players '/> |
| 12 | <meta name='reference' content='AEC Hackathon v1.1, Facebook Menlo Park California'/> |
| 13 | <meta name='reference' content='http://www.aechackathon.org'/> |
| 14 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/UserExperienceUX/EventMonitorTest.x3d '/> |
| 15 | <meta name='generator' content='X3D-Edit 4.0, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
| 16 | <meta name='generator' content=' https://www.web3d.org/x3d/stylesheets/X3dToX3dom.xslt '/> |
| 17 | <meta name='license' content='../license.html'/> |
| 18 | </head> |
| 19 | <Scene> |
| 20 | <!-- ================================================== --> |
| 21 | <!-- Reusable code block for X3DOM: indicate event status --> |
| 22 | <WorldInfo title='EventMonitorTest.x3d'/> |
| 23 | <Background skyColor='0.4 0.6 1'/> |
| 24 | <Viewpoint description='Event Monitor Text' position='0 0 6'/> |
| 25 | <Transform translation='-0.6 1.2 0'> |
| 26 | <Shape> |
| 27 | <Text string='"Event Status"'> |
| 28 | |
| 29 | </Text> |
| 30 | <Appearance> |
| 31 | <Material DEF='TextMaterial' diffuseColor='0.7 0.7 0.1'/> |
| 32 | </Appearance> |
| 33 | </Shape> |
| 34 | </Transform> |
| 35 |
<!-- ROUTE information for EventSwitch node:
[from EventTrueTrigger.triggerValue to whichChoice
]
[from EventFalseTrigger.triggerValue to whichChoice
]
-->
<Switch DEF='EventSwitch' whichChoice='0'> |
| 36 | <Group DEF='DisplayUp'> |
| 37 | <Shape> |
| 38 | <Text string='"UP"'> |
| 39 | <FontStyle USE='Font'/> |
| 40 | </Text> |
| 41 | <Appearance> |
| 42 | |
| 43 | </Appearance> |
| 44 | </Shape> |
| 45 | <Transform translation='-2.5 0 0'> |
| 46 | <Shape> |
| 47 | |
| 48 | <Appearance> |
| 49 | <Material USE='UpColor'/> |
| 50 | </Appearance> |
| 51 | </Shape> |
| 52 | </Transform> |
| 53 | </Group> |
| 54 | <Group DEF='DisplayDown'> |
| 55 | <Shape> |
| 56 | <Text string='"DOWN"'> |
| 57 | <FontStyle USE='Font'/> |
| 58 | </Text> |
| 59 | <Appearance> |
| 60 | |
| 61 | </Appearance> |
| 62 | </Shape> |
| 63 | <Transform rotation='1 0 0 3.14159' translation='-2.5 0 0'> |
| 64 | <Shape> |
| 65 | <Cone USE='SmallCone'/> |
| 66 | <Appearance> |
| 67 | <Material USE='DownColor'/> |
| 68 | </Appearance> |
| 69 | </Shape> |
| 70 | </Transform> |
| 71 | </Group> |
| 72 | </Switch> |
| 73 | <!-- ================================================== --> |
| 74 | <!-- Test harness: produce true/false events, flip the Switch --> |
| 75 |
<!-- ROUTE information for EventTrueTrigger node:
[from EventReceiverScript.eventIsTrue to set_boolean
]
[from triggerValue to EventSwitch.whichChoice
]
-->
<IntegerTrigger DEF='EventTrueTrigger' integerKey='0'/> |
| 76 | < ROUTE fromNode='EventTrueTrigger' fromField='triggerValue' toNode='EventSwitch' toField='whichChoice'/> |
| 77 |
<!-- ROUTE information for EventFalseTrigger node:
[from EventReceiverScript.eventIsFalse to set_boolean
]
[from triggerValue to EventSwitch.whichChoice
]
-->
<IntegerTrigger DEF='EventFalseTrigger' integerKey='1'/> |
| 78 | < ROUTE fromNode='EventFalseTrigger' fromField='triggerValue' toNode='EventSwitch' toField='whichChoice'/> |
| 79 |
<!-- ROUTE information for EventReceiverScript node:
[from BooleanSwitcher.value_changed to input
]
[from eventIsTrue to EventTrueTrigger.set_boolean
]
[from eventIsFalse to EventFalseTrigger.set_boolean
]
-->
<Script DEF='EventReceiverScript'> |
| 80 | <field name='input' type='SFBool' accessType='inputOnly'/> |
| 81 | <field name='eventIsTrue' type='SFBool' accessType='outputOnly'/> |
| 82 | <field name='eventIsFalse' type='SFBool' accessType='outputOnly'/> |
<![CDATA[
ecmascript:
function input (eventValue) // input eventValue received for inputOnly field
{
if (eventValue) eventIsTrue = true;
else eventIsFalse = true;
}
]]>
|
|
| 84 | </Script> |
| 85 | < ROUTE fromNode='EventReceiverScript' fromField='eventIsTrue' toNode='EventTrueTrigger' toField='set_boolean'/> |
| 86 | < ROUTE fromNode='EventReceiverScript' fromField='eventIsFalse' toNode='EventFalseTrigger' toField='set_boolean'/> |
| 87 | <!-- Testing block: alternate true/false --> |
| 88 |
<!-- ROUTE information for BooleanSwitcher node:
[from SwitchTestClock.fraction_changed to set_fraction
]
[from value_changed to EventReceiverScript.input
]
-->
<BooleanSequencer DEF='BooleanSwitcher' key='0 0.5 1' keyValue='true false false'/> |
| 89 | < ROUTE fromNode='BooleanSwitcher' fromField='value_changed' toNode='EventReceiverScript' toField='input'/> |
| 90 |
<!-- ROUTE information for SwitchTestClock node:
[from fraction_changed to BooleanSwitcher.set_fraction
]
-->
<TimeSensor DEF='SwitchTestClock' cycleInterval='6' loop='true'/> |
| 91 | < ROUTE fromNode='SwitchTestClock' fromField='fraction_changed' toNode='BooleanSwitcher' toField='set_fraction'/> |
| 92 | </Scene> |
| 93 | </X3D> |
Event Graph ROUTE Table entries with 6 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.
|
SwitchTestClock
TimeSensor fraction_changed SFFloat |
BooleanSwitcher
BooleanSequencer set_fraction SFFloat |
then
|
BooleanSwitcher
BooleanSequencer value_changed SFBool |
EventReceiverScript
Script input SFBool |
then
|
EventReceiverScript
Script eventIsFalse SFBool |
EventFalseTrigger
IntegerTrigger set_boolean SFBool |
then
|
EventFalseTrigger
IntegerTrigger triggerValue SFInt32 |
EventSwitch
Switch whichChoice SFInt32 |
||||
|
then
|
EventReceiverScript
Script eventIsTrue SFBool |
EventTrueTrigger
IntegerTrigger set_boolean SFBool |
then
|
EventTrueTrigger
IntegerTrigger triggerValue SFInt32 |
EventSwitch
Switch whichChoice SFInt32 |
|||||||||
<!--
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)
-->
<!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->