| 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='http://www.web3d.org/specifications/x3d-3.0.xsd'> |
| 4 | <head> |
| 5 | <meta name='title' content=' Example14.x3d '/> |
| 6 | <meta name='creator' content='Don Brutzman'/> |
| 7 | <meta name='created' content='22 November 2000'/> |
| 8 | <meta name='modified' content='26 November 2015'/> |
| 9 | <meta name='creator' content='X3D working group'/> |
| 10 | <meta name='description' content='VRML 97 specification example: animation of shuttle and pendulum prototype nodes.'/> |
| 11 | <meta name='reference' content='originals/exampleD_14.wrl'/> |
| 12 | <meta name='specificationSection' content='VRML 97, ISO/IEC 14772-1, Part 1: Functional specification and UTF-8 encoding, D.14 Shuttles and pendulums'/> |
| 13 | <meta name='specificationUrl' content='http://www.web3d.org/documents/specifications/14772/V2.0/part1/examples.html#D.14'/> |
| 14 | <meta name='identifier' content=' http://www.web3d.org/x3d/content/examples/Basic/Vrml97Specification/Example14.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 | <ProtoDeclare name='Shuttle'> |
| 20 | <ProtoInterface> |
| 21 | <field name='rate' type='SFTime' value='1' accessType='initializeOnly'/> |
| 22 | <field name='distance' type='SFFloat' value='1' accessType='initializeOnly'/> |
| 23 | <field name='children' type='MFNode' accessType='initializeOnly'/> |
| 24 | <field name='startTime' type='SFTime' value='0' accessType='inputOutput'/> |
| 25 | <field name='stopTime' type='SFTime' value='0' accessType='inputOutput'/> |
| 26 | <field name='loop' type='SFBool' value='true' accessType='initializeOnly'/> |
| 27 | </ProtoInterface> |
| 28 | <ProtoBody> |
| 29 |
<!-- ROUTE information for F node:
[from I.value_changed to set_translation
]
-->
<Transform DEF='F'> |
| 30 | <IS> |
| 31 | <connect nodeField='children' protoField='children'/> |
| 32 | </IS> |
| 33 | </Transform> |
| 34 |
<!-- ROUTE information for T node:
[from fraction_changed to I.set_fraction
]
-->
<TimeSensor DEF='T'> |
| 35 | <IS> |
| 36 | <connect nodeField='cycleInterval' protoField='rate'/> |
| 37 | <connect nodeField='startTime' protoField='startTime'/> |
| 38 | <connect nodeField='stopTime' protoField='stopTime'/> |
| 39 | <connect nodeField='loop' protoField='loop'/> |
| 40 | </IS> |
| 41 | </TimeSensor> |
| 42 |
<!-- ROUTE information for S node:
[from position to I.set_keyValue
]
-->
<Script DEF='S'> |
| 43 | <field name='distance' type='SFFloat' accessType='initializeOnly'/> |
| 44 | <field name='position' type='MFVec3f' accessType='outputOnly'/> |
| 45 | <IS> |
| 46 | <connect nodeField='distance' protoField='distance'/> |
| 47 | </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);
}
]]>
|
|
| 49 | </Script> |
| 50 |
<!-- ROUTE information for I node:
[from T.fraction_changed to set_fraction
]
[from S.position to set_keyValue
]
[from value_changed to F.set_translation
]
-->
<PositionInterpolator DEF='I' key='0 0.5 1' keyValue='-1 0 0 1 0 0 -1 0 0'/> |
| 51 | < ROUTE fromNode='T' fromField='fraction_changed' toNode='I' toField='set_fraction'/> |
| 52 | < ROUTE fromNode='I' fromField='value_changed' toNode='F' toField='set_translation'/> |
| 53 | < ROUTE fromNode='S' fromField='position' toNode='I' toField='set_keyValue'/> |
| 54 | </ProtoBody> |
| 55 | </ProtoDeclare> |
| 56 | <ProtoDeclare name='Pendulum'> |
| 57 | <ProtoInterface> |
| 58 | <field name='rate' type='SFTime' value='1' accessType='initializeOnly'/> |
| 59 | <field name='maxAngle' type='SFFloat' value='3.14159' accessType='initializeOnly'/> |
| 60 | <field name='children' type='MFNode' accessType='initializeOnly'/> |
| 61 | <field name='startTime' type='SFTime' value='0' accessType='inputOutput'/> |
| 62 | <field name='stopTime' type='SFTime' value='0' accessType='inputOutput'/> |
| 63 | <field name='loop' type='SFBool' value='true' accessType='initializeOnly'/> |
| 64 | </ProtoInterface> |
| 65 | <ProtoBody> |
| 66 |
<!-- ROUTE information for FF node:
[from II.value_changed to set_rotation
]
-->
<Transform DEF='FF'> |
| 67 | <IS> |
| 68 | <connect nodeField='children' protoField='children'/> |
| 69 | </IS> |
| 70 | </Transform> |
| 71 |
<!-- ROUTE information for TT node:
[from fraction_changed to II.set_fraction
]
-->
<TimeSensor DEF='TT'> |
| 72 | <IS> |
| 73 | <connect nodeField='cycleInterval' protoField='rate'/> |
| 74 | <connect nodeField='startTime' protoField='startTime'/> |
| 75 | <connect nodeField='stopTime' protoField='stopTime'/> |
| 76 | <connect nodeField='loop' protoField='loop'/> |
| 77 | </IS> |
| 78 | </TimeSensor> |
| 79 |
<!-- ROUTE information for SS node:
[from rotation to II.set_keyValue
]
-->
<Script DEF='SS'> |
| 80 | <field name='maxAngle' type='SFFloat' accessType='initializeOnly'/> |
| 81 | <field name='rotation' type='MFRotation' accessType='outputOnly'/> |
| 82 | <IS> |
| 83 | <connect nodeField='maxAngle' protoField='maxAngle'/> |
| 84 | </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);
}
]]>
|
|
| 86 | </Script> |
| 87 |
<!-- ROUTE information for II node:
[from TT.fraction_changed to set_fraction
]
[from SS.rotation to set_keyValue
]
[from value_changed to FF.set_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'/> |
| 88 | < ROUTE fromNode='TT' fromField='fraction_changed' toNode='II' toField='set_fraction'/> |
| 89 | < ROUTE fromNode='II' fromField='value_changed' toNode='FF' toField='set_rotation'/> |
| 90 | < ROUTE fromNode='SS' fromField='rotation' toNode='II' toField='set_keyValue'/> |
| 91 | </ProtoBody> |
| 92 | </ProtoDeclare> |
| 93 | <Transform translation='-3 0 0'> |
| 94 | <ProtoInstance name='Pendulum'> |
| 95 | <fieldValue name='rate' value='3'/> |
| 96 | <fieldValue name='maxAngle' value='6.28'/> |
| 97 | <fieldValue name='children'> |
| 98 | <Shape> |
| 99 | <Cylinder height='5'/> |
| 100 | <Appearance> |
| 101 | <Material diffuseColor='0.8 0.1 0'/> |
| 102 | </Appearance> |
| 103 | </Shape> |
| 104 | </fieldValue> |
| 105 | </ProtoInstance> |
| 106 | </Transform> |
| 107 | <Transform> |
| 108 | <ProtoInstance name='Shuttle'> |
| 109 | <fieldValue name='rate' value='2'/> |
| 110 | <fieldValue name='children'> |
| 111 | <Shape> |
| 112 | <Sphere/> |
| 113 | <Appearance> |
| 114 | <Material diffuseColor='0.1 0.8 0'/> |
| 115 | </Appearance> |
| 116 | </Shape> |
| 117 | </fieldValue> |
| 118 | </ProtoInstance> |
| 119 | </Transform> |
| 120 | </Scene> |
| 121 | </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 set_translation SFVec3f |
|
TT
TimeSensor fraction_changed SFFloat |
II
OrientationInterpolator set_fraction SFFloat |
then
|
II
OrientationInterpolator value_changed SFRotation |
FF
Transform set_rotation SFRotation |
|
S
Script position MFVec3f |
I
PositionInterpolator set_keyValue MFVec3f |
then
|
I
PositionInterpolator value_changed SFVec3f |
F
Transform set_translation SFVec3f |
|
SS
Script rotation MFRotation |
II
OrientationInterpolator set_keyValue MFRotation |
then
|
II
OrientationInterpolator value_changed SFRotation |
FF
Transform set_rotation SFRotation |
| line 94
ProtoInstance Pendulum |
No direct ROUTE connection found for events to/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. |
| line 108
ProtoInstance Shuttle |
No direct ROUTE connection found for events to/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-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)
<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.
-->