<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
<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 '>
<head>
<meta name='titlecontent='EventMonitorTest.x3d'/>
<meta name='descriptioncontent='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).'/>
<meta name='creatorcontent='Don Brutzman'/>
<meta name='acknowledgementscontent='Chris Peri, Dave Arendash and Damon Hernandez'/>
<meta name='createdcontent='15 March 2014'/>
<meta name='modifiedcontent='31 October 2021'/>
<meta name=' TODO content=' record log outputs, compare various X3D players '/>
<meta name='referencecontent='AEC Hackathon v1.1, Facebook Menlo Park California'/>
<meta name='referencecontent=' http://www.aechackathon.org '/>
<meta name='identifiercontent=' https://x3dgraphics.com/examples/X3dForAdvancedModeling/UserExperienceUX/EventMonitorTest.x3d '/>
<meta name='generatorcontent='X3D-Edit 4.0, https://savage.nps.edu/X3D-Edit'/>
<meta name='generatorcontent='https://www.web3d.org/x3d/stylesheets/X3dToX3dom.xslt'/>
<meta name='licensecontent=' ../license.html'/>
</head>
<!-- -->
<Scene>
<!-- ================================================== -->
<!-- Reusable code block for X3DOM: indicate event status -->
<WorldInfo title='EventMonitorTest.x3d'/>
<Background skyColor='0.4 0.6 1'/>
<Viewpoint description='Event Monitor Textposition='0 0 6'/>
<Transform translation='-0.6 1.2 0'>
<Shape>
<Text string='"Event Status"'>
<FontStyle DEF='Fontjustify='"MIDDLE" "MIDDLE"style='BOLD'/>
</Text>
<Appearance>
<Material DEF='TextMaterialdiffuseColor='0.7 0.7 0.1'/>
</Appearance>
</Shape>
</Transform>
<!-- ROUTE information for EventSwitch node:  [from EventTrueTrigger.triggerValue to whichChoice ] [from EventFalseTrigger.triggerValue to whichChoice ] -->
<Switch DEF='EventSwitchwhichChoice='0'>
<Group DEF='DisplayUp'>
<Shape>
<Text string='"UP"'>
<FontStyle USE='Font'/>
</Text>
<Appearance>
<Material DEF='UpColordiffuseColor='0.2 0.7 0.3'/>
</Appearance>
</Shape>
<Transform translation='-2.5 0 0'>
<Shape>
<Cone DEF='SmallConebottomRadius='0.4height='0.6'/>
<Appearance>
<Material USE='UpColor'/>
</Appearance>
</Shape>
</Transform>
</Group>
<Group DEF='DisplayDown'>
<Shape>
<Text string='"DOWN"'>
<FontStyle USE='Font'/>
</Text>
<Appearance>
<Material DEF='DownColordiffuseColor='1 0.2 0.2'/>
</Appearance>
</Shape>
<Transform rotation='1 0 0 3.14159translation='-2.5 0 0'>
<Shape>
<Cone USE='SmallCone'/>
<Appearance>
<Material USE='DownColor'/>
</Appearance>
</Shape>
</Transform>
</Group>
</Switch>
<!-- ================================================== -->
<!-- Test harness: produce true/false events, flip the Switch -->
<!-- ROUTE information for EventTrueTrigger node:  [from EventReceiverScript.eventIsTrue to set_boolean ] [from triggerValue to EventSwitch.whichChoice ] -->
<IntegerTrigger DEF='EventTrueTriggerintegerKey='0containerField='children'/>
<ROUTE fromNode='EventTrueTriggerfromField='triggerValuetoNode='EventSwitchtoField='whichChoice'/>
<!-- ROUTE information for EventFalseTrigger node:  [from EventReceiverScript.eventIsFalse to set_boolean ] [from triggerValue to EventSwitch.whichChoice ] -->
<IntegerTrigger DEF='EventFalseTriggerintegerKey='1containerField='children'/>
<ROUTE fromNode='EventFalseTriggerfromField='triggerValuetoNode='EventSwitchtoField='whichChoice'/>
<!-- 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'>
<field name='inputtype='SFBoolaccessType='inputOnly'/>
<field name='eventIsTruetype='SFBoolaccessType='outputOnly'/>
<field name='eventIsFalsetype='SFBoolaccessType='outputOnly'/>
<![CDATA[
      
ecmascript:

function input (eventValue) // input eventValue received for inputOnly field
{
   if (eventValue) eventIsTrue  = true;
   else            eventIsFalse = true;
}

    
]]>
</Script>
<ROUTE fromNode='EventReceiverScriptfromField='eventIsTruetoNode='EventTrueTriggertoField='set_boolean'/>
<ROUTE fromNode='EventReceiverScriptfromField='eventIsFalsetoNode='EventFalseTriggertoField='set_boolean'/>
<!-- Testing block: alternate true/false -->
<!-- ROUTE information for BooleanSwitcher node:  [from SwitchTestClock.fraction_changed to set_fraction ] [from value_changed to EventReceiverScript.input ] -->
<BooleanSequencer DEF='BooleanSwitcherkey='0 0.5 1keyValue='true false falsecontainerField='children'/>
<ROUTE fromNode='BooleanSwitcherfromField='value_changedtoNode='EventReceiverScripttoField='input'/>
<!-- ROUTE information for SwitchTestClock node:  [from fraction_changed to BooleanSwitcher.set_fraction ] -->
<TimeSensor DEF='SwitchTestClockcycleInterval='6loop='true'/>
<ROUTE fromNode='SwitchTestClockfromField='fraction_changedtoNode='BooleanSwitchertoField='set_fraction'/>
</Scene>
</X3D>
<!--

Index for DEF nodes : BooleanSwitcher, DisplayDown, DisplayUp, DownColor, EventFalseTrigger, EventReceiverScript, EventSwitch, EventTrueTrigger, Font, SmallCone, SwitchTestClock, TextMaterial, UpColor

Index for Viewpoint image : Viewpoint_1
-->

<!-- Color key: <X3dNode DEF='idName' field='value'/> matches <XmlElement DEF='idName' attribute='value'/>
(Light blue background: behavior node) (Grey background: inserted documentation) (Magenta background: X3D Extensibility)
-->

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