X3D Model Documentation: Figure31_9SpinGroupPrototype.x3d

  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='titlecontent='Figure31_9SpinGroupPrototype.x3d'/>
  6            <meta name='creatorcontent='Figure 31.9, The VRML 2.0 Sourcebook, Copyright [1997] By Andrea L. Ames, David R. Nadeau, and John L. Moreland'/>
  7            <meta name='referencecontent='http://www.wiley.com/legacy/compbooks/vrml2sbk/ch31/31fig09.htm'/>
  8            <meta name='translatorcontent='Don Brutzman'/>
  9            <meta name='createdcontent='24 October 2000'/>
 10            <meta name='modifiedcontent='20 October 2019'/>
 11            <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.'/>
 12            <meta name='identifiercontent='https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter31Prototypes/Figure31_9SpinGroupPrototype.x3d'/>
 13            <meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
 14            <meta name='licensecontent='../../license.html'/>
 15       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->

<!-- to top Index for DEF nodes: ActivateSecondSpinGroup, Green, SecondSpinGroup, SpinGroupClock, SpinGroupTransform, Spinner

Index for Viewpoint node: Viewpoint_1

Index for ProtoDeclare definition: SpinGroup
-->
 16       <Scene>
 17            <WorldInfo title='Figure31_9SpinGroupPrototype.x3d'/>
 18            <ProtoDeclare name='SpinGroup'>
 19                 <ProtoInterface>
 20                      <field name='childrentype='MFNodeaccessType='inputOutput'>
 21                           <!-- NULL node initialization -->
 22                      </field>
 23                      <field name='cycleIntervaltype='SFTimevalue='1accessType='inputOutput'/>
 24                      <field name='looptype='SFBoolvalue='falseaccessType='inputOutput'/>
 25                      <field name='startTimetype='SFTimevalue='0accessType='inputOutput'/>
 26                      <field name='stopTimetype='SFTimevalue='0accessType='inputOutput'/>
 27                 </ProtoInterface>
 28                 <ProtoBody>
 29 
                    <!-- ROUTE information for SpinGroupTransform node:  [from Spinner.value_changed to set_rotation ] -->
                    <Transform DEF='SpinGroupTransform'>
 30                           <IS>
 31                                <connect nodeField='childrenprotoField='children'/>
 32                           </IS>
 33                      </Transform>
 34                      <!-- following nodes will not be rendered, only the first node of a ProtoBody is drawn -->
 35 
                    <!-- ROUTE information for SpinGroupClock node:  [from fraction_changed to Spinner.set_fraction ] -->
                    <TimeSensor DEF='SpinGroupClock'>
 36                           <IS>
 37                                <connect nodeField='cycleIntervalprotoField='cycleInterval'/>
 38                                <connect nodeField='loopprotoField='loop'/>
 39                                <connect nodeField='startTimeprotoField='startTime'/>
 40                                <connect nodeField='stopTimeprotoField='stopTime'/>
 41                           </IS>
 42                      </TimeSensor>
 43 
                    <!-- 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'/>
 44                      < ROUTE  fromNode='SpinGroupClock' fromField='fraction_changed' toNode='Spinner' toField='set_fraction'/>
 45                      < ROUTE  fromNode='Spinner' fromField='value_changed' toNode='SpinGroupTransform' toField='set_rotation'/>
 46                 </ProtoBody>
 47            </ProtoDeclare>
 48            <!-- Now the scene proper begins. Nothing renders in a ProtoDeclare (or ExternProtoDeclare). -->
 49            <Viewpoint description='Click on blue crossbar to activate second SpinGrouporientation='1 0 0 -0.52position='0 18 30'/>
 50            <!-- Create an instance, meaning actual nodes that render -->
 51            <ProtoInstance name='SpinGroup'>
 52                 <fieldValue name='cycleIntervalvalue='8'/>
 53                 <fieldValue name='loopvalue='true'/>
 54                 <fieldValue name='children'>
 55                      <Shape>
 56                           <Box size='25 2 2'/>
 57 
                         <!-- Appearance Green is a DEF node that has 1 USE node: USE_1 -->
                         <Appearance DEF='Green'>
 58                                <Material diffuseColor='0 1 0.3'/>
 59                           </Appearance>
 60                      </Shape>
 61                      <Shape>
 62                           <Box size='2 25 2'/>
 63                           <Appearance USE='Green'/>
 64                      </Shape>
 65 
                    <!-- ROUTE information for SecondSpinGroup node:  [from ActivateSecondSpinGroup.touchTime to startTime ] -->
                    <ProtoInstance name='SpinGroupDEF='SecondSpinGroup'>
 66                           <fieldValue name='cycleIntervalvalue='4'/>
 67                           <fieldValue name='loopvalue='true'/>
 68                           <!-- stopTime > startTime ensures that initial state is stopped -->
 69                           <fieldValue name='stopTimevalue='1'/>
 70                           <fieldValue name='children'>
 71 
                              <!-- ROUTE information for ActivateSecondSpinGroup node:  [from touchTime to SecondSpinGroup.startTime ] -->
                              <TouchSensor DEF='ActivateSecondSpinGroupdescription='Activate second SpinGroup by clicking blue bar'/>
 72                                <Shape>
 73                                     <Box size='2 2.05 25'/>
 74                                     <Appearance>
 75                                          <Material diffuseColor='0 0.3 1'/>
 76                                     </Appearance>
 77                                </Shape>
 78                           </fieldValue>
 79                      </ProtoInstance>
 80                 </fieldValue>
 81            </ProtoInstance>
 82            < ROUTE  fromNode='ActivateSecondSpinGroup' fromField='touchTime' toNode='SecondSpinGroup' toField='startTime'/>
 83       </Scene>
 84  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->

<!-- to top Index for DEF nodes: ActivateSecondSpinGroup, Green, SecondSpinGroup, SpinGroupClock, SpinGroupTransform, Spinner

Index for Viewpoint node: Viewpoint_1

Index for ProtoDeclare definition: SpinGroup
-->
X3D Tooltips element index: Appearance, Box, connect, field, fieldValue, head, IS, Material, meta, OrientationInterpolator, ProtoBody, ProtoDeclare, ProtoInstance, ProtoInterface, ROUTE, Scene, Shape, TimeSensor, TouchSensor, Transform, Viewpoint, WorldInfo, X3D, accessType and type, XML data types, field types

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 events from this node.
This ProtoInstance contains SFNode/MFNode fieldValue declarations with
direct access to other nodes, and thus has potential to produce run-time animation. 

Additional guidance on X3D animation can be found in the 10-Step Animation Design Process and Event Tracing hint sheets. Have fun with X3D! 😀

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