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='MoodSelector.x3d'/> |
6 | <meta name='description' content='Design pattern demonstrating multiple TouchSensor, IntegerTrigger, Shape and ROUTE combinations for selecting a Switch'/> |
7 | <meta name='creator' content='Jason Nelson and MV4205 class'/> |
8 | <meta name='created' content='6 April 2009'/> |
9 | <meta name='modified' content='20 October 2019'/> |
10 | <meta name='license' content='smiley images are open source'/> |
11 | <meta name='reference' content='http://openclipart.org/media/tags/smiley'/> |
12 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/MoodSelector.x3d'/> |
13 | <meta name='generator' content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/> |
14 | <meta name='license' content='../license.html'/> |
15 | </head> |
16 | <Scene> |
17 | <WorldInfo title='MoodSelector.x3d'/> |
18 | <Viewpoint description='How do you feel today?' position='0 0 15'/> |
19 | <Transform translation='0 3 0'> |
20 |
<!-- ROUTE information for howFeelText node:
[from isActive to nodisplay.set_boolean
]
-->
<TouchSensor DEF='howFeelText' description='Touch to select your mood face'/> |
21 | <Shape> |
22 | <Text string='"How do you feel today?"'> |
23 | <FontStyle justify='"MIDDLE" "MIDDLE"'/> |
24 | </Text> |
25 | <Appearance> |
26 | <Material/> |
27 | </Appearance> |
28 | </Shape> |
29 | </Transform> |
30 | <Transform translation='-5 0 0'> |
31 |
<!-- ROUTE information for happyText node:
[from isActive to happydisplay.set_boolean
]
-->
<TouchSensor DEF='happyText' description='I feel happy I feel happy...'/> |
32 | <Shape> |
33 | <Text string='"Happy"'> |
34 | <FontStyle justify='"MIDDLE" "MIDDLE"'/> |
35 | </Text> |
36 | <Appearance> |
37 | <Material diffuseColor='0.129412 1 0.019608'/> |
38 | </Appearance> |
39 | </Shape> |
40 | <Shape> |
41 | <Box size='2.5 1 0.1'/> |
42 |
<!-- Appearance
TransparentAppearance is a DEF node that has 3 USE nodes: USE_1, USE_2, USE_3 -->
<Appearance DEF='TransparentAppearance'> |
43 | <Material transparency='1'/> |
44 | </Appearance> |
45 | </Shape> |
46 | </Transform> |
47 | <Transform translation='-1.3 0 0'> |
48 |
<!-- ROUTE information for notBadText node:
[from isActive to nbdisplay.set_boolean
]
-->
<TouchSensor DEF='notBadText' description='OK mediocre just plain average no comment'/> |
49 | <Shape> |
50 | <Text string='"Average"'> |
51 | <FontStyle justify='"MIDDLE" "MIDDLE"'/> |
52 | </Text> |
53 | <Appearance> |
54 | <Material diffuseColor='1 0.960784 0.019608'/> |
55 | </Appearance> |
56 | </Shape> |
57 | <Shape> |
58 | <Box size='3 1 0.1'/> |
59 | <Appearance USE='TransparentAppearance'/> |
60 | </Shape> |
61 | </Transform> |
62 | <Transform translation='2.2 0 0'> |
63 |
<!-- ROUTE information for sadText node:
[from isActive to saddisplay.set_boolean
]
-->
<TouchSensor DEF='sadText' description='Poor poor pitiful me'/> |
64 | <Shape> |
65 | <Text string='"Sad"'> |
66 | <FontStyle justify='"MIDDLE" "MIDDLE"'/> |
67 | </Text> |
68 | <Appearance> |
69 | <Material diffuseColor='0.180392 0.705882 1'/> |
70 | </Appearance> |
71 | </Shape> |
72 | <Shape> |
73 | <Box size='2 1 0.1'/> |
74 | <Appearance USE='TransparentAppearance'/> |
75 | </Shape> |
76 | </Transform> |
77 | <Transform translation='5 0 0'> |
78 |
<!-- ROUTE information for badText node:
[from isActive to bulldisplay.set_boolean
]
-->
<TouchSensor DEF='badText' description='Look out below!'/> |
79 | <Shape> |
80 | <Text string='"Bad"'> |
81 | <FontStyle justify='"MIDDLE" "MIDDLE"'/> |
82 | </Text> |
83 | <Appearance> |
84 | <Material diffuseColor='1 0.019608 0.05098'/> |
85 | </Appearance> |
86 | </Shape> |
87 | <Shape> |
88 | <Box size='4.5 1 0.1'/> |
89 | <Appearance USE='TransparentAppearance'/> |
90 | </Shape> |
91 | </Transform> |
92 |
<!-- ROUTE information for display node:
[from nodisplay.triggerValue to whichChoice
]
[from happydisplay.triggerValue to whichChoice
]
[from nbdisplay.triggerValue to whichChoice
]
[from saddisplay.triggerValue to whichChoice
]
[from bulldisplay.triggerValue to whichChoice
]
-->
<Switch DEF='display' whichChoice='-1'> |
93 | <Transform translation='-5 -3 0'> |
94 | <Shape DEF='happyimg'> |
95 | <Box/> |
96 | <Appearance> |
97 | <Material diffuseColor='0 0.819608 0.156863'/> |
98 |
<ImageTexture
url=' "images/nicubunu_Emoticons_Laughing_face.png![]() ![]() |
99 | </Appearance> |
100 | </Shape> |
101 | </Transform> |
102 | <Transform translation='-1.3 -3 0'> |
103 | <Shape DEF='nbimg'> |
104 | <Box/> |
105 | <Appearance> |
106 | <Material diffuseColor='0 0.066667 0.941176'/> |
107 |
<ImageTexture
url=' "images/nicubunu_Emoticons_Worried_face.png![]() ![]() |
108 | </Appearance> |
109 | </Shape> |
110 | </Transform> |
111 | <Transform translation='2.2 -3 0'> |
112 | <Shape DEF='sadimg'> |
113 | <Box/> |
114 | <Appearance> |
115 | <Material diffuseColor='0.980392 0.968627 0'/> |
116 |
<ImageTexture
url=' "images/nicubunu_Emoticons_Crying_face.png![]() ![]() |
117 | </Appearance> |
118 | </Shape> |
119 | </Transform> |
120 | <Transform translation='4.7 -3 0'> |
121 | <Shape DEF='bullimg'> |
122 | <Box/> |
123 | <Appearance> |
124 | <Material diffuseColor='1 0.101961 0.180392'/> |
125 |
<ImageTexture
url=' "images/nicubunu_Emoticons_Devil_face.png![]() ![]() |
126 | </Appearance> |
127 | </Shape> |
128 | </Transform> |
129 | </Switch> |
130 |
<!-- ROUTE information for nodisplay node:
[from howFeelText.isActive to set_boolean
]
[from triggerValue to display.whichChoice
]
-->
<IntegerTrigger DEF='nodisplay'/> |
131 |
<!-- ROUTE information for happydisplay node:
[from happyText.isActive to set_boolean
]
[from triggerValue to display.whichChoice
]
-->
<IntegerTrigger DEF='happydisplay' integerKey='0'/> |
132 |
<!-- ROUTE information for nbdisplay node:
[from notBadText.isActive to set_boolean
]
[from triggerValue to display.whichChoice
]
-->
<IntegerTrigger DEF='nbdisplay' integerKey='1'/> |
133 |
<!-- ROUTE information for saddisplay node:
[from sadText.isActive to set_boolean
]
[from triggerValue to display.whichChoice
]
-->
<IntegerTrigger DEF='saddisplay' integerKey='2'/> |
134 |
<!-- ROUTE information for bulldisplay node:
[from badText.isActive to set_boolean
]
[from triggerValue to display.whichChoice
]
-->
<IntegerTrigger DEF='bulldisplay' integerKey='3'/> |
135 | < ROUTE fromNode='howFeelText' fromField='isActive' toNode='nodisplay' toField='set_boolean'/> |
136 | < ROUTE fromNode='happyText' fromField='isActive' toNode='happydisplay' toField='set_boolean'/> |
137 | < ROUTE fromNode='notBadText' fromField='isActive' toNode='nbdisplay' toField='set_boolean'/> |
138 | < ROUTE fromNode='sadText' fromField='isActive' toNode='saddisplay' toField='set_boolean'/> |
139 | < ROUTE fromNode='badText' fromField='isActive' toNode='bulldisplay' toField='set_boolean'/> |
140 | <!-- Note that Switch "which choice" has FAN IN --> |
141 | < ROUTE fromNode='nodisplay' fromField='triggerValue' toNode='display' toField='whichChoice'/> |
142 | < ROUTE fromNode='happydisplay' fromField='triggerValue' toNode='display' toField='whichChoice'/> |
143 | < ROUTE fromNode='nbdisplay' fromField='triggerValue' toNode='display' toField='whichChoice'/> |
144 | < ROUTE fromNode='saddisplay' fromField='triggerValue' toNode='display' toField='whichChoice'/> |
145 | < ROUTE fromNode='bulldisplay' fromField='triggerValue' toNode='display' toField='whichChoice'/> |
146 | </Scene> |
147 | </X3D> |
Event Graph ROUTE Table entries with 10 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.
badText
TouchSensor isActive SFBool |
bulldisplay
IntegerTrigger set_boolean SFBool |
then
|
bulldisplay
IntegerTrigger triggerValue SFInt32 |
display
Switch whichChoice SFInt32 |
happyText
TouchSensor isActive SFBool |
happydisplay
IntegerTrigger set_boolean SFBool |
then
|
happydisplay
IntegerTrigger triggerValue SFInt32 |
display
Switch whichChoice SFInt32 |
howFeelText
TouchSensor isActive SFBool |
nodisplay
IntegerTrigger set_boolean SFBool |
then
|
nodisplay
IntegerTrigger triggerValue SFInt32 |
display
Switch whichChoice SFInt32 |
notBadText
TouchSensor isActive SFBool |
nbdisplay
IntegerTrigger set_boolean SFBool |
then
|
nbdisplay
IntegerTrigger triggerValue SFInt32 |
display
Switch whichChoice SFInt32 |
sadText
TouchSensor isActive SFBool |
saddisplay
IntegerTrigger set_boolean SFBool |
then
|
saddisplay
IntegerTrigger triggerValue SFInt32 |
display
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.
-->