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='title' content='Loader.x3d'/> |
6 | <meta name='description' content='This example illustrates use of JavaScript to load a scene from a file through use of the Browser object. When a button is selected to provide a new url for a file to load, the Script adds the new world, waits for the load to complete, then adds the loaded Shape into a rendered group.'/> |
7 | <meta name='creator' content='David R. Nadeau'/> |
8 | <meta name='translator' content='Don Brutzman'/> |
9 | <meta name='created' content='1 July 1998'/> |
10 | <meta name='translated' content='2 February 2014'/> |
11 | <meta name='modified' content='20 October 2019'/> |
12 |
<meta name='Image' content='Loader.png'![]() |
13 | <meta name='reference' content='Button.x3d'/> |
14 | <meta name='reference' content='originals/loader.wrl'/> |
15 | <meta name='reference' content='http://www.siggraph.org/s98'/> |
16 | <meta name='reference' content='http://www.siggraph.org/s98/conference/courses/18.html'/> |
17 | <meta name='reference' content='http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/slides/mt0469.htm'/> |
18 | <meta name='reference' content='http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/vrml97.htm'/> |
19 | <meta name='reference' content='https://www.web3d.org/x3d/content/examples/X3dResources.html'/> |
20 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Loader.x3d'/> |
21 | <meta name='generator' content='Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html'/> |
22 | <meta name='generator' content='X3D-Edit, https://savage.nps.edu/X3D-Edit'/> |
23 | <meta name='license' content='../license.html'/> |
24 | </head> |
25 | <Scene> |
26 | <WorldInfo info='"Copyright (c) 1998, David R. Nadeau"' title='Load VRML using a script'/> |
27 | <NavigationInfo/> |
28 | <Viewpoint description='Entry view'/> |
29 | <Background skyAngle='1.37 1.57 1.77' skyColor='0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.8 0.2 0.0 0.0 0.0'/> |
30 | <ExternProtoDeclare name='Button' url=' "Button.x3d#Button" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Button.x3d#Button" "Button.wrl#Button" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Button.wrl#Button" '> |
31 | <field name='url' type='MFString' accessType='inputOutput'/> |
32 | <field name='textureUrl' type='MFString' accessType='inputOutput'/> |
33 | <field name='url_changed' type='MFString' accessType='outputOnly'/> |
34 | <field name='translation' type='SFVec3f' accessType='initializeOnly'/> |
35 | </ExternProtoDeclare> |
36 |
<!-- ROUTE information for Button1 node:
[from url_changed to Loader.loadUrl
]
-->
<ProtoInstance name='Button' DEF='Button1'> |
37 | <fieldValue name='url' value=' "One.x3d" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/One.x3d"'/> |
38 | <fieldValue name='textureUrl' value=' "one.jpg" '/> |
39 | <fieldValue name='translation' value='-4.0 2.0 0.0'/> |
40 | </ProtoInstance> |
41 |
<!-- ROUTE information for Button2 node:
[from url_changed to Loader.loadUrl
]
-->
<ProtoInstance name='Button' DEF='Button2'> |
42 | <fieldValue name='url' value=' "Two.x3d" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Two.x3d"'/> |
43 | <fieldValue name='textureUrl' value=' "two.jpg" '/> |
44 | <fieldValue name='translation' value='-4.0 0.0 0.0'/> |
45 | </ProtoInstance> |
46 |
<!-- ROUTE information for Button3 node:
[from url_changed to Loader.loadUrl
]
-->
<ProtoInstance name='Button' DEF='Button3'> |
47 | <fieldValue name='url' value=' "Three.x3d" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Three.x3d"'/> |
48 | <fieldValue name='textureUrl' value=' "three.jpg" '/> |
49 | <fieldValue name='translation' value='-4.0 -2.0 0.0'/> |
50 | </ProtoInstance> |
51 | <Transform translation='-4.0 -3.5 0.0'> |
52 | <Shape> |
53 | <Appearance> |
54 | <Material/> |
55 | </Appearance> |
56 |
<!-- ROUTE information for Label node:
[from Loader.string_changed to set_string
]
-->
<Text DEF='Label'> |
57 | <FontStyle justify='"MIDDLE" "MIDDLE"' size='0.75'/> |
58 | </Text> |
59 | </Shape> |
60 | </Transform> |
61 |
<!-- ROUTE information for Loaded node:
[from Loader.node_changed to set_children
]
-->
<Transform DEF='Loaded' translation='1.0 0.0 0.0'> |
62 | <!-- load result goes here --> |
63 | </Transform> |
64 |
<!-- Script
Loader is a DEF node that has 1 USE node: USE_1
<!-- ROUTE information for Loader node: [from Button1.url_changed to loadUrl ] [from Button2.url_changed to loadUrl ] [from Button3.url_changed to loadUrl ] [from node_changed to Loaded.set_children ] [from string_changed to Label.set_string ] --> <Script DEF='Loader' directOutput='true'> |
65 | <field name='lastUrl' type='MFString' value=' "" ' accessType='initializeOnly'/> |
66 | <field name='loadUrl' type='MFString' accessType='inputOnly'/> |
67 | <field name='vrmlLoaded' type='MFNode' accessType='inputOnly'/> |
68 | <field name='node_changed' type='MFNode' accessType='outputOnly'/> |
69 | <field name='string_changed' type='MFString' accessType='outputOnly'/> |
70 | <field name='myself' type='SFNode' accessType='initializeOnly'> |
71 | <Script USE='Loader'> |
72 | </Script> |
72 | </field> |
74 | </Script> |
75 | < ROUTE fromNode='Button1' fromField='url_changed' toNode='Loader' toField='loadUrl'/> |
76 | < ROUTE fromNode='Button2' fromField='url_changed' toNode='Loader' toField='loadUrl'/> |
77 | < ROUTE fromNode='Button3' fromField='url_changed' toNode='Loader' toField='loadUrl'/> |
78 | < ROUTE fromNode='Loader' fromField='node_changed' toNode='Loaded' toField='set_children'/> |
79 | < ROUTE fromNode='Loader' fromField='string_changed' toNode='Label' toField='set_string'/> |
80 | </Scene> |
81 | </X3D> |
Event Graph ROUTE Table entries with 5 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.
Button1
ProtoInstance url_changed MFString |
Loader
Script loadUrl MFString |
then
|
Loader
Script node_changed MFNode |
Loaded
Transform set_children MFNode |
||
then
|
Loader
Script string_changed MFString |
Label
Text set_string MFString |
Button2
ProtoInstance url_changed MFString |
Loader
Script loadUrl MFString |
then
|
Loader
Script node_changed MFNode |
Loaded
Transform set_children MFNode |
||
then
|
Loader
Script string_changed MFString |
Label
Text set_string MFString |
Button3
ProtoInstance url_changed MFString |
Loader
Script loadUrl MFString |
then
|
Loader
Script node_changed MFNode |
Loaded
Transform set_children MFNode |
||
then
|
Loader
Script string_changed MFString |
Label
Text set_string MFString |
<!--
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)
<ProtoInstance
name='ProtoName'>
<field
name='fieldName'/> </ProtoInstance>
-->
<!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->