X3D Model Documentation: BooleanToggleExample.x3d

  1  <?xml version="1.0" encoding="UTF-8"?>
  2  <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
  3  <X3D profile='Interactive' version='3.3 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.3.xsd'>
  4       <head>
  5            <meta name='titlecontent='BooleanToggleExample.x3d'/>
  6            <meta name='descriptioncontent='A BooleanToggle button determines whether an animated Cone is jittery or not.'/>
  7            <meta name='creatorcontent='Leonard Daly and Don Brutzman'/>
  8            <meta name='createdcontent='9 October 2006'/>
  9            <meta name='modifiedcontent='28 April 2023'/>
 10            <meta name=' TODO content=' BS Contact BitManagement Bug Report submitted 28 November 2014 http://www.bitmanagement.de/en/contact '/>
 11            <meta name='referencecontent='https://X3dGraphics.com'/>
 12            <meta name='referencecontent='https://www.web3d.org/x3d/content/examples/X3dResources.html'/>
 13            <meta name='rightscontent='Copyright 2006, Daly Realism and Don Brutzman'/>
 14            <meta name='subjectcontent='X3D book, X3D graphics, X3D-Edit, http://www.x3dGraphics.com'/>
 15            <meta name='identifiercontent='https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/BooleanToggleExample.x3d'/>
 16            <meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
 17            <meta name='licensecontent='../license.html'/>
 18       </head>
<!--

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

<!-- to top Index for DEF nodes: PauseOff, PauseOn, Shaker, ShakingCone, Tee, Timer, Toggler, TouchButton

Index for Viewpoint node: Viewpoint_1
-->
 19       <Scene>
 20            <WorldInfo title='Boolean Toggle Example'/>
 21            <Viewpoint description='Select red button to toggle cone jitter'/>
 22            <Transform rotation='1 0 0 1.57'>
 23                 <Shape>
 24                      <Appearance>
 25                           <Material diffuseColor='1 0 0'/>
 26                      </Appearance>
 27                      <Cylinder height='.5radius='.5'/>
 28                 </Shape>
 29 
               <!-- ROUTE information for TouchButton node:  [from isActive to Toggler.set_boolean ] -->
               <TouchSensor DEF='TouchButtondescription='touch to activate'/>
 30            </Transform>
 31            <Transform translation='2 0 0'>
 32 
               <!-- ROUTE information for ShakingCone node:  [from Shaker.value_changed to translation ] -->
               <Transform DEF='ShakingCone'>
 33                      <Shape>
 34                           <Appearance>
 35                                <Material diffuseColor='0 .8 0'/>
 36                           </Appearance>
 37                           <Cone/>
 38                      </Shape>
 39                 </Transform>
 40            </Transform>
 41 
          <!-- ROUTE information for Toggler node:  [from TouchButton.isActive to set_boolean ] [from toggle_changed to Tee.set_boolean ] -->
          <BooleanToggle DEF='TogglercontainerField='children'/>
 42            < ROUTE  fromNode='TouchButton' fromField='isActive' toNode='Toggler' toField='set_boolean'/>
 43 
          <!-- ROUTE information for Tee node:  [from Toggler.toggle_changed to set_boolean ] [from inputTrue to PauseOn.set_boolean ] [from inputFalse to PauseOff.set_boolean ] -->
          <BooleanFilter DEF='Tee'/>
 44            < ROUTE  fromNode='Toggler' fromField='toggle_changed' toNode='Tee' toField='set_boolean'/>
 45 
          <!-- ROUTE information for PauseOn node:  [from Tee.inputTrue to set_boolean ] [from triggerTime to Timer.pauseTime ] -->
          <TimeTrigger DEF='PauseOn'/>
 46            < ROUTE  fromNode='Tee' fromField='inputTrue' toNode='PauseOn' toField='set_boolean'/>
 47 
          <!-- ROUTE information for PauseOff node:  [from Tee.inputFalse to set_boolean ] [from triggerTime to Timer.resumeTime ] -->
          <TimeTrigger DEF='PauseOff'/>
 48            < ROUTE  fromNode='Tee' fromField='inputFalse' toNode='PauseOff' toField='set_boolean'/>
 49 
          <!-- ROUTE information for Timer node:  [from PauseOn.triggerTime to pauseTime ] [from PauseOff.triggerTime to resumeTime ] [from fraction_changed to Shaker.set_fraction ] -->
          <TimeSensor DEF='TimercycleInterval='.15loop='truestartTime='1'/>
 50            < ROUTE  fromNode='PauseOn' fromField='triggerTime' toNode='Timer' toField='pauseTime'/>
 51            < ROUTE  fromNode='PauseOff' fromField='triggerTime' toNode='Timer' toField='resumeTime'/>
 52 
          <!-- ROUTE information for Shaker node:  [from Timer.fraction_changed to set_fraction ] [from value_changed to ShakingCone.translation ] -->
          <PositionInterpolator DEF='Shakerkey='0 .25 .50 .75 1keyValue='0 0 0 .4 .2 -.3 -.2 .3 .1 -.1 -.2 .3 0 0 0'/>
 53            < ROUTE  fromNode='Timer' fromField='fraction_changed' toNode='Shaker' toField='set_fraction'/>
 54            < ROUTE  fromNode='Shaker' fromField='value_changed' toNode='ShakingCone' toField='translation'/>
 55       </Scene>
 56  </X3D>
<!--

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

<!-- to top Index for DEF nodes: PauseOff, PauseOn, Shaker, ShakingCone, Tee, Timer, Toggler, TouchButton

Index for Viewpoint node: Viewpoint_1
-->
X3D Tooltips element index: Appearance, BooleanFilter, BooleanToggle, Cone, Cylinder, head, Material, meta, PositionInterpolator, ROUTE, Scene, Shape, TimeSensor, TimeTrigger, TouchSensor, Transform, Viewpoint, WorldInfo, X3D, accessType and type, XML data types, field types

Event Graph ROUTE Table entries with 8 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.

TouchButton
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
Toggler
BooleanToggle
set_boolean
SFBool
then
 
 
 
Toggler
BooleanToggle
toggle_changed
SFBool

ROUTE
event to
(2)
Tee
BooleanFilter
set_boolean
SFBool
then
 
 
 
Tee
BooleanFilter
inputFalse
SFBool

ROUTE
event to
(3)
PauseOff
TimeTrigger
set_boolean
SFBool
then
 
 
 
PauseOff
TimeTrigger
triggerTime
SFTime

ROUTE
event to
(4)
Timer
TimeSensor
resumeTime
SFTime
then
 
 
 
Timer
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(5)
Shaker
PositionInterpolator
set_fraction
SFFloat
then
 
 
 
Shaker
PositionInterpolator
value_changed
SFVec3f

ROUTE
event to
(6)
ShakingCone
Transform
translation
SFVec3f
  then
 
 
 
Tee
BooleanFilter
inputTrue
SFBool

ROUTE
event to
(3)
PauseOn
TimeTrigger
set_boolean
SFBool
then
 
 
 
PauseOn
TimeTrigger
triggerTime
SFTime

ROUTE
event to
(4)
Timer
TimeSensor
pauseTime
SFTime
then
 
 
 
Timer
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(5)
Shaker
PositionInterpolator
set_fraction
SFFloat
then
 
 
 
Shaker
PositionInterpolator
value_changed
SFVec3f

ROUTE
event to
(6)
ShakingCone
Transform
translation
SFVec3f

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/X3dForWebAuthors/Chapter09EventUtilitiesScripting/BooleanToggleExampleIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/BooleanToggleExample.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)
-->

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