<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
<X3D profile='Immersive'  version='3.3 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation =' https://www.web3d.org/specifications/x3d-3.3.xsd ' >
<head>
<meta name='titlecontent=' IntegerTriggerExample.x3d '/>
<meta name='descriptioncontent='An IntegerTrigger node controls the display of colored text.'/>
<meta name='creatorcontent='Don Brutzman and Leonard Daly'/>
<meta name='createdcontent='1 March 2008'/>
<meta name='modifiedcontent='25 August 2023'/>
<meta name='referencecontent=' KelpTank.x3d '/>
<meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/IntegerTriggerExample.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: Filter1, Filter2, Filter3, MessageText, SwitchColoredTextGroups, Touch1, Touch2, Touch3, TransparentBox

Index for Viewpoint node: Viewpoint_1
-->
<Scene>
<WorldInfo title='IntegerTriggerExample.x3d'/>
<Background skyColor='1 1 1'/>
<Viewpoint description='Select text to change colorposition='0 0 6'/>
<!-- ROUTE information for SwitchColoredTextGroups node:  [from Filter1.triggerValue to whichChoice ] [from Filter2.triggerValue to whichChoice ] [from Filter3.triggerValue to whichChoice ] -->
<Switch DEF='SwitchColoredTextGroupswhichChoice='0'>
<Group>
<Shape>
<Appearance>
<Material diffuseColor='1 0 0'/>
</Appearance>
<Text DEF='MessageTextstring='"Select these words" "to change color"'>
<FontStyle justify='"MIDDLE" "BEGIN"'/>
</Text>
</Shape>
<!-- TransparentBox makes selection of Text using TouchSensor easier for user -->
<Shape DEF='TransparentBox'>
<Box size='6 2 0.02'/>
<Appearance>
<Material transparency='1'/>
</Appearance>
</Shape>
<!-- ROUTE information for Touch1 node:  [from isActive to Filter1.set_boolean ] -->
<TouchSensor DEF='Touch1description='touch to activate'/>
</Group>
<!-- Reuse Text geoemetry, paired with different Material colors -->
<Group>
<Shape>
<Appearance>
<Material diffuseColor='0 1 1'/>
</Appearance>
<Text USE=' MessageText'/>
</Shape>
<Shape USE=' TransparentBox'/>
<!-- ROUTE information for Touch2 node:  [from isActive to Filter2.set_boolean ] -->
<TouchSensor DEF='Touch2description='touch to activate'/>
</Group>
<Group>
<Shape>
<Appearance>
<Material diffuseColor='0.7 0.7 0'/>
</Appearance>
<Text USE=' MessageText'/>
</Shape>
<Shape USE=' TransparentBox'/>
<!-- ROUTE information for Touch3 node:  [from isActive to Filter3.set_boolean ] -->
<TouchSensor DEF='Touch3description='touch to activate'/>
</Group>
</Switch>
<!-- IntegerTrigger nodes used to switch child shapes, must use separate one for each output value -->
<!-- ROUTE information for Filter1 node:  [from Touch1.isActive to set_boolean ] [from triggerValue to SwitchColoredTextGroups.whichChoice ] -->
<IntegerTrigger DEF='Filter1integerKey='1'/>

<!-- ROUTE information for Filter2 node:  [from Touch2.isActive to set_boolean ] [from triggerValue to SwitchColoredTextGroups.whichChoice ] -->
<IntegerTrigger DEF='Filter2integerKey='2'/>

<!-- ROUTE information for Filter3 node:  [from Touch3.isActive to set_boolean ] [from triggerValue to SwitchColoredTextGroups.whichChoice ] -->
<IntegerTrigger DEF='Filter3integerKey='0'/>

< ROUTE  fromNode=' Touch1' fromField='isActive' toNode=' Filter1' toField='set_boolean'/>
< ROUTE  fromNode=' Touch2' fromField='isActive' toNode=' Filter2' toField='set_boolean'/>
< ROUTE  fromNode=' Touch3' fromField='isActive' toNode=' Filter3' toField='set_boolean'/>
< ROUTE  fromNode=' Filter1' fromField='triggerValue' toNode=' SwitchColoredTextGroups' toField='whichChoice'/>
< ROUTE  fromNode=' Filter2' fromField='triggerValue' toNode=' SwitchColoredTextGroups' toField='whichChoice'/>
< ROUTE  fromNode=' Filter3' fromField='triggerValue' toNode=' SwitchColoredTextGroups' toField='whichChoice'/>
</Scene>
</X3D>
<!--

to top <!-- Event Graph ROUTE Table shows event connections -->
 
<!-- Index for DEF nodes: Filter1, Filter2, Filter3, MessageText, SwitchColoredTextGroups, Touch1, Touch2, Touch3, TransparentBox

Index for Viewpoint node: Viewpoint_1
-->

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

Touch1
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
Filter1
IntegerTrigger
set_boolean
SFBool

 
 
then
Filter1
IntegerTrigger
triggerValue
SFInt32

ROUTE
event to
(2)
SwitchColoredTextGroups
Switch
whichChoice
SFInt32


Touch2
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
Filter2
IntegerTrigger
set_boolean
SFBool

 
 
then
Filter2
IntegerTrigger
triggerValue
SFInt32

ROUTE
event to
(2)
SwitchColoredTextGroups
Switch
whichChoice
SFInt32


Touch3
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
Filter3
IntegerTrigger
set_boolean
SFBool

 
 
then
Filter3
IntegerTrigger
triggerValue
SFInt32

ROUTE
event to
(2)
SwitchColoredTextGroups
Switch
whichChoice
SFInt32


-->

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