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='ShuttlesAndPendulums.x3d'/> |
6 | <meta name='description' content='X3D encodings example: animation of shuttle and pendulum prototype nodes.'/> |
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.14 Shuttles and pendulums'/> |
11 | <meta name='specificationUrl' content='https://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/examples.html#ShuttlesAndPendulums'/> |
12 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ShuttlesAndPendulums.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='ShuttlesAndPendulums.x3d'/> |
18 | <ProtoDeclare name='Shuttle'> |
19 | <ProtoInterface> |
20 | <field name='rate' type='SFTime' value='1' accessType='initializeOnly'/> |
21 | <field name='distance' type='SFFloat' value='1' accessType='initializeOnly'/> |
22 | <field name='children' type='MFNode' accessType='initializeOnly'> |
23 | <!-- initial value is empty node array --> |
24 | </field> |
25 | <field name='startTime' type='SFTime' value='0' accessType='inputOutput'/> |
26 | <field name='stopTime' type='SFTime' value='0' accessType='inputOutput'/> |
27 | <field name='loop' type='SFBool' value='true' accessType='initializeOnly'/> |
28 | </ProtoInterface> |
29 | <ProtoBody> |
30 |
<!-- ROUTE information for F node:
[from I.value_changed to translation
]
-->
<Transform DEF='F'> |
31 | <IS> |
32 | <connect nodeField='children' protoField='children'/> |
33 | </IS> |
34 | </Transform> |
35 | <!-- after first node in ProtoDeclare, remainder of nodes do not render --> |
36 |
<!-- ROUTE information for T node:
[from fraction_changed to I.set_fraction
]
-->
<TimeSensor DEF='T'> |
37 | <IS> |
38 | <connect nodeField='cycleInterval' protoField='rate'/> |
39 | <connect nodeField='startTime' protoField='startTime'/> |
40 | <connect nodeField='stopTime' protoField='stopTime'/> |
41 | <connect nodeField='loop' protoField='loop'/> |
42 | </IS> |
43 | </TimeSensor> |
44 |
<!-- ROUTE information for S node:
[from position to I.keyValue
]
-->
<Script DEF='S'> |
45 | <field name='distance' type='SFFloat' accessType='initializeOnly'/> |
46 | <field name='position' type='MFVec3f' accessType='outputOnly'/> |
47 | <IS> |
48 | <connect nodeField='distance' protoField='distance'/> |
49 | </IS> |
<![CDATA[
ecmascript: function initialize () { // constructor:setup interpolator pos1 = new SFVec3f(-distance, 0, 0); pos2 = new SFVec3f(distance, 0, 0); position = new MFVec3f(pos1, pos2, pos1); }
]]>
|
|
51 | </Script> |
52 |
<!-- ROUTE information for I node:
[from T.fraction_changed to set_fraction
]
[from S.position to keyValue
]
[from value_changed to F.translation
]
-->
<PositionInterpolator DEF='I' key='0 0.5 1' keyValue='-1 0 0 1 0 0 -1 0 0'/> |
53 | < ROUTE fromNode='T' fromField='fraction_changed' toNode='I' toField='set_fraction'/> |
54 | < ROUTE fromNode='I' fromField='value_changed' toNode='F' toField='translation'/> |
55 | < ROUTE fromNode='S' fromField='position' toNode='I' toField='keyValue'/> |
56 | </ProtoBody> |
57 | </ProtoDeclare> |
58 | <ProtoDeclare name='Pendulum'> |
59 | <ProtoInterface> |
60 | <field name='rate' type='SFTime' value='1' accessType='initializeOnly'/> |
61 | <field name='maxAngle' type='SFFloat' value='3.14159' accessType='initializeOnly'/> |
62 | <field name='children' type='MFNode' accessType='initializeOnly'> |
63 | <!-- initial value is empty node array --> |
64 | </field> |
65 | <field name='startTime' type='SFTime' value='0' accessType='inputOutput'/> |
66 | <field name='stopTime' type='SFTime' value='0' accessType='inputOutput'/> |
67 | <field name='loop' type='SFBool' value='true' accessType='initializeOnly'/> |
68 | </ProtoInterface> |
69 | <ProtoBody> |
70 |
<!-- ROUTE information for FF node:
[from II.value_changed to rotation
]
-->
<Transform DEF='FF'> |
71 | <IS> |
72 | <connect nodeField='children' protoField='children'/> |
73 | </IS> |
74 | </Transform> |
75 | <!-- after first node in ProtoDeclare, remainder of nodes do not render --> |
76 |
<!-- ROUTE information for TT node:
[from fraction_changed to II.set_fraction
]
-->
<TimeSensor DEF='TT'> |
77 | <IS> |
78 | <connect nodeField='cycleInterval' protoField='rate'/> |
79 | <connect nodeField='startTime' protoField='startTime'/> |
80 | <connect nodeField='stopTime' protoField='stopTime'/> |
81 | <connect nodeField='loop' protoField='loop'/> |
82 | </IS> |
83 | </TimeSensor> |
84 |
<!-- ROUTE information for SS node:
[from rotation to II.keyValue
]
-->
<Script DEF='SS'> |
85 | <field name='maxAngle' type='SFFloat' accessType='initializeOnly'/> |
86 | <field name='rotation' type='MFRotation' accessType='outputOnly'/> |
87 | <IS> |
88 | <connect nodeField='maxAngle' protoField='maxAngle'/> |
89 | </IS> |
<![CDATA[
ecmascript: function initialize() { // constructor: setup interpolator rot1 = new SFRotation(0, 0, 1, 0); rot2 = new SFRotation(0, 0, 1, maxAngle/2); rot3 = new SFRotation(0, 0, 1, maxAngle); rotation = new MFRotation(rot1, rot2, rot3, rot2, rot1); }
]]>
|
|
91 | </Script> |
92 |
<!-- ROUTE information for II node:
[from TT.fraction_changed to set_fraction
]
[from SS.rotation to keyValue
]
[from value_changed to FF.rotation
]
-->
<OrientationInterpolator DEF='II' key='0 0.25 0.5 0.75 1' keyValue='0 0 1 0 0 0 1 1.57 0 0 1 3.14 0 0 1 1.57 0 0 1 0'/> |
93 | < ROUTE fromNode='TT' fromField='fraction_changed' toNode='II' toField='set_fraction'/> |
94 | < ROUTE fromNode='II' fromField='value_changed' toNode='FF' toField='rotation'/> |
95 | < ROUTE fromNode='SS' fromField='rotation' toNode='II' toField='keyValue'/> |
96 | </ProtoBody> |
97 | </ProtoDeclare> |
98 | <Transform translation='-3 0 0'> |
99 | <ProtoInstance name='Pendulum'> |
100 | <fieldValue name='rate' value='3'/> |
101 | <fieldValue name='maxAngle' value='6.28'/> |
102 | <fieldValue name='children'> |
103 | <Shape> |
104 | <Cylinder height='5'/> |
105 | <Appearance> |
106 | <Material diffuseColor='0.8 0.1 0'/> |
107 | </Appearance> |
108 | </Shape> |
109 | </fieldValue> |
110 | </ProtoInstance> |
111 | </Transform> |
112 | <Transform> |
113 | <ProtoInstance name='Shuttle'> |
114 | <fieldValue name='rate' value='2'/> |
115 | <fieldValue name='children'> |
116 | <Shape> |
117 | <Sphere/> |
118 | <Appearance> |
119 | <Material diffuseColor='0.1 0.8 0'/> |
120 | </Appearance> |
121 | </Shape> |
122 | </fieldValue> |
123 | </ProtoInstance> |
124 | </Transform> |
125 | </Scene> |
126 | </X3D> |
Event Graph ROUTE Table entries with 6 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.
T
TimeSensor fraction_changed SFFloat |
I
PositionInterpolator set_fraction SFFloat |
then
|
I
PositionInterpolator value_changed SFVec3f |
F
Transform translation SFVec3f |
TT
TimeSensor fraction_changed SFFloat |
II
OrientationInterpolator set_fraction SFFloat |
then
|
II
OrientationInterpolator value_changed SFRotation |
FF
Transform rotation SFRotation |
S
Script position MFVec3f |
I
PositionInterpolator keyValue MFVec3f |
then
|
I
PositionInterpolator value_changed SFVec3f |
F
Transform translation SFVec3f |
SS
Script rotation MFRotation |
II
OrientationInterpolator keyValue MFRotation |
then
|
II
OrientationInterpolator value_changed SFRotation |
FF
Transform rotation SFRotation |
ProtoInstance Pendulum |
No ROUTE connection found for output events from this node. This ProtoInstance contains SFNode/MFNode fieldValue declaration with direct access to other nodes, and thus has potential to produce run-time animation. |
ProtoInstance Shuttle |
No ROUTE connection found for output events from this node. This ProtoInstance contains SFNode/MFNode fieldValue declaration 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. -->