| 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='title' content=' IntegerTriggerExample.x3d '/> |
| 6 | <meta name='description' content='An IntegerTrigger node controls the display of colored text.'/> |
| 7 | <meta name='creator' content='Don Brutzman and Leonard Daly'/> |
| 8 | <meta name='created' content='1 March 2008'/> |
| 9 | <meta name='modified' content='25 August 2023'/> |
| 10 | <meta name='reference' content=' KelpTank.x3d '/> |
| 11 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/IntegerTriggerExample.x3d '/> |
| 12 | <meta name='generator' content='X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
| 13 | <meta name='license' content='../license.html'/> |
| 14 | </head> |
| 15 | <Scene> |
| 16 | <WorldInfo title='IntegerTriggerExample.x3d'/> |
| 17 | <Background skyColor='1 1 1'/> |
| 18 | <Viewpoint description='Select text to change color' position='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='SwitchColoredTextGroups' whichChoice='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='MessageText' string='"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='Touch1' description='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='Touch2' description='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='Touch3' description='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='Filter1' integerKey='1'/> |
| 62 |
<!-- ROUTE information for Filter2 node:
[from Touch2.isActive to set_boolean
]
[from triggerValue to SwitchColoredTextGroups.whichChoice
]
-->
<IntegerTrigger DEF='Filter2' integerKey='2'/> |
| 63 |
<!-- ROUTE information for Filter3 node:
[from Touch3.isActive to set_boolean
]
[from triggerValue to SwitchColoredTextGroups.whichChoice
]
-->
<IntegerTrigger DEF='Filter3' integerKey='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 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 |
Filter1
IntegerTrigger set_boolean SFBool |
then
|
Filter1
IntegerTrigger triggerValue SFInt32 |
SwitchColoredTextGroups
Switch whichChoice SFInt32 |
|
Touch2
TouchSensor isActive SFBool |
Filter2
IntegerTrigger set_boolean SFBool |
then
|
Filter2
IntegerTrigger triggerValue SFInt32 |
SwitchColoredTextGroups
Switch whichChoice SFInt32 |
|
Touch3
TouchSensor isActive SFBool |
Filter3
IntegerTrigger set_boolean SFBool |
then
|
Filter3
IntegerTrigger triggerValue SFInt32 |
SwitchColoredTextGroups
Switch whichChoice SFInt32 |
<!--
Color-coding 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)
-->
<!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->