X3D Model Documentation: StringSensorExample.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='StringSensorExample.x3d'/>
  6            <meta name='descriptioncontent='A StringSensor example that displays typed text in the world.'/>
  7            <meta name='creatorcontent='Leonard Daly and Don Brutzman'/>
  8            <meta name='createdcontent='7 June 2006'/>
  9            <meta name='modifiedcontent='25 August 2023'/>
 10            <meta name='referencecontent='https://X3dGraphics.com'/>
 11            <meta name='referencecontent='https://www.web3d.org/x3d/content/examples/X3dResources.html'/>
 12            <meta name='rightscontent='Copyright (c) 2006, Daly Realism and Don Brutzman'/>
 13            <meta name='subjectcontent='X3D book, X3D graphics, X3D-Edit, http://www.x3dGraphics.com'/>
 14            <meta name='identifiercontent='https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter08UserInteractivity/StringSensorExample.x3d'/>
 15            <meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
 16            <meta name='licensecontent='../license.html'/>
 17       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top Index for DEF nodes: Converter, DisplayText, GenText

Index for Viewpoint node: Viewpoint_1
-->
 18       <Scene>
 19            <WorldInfo title='StringSensorExample.x3d'/>
 20            <Background skyColor='1 1 1'/>
 21            <Viewpoint description='Book Viewposition='-0.02 0.01 6.85'/>
 22 
          <!-- ROUTE information for GenText node:  [from enteredText to Converter.SFString_MFString ] -->
          <StringSensor DEF='GenText'/>
 23            <Transform translation='0 0.8 0'>
 24                 <Transform translation='0 0 -.1'>
 25                      <Shape>
 26                           <Appearance>
 27                                <Material diffuseColor='1 1 .6'/>
 28                           </Appearance>
 29                           <Box size='8 1.5 .01'/>
 30                      </Shape>
 31                 </Transform>
 32                 <Transform translation='-3.8 0.2 0'>
 33                      <Shape>
 34                           <Appearance>
 35                                <Material diffuseColor='0 0 1'/>
 36                           </Appearance>
 37 
                         <!-- ROUTE information for DisplayText node:  [from Converter.MFString_out to string ] -->
                         <Text DEF='DisplayText'>
 38                                <FontStyle justify='"BEGIN" "MIDDLE"size='0.75'/>
 39                           </Text>
 40                      </Shape>
 41                 </Transform>
 42                 <!-- convert StringSensor SFString into Text node MFString by using explicit typecasting in ECMAScript -->
 43 
 44                      <field name='SFString_MFStringtype='SFStringaccessType='inputOnly'/>
 45                      <field name='MFString_outtype='MFStringaccessType='outputOnly'/>
 46                      <field name='SFFloat_Xouttype='SFFloataccessType='outputOnly'/>
 47                      <field name='SFFloat_Youttype='SFFloataccessType='outputOnly'/>
 48                      <field name='SFFloat_Zouttype='SFFloataccessType='outputOnly'/>
 49                 </Script>
 50                 < ROUTE  fromNode='GenText' fromField='enteredText' toNode='Converter' toField='SFString_MFString'/>
 51                 < ROUTE  fromNode='Converter' fromField='MFString_out' toNode='DisplayText' toField='string'/>
 52                 <Transform translation='0 -1.25 0'>
 53                      <Group>
 54                           <Shape>
 55                                <Text string='"StringSensor lets users enter text..." "please type to test"'>
 56                                     <FontStyle family='"SANS"justify='"MIDDLE" "BEGIN"size='0.5'/>
 57                                </Text>
 58                                <Appearance>
 59                                     <Material diffuseColor='0.7 0.7 0.7'/>
 60                                </Appearance>
 61                           </Shape>
 62                      </Group>
 63                 </Transform>
 64            </Transform>
 65       </Scene>
 66  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top Index for DEF nodes: Converter, DisplayText, GenText

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

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

GenText
StringSensor
enteredText
SFString

ROUTE
event to
(1)
Converter
Script
SFString_MFString
SFString
then
 
 
 
Converter
Script
MFString_out
MFString

ROUTE
event to
(2)
DisplayText
Text
string
MFString


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