X3D Model Documentation: ExecutionModel.x3d go to online X3D Example Archives model page

  1  <?xml version="1.0" encoding="UTF-8"?>
  2  <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 4.0//EN" "https://www.web3d.org/specifications/x3d-4.0.dtd">
  3  <X3D profile='Immersive' version='4.0'  xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-4.0.xsd'>
  4       <head>
  5            <meta name='title' content=' ExecutionModel.x3d '/>
  6            <meta name='description' content='X3D encodings example: execution model demonstrated. Click ball to see script-generated text appear.'/>
  7            <meta name='creator' content='Don Brutzman and Joe Williams'/>
  8            <meta name='created' content='1 June 2002'/>
  9            <meta name='modified' content='28 September 2025'/>
 10            <meta name='specificationSection' content='X3D encodings, ISO/IEC 19776-1.3, Part 1: XML encoding, Annex C.19 Execution model'/>
 11            <meta name='specificationUrl' content='https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19776-1v4.0-CD/Part01/examples.html#ExecutionModel'/>
 12            <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ExecutionModel.x3d '/>
 13            <meta name='generator' content='X3D-Edit 4.0, https://www.web3d.org/x3d/tools/X3D-Edit'/>
 14            <meta name='license' content='../license.html'/>
 15       </head>
<!--

Event Graph ROUTE Table shows event connections.

--> <!-- to top DEF nodes index: 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='TS' description='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='touchTime' type='SFTime' accessType='inputOnly'/>
 21                 <field name='toScript2' type='SFBool' accessType='outputOnly'/>
 22                 <field name='toScript3' type='SFBool' accessType='outputOnly'/>
 23                 <field name='string' type='SFString' accessType='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='fromScript1' type='SFBool' accessType='inputOnly'/>
 28                 <field name='toScript4' type='SFBool' accessType='outputOnly'/>
 29                 <field name='string' type='SFString' accessType='outputOnly'/>
  <![CDATA[
      
ecmascript:
      function fromScript1() {
      }
      function eventsProcessed() {
        string = 'Script2.eventsProcessed';
        toScript4 = true;
      }

    
]]>
 31            </Script>
 32 
 33                 <field name='fromScript1' type='SFBool' accessType='inputOnly'/>
 34                 <field name='toScript5' type='SFBool' accessType='outputOnly'/>
 35                 <field name='toScript6' type='SFBool' accessType='outputOnly'/>
 36                 <field name='string' type='SFString' accessType='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='fromScript2' type='SFBool' accessType='inputOnly'/>
  <![CDATA[
      
ecmascript:
      function fromScript2() {
      }

    
]]>
 42            </Script>
 43 
          <!-- ROUTE information for Script5 node:  [from Script3.toScript5 to fromScript3 ] -->
          <Script DEF='Script5'>
 44                 <field name='fromScript3' type='SFBool' accessType='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='fromScript3' type='SFBool' accessType='inputOnly'/>
 49                 <field name='toScript7' type='SFBool' accessType='outputOnly'/>
 50                 <field name='string' type='SFString' accessType='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='fromScript6' type='SFBool' accessType='inputOnly'/>
  <![CDATA[
      
ecmascript:
      function fromScript6 () {
      }

    
]]>
 56            </Script>
 57            <!-- Display the results -->
 58 
 59                 <field name='string' type='MFString' accessType='outputOnly'/>
 60                 <field name='fromString' type='SFString' accessType='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 example' position='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 DEF nodes index: Collector, Result, Script1, Script2, Script3, Script4, Script5, Script6, Script7, TS

Index for Viewpoint node: Viewpoint_1

-->

X3D Tooltips element index: to top Appearance, field, head, Material, meta, ROUTE, Scene, Script, Shape, Sphere, Text, TouchSensor, Transform, Viewpoint, WorldInfo, X3D,
plus documentation for accessType definitions, type definitions, XML data types, and field types

🔖   Event Graph ROUTE Table entries with 10 ROUTE connections and 1 TouchSensor hover hint, showing X3D event-model relationships for this scene.

Each row with a ROUTE statement shows an event cascade that may occur during a single timestamp interval between frame renderings, performed as part of the X3D execution model.

      Collector
Script
string
MFString
→
ROUTE
event to
(1)
Result
Text
string
MFString

TS
TouchSensor
touchTime
SFTime
→
ROUTE
event to
(1)
Script1
Script
touchTime
SFTime
then
from
same
node
Script1
Script
string
SFString
→
ROUTE
event to
(2)
Collector
Script
fromString
SFString
then
from
same
node
Collector
Script
string
MFString
→
ROUTE
event to
(3)
Result
Text
string
MFString
  then
from
same
node
Script1
Script
toScript2
SFBool
→
ROUTE
event to
(2)
Script2
Script
fromScript1
SFBool
then
from
same
node
Script2
Script
string
SFString
→
ROUTE
event to
(3)
Collector
Script
fromString
SFString
then
from
same
node
Collector
Script
string
MFString
→
ROUTE
event to
(4)
Result
Text
string
MFString
  then
from
same
node
Script2
Script
toScript4
SFBool
→
ROUTE
event to
(3)
Script4
Script
fromScript2
SFBool
  then
from
same
node
Script1
Script
toScript3
SFBool
→
ROUTE
event to
(2)
Script3
Script
fromScript1
SFBool
then
from
same
node
Script3
Script
string
SFString
→
ROUTE
event to
(3)
Collector
Script
fromString
SFString
then
from
same
node
Collector
Script
string
MFString
→
ROUTE
event to
(4)
Result
Text
string
MFString
  then
from
same
node
Script3
Script
toScript5
SFBool
→
ROUTE
event to
(3)
Script5
Script
fromScript3
SFBool
  then
from
same
node
Script3
Script
toScript6
SFBool
→
ROUTE
event to
(3)
Script6
Script
fromScript3
SFBool
then
from
same
node
Script6
Script
string
SFString
→
ROUTE
event to
(4)
Collector
Script
fromString
SFString
then
from
same
node
Collector
Script
string
MFString
→
ROUTE
event to
(5)
Result
Text
string
MFString
  then
from
same
node
Script6
Script
toScript7
SFBool
→
ROUTE
event to
(4)
Script7
Script
fromScript6
SFBool

Additional guidance on X3D animation can be found in the 10-Step Animation Design Process and Event Tracing hint sheets.
Have fun with X3D! 😀

-->
go to online X3D Example Archives model page <!-- Online at
https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ExecutionModelIndex.html -->
<!-- SourceForge version control Version control at    
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ExecutionModel.x3d -->

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

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