<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
<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 ' >
<head>
<meta name='titlecontent='Figure31_9SpinGroupPrototype.x3d'/>
<meta name='creatorcontent='Figure 31.9, The VRML 2.0 Sourcebook, Copyright [1997] By Andrea L. Ames, David R. Nadeau, and John L. Moreland'/>
<meta name='referencecontent=' http://www.wiley.com/legacy/compbooks/vrml2sbk/ch31/31fig09.htm '/>
<meta name='translatorcontent='Don Brutzman'/>
<meta name='createdcontent='24 October 2000'/>
<meta name='modifiedcontent='20 October 2019'/>
<meta name='descriptioncontent='The SpinGroup prototype is used to automatically spin a group of three long rectangular boxes. Click on blue crossbar to activate second SpinGroup.'/>
<meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter31Prototypes/Figure31_9SpinGroupPrototype.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../../license.html'/>
</head>
<!--

to top <!-- Event Graph ROUTE Table shows event connections -->
 
<!-- Index for DEF nodes: ActivateSecondSpinGroup, Green, SecondSpinGroup, SpinGroupClock, SpinGroupTransform, Spinner

Index for Viewpoint node: Viewpoint_1

Index for ProtoDeclare definition: SpinGroup
-->
<Scene>
<WorldInfo title='Figure31_9SpinGroupPrototype.x3d'/>
<ProtoDeclare name='SpinGroup'>
<ProtoInterface>
<field name='childrentype='MFNodeaccessType='inputOutput'>
<!-- NULL node initialization -->
</field>
<field name='cycleIntervaltype='SFTimevalue='1accessType='inputOutput'/>
<field name='looptype='SFBoolvalue='falseaccessType='inputOutput'/>
<field name='startTimetype='SFTimevalue='0accessType='inputOutput'/>
<field name='stopTimetype='SFTimevalue='0accessType='inputOutput'/>
</ProtoInterface>
<ProtoBody>
<!-- ROUTE information for SpinGroupTransform node:  [from Spinner.value_changed to set_rotation ] -->
<Transform DEF='SpinGroupTransform'>
<IS>
<connect nodeField='childrenprotoField='children'/>
</IS>
</Transform>
<!-- following nodes will not be rendered, only the first node of a ProtoBody is drawn -->
<!-- ROUTE information for SpinGroupClock node:  [from fraction_changed to Spinner.set_fraction ] -->
<TimeSensor DEF='SpinGroupClock'>
<IS>
<connect nodeField='cycleIntervalprotoField='cycleInterval'/>
<connect nodeField='loopprotoField='loop'/>
<connect nodeField='startTimeprotoField='startTime'/>
<connect nodeField='stopTimeprotoField='stopTime'/>
</IS>
</TimeSensor>
<!-- ROUTE information for Spinner node:  [from SpinGroupClock.fraction_changed to set_fraction ] [from value_changed to SpinGroupTransform.set_rotation ] -->
<OrientationInterpolator DEF='Spinnerkey='0 0.5 1keyValue='0 1 0 0 0 1 0 3.14 0 1 0 6.28'/>

< ROUTE  fromNode=' SpinGroupClock' fromField='fraction_changed' toNode=' Spinner' toField='set_fraction'/>
< ROUTE  fromNode=' Spinner' fromField='value_changed' toNode=' SpinGroupTransform' toField='set_rotation'/>
</ProtoBody>
</ProtoDeclare>
<!-- Now the scene proper begins. Nothing renders in a ProtoDeclare (or ExternProtoDeclare). -->
<Viewpoint description='Click on blue crossbar to activate second SpinGrouporientation='1 0 0 -0.52position='0 18 30'/>
<!-- Create an instance, meaning actual nodes that render -->
<ProtoInstance name='SpinGroup'>
<fieldValue name='cycleIntervalvalue='8'/>
<fieldValue name='loopvalue='true'/>
<fieldValue name='children'>
<Shape>
<Box size='25 2 2'/>
<Appearance DEF='Green'>
<Material diffuseColor='0 1 0.3'/>
</Appearance>
</Shape>
<Shape>
<Box size='2 25 2'/>
<Appearance USE=' Green'/>
</Shape>
<!-- ROUTE information for SecondSpinGroup node:  [from ActivateSecondSpinGroup.touchTime to startTime ] -->
<ProtoInstance name='SpinGroupDEF='SecondSpinGroup'>
<fieldValue name='cycleIntervalvalue='4'/>
<fieldValue name='loopvalue='true'/>
<!-- stopTime > startTime ensures that initial state is stopped -->
<fieldValue name='stopTimevalue='1'/>
<fieldValue name='children'>
<!-- ROUTE information for ActivateSecondSpinGroup node:  [from touchTime to SecondSpinGroup.startTime ] -->
<TouchSensor DEF='ActivateSecondSpinGroupdescription='Activate second SpinGroup by clicking blue bar'/>

<Shape>
<Box size='2 2.05 25'/>
<Appearance>
<Material diffuseColor='0 0.3 1'/>
</Appearance>
</Shape>
</fieldValue>
</ProtoInstance>
</fieldValue>
</ProtoInstance>
< ROUTE  fromNode=' ActivateSecondSpinGroup' fromField='touchTime' toNode=' SecondSpinGroup' toField='startTime'/>
</Scene>
</X3D>
<!--

to top <!-- Event Graph ROUTE Table shows event connections -->
 
<!-- Index for DEF nodes: ActivateSecondSpinGroup, Green, SecondSpinGroup, SpinGroupClock, SpinGroupTransform, Spinner

Index for Viewpoint node: Viewpoint_1

Index for ProtoDeclare definition: SpinGroup
-->

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.

ActivateSecondSpinGroup
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
SecondSpinGroup
ProtoInstance
startTime
SFTime


SpinGroupClock
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(1)
Spinner
OrientationInterpolator
set_fraction
SFFloat

 
 
then
Spinner
OrientationInterpolator
value_changed
SFRotation

ROUTE
event to
(2)
SpinGroupTransform
Transform
set_rotation
SFRotation



ProtoInstance
SpinGroup
No ROUTE connection found for output from this node.
Contains SFNode/MFNode field with indirect access to other nodes. 


      SecondSpinGroup
ProtoInstance
SpinGroup
No ROUTE connection found for output from this node.
Contains SFNode/MFNode field with indirect access to other nodes. 


-->

<!-- Online at
https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter31Prototypes/Figure31_9SpinGroupPrototypeIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter31Prototypes/Figure31_9SpinGroupPrototype.x3d -->

<!-- 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> -->

to top <!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->