X3D Model Documentation: ExecutionModel.x3d

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

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

<!-- to top Index for DEF nodes: Collector, Result, Script1, Script2, Script3, Script4, Script5, Script6, Script7, TS

Index for Viewpoint node: Viewpoint_1
-->
 16       <Scene>
 17            <WorldInfo title='ExecutionModel.x3d'/>
 18 
          <!-- ROUTE information for TS node:  [from touchTime to Script1.touchTime ] -->
          <TouchSensor DEF='TSdescription='click to animate'/>
 19 
          <!-- 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'>
 20                 <field name='touchTimetype='SFTimeaccessType='inputOnly'/>
 21                 <field name='toScript2type='SFBoolaccessType='outputOnly'/>
 22                 <field name='toScript3type='SFBoolaccessType='outputOnly'/>
 23                 <field name='stringtype='SFStringaccessType='outputOnly'/>
  <![CDATA[
      
ecmascript:
      function touchTime() {
        toScript2 = true;
      }
      function eventsProcessed() {
        string = 'Script1.eventsProcessed';
        toScript3 = true;
      }

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

    
]]>
 31            </Script>
 32 
 33                 <field name='fromScript1type='SFBoolaccessType='inputOnly'/>
 34                 <field name='toScript5type='SFBoolaccessType='outputOnly'/>
 35                 <field name='toScript6type='SFBoolaccessType='outputOnly'/>
 36                 <field name='stringtype='SFStringaccessType='outputOnly'/>
  <![CDATA[
      
ecmascript:
      function fromScript1() {
        toScript5 = true;
      }
      function eventsProcessed() {
        string = 'Script3.eventsProcessed';
        toScript6 = true;
      }

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

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

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

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

    
]]>
 56            </Script>
 57            <!-- Display the results -->
 58 
 59                 <field name='stringtype='MFStringaccessType='outputOnly'/>
 60                 <field name='fromStringtype='SFStringaccessType='inputOnly'/>
  <![CDATA[
      
ecmascript:
      function initialize() {
        string[0] = 'Event Sequence:';
      }
      function fromString(s) {
        i = string.length;
        string[i] = ' ( ' + i + ' ) ' + s + ' occurred';
      }

    
]]>
 62            </Script>
 63            <Transform translation='0 2 0'>
 64                 <Shape>
 65                      <Appearance>
 66                           <Material diffuseColor='0 0.6 0'/>
 67                      </Appearance>
 68                      <Sphere/>
 69                 </Shape>
 70            </Transform>
 71            <Shape>
 72 
               <!-- ROUTE information for Result node:  [from Collector.string to string ] -->
               <Text DEF='Result'/>
 73                 <Appearance>
 74                      <Material diffuseColor='0.101961 0.839216 1'/>
 75                 </Appearance>
 76            </Shape>
 77            <Viewpoint description='Execution model exampleposition='7 -1 18'/>
 78            < ROUTE  fromNode='TS' fromField='touchTime' toNode='Script1' toField='touchTime'/>
 79            < ROUTE  fromNode='Script1' fromField='toScript2' toNode='Script2' toField='fromScript1'/>
 80            < ROUTE  fromNode='Script1' fromField='toScript3' toNode='Script3' toField='fromScript1'/>
 81            < ROUTE  fromNode='Script2' fromField='toScript4' toNode='Script4' toField='fromScript2'/>
 82            < ROUTE  fromNode='Script3' fromField='toScript5' toNode='Script5' toField='fromScript3'/>
 83            < ROUTE  fromNode='Script3' fromField='toScript6' toNode='Script6' toField='fromScript3'/>
 84            < ROUTE  fromNode='Script6' fromField='toScript7' toNode='Script7' toField='fromScript6'/>
 85            < ROUTE  fromNode='Script1' fromField='string' toNode='Collector' toField='fromString'/>
 86            < ROUTE  fromNode='Script2' fromField='string' toNode='Collector' toField='fromString'/>
 87            < ROUTE  fromNode='Script3' fromField='string' toNode='Collector' toField='fromString'/>
 88            < ROUTE  fromNode='Script6' fromField='string' toNode='Collector' toField='fromString'/>
 89            < ROUTE  fromNode='Collector' fromField='string' toNode='Result' toField='string'/>
 90       </Scene>
 91  </X3D>
<!--

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

<!-- to top Index for DEF nodes: Collector, Result, Script1, Script2, Script3, Script4, Script5, Script6, Script7, TS

Index for Viewpoint node: Viewpoint_1
-->
X3D Tooltips element index: Appearance, field, head, Material, meta, ROUTE, Scene, Script, Shape, Sphere, Text, TouchSensor, Transform, Viewpoint, WorldInfo, X3D, accessType and type, XML data types, field types

Event Graph ROUTE Table entries with 12 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.

TS
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
Script1
Script
touchTime
SFTime
then
 
 
 
Script1
Script
string
SFString

ROUTE
event to
(2)
Collector
Script
fromString
SFString
then
 
 
 
Collector
Script
string
MFString

ROUTE
event to
(3)
Result
Text
string
MFString
  then
 
 
 
Script1
Script
toScript2
SFBool

ROUTE
event to
(2)
Script2
Script
fromScript1
SFBool
then
 
 
 
Script2
Script
string
SFString

ROUTE
event to
(3)
Collector
Script
fromString
SFString
then
 
 
 
Collector
Script
string
MFString

ROUTE
event to
(4)
Result
Text
string
MFString
  then
 
 
 
Script2
Script
toScript4
SFBool

ROUTE
event to
(3)
Script4
Script
fromScript2
SFBool
  then
 
 
 
Script1
Script
toScript3
SFBool

ROUTE
event to
(2)
Script3
Script
fromScript1
SFBool
then
 
 
 
Script3
Script
string
SFString

ROUTE
event to
(3)
Collector
Script
fromString
SFString
then
 
 
 
Collector
Script
string
MFString

ROUTE
event to
(4)
Result
Text
string
MFString
  then
 
 
 
Script3
Script
toScript5
SFBool

ROUTE
event to
(3)
Script5
Script
fromScript3
SFBool
  then
 
 
 
Script3
Script
toScript6
SFBool

ROUTE
event to
(3)
Script6
Script
fromScript3
SFBool
then
 
 
 
Script6
Script
string
SFString

ROUTE
event to
(4)
Collector
Script
fromString
SFString
then
 
 
 
Collector
Script
string
MFString

ROUTE
event to
(5)
Result
Text
string
MFString
  then
 
 
 
Script6
Script
toScript7
SFBool

ROUTE
event to
(4)
Script7
Script
fromScript6
SFBool

      Collector
Script
string
MFString

ROUTE
event to
(1)
Result
Text
string
MFString

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/X3dSpecifications/ExecutionModelIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ExecutionModel.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)
-->

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