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='ViewpointSequencerPrototype.x3d'/> |
6 | <meta name='description' content='Animate through a set of Viewpoint or GeoViewpoint nodes and repeat'/> |
7 | <meta name='creator' content='Don Brutzman'/> |
8 | <meta name='created' content='10 December 2002'/> |
9 | <meta name='modified' content='3 February 2024'/> |
10 | <meta name='subject' content='Viewpoint Tour'/> |
11 | <meta name='reference' content='CubeWithLabeledSidesViewpointSequencerIndex.html'/> |
12 | <meta name='reference' content='https://www.web3d.org/x3d/content/examples//Basic/Geospatial/CaliforniaCampusesIndex.html'/> |
13 | <meta name='info' content='Two versions of this scene are maintained in order to avoid Cross-Origin Resource Sharing (CORS) restrictions when referenced from X3D models embedded inside HTML.'/> |
14 | <meta name='reference' content='https://savage.nps.edu/Savage/Tools/Animation/ViewpointSequencerPrototype.x3d'/> |
15 | <meta name='reference' content='https://www.web3d.org/technicalinfo/specifications/vrml97/part1/nodesRef.html#ScalarInterpolator'/> |
16 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Animation/ViewpointSequencerPrototype.x3d'/> |
17 | <meta name='generator' content='X3D-Edit 4.0, https://savage.nps.edu/X3D-Edit'/> |
18 | <meta name='license' content='../../license.html'/> |
19 | </head> |
20 | <Scene> |
21 | <WorldInfo title='ViewpointSequencerPrototype.x3d'/> |
22 | <ProtoDeclare name='ViewpointSequencer' appinfo='Sequentially binds each Viewpoint in a set of Viewpoint USE nodes, creating an automatic tour for a scene'> |
23 | <ProtoInterface> |
24 |
<field name='viewpoints' type='MFNode' accessType='initializeOnly'
appinfo='Viewpoint USE nodes that are sequentially bound'> |
25 | <!-- initialization nodes (if any) go here --> |
26 | </field> |
27 |
<field name='interval' type='SFTime' value='5' accessType='inputOutput'
appinfo='number of seconds between viewpoint shifts'/> |
28 |
<field name='enabled' type='SFBool' value='true' accessType='inputOutput'
appinfo='whether ViewpointSequencer is enabled or not'/> |
29 |
<field name='set_enabled' type='SFBool' accessType='inputOnly'
appinfo='whether ViewpointSequencer is enabled or not'/> |
30 |
<field name='previous' type='SFBool' accessType='inputOnly'
appinfo='bind previous Viewpoint in list'/> |
31 |
<field name='next' type='SFBool' accessType='inputOnly'
appinfo='bind next Viewpoint in list'/> |
32 |
<field name='toggleMessage' type='MFString' value='"Click text to toggle" "ViewpointSequencer"' accessType='inputOutput'
appinfo='Select message to toggle ViewpointSequencer'/> |
33 |
<field name='toggleMessageFontSize' type='SFFloat' value='1' accessType='initializeOnly'
appinfo='Font size for toggleMessage text'/> |
34 |
<field name='toggleMessageColor' type='SFColor' value='0.6 0.4 0.13' accessType='inputOutput'
appinfo='Color for toggleMessage text'/> |
35 |
<field name='traceEnabled' type='SFBool' value='false' accessType='inputOutput'
appinfo='enable console output'/> |
36 | </ProtoInterface> |
37 | <ProtoBody> |
38 | <Group DEF='ProtoBodyGroup'> |
39 |
<!-- TimeSensor
Trigger is a DEF node that has 1 USE node: USE_1
<!-- ROUTE information for Trigger node: [from TouchToggle.toggle to enabled ] [from cycleTime to SequencerScript.triggerNext ] --> <TimeSensor DEF='Trigger' loop='true'> |
40 | <IS> |
41 | <connect nodeField='enabled' protoField='enabled'/> |
42 | <connect nodeField='cycleInterval' protoField='interval'/> |
43 | </IS> |
44 | </TimeSensor> |
45 |
<!-- TimeSensor
TraceHolder is a DEF node that has 1 USE node: USE_1 -->
<TimeSensor DEF='TraceHolder'> |
46 | <IS> |
47 | <!-- this node and field is used to hold value of ProtoInterface field --> |
48 | <connect nodeField='enabled' protoField='traceEnabled'/> |
49 | </IS> |
50 | </TimeSensor> |
51 |
<!-- ROUTE information for SequencerScript node:
[from Trigger.cycleTime to triggerNext
]
[from TouchToggle.toggle to set_enabled
]
-->
<Script DEF='SequencerScript' directOutput='true'> |
52 | <field name='viewpoints' type='MFNode' accessType='initializeOnly'/> |
53 |
<field name='set_enabled' type='SFBool' accessType='inputOnly'
appinfo='whether ViewpointSequencer is enabled or not'/> |
54 | <field name='TriggerNode' type='SFNode' accessType='initializeOnly'> |
55 | <TimeSensor USE='Trigger'/> |
56 | </field> |
57 | <field name='TraceHolderNode' type='SFNode' accessType='initializeOnly'> |
58 | <TimeSensor USE='TraceHolder'/> |
59 | </field> |
60 | <field name='triggerNext' type='SFTime' accessType='inputOnly'/> |
61 | <field name='previous' type='SFBool' accessType='inputOnly'/> |
62 | <field name='next' type='SFBool' accessType='inputOnly'/> |
63 | <!-- local Script variables needing persistent values --> |
64 | <field name='index' type='SFInt32' value='0' accessType='initializeOnly'/> |
65 | <field name='viewpointCount' type='SFInt32' value='0' accessType='initializeOnly'/> |
66 | <field name='traceEnabled' type='SFBool' value='false' accessType='initializeOnly'/> |
67 | <IS> |
68 | <connect nodeField='viewpoints' protoField='viewpoints'/> |
69 | <connect nodeField='previous' protoField='previous'/> |
70 | <connect nodeField='next' protoField='next'/> |
71 | <connect nodeField='set_enabled' protoField='set_enabled'/> |
72 | </IS> |
<![CDATA[
ecmascript: function initialize () { index = 0; viewpointCount = viewpoints.length; traceEnabled = TraceHolderNode.loop; tracePrint ('initialize: viewpoints.length=' + viewpointCount); tracePrint ('initialize: Viewpoint [' + index + '] ' + viewpoints[index].description); if (TriggerNode.enabled=='false') return; if (viewpointCount > 0) viewpoints[index].set_bind = true; } function set_enabled (newValue, timeStamp) { enabled = newValue; tracePrint ('enabled=' + newValue); if ((newValue == true) && (viewpoints.length >= 1)) viewpoints[0].bind = true; } function triggerNext(triggerTime, timeStamp) { if ((TriggerNode.enabled=='false') || (viewpointCount==0)) return; if (index < viewpointCount - 1) index++; else index = 0; if (viewpointCount > 1) viewpoints[index].set_bind = true; tracePrint ('triggerNext: Viewpoint [' + index + '] ' + viewpoints[index].description); } function previous (value, timeStamp) { if ((TriggerNode.enabled=='false') || (viewpointCount==0)) return; if (value==true) // trigger on true events only { if (index > 0) index--; else index = viewpointCount - 1; if (viewpointCount > 1) viewpoints[index].set_bind = true; tracePrint ('previous: Viewpoint [' + index + '] ' + viewpoints[index].description); } } function next (value, timeStamp) { if ((TriggerNode.enabled=='false') || (viewpointCount==0)) return; if (value==true) // trigger on true events only { if (index < viewpointCount - 1) index++; else index = 0; if (viewpointCount > 1) viewpoints[index].set_bind = true; tracePrint ('next: Viewpoint [' + index + '] ' + viewpoints[index].description); } } function tracePrint(outputString) { if (traceEnabled) Browser.println ('[ViewpointSequencer] ' + outputString); } function alwaysPrint(outputString) { Browser.println ('[ViewpointSequencer] ' + outputString); }
]]>
|
|
74 | </Script> |
75 | < ROUTE fromNode='Trigger' fromField='cycleTime' toNode='SequencerScript' toField='triggerNext'/> |
76 | <Group DEF='TouchTextGroup'> |
77 |
<!-- ROUTE information for TouchTextSensor node:
[from isActive to TouchToggle.set_boolean
]
-->
<TouchSensor DEF='TouchTextSensor' description='Click text to toggle ViewpointSequencer'/> |
78 | <Billboard axisOfRotation='0 0 0'> |
79 | <Shape> |
80 | <Text> |
81 | <IS> |
82 | <connect nodeField='string' protoField='toggleMessage'/> |
83 | </IS> |
84 | <FontStyle justify='"MIDDLE" "MIDDLE"'> |
85 | <IS> |
86 | <connect nodeField='size' protoField='toggleMessageFontSize'/> |
87 | </IS> |
88 | </FontStyle> |
89 | </Text> |
90 | <Appearance> |
91 | <Material> |
92 | <IS> |
93 | <connect nodeField='diffuseColor' protoField='toggleMessageColor'/> |
94 | </IS> |
95 | </Material> |
96 | </Appearance> |
97 | </Shape> |
98 | <!-- An invisible box behind the string helps to toggle the ViewpointSequencer --> |
99 | <Shape> |
100 | <Box size='7.8 2 0.1'/> |
101 | <Appearance> |
102 | <Material diffuseColor='1 1 1' transparency='1'/> |
103 | </Appearance> |
104 | </Shape> |
105 | </Billboard> |
106 |
<!-- ROUTE information for TouchToggle node:
[from TouchTextSensor.isActive to set_boolean
]
[from toggle to SequencerScript.set_enabled
]
[from toggle to Trigger.enabled
]
-->
<BooleanToggle DEF='TouchToggle' containerField='children'/> |
107 | < ROUTE fromNode='TouchTextSensor' fromField='isActive' toNode='TouchToggle' toField='set_boolean'/> |
108 | <!-- TouchToggle toggle_changed should likely revert to TouchToggle toggle when inputOutput fields supported in Script, or native implementation provided. --> |
109 | < ROUTE fromNode='TouchToggle' fromField='toggle' toNode='SequencerScript' toField='set_enabled'/> |
110 | < ROUTE fromNode='TouchToggle' fromField='toggle' toNode='Trigger' toField='enabled'/> |
111 | </Group> |
112 | </Group> |
113 | </ProtoBody> |
114 | </ProtoDeclare> |
115 | <!-- ===============Example============== --> |
116 | <Anchor description='select to view ViewpointSequencer example' parameter='"target=_blank"' url=' "ViewpointSequencerExample.x3d" "https://savage.nps.edu/Savage/Tools/Animation/ViewpointSequencerExample.x3d" "ViewpointSequencerExample.wrl" "https://savage.nps.edu/Savage/Tools/Animation/ViewpointSequencerExample.wrl" '> |
117 | <Shape> |
118 | <Text string='"ViewpointSequencerPrototype" "defines a prototype" "" "Click text to see example scene" "ViewpointTourExample"'> |
119 | <FontStyle justify='"MIDDLE" "MIDDLE"' size='0.9'/> |
120 | </Text> |
121 | <Appearance> |
122 | <Material diffuseColor='1 1 0.2'/> |
123 | </Appearance> |
124 | </Shape> |
125 | <Shape> |
126 | <!-- transparent Box to make text more selectable --> |
127 | <Box size='11 5 0.1'/> |
128 | <Appearance> |
129 | <Material diffuseColor='1 1 1' transparency='1'/> |
130 | </Appearance> |
131 | </Shape> |
132 | </Anchor> |
133 | </Scene> |
134 | </X3D> |
Event Graph ROUTE Table entries with 4 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.
TouchTextSensor
TouchSensor isActive SFBool |
TouchToggle
BooleanToggle set_boolean SFBool |
then
|
TouchToggle
BooleanToggle toggle SFBool |
SequencerScript
Script set_enabled SFBool |
||||||
then
|
TouchToggle
BooleanToggle toggle SFBool |
Trigger
TimeSensor enabled SFBool |
then
|
Trigger
TimeSensor cycleTime SFTime |
SequencerScript
Script triggerNext SFTime |
SequencerScript
Script |
No ROUTE connection found for output events from this node. Contains SFNode fields with direct access to another node. Contains MFNode field with direct access to another node. |
Anchor |
description='select to view ViewpointSequencer example' User-interaction hint for this node. |
<!--
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)
<ProtoDeclare
name='ProtoName'>
<field
name='fieldName'/> </ProtoDeclare>
-->
<!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->