<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "http://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 =' http://www.web3d.org/specifications/x3d-3.3.xsd '>
<head>
<meta name='titlecontent='ExecutionModel.x3d'/>
<meta name='descriptioncontent='X3D encodings example: execution model demonstrated. Click ball to see script-generated text appear.'/>
<meta name='creatorcontent='Don Brutzman and Joe Williams'/>
<meta name='createdcontent='1 June 2002'/>
<meta name='modifiedcontent='28 October 2019'/>
<meta name='specificationSectioncontent=' X3D encodings, ISO/IEC 19776-1.3, Part 1: XML encoding, Annex C.19 Execution model'/>
<meta name='specificationUrlcontent=' https://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/examples.html#ExecutionModel '/>
<meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ExecutionModel.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../license.html'/>
</head>
<!--

Index for DEF nodes : Collector, Result, Script1, Script2, Script3, Script4, Script5, Script6, Script7, TS

Index for Viewpoint image : Viewpoint_1
-->
<Scene>
<WorldInfo title='ExecutionModel.x3d'/>
<!-- ROUTE information for TS node:  [from touchTime to Script1.touchTime ] -->
<TouchSensor DEF='TSdescription='click to animate'/>
<!-- ROUTE information for Script1 node:  [from TS.touchTime to touchTime ] [from toScript2 to Script2.fromScript1 ] [from toScript3 to Script3.fromScript1 ] [from string to Collector.fromString ] -->
<Script DEF='Script1'>
<field name='touchTimetype='SFTimeaccessType='inputOnly'/>
<field name='toScript2type='SFBoolaccessType='outputOnly'/>
<field name='toScript3type='SFBoolaccessType='outputOnly'/>
<field name='stringtype='SFStringaccessType='outputOnly'/>
<![CDATA[
      
ecmascript:
      function touchTime() {
        toScript2 = true;
      }
      function eventsProcessed() {
        string = 'Script1.eventsProcessed';
        toScript3 = true;
      }

    
]]>
</Script>
<!-- ROUTE information for Script2 node:  [from Script1.toScript2 to fromScript1 ] [from toScript4 to Script4.fromScript2 ] [from string to Collector.fromString ] -->
<Script DEF='Script2'>
<field name='fromScript1type='SFBoolaccessType='inputOnly'/>
<field name='toScript4type='SFBoolaccessType='outputOnly'/>
<field name='stringtype='SFStringaccessType='outputOnly'/>
<![CDATA[
      
ecmascript:
      function fromScript1() {
      }
      function eventsProcessed() {
        string = 'Script2.eventsProcessed';
        toScript4 = true;
      }

    
]]>
</Script>
<!-- ROUTE information for Script3 node:  [from Script1.toScript3 to fromScript1 ] [from toScript5 to Script5.fromScript3 ] [from toScript6 to Script6.fromScript3 ] [from string to Collector.fromString ] -->
<Script DEF='Script3'>
<field name='fromScript1type='SFBoolaccessType='inputOnly'/>
<field name='toScript5type='SFBoolaccessType='outputOnly'/>
<field name='toScript6type='SFBoolaccessType='outputOnly'/>
<field name='stringtype='SFStringaccessType='outputOnly'/>
<![CDATA[
      
ecmascript:
      function fromScript1() {
        toScript5 = true;
      }
      function eventsProcessed() {
        string = 'Script3.eventsProcessed';
        toScript6 = true;
      }

    
]]>
</Script>
<!-- ROUTE information for Script4 node:  [from Script2.toScript4 to fromScript2 ] -->
<Script DEF='Script4'>
<field name='fromScript2type='SFBoolaccessType='inputOnly'/>
<![CDATA[
      
ecmascript:
      function fromScript2() {
      }

    
]]>
</Script>
<!-- ROUTE information for Script5 node:  [from Script3.toScript5 to fromScript3 ] -->
<Script DEF='Script5'>
<field name='fromScript3type='SFBoolaccessType='inputOnly'/>
<![CDATA[
      
ecmascript:
       function fromScript3() {
      }

    
]]>
</Script>
<!-- ROUTE information for Script6 node:  [from Script3.toScript6 to fromScript3 ] [from toScript7 to Script7.fromScript6 ] [from string to Collector.fromString ] -->
<Script DEF='Script6'>
<field name='fromScript3type='SFBoolaccessType='inputOnly'/>
<field name='toScript7type='SFBoolaccessType='outputOnly'/>
<field name='stringtype='SFStringaccessType='outputOnly'/>
<![CDATA[
      
ecmascript:
      function fromScript3() {
        toScript7 = true;
      }
      function eventsProcessed() {
        string = 'Script6.eventsProcessed';
      }

    
]]>
</Script>
<!-- ROUTE information for Script7 node:  [from Script6.toScript7 to fromScript6 ] -->
<Script DEF='Script7'>
<field name='fromScript6type='SFBoolaccessType='inputOnly'/>
<![CDATA[
      
ecmascript:
      function fromScript6 () {
      }

    
]]>
</Script>
<!-- Display the results -->
<!-- ROUTE information for Collector node:  [from Script1.string to fromString ] [from Script2.string to fromString ] [from Script3.string to fromString ] [from Script6.string to fromString ] [from string to Result.string ] -->
<Script DEF='Collector'>
<field name='stringtype='MFStringaccessType='outputOnly'/>
<field name='fromStringtype='SFStringaccessType='inputOnly'/>
<![CDATA[
      
ecmascript:
      function initialize() {
        string[0] = 'Event Sequence:';
      }
      function fromString(s) {
        i = string.length;
        string[i] = ' ( ' + i + ' ) ' + s + ' occurred';
      }

    
]]>
</Script>
<Transform translation='0 2 0'>
<Shape>
<Appearance>
<Material diffuseColor='0 0.6 0'/>
</Appearance>
<Sphere/>
</Shape>
</Transform>
<Shape>
<!-- ROUTE information for Result node:  [from Collector.string to string ] -->
<Text DEF='Result'/>
<Appearance>
<Material diffuseColor='0.101961 0.839216 1'/>
</Appearance>
</Shape>
<Viewpoint description='Execution model exampleposition='7 -1 18'/>
<ROUTE fromNode='TSfromField='touchTimetoNode='Script1toField='touchTime'/>
<ROUTE fromNode='Script1fromField='toScript2toNode='Script2toField='fromScript1'/>
<ROUTE fromNode='Script1fromField='toScript3toNode='Script3toField='fromScript1'/>
<ROUTE fromNode='Script2fromField='toScript4toNode='Script4toField='fromScript2'/>
<ROUTE fromNode='Script3fromField='toScript5toNode='Script5toField='fromScript3'/>
<ROUTE fromNode='Script3fromField='toScript6toNode='Script6toField='fromScript3'/>
<ROUTE fromNode='Script6fromField='toScript7toNode='Script7toField='fromScript6'/>
<ROUTE fromNode='Script1fromField='stringtoNode='CollectortoField='fromString'/>
<ROUTE fromNode='Script2fromField='stringtoNode='CollectortoField='fromString'/>
<ROUTE fromNode='Script3fromField='stringtoNode='CollectortoField='fromString'/>
<ROUTE fromNode='Script6fromField='stringtoNode='CollectortoField='fromString'/>
<ROUTE fromNode='CollectorfromField='stringtoNode='ResulttoField='string'/>
</Scene>
</X3D>
<!--

Index for DEF nodes : Collector, Result, Script1, Script2, Script3, Script4, Script5, Script6, Script7, TS

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)
-->

<!-- Additional help information about X3D scenes: X3D Resources, X3D Scene Authoring Hints and X3D Tooltips -->