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='SceneNodePrototype.x3d'/> |
6 | <meta name='creator' content='Don Brutzman'/> |
7 | <meta name='created' content='19 December 2000'/> |
8 | <meta name='modified' content='20 October 2019'/> |
9 | <meta name='description' content='Expose functionality of Browser class in Java/ECMAscript annexes of VRML 97 specification. Consider promotion to a native node in X3D/VRML 200x scenes.'/> |
10 | <meta name=' warning ' content=' Under development, many of these exposed attributes will be eliminated. Scene node will not be used in X3D proper, but may become a valuable prototype via SAI scripting. '/> |
11 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/Basic/development/SceneNodePrototype.x3d'/> |
12 | <meta name='generator' content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/> |
13 | <meta name='license' content='../license.html'/> |
14 | </head> |
15 | <Scene> |
16 | <WorldInfo title='SceneNodePrototype.x3d'/> |
17 | <ProtoDeclare name='Scene'> |
18 | <ProtoInterface> |
19 | <!-- Standard browser attributes exposed via VRML 97 Script annexes --> |
20 | <field name='createVrmlFromString' type='SFString' accessType='inputOnly'/> |
21 | <field name='createVrmlFromURL' type='SFString' accessType='inputOnly'/> |
22 | <field name='createdVrmlNodes' type='MFNode' accessType='outputOnly'/> |
23 | <field name='currentFrameRate' type='SFFloat' accessType='outputOnly'/> |
24 | <field name='currentSpeed' type='SFFloat' accessType='outputOnly'/> |
25 | <field name='description' type='SFString' accessType='inputOnly'/> |
26 | <field name='evaluate' type='SFBool' accessType='inputOnly'/> |
27 | <field name='loadUrl' type='SFString' accessType='inputOnly'/> |
28 | <field name='loadUrlParameter' type='SFString' accessType='inputOnly'/> |
29 | <field name='name' type='SFString' accessType='outputOnly'/> |
30 | <field name='replaceWorld' type='MFNode' accessType='inputOnly'/> |
31 | <field name='version' type='SFString' accessType='outputOnly'/> |
32 | <field name='worldUrl' type='SFString' accessType='outputOnly'/> |
33 | <field name='addRoute' type='SFBool' accessType='inputOnly'/> |
34 | <field name='deleteRoute' type='SFBool' accessType='inputOnly'/> |
35 | <field name='fromNode' type='SFNode' accessType='inputOnly'/> |
36 | <field name='fromEventOut' type='SFString' accessType='inputOnly'/> |
37 | <field name='toNode' type='SFNode' accessType='inputOnly'/> |
38 | <field name='toEventIn' type='SFString' accessType='inputOnly'/> |
39 | <!-- Candidate additions --> |
40 | <field name='boundBackground' type='SFNode' accessType='outputOnly'/> |
41 | <field name='boundFog' type='SFNode' accessType='outputOnly'/> |
42 | <field name='boundGeoViewpoint' type='SFNode' accessType='outputOnly'/> |
43 | <field name='boundNavigationInfo' type='SFNode' accessType='outputOnly'/> |
44 | <field name='boundViewpoint' type='SFNode' accessType='outputOnly'/> |
45 | <field name='response' type='MFString' accessType='outputOnly'/> |
46 | <field name='dashboardVisible' type='SFBool' value='true' accessType='inputOutput'/> |
47 | <field name='pixelWidth' type='SFInt32' value='-1' accessType='inputOutput'/> |
48 | <field name='pixelHeight' type='SFInt32' value='-1' accessType='inputOutput'/> |
49 | </ProtoInterface> |
50 | <ProtoBody> |
51 | <Script DEF='BrowserScript' directOutput='true'> |
52 | <field name='createVrmlFromString' type='SFString' accessType='inputOnly'/> |
53 | <field name='createVrmlFromURL' type='SFString' accessType='inputOnly'/> |
54 | <field name='createdVrmlNodes' type='MFNode' accessType='outputOnly'/> |
55 | <field name='currentFrameRate' type='SFFloat' accessType='outputOnly'/> |
56 | <field name='currentSpeed' type='SFFloat' accessType='outputOnly'/> |
57 | <field name='description' type='SFString' accessType='inputOnly'/> |
58 | <field name='evaluate' type='SFBool' accessType='inputOnly'/> |
59 | <field name='loadUrl' type='SFString' accessType='inputOnly'/> |
60 | <field name='loadUrlParameter' type='SFString' accessType='inputOnly'/> |
61 | <field name='name' type='SFString' accessType='outputOnly'/> |
62 | <field name='replaceWorld' type='MFNode' accessType='inputOnly'/> |
63 | <field name='version' type='SFString' accessType='outputOnly'/> |
64 | <field name='worldUrl' type='SFString' accessType='outputOnly'/> |
65 | <field name='addRoute' type='SFBool' accessType='inputOnly'/> |
66 | <field name='deleteRoute' type='SFBool' accessType='inputOnly'/> |
67 | <field name='fromNode' type='SFNode' accessType='inputOnly'/> |
68 | <field name='fromEventOut' type='SFString' accessType='inputOnly'/> |
69 | <field name='toNode' type='SFNode' accessType='inputOnly'/> |
70 | <field name='toEventIn' type='SFString' accessType='inputOnly'/> |
71 | <field name='response' type='MFString' accessType='outputOnly'/> |
72 | <IS> |
73 | <connect nodeField='createVrmlFromString' protoField='createVrmlFromString'/> |
74 | <connect nodeField='createVrmlFromURL' protoField='createVrmlFromURL'/> |
75 | <connect nodeField='createdVrmlNodes' protoField='createdVrmlNodes'/> |
76 | <connect nodeField='currentFrameRate' protoField='currentFrameRate'/> |
77 | <connect nodeField='currentSpeed' protoField='currentSpeed'/> |
78 | <connect nodeField='description' protoField='description'/> |
79 | <connect nodeField='evaluate' protoField='evaluate'/> |
80 | <connect nodeField='loadUrl' protoField='loadUrl'/> |
81 | <connect nodeField='loadUrlParameter' protoField='loadUrlParameter'/> |
82 | <connect nodeField='name' protoField='name'/> |
83 | <connect nodeField='replaceWorld' protoField='replaceWorld'/> |
84 | <connect nodeField='version' protoField='version'/> |
85 | <connect nodeField='worldUrl' protoField='worldUrl'/> |
86 | <connect nodeField='addRoute' protoField='addRoute'/> |
87 | <connect nodeField='deleteRoute' protoField='deleteRoute'/> |
88 | <connect nodeField='fromNode' protoField='fromNode'/> |
89 | <connect nodeField='fromEventOut' protoField='fromEventOut'/> |
90 | <connect nodeField='toNode' protoField='toNode'/> |
91 | <connect nodeField='toEventIn' protoField='toEventIn'/> |
92 | <connect nodeField='response' protoField='response'/> |
93 | </IS> |
<![CDATA[
ecmascript: function evaluate (inputValue, timeStamp) { if (inputValue) // Boolean { currentFrameRate = Browser.getCurrentFrameRate (); currentSpeed = Browser.getCurrentSpeed (); version = Browser.getVersion (); name = Browser.getName (); worldUrl = Browser.getWorldURL (); Browser.println ('currentFrameRate = ' + currentFrameRate); Browser.println ('currentSpeed = ' + currentSpeed); Browser.println ('version = ' + version); Browser.println ('name = ' + name); Browser.println ('worldUrl = ' + worldUrl); } } function createVrmlFromString (inputValue, timeStamp) { // note VRML 97 method name didn't follow capitalization convention createdVrmlNodes = Browser.createVrmlFromString (inputValue); } function createVrmlFromUrl (inputValue, timeStamp) { // note VRML 97 method name didn't follow capitalization convention createdVrmlNodes = Browser.createVrmlFromURL (inputValue); } function description (inputValue, timeStamp) { Browser.println ('description = ' + inputValue); Browser.setDescription (inputValue); } function replaceWorld (inputValue, timeStamp) { Browser.replaceWorld (inputValue); } function addRoute (inputValue, timeStamp) { if (inputValue) // Boolean { Browser.addRoute (fromNode, fromEventOut, toNode, toEventIn); } } function deleteRoute (inputValue, timeStamp) { if (inputValue) // Boolean { Browser.deleteRoute (fromNode, fromEventOut, toNode, toEventIn); } } function loadURL (inputValue, timeStamp) { Browser.println ('loadURL = ' + inputValue); Browser.println ('loadUrlParameter = ' + loadUrlParameter); Browser.loadURL (inputValue, loadUrlParameter); } function createVrmlFromURL (SFStringValue, timestamp) { } function loadUrl (SFStringValue, timestamp) { } function loadUrlParameter (SFStringValue, timestamp) { } function fromNode (SFNodeValue, timestamp) { } function fromEventOut (SFStringValue, timestamp) { } function toNode (SFNodeValue, timestamp) { } function toEventIn (SFStringValue, timestamp) { }
]]>
|
|
95 | </Script> |
96 | </ProtoBody> |
97 | </ProtoDeclare> |
98 | <!-- Example invocation --> |
99 |
<!-- ROUTE information for SceneNode node:
[from ClickTextSensor.isActive to evaluate
]
[from currentFrameRate to AssembleBrowserOutputText.currentFrameRate
]
[from currentSpeed to AssembleBrowserOutputText.currentSpeed
]
[from version to AssembleBrowserOutputText.version
]
[from name to AssembleBrowserOutputText.name
]
[from worldUrl to AssembleBrowserOutputText.worldUrl
]
-->
<ProtoInstance name='Scene' DEF='SceneNode'/> |
100 | <Shape> |
101 |
<!-- ROUTE information for Output3dText node:
[from AssembleBrowserOutputText.evaluatedResult to string
]
-->
<Text DEF='Output3dText' string='"Click text for partial Scene node test"'> |
102 | <FontStyle justify='"MIDDLE" "MIDDLE"' size='0.5'/> |
103 | </Text> |
104 | <Appearance> |
105 | <Material diffuseColor='0 0.6 0.6'/> |
106 | </Appearance> |
107 | </Shape> |
108 |
<!-- ROUTE information for ClickTextSensor node:
[from isActive to SceneNode.evaluate
]
-->
<TouchSensor DEF='ClickTextSensor' description='Click text for partial Scene node test'/> |
109 |
<!-- ROUTE information for AssembleBrowserOutputText node:
[from SceneNode.currentFrameRate to currentFrameRate
]
[from SceneNode.currentSpeed to currentSpeed
]
[from SceneNode.version to version
]
[from SceneNode.name to name
]
[from SceneNode.worldUrl to worldUrl
]
[from evaluatedResult to Output3dText.string
]
-->
<Script DEF='AssembleBrowserOutputText'> |
110 | <field name='currentFrameRate' type='SFFloat' accessType='inputOnly'/> |
111 | <field name='currentSpeed' type='SFFloat' accessType='inputOnly'/> |
112 | <field name='name' type='SFString' accessType='inputOnly'/> |
113 | <field name='version' type='SFString' accessType='inputOnly'/> |
114 | <field name='worldUrl' type='SFString' accessType='inputOnly'/> |
115 | <field name='evaluatedResult' type='MFString' accessType='outputOnly'/> |
<![CDATA[
ecmascript: function initialize () { evaluatedResult = new MFString ( 'Click for partial Scene node test:', ' ', ' ', ' ', ' ', ' ', ' ', ' '); } function currentFrameRate (inputValue, timeStamp) { evaluatedResult [2] = 'currentFrameRate=' + inputValue; } function currentSpeed (inputValue, timeStamp) { evaluatedResult [3] = 'currentSpeed=' + inputValue; } function version (inputValue, timeStamp) { evaluatedResult [4] = 'version=' + inputValue; } function name (inputValue, timeStamp) { evaluatedResult [5] = 'name=' + inputValue; } function worldUrl (inputValue, timeStamp) { evaluatedResult [6] = 'worldUrl='; evaluatedResult [7] = inputValue; }
]]>
|
|
117 | </Script> |
118 | < ROUTE fromNode='ClickTextSensor' fromField='isActive' toNode='SceneNode' toField='evaluate'/> |
119 | < ROUTE fromNode='SceneNode' fromField='currentFrameRate' toNode='AssembleBrowserOutputText' toField='currentFrameRate'/> |
120 | < ROUTE fromNode='SceneNode' fromField='currentSpeed' toNode='AssembleBrowserOutputText' toField='currentSpeed'/> |
121 | < ROUTE fromNode='SceneNode' fromField='version' toNode='AssembleBrowserOutputText' toField='version'/> |
122 | < ROUTE fromNode='SceneNode' fromField='name' toNode='AssembleBrowserOutputText' toField='name'/> |
123 | < ROUTE fromNode='SceneNode' fromField='worldUrl' toNode='AssembleBrowserOutputText' toField='worldUrl'/> |
124 | < ROUTE fromNode='AssembleBrowserOutputText' fromField='evaluatedResult' toNode='Output3dText' toField='string'/> |
125 | </Scene> |
126 | </X3D> |
Event Graph ROUTE Table entries with 7 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.
AssembleBrowserOutputText
Script evaluatedResult MFString |
Output3dText
Text 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. -->