X3D Model Documentation: IntegerTriggerExample.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='Immersive' 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='IntegerTriggerExample.x3d'/>
  6            <meta name='descriptioncontent='An IntegerTrigger node controls the display of colored text.'/>
  7            <meta name='creatorcontent='Don Brutzman and Leonard Daly'/>
  8            <meta name='createdcontent='1 March 2008'/>
  9            <meta name='modifiedcontent='25 August 2023'/>
 10            <meta name='referencecontent='KelpTank.x3d'/>
 11            <meta name='identifiercontent='https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/IntegerTriggerExample.x3d'/>
 12            <meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
 13            <meta name='licensecontent='../license.html'/>
 14       </head>
<!--

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

Index for Viewpoint node: Viewpoint_1
-->
 15       <Scene>
 16            <WorldInfo title='IntegerTriggerExample.x3d'/>
 17            <Background skyColor='1 1 1'/>
 18            <Viewpoint description='Select text to change colorposition='0 0 6'/>
 19 
          <!-- ROUTE information for SwitchColoredTextGroups node:  [from Filter1.triggerValue to whichChoice ] [from Filter2.triggerValue to whichChoice ] [from Filter3.triggerValue to whichChoice ] -->
          <Switch DEF='SwitchColoredTextGroupswhichChoice='0'>
 20                 <Group>
 21                      <Shape>
 22                           <Appearance>
 23                                <Material diffuseColor='1 0 0'/>
 24                           </Appearance>
 25 
                         <!-- Text MessageText is a DEF node that has 2 USE nodes: USE_1, USE_2 -->
                         <Text DEF='MessageTextstring='"Select these words" "to change color"'>
 26                                <FontStyle justify='"MIDDLE" "BEGIN"'/>
 27                           </Text>
 28                      </Shape>
 29                      <!-- TransparentBox makes selection of Text using TouchSensor easier for user -->
 30 
                    <!-- Shape TransparentBox is a DEF node that has 2 USE nodes: USE_1, USE_2 -->
                    <Shape DEF='TransparentBox'>
 31                           <Box size='6 2 0.02'/>
 32                           <Appearance>
 33                                <Material transparency='1'/>
 34                           </Appearance>
 35                      </Shape>
 36 
                    <!-- ROUTE information for Touch1 node:  [from isActive to Filter1.set_boolean ] -->
                    <TouchSensor DEF='Touch1description='touch to activate'/>
 37                 </Group>
 38                 <!-- Reuse Text geoemetry, paired with different Material colors -->
 39                 <Group>
 40                      <Shape>
 41                           <Appearance>
 42                                <Material diffuseColor='0 1 1'/>
 43                           </Appearance>
 44                           <Text USE='MessageText'/>
 45                      </Shape>
 46                      <Shape USE='TransparentBox'/>
 47 
                    <!-- ROUTE information for Touch2 node:  [from isActive to Filter2.set_boolean ] -->
                    <TouchSensor DEF='Touch2description='touch to activate'/>
 48                 </Group>
 49                 <Group>
 50                      <Shape>
 51                           <Appearance>
 52                                <Material diffuseColor='0.7 0.7 0'/>
 53                           </Appearance>
 54                           <Text USE='MessageText'/>
 55                      </Shape>
 56                      <Shape USE='TransparentBox'/>
 57 
                    <!-- ROUTE information for Touch3 node:  [from isActive to Filter3.set_boolean ] -->
                    <TouchSensor DEF='Touch3description='touch to activate'/>
 58                 </Group>
 59            </Switch>
 60            <!-- IntegerTrigger nodes used to switch child shapes, must use separate one for each output value -->
 61 
          <!-- ROUTE information for Filter1 node:  [from Touch1.isActive to set_boolean ] [from triggerValue to SwitchColoredTextGroups.whichChoice ] -->
          <IntegerTrigger DEF='Filter1integerKey='1'/>
 62 
          <!-- ROUTE information for Filter2 node:  [from Touch2.isActive to set_boolean ] [from triggerValue to SwitchColoredTextGroups.whichChoice ] -->
          <IntegerTrigger DEF='Filter2integerKey='2'/>
 63 
          <!-- ROUTE information for Filter3 node:  [from Touch3.isActive to set_boolean ] [from triggerValue to SwitchColoredTextGroups.whichChoice ] -->
          <IntegerTrigger DEF='Filter3integerKey='0'/>
 64            < ROUTE  fromNode='Touch1' fromField='isActive' toNode='Filter1' toField='set_boolean'/>
 65            < ROUTE  fromNode='Touch2' fromField='isActive' toNode='Filter2' toField='set_boolean'/>
 66            < ROUTE  fromNode='Touch3' fromField='isActive' toNode='Filter3' toField='set_boolean'/>
 67            < ROUTE  fromNode='Filter1' fromField='triggerValue' toNode='SwitchColoredTextGroups' toField='whichChoice'/>
 68            < ROUTE  fromNode='Filter2' fromField='triggerValue' toNode='SwitchColoredTextGroups' toField='whichChoice'/>
 69            < ROUTE  fromNode='Filter3' fromField='triggerValue' toNode='SwitchColoredTextGroups' toField='whichChoice'/>
 70       </Scene>
 71  </X3D>
<!--

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

Index for Viewpoint node: Viewpoint_1
-->
X3D Tooltips element index: Appearance, Background, Box, FontStyle, Group, head, IntegerTrigger, Material, meta, ROUTE, Scene, Shape, Switch, Text, TouchSensor, Viewpoint, WorldInfo, X3D, plus documentation for accessType definitions, type definitions, XML data types, and field types

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

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

<!-- Color-coding legend: X3D terminology <X3dNode  DEF='idNamefield='value'/> matches XML terminology <XmlElement  DEF='idNameattribute='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. -->