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='Chopper.x3d'/> |
6 | <meta name='description' content='Rotor node provides animation and serves as an ExternProtoDeclare example'/> |
7 | <meta name='creator' content='Don Brutzman and Joe Williams'/> |
8 | <meta name='created' content='1 June 2002'/> |
9 | <meta name='modified' content='28 October 2019'/> |
10 | <meta name='specificationSection' content='X3D encodings, ISO/IEC 19776-1.3, Part 1: XML encoding, Annex C.16 Chopper'/> |
11 | <meta name='specificationUrl' content='https://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/examples.html#Chopper'/> |
12 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/Chopper.x3d'/> |
13 | <meta name='generator' content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/> |
14 | <meta name='license' content='../license.html'/> |
15 | </head> |
16 | <Scene> |
17 | <WorldInfo title='Chopper.x3d'/> |
18 | <ExternProtoDeclare name='Rotor' url=' "Rotor.x3d#Rotor" "https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/Rotor.x3d#Rotor" "Rotor.wrl#Rotor" "https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/Rotor.wrl#Rotor" '> |
19 | <field name='rate' type='SFTime' accessType='initializeOnly'/> |
20 | <field name='children' type='MFNode' accessType='initializeOnly'/> |
21 | <field name='startTime' type='SFTime' accessType='inputOutput'/> |
22 | <field name='stopTime' type='SFTime' accessType='inputOutput'/> |
23 | </ExternProtoDeclare> |
24 | <ProtoDeclare name='Chopper'> |
25 | <ProtoInterface> |
26 | <field name='rotorSpeed' type='SFTime' value='1' accessType='initializeOnly'/> |
27 | </ProtoInterface> |
28 | <ProtoBody> |
29 | <Group> |
30 |
<!-- ROUTE information for Touch node:
[from touchTime to RotorScript.startOrStopEngine
]
-->
<TouchSensor DEF='Touch' description='touch to toggle rotor rotation'/> |
31 | <Inline url=' "ChopperBody.x3d" "https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ChopperBody.x3d" "ChopperBody.wrl" "https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ChopperBody.wrl" '/> |
32 |
<!-- ROUTE information for Top node:
[from RotorScript.startEngine to startTime
]
[from RotorScript.stopEngine to stopTime
]
-->
<ProtoInstance name='Rotor' DEF='Top'> |
33 | <fieldValue name='stopTime' value='1'/> |
34 | <fieldValue name='children'> |
35 | <Inline url=' "ChopperRotor.x3d" "https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ChopperRotor.x3d" "ChopperRotor.wrl" "https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ChopperRotor.wrl" '/> |
36 | </fieldValue> |
37 | <IS> |
38 | <connect nodeField='rate' protoField='rotorSpeed'/> |
39 | </IS> |
40 | </ProtoInstance> |
41 | </Group> |
42 | <!-- after first node in ProtoDeclare, remainder of nodes do not render --> |
43 |
<!-- ROUTE information for RotorScript node:
[from Touch.touchTime to startOrStopEngine
]
[from startEngine to Top.startTime
]
[from stopEngine to Top.stopTime
]
-->
<Script DEF='RotorScript'> |
44 | <field name='startOrStopEngine' type='SFTime' accessType='inputOnly'/> |
45 | <field name='startEngine' type='SFTime' accessType='outputOnly'/> |
46 | <field name='stopEngine' type='SFTime' accessType='outputOnly'/> |
47 | <field name='engineStarted' type='SFBool' value='false' accessType='initializeOnly'/> |
<![CDATA[
ecmascript: function startOrStopEngine(value) { // start or stop engine: if (!engineStarted) { startEngine = value; engineStarted = true; } else { stopEngine = value; engineStarted = false; } }
]]>
|
|
49 | </Script> |
50 | < ROUTE fromNode='Touch' fromField='touchTime' toNode='RotorScript' toField='startOrStopEngine'/> |
51 | < ROUTE fromNode='RotorScript' fromField='startEngine' toNode='Top' toField='startTime'/> |
52 | < ROUTE fromNode='RotorScript' fromField='stopEngine' toNode='Top' toField='stopTime'/> |
53 | </ProtoBody> |
54 | </ProtoDeclare> |
55 | <Viewpoint description='Example16' position='0 0 5'/> |
56 | <Group> |
57 | <ProtoInstance name='Chopper' DEF='MikesChopper'/> |
58 | </Group> |
59 | </Scene> |
60 | </X3D> |
Event Graph ROUTE Table entries with 3 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.
Touch
TouchSensor touchTime SFTime |
RotorScript
Script startOrStopEngine SFTime |
then
|
RotorScript
Script startEngine SFTime |
Top
ProtoInstance startTime SFTime |
||
then
|
RotorScript
Script stopEngine SFTime |
Top
ProtoInstance stopTime SFTime |
MikesChopper
ProtoInstance Chopper |
No ROUTE connection found for output events from this node. This ProtoInstance contains SFNode/MFNode fieldValue declarations with direct access to other nodes, and thus has potential to produce run-time animation. |
<!--
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. -->