X3D Model Documentation: MoodSelector.x3d go to online X3D Example Archives model page

  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='https://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://www.web3d.org/x3d/tools/X3D-Edit'/>
 14            <meta name='license' content='../license.html'/>
 15       </head>
<!--

Event Graph ROUTE Table shows event connections.

--> <!-- to top DEF nodes index: badText, bulldisplay, bullimg, display, happydisplay, happyimg, happyText, howFeelText, nbdisplay, nbimg, nodisplay, notBadText, saddisplay, sadimg, sadText, TransparentAppearance

Index for Viewpoint node: Viewpoint_1

-->
 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 
 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"image preview "https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/images/nicubunu_Emoticons_Laughing_face.png"image preview '/>
 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"image preview "https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/images/nicubunu_Emoticons_Worried_face.png"image preview '/>
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"image preview "https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/images/nicubunu_Emoticons_Crying_face.png"image preview '/>
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"image preview "https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/images/nicubunu_Emoticons_Devil_face.png"image preview '/>
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 shows event connections.

--> <!-- to top DEF nodes index: badText, bulldisplay, bullimg, display, happydisplay, happyimg, happyText, howFeelText, nbdisplay, nbimg, nodisplay, notBadText, saddisplay, sadimg, sadText, TransparentAppearance

Index for Viewpoint node: Viewpoint_1

-->

X3D Tooltips element index: to top Appearance, Box, FontStyle, head, ImageTexture, IntegerTrigger, Material, meta, ROUTE, Scene, Shape, Switch, Text, TouchSensor, Transform, Viewpoint, WorldInfo, X3D,
plus documentation for accessType definitions, type definitions, XML data types, and field types

🔖   Event Graph ROUTE Table entries with 10 ROUTE connections and 5 TouchSensor hover hints, showing X3D event-model relationships for this scene.

Each row with a ROUTE statement shows an event cascade that may occur during a single timestamp interval between frame renderings, performed as part of the X3D execution model.

howFeelText
TouchSensor
isActive
SFBool
→
ROUTE
event to
(1)
nodisplay
IntegerTrigger
set_boolean
SFBool
then
from
same
node
nodisplay
IntegerTrigger
triggerValue
SFInt32
→
ROUTE
event to
(2)
display
Switch
whichChoice
SFInt32

happyText
TouchSensor
isActive
SFBool
→
ROUTE
event to
(1)
happydisplay
IntegerTrigger
set_boolean
SFBool
then
from
same
node
happydisplay
IntegerTrigger
triggerValue
SFInt32
→
ROUTE
event to
(2)
display
Switch
whichChoice
SFInt32

notBadText
TouchSensor
isActive
SFBool
→
ROUTE
event to
(1)
nbdisplay
IntegerTrigger
set_boolean
SFBool
then
from
same
node
nbdisplay
IntegerTrigger
triggerValue
SFInt32
→
ROUTE
event to
(2)
display
Switch
whichChoice
SFInt32

sadText
TouchSensor
isActive
SFBool
→
ROUTE
event to
(1)
saddisplay
IntegerTrigger
set_boolean
SFBool
then
from
same
node
saddisplay
IntegerTrigger
triggerValue
SFInt32
→
ROUTE
event to
(2)
display
Switch
whichChoice
SFInt32

badText
TouchSensor
isActive
SFBool
→
ROUTE
event to
(1)
bulldisplay
IntegerTrigger
set_boolean
SFBool
then
from
same
node
bulldisplay
IntegerTrigger
triggerValue
SFInt32
→
ROUTE
event to
(2)
display
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! 😀

-->
go to online X3D Example Archives model page <!-- Online at
https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/MoodSelectorIndex.html -->
<!-- SourceForge version control Version control at    
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/MoodSelector.x3d -->

<!-- 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)
-->

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