| 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='28 November 2019'/> |
| 10 | <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.'/> |
| 11 | <meta name='reference' content=' https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Animation/ViewpointSequencerPrototype.x3d '/> |
| 12 | <meta name='reference' content='https://www.web3d.org/technicalinfo/specifications/vrml97/part1/nodesRef.html#ScalarInterpolator'/> |
| 13 | <meta name='subject' content='Viewpoint Tour'/> |
| 14 | <meta name=' TODO ' content=' eliminate intermediate TraceHolder '/> |
| 15 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/ViewpointSequencerPrototype.x3d '/> |
| 16 | <meta name='generator' content='X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
| 17 | <meta name='license' content='../../license.html'/> |
| 18 | </head> |
| 19 | <Scene> |
| 20 | <WorldInfo title='ViewpointSequencerPrototype.x3d'/> |
| 21 | <ProtoDeclare name='ViewpointSequencer' appinfo='Sequentially binds each Viewpoint in a set of Viewpoint USE nodes, creating an automatic tour for a scene'> |
| 22 | <ProtoInterface> |
| 23 |
<field name='viewpoints' type='MFNode' accessType='initializeOnly'
appinfo='Viewpoint USE nodes that are sequentially bound'> |
| 24 | <!-- initialization nodes (if any) go here --> |
| 25 | </field> |
| 26 |
<field name='interval' type='SFTime' value='5' accessType='inputOutput'
appinfo='number of seconds between viewpoint shifts'/> |
| 27 |
<field name='enabled' type='SFBool' value='true' accessType='inputOutput'
appinfo='whether ViewpointSequencer is enabled or not'/> |
| 28 |
<field name='set_enabled' type='SFBool' accessType='inputOnly'
appinfo='whether ViewpointSequencer is enabled or not'/> |
| 29 |
<field name='previous' type='SFBool' accessType='inputOnly'
appinfo='bind previous Viewpoint in list'/> |
| 30 |
<field name='next' type='SFBool' accessType='inputOnly'
appinfo='bind next Viewpoint in list'/> |
| 31 |
<field name='toggleMessage' type='MFString' value='"Click text to toggle" "ViewpointSequencer"' accessType='inputOutput'
appinfo='Select message to toggle ViewpointSequencer'/> |
| 32 |
<field name='toggleMessageFontSize' type='SFFloat' value='1' accessType='initializeOnly'
appinfo='Font size for toggleMessage text'/> |
| 33 |
<field name='toggleMessageColor' type='SFColor' value='0.6 0.4 0.13' accessType='inputOutput'
appinfo='Color for toggleMessage text'/> |
| 34 |
<field name='traceEnabled' type='SFBool' value='false' accessType='inputOutput'
appinfo='enable console output'/> |
| 35 | </ProtoInterface> |
| 36 | <ProtoBody> |
| 37 | <Group DEF='ProtoBodyGroup'> |
| 38 |
<!-- 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'> |
| 39 | <IS> |
| 40 | <connect nodeField='enabled' protoField='enabled'/> |
| 41 | <connect nodeField='cycleInterval' protoField='interval'/> |
| 42 | </IS> |
| 43 | </TimeSensor> |
| 44 |
<!-- TimeSensor
TraceHolder is a DEF node that has 1 USE node: USE_1 -->
<TimeSensor DEF='TraceHolder'> |
| 45 | <IS> |
| 46 | <connect nodeField='enabled' protoField='traceEnabled'/> |
| 47 | </IS> |
| 48 | </TimeSensor> |
| 49 |
<!-- ROUTE information for SequencerScript node:
[from Trigger.cycleTime to triggerNext
]
[from TouchToggle.toggle to set_enabled
]
-->
<Script DEF='SequencerScript' directOutput='true'> |
| 50 | <field name='viewpoints' type='MFNode' accessType='initializeOnly'/> |
| 51 |
<field name='set_enabled' type='SFBool' accessType='inputOnly'
appinfo='whether ViewpointSequencer is enabled or not'/> |
| 52 | <field name='TriggerNode' type='SFNode' accessType='initializeOnly'> |
| 53 | <TimeSensor USE='Trigger'/> |
| 54 | </field> |
| 55 | <field name='TraceHolderNode' type='SFNode' accessType='initializeOnly'> |
| 56 | <TimeSensor USE='TraceHolder'/> |
| 57 | </field> |
| 58 | <field name='triggerNext' type='SFTime' accessType='inputOnly'/> |
| 59 | <field name='previous' type='SFBool' accessType='inputOnly'/> |
| 60 | <field name='next' type='SFBool' accessType='inputOnly'/> |
| 61 | <!-- local Script variables needing persistent values --> |
| 62 | <field name='index' type='SFInt32' value='0' accessType='initializeOnly'/> |
| 63 | <field name='viewpointCount' type='SFInt32' value='0' accessType='initializeOnly'/> |
| 64 | <field name='traceEnabled' type='SFBool' value='false' accessType='initializeOnly'/> |
| 65 | <IS> |
| 66 | <connect nodeField='viewpoints' protoField='viewpoints'/> |
| 67 | <connect nodeField='previous' protoField='previous'/> |
| 68 | <connect nodeField='next' protoField='next'/> |
| 69 | <connect nodeField='set_enabled' protoField='set_enabled'/> |
| 70 | </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);
}
]]>
|
|
| 72 | </Script> |
| 73 | < ROUTE fromNode='Trigger' fromField='cycleTime' toNode='SequencerScript' toField='triggerNext'/> |
| 74 | <Group DEF='TouchTextGroup'> |
| 75 |
<!-- ROUTE information for TouchTextSensor node:
[from isActive to TouchToggle.set_boolean
]
-->
<TouchSensor DEF='TouchTextSensor' description='Click text to toggle ViewpointSequencer'/> |
| 76 | <Billboard axisOfRotation='0 0 0'> |
| 77 | <Shape> |
| 78 | <Text> |
| 79 | <IS> |
| 80 | <connect nodeField='string' protoField='toggleMessage'/> |
| 81 | </IS> |
| 82 | <FontStyle justify='"MIDDLE" "MIDDLE"'> |
| 83 | <IS> |
| 84 | <connect nodeField='size' protoField='toggleMessageFontSize'/> |
| 85 | </IS> |
| 86 | </FontStyle> |
| 87 | </Text> |
| 88 | <Appearance> |
| 89 | <Material> |
| 90 | <IS> |
| 91 | <connect nodeField='diffuseColor' protoField='toggleMessageColor'/> |
| 92 | </IS> |
| 93 | </Material> |
| 94 | </Appearance> |
| 95 | </Shape> |
| 96 | <!-- An invisible box behind the string helps to toggle the ViewpointSequencer --> |
| 97 | <Shape> |
| 98 | <Box size='7.8 2 0.1'/> |
| 99 | <Appearance> |
| 100 | <Material diffuseColor='1 1 1' transparency='1'/> |
| 101 | </Appearance> |
| 102 | </Shape> |
| 103 | </Billboard> |
| 104 |
<!-- 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'/> |
| 105 | < ROUTE fromNode='TouchTextSensor' fromField='isActive' toNode='TouchToggle' toField='set_boolean'/> |
| 106 | <!-- TouchToggle toggle_changed should likely revert to TouchToggle toggle when inputOutput fields supported in Script, or native implementation provided. --> |
| 107 | < ROUTE fromNode='TouchToggle' fromField='toggle' toNode='SequencerScript' toField='set_enabled'/> |
| 108 | < ROUTE fromNode='TouchToggle' fromField='toggle' toNode='Trigger' toField='enabled'/> |
| 109 | </Group> |
| 110 | </Group> |
| 111 | </ProtoBody> |
| 112 | </ProtoDeclare> |
| 113 | <!-- ===============Example============== --> |
| 114 | <Anchor description='select to view ViewpointSequencer example' parameter='"target=_blank"' url=' "ViewpointSequencerExample.x3d" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/ViewpointSequencerExample.x3d" "ViewpointSequencerExample.wrl" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/ViewpointSequencerExample.wrl" '> |
| 115 | <Shape> |
| 116 | <Text string='"ViewpointSequencerPrototype" "defines a prototype" "" "Click text to see example scene" "ViewpointTourExample"'> |
| 117 | <FontStyle justify='"MIDDLE" "MIDDLE"' size='0.9'/> |
| 118 | </Text> |
| 119 | <Appearance> |
| 120 | <Material diffuseColor='1 1 0.2'/> |
| 121 | </Appearance> |
| 122 | </Shape> |
| 123 | <Shape> |
| 124 | <!-- transparent Box to make text more selectable --> |
| 125 | <Box size='11 5 0.1'/> |
| 126 | <Appearance> |
| 127 | <Material diffuseColor='1 1 1' transparency='1'/> |
| 128 | </Appearance> |
| 129 | </Shape> |
| 130 | </Anchor> |
| 131 | </Scene> |
| 132 | </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 |
|||||
|
TraceHolder
TimeSensor |
No direct ROUTE connection found for events to/from this node. |
|
SequencerScript
Script |
No direct ROUTE connection found for events to/from this node. Contains SFNode fields with direct access to another node. Contains MFNode field with direct access to another node. |
| line 114
Anchor |
description='select to view ViewpointSequencer example' User-interaction hint for this node. |
<!--
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)
<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.
-->