| 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
|
| 3 | <X3D profile='Immersive' version='3.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.0.xsd'> |
| 4 | <head> |
| 5 | <meta name='title' content=' Example19.x3d '/> |
| 6 | <meta name='creator' content='Don Brutzman'/> |
| 7 | <meta name='created' content='24 May 2000'/> |
| 8 | <meta name='modified' content='28 October 2019'/> |
| 9 | <meta name='creator' content='X3D working group'/> |
| 10 | <meta name='description' content='VRML 97 specification example: Execution model demonstrated. Click ball to see script-generated text appear.'/> |
| 11 | <meta name='reference' content='originals/exampleD_19.wrl'/> |
| 12 | <meta name='specificationSection' content='VRML 97, ISO/IEC 14772-1, Part 1: Functional specification and UTF-8 encoding, D.19 Execution model'/> |
| 13 | <meta name='specificationUrl' content='https://www.web3d.org/documents/specifications/14772/V2.0/part1/examples.html#D.19'/> |
| 14 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/Basic/Vrml97Specification/Example19.x3d '/> |
| 15 | <meta name='generator' content='X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
| 16 | <meta name='license' content='../license.html'/> |
| 17 | </head> |
| 18 | <Scene> |
| 19 | <WorldInfo title='Example19.x3d'/> |
| 20 |
<!-- ROUTE information for TS node:
[from touchTime to Script1.touchTime
]
-->
<TouchSensor DEF='TS' description='touch to trigger more events'/> |
| 21 | <!-- Warning: VRML97-style scripting, not X3D Scene Authoring Interface (SAI) --> |
| 22 |
<!-- 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'> |
| 23 | <field name='touchTime' type='SFTime' accessType='inputOnly'/> |
| 24 | <field name='toScript2' type='SFBool' accessType='outputOnly'/> |
| 25 | <field name='toScript3' type='SFBool' accessType='outputOnly'/> |
| 26 | <field name='string' type='SFString' accessType='outputOnly'/> |
<![CDATA[
ecmascript:
function touchTime()
{
toScript2 = true;
}
function eventsProcessed()
{
string = 'Script1.eventsProcessed';
toScript3 = true;
}
]]>
|
|
| 28 | </Script> |
| 29 | <!-- Warning: VRML97-style scripting, not X3D Scene Authoring Interface (SAI) --> |
| 30 |
<!-- ROUTE information for Script2 node:
[from Script1.toScript2 to fromScript1
]
[from toScript4 to Script4.fromScript2
]
[from string to Collector.fromString
]
-->
<Script DEF='Script2'> |
| 31 | <field name='fromScript1' type='SFBool' accessType='inputOnly'/> |
| 32 | <field name='toScript4' type='SFBool' accessType='outputOnly'/> |
| 33 | <field name='string' type='SFString' accessType='outputOnly'/> |
<![CDATA[
ecmascript:
function fromScript1() { }
function eventsProcessed()
{
string = 'Script2.eventsProcessed';
toScript4 = true;
}
]]>
|
|
| 35 | </Script> |
| 36 | <!-- Warning: VRML97-style scripting, not X3D Scene Authoring Interface (SAI) --> |
| 37 |
<!-- 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'> |
| 38 | <field name='fromScript1' type='SFBool' accessType='inputOnly'/> |
| 39 | <field name='toScript5' type='SFBool' accessType='outputOnly'/> |
| 40 | <field name='toScript6' type='SFBool' accessType='outputOnly'/> |
| 41 | <field name='string' type='SFString' accessType='outputOnly'/> |
<![CDATA[
ecmascript:
function fromScript1()
{
toScript5 = true;
}
function eventsProcessed()
{
string = 'Script3.eventsProcessed';
toScript6 = true;
}
]]>
|
|
| 43 | </Script> |
| 44 | <!-- Warning: VRML97-style scripting, not X3D Scene Authoring Interface (SAI) --> |
| 45 |
<!-- ROUTE information for Script4 node:
[from Script2.toScript4 to fromScript2
]
-->
<Script DEF='Script4'> |
| 46 | <field name='fromScript2' type='SFBool' accessType='inputOnly'/> |
<![CDATA[
ecmascript:
function fromScript2() { }
]]>
|
|
| 48 | </Script> |
| 49 | <!-- Warning: VRML97-style scripting, not X3D Scene Authoring Interface (SAI) --> |
| 50 |
<!-- ROUTE information for Script5 node:
[from Script3.toScript5 to fromScript3
]
-->
<Script DEF='Script5'> |
| 51 | <field name='fromScript3' type='SFBool' accessType='inputOnly'/> |
<![CDATA[
ecmascript:
function fromScript3() { }
]]>
|
|
| 53 | </Script> |
| 54 | <!-- Warning: VRML97-style scripting, not X3D Scene Authoring Interface (SAI) --> |
| 55 |
<!-- ROUTE information for Script6 node:
[from Script3.toScript6 to fromScript3
]
[from toScript7 to Script7.fromScript6
]
[from string to Collector.fromString
]
-->
<Script DEF='Script6'> |
| 56 | <field name='fromScript3' type='SFBool' accessType='inputOnly'/> |
| 57 | <field name='toScript7' type='SFBool' accessType='outputOnly'/> |
| 58 | <field name='string' type='SFString' accessType='outputOnly'/> |
<![CDATA[
ecmascript:
function fromScript3()
{
toScript7 = true;
}
function eventsProcessed()
{
string = 'Script6.eventsProcessed';
}
]]>
|
|
| 60 | </Script> |
| 61 | <!-- Warning: VRML97-style scripting, not X3D Scene Authoring Interface (SAI) --> |
| 62 |
<!-- ROUTE information for Script7 node:
[from Script6.toScript7 to fromScript6
]
-->
<Script DEF='Script7'> |
| 63 | <field name='fromScript6' type='SFBool' accessType='inputOnly'/> |
<![CDATA[
ecmascript:
function fromScript6 () { }
]]>
|
|
| 65 | </Script> |
| 66 | <!-- Display the results --> |
| 67 |
<!-- 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'> |
| 68 | <field name='string' type='MFString' accessType='outputOnly'/> |
| 69 | <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';
}
]]>
|
|
| 71 | </Script> |
| 72 | <Transform translation='0 -6 0'> |
| 73 | <Transform translation='-2 2 0'> |
| 74 | <Shape> |
| 75 | <Appearance> |
| 76 | <Material diffuseColor='0 0.6 0'/> |
| 77 | </Appearance> |
| 78 | <Sphere/> |
| 79 | </Shape> |
| 80 | </Transform> |
| 81 | <Shape> |
| 82 |
<!-- ROUTE information for Result node:
[from Collector.string to string
]
-->
<Text DEF='Result'> |
| 83 | <FontStyle justify='"BEGIN" "END"'/> |
| 84 | </Text> |
| 85 | <Appearance DEF='DefaultAppearance'> |
| 86 | <Material/> |
| 87 | </Appearance> |
| 88 | </Shape> |
| 89 | </Transform> |
| 90 | <Viewpoint description='Touch ball to trigger events' position='7 -1 18'/> |
| 91 | < ROUTE fromNode='TS' fromField='touchTime' toNode='Script1' toField='touchTime'/> |
| 92 | < ROUTE fromNode='Script1' fromField='toScript2' toNode='Script2' toField='fromScript1'/> |
| 93 | < ROUTE fromNode='Script1' fromField='toScript3' toNode='Script3' toField='fromScript1'/> |
| 94 | < ROUTE fromNode='Script2' fromField='toScript4' toNode='Script4' toField='fromScript2'/> |
| 95 | < ROUTE fromNode='Script3' fromField='toScript5' toNode='Script5' toField='fromScript3'/> |
| 96 | < ROUTE fromNode='Script3' fromField='toScript6' toNode='Script6' toField='fromScript3'/> |
| 97 | < ROUTE fromNode='Script6' fromField='toScript7' toNode='Script7' toField='fromScript6'/> |
| 98 | < ROUTE fromNode='Script1' fromField='string' toNode='Collector' toField='fromString'/> |
| 99 | < ROUTE fromNode='Script2' fromField='string' toNode='Collector' toField='fromString'/> |
| 100 | < ROUTE fromNode='Script3' fromField='string' toNode='Collector' toField='fromString'/> |
| 101 | < ROUTE fromNode='Script6' fromField='string' toNode='Collector' toField='fromString'/> |
| 102 | < ROUTE fromNode='Collector' fromField='string' toNode='Result' toField='string'/> |
| 103 | </Scene> |
| 104 | </X3D> |
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.
|
Collector
Script string MFString |
Result
Text string MFString |
<!--
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.
-->