X3D Model Documentation: Button.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='Button.x3d'/>
  6            <meta name='descriptioncontent='Simple button: this file contains a Prototype declaration to manage a button that, when clicked, rotates 90 degrees and sends a URL. This button is used in "loader.wrl".'/>
  7            <meta name='creatorcontent='David R. Nadeau'/>
  8            <meta name='translatorcontent='Don Brutzman'/>
  9            <meta name='createdcontent='1 July 1998'/>
 10            <meta name='translatedcontent='2 February 2014'/>
 11            <meta name='modifiedcontent='19 August 2024'/>
 12            <meta name='referencecontent='Loader.x3d'/>
 13            <meta name='referencecontent='originals/button.wrl'/>
 14            <meta name='referencecontent='http://www.siggraph.org/s98'/>
 15            <meta name='referencecontent='http://www.siggraph.org/s98/conference/courses/18.html'/>
 16            <meta name='referencecontent='http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/slides/mt0469.htm'/>
 17            <meta name='referencecontent='http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/vrml97.htm'/>
 18            <meta name='referencecontent='https://www.web3d.org/x3d/content/examples/X3dResources.html'/>
 19            <meta name='identifiercontent='https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Button.x3d'/>
 20            <meta name='generatorcontent='Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html'/>
 21            <meta name='generatorcontent='X3D-Edit, https://savage.nps.edu/X3D-Edit'/>
 22            <meta name='licensecontent='../license.html'/>
 23       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->

<!-- to top Index for DEF nodes: Rotator, SendUrl, Timer, Touch, Trans

Index for ProtoDeclare definition: Button
-->
 24       <Scene>
 25            <WorldInfo info='"Copyright (c) 1998, David R. Nadeau"title='Simple Button'/>
 26            <ProtoDeclare name='Button'>
 27                 <ProtoInterface>
 28                      <field name='urltype='MFStringvalue=' "" ' accessType='initializeOnly'/>
 29                      <field name='textureUrltype='MFStringvalue=' "" ' accessType='inputOutput'/>
 30                      <field name='url_changedtype='MFStringaccessType='outputOnly'/>
 31                      <field name='translationtype='SFVec3fvalue='0.0 0.0 0.0accessType='initializeOnly'/>
 32                 </ProtoInterface>
 33                 <ProtoBody>
 34 
                    <!-- ROUTE information for Trans node:  [from Rotator.value_changed to set_rotation ] -->
                    <Transform DEF='Trans'>
 35                           <IS>
 36                                <connect nodeField='translationprotoField='translation'/>
 37                           </IS>
 38                           <Shape>
 39                                <Appearance>
 40                                     <Material diffuseColor='1.0 1.0 1.0'/>
 41                                     <ImageTexture>
 42                                          <IS>
 43                                               <connect nodeField='urlprotoField='textureUrl'/>
 44                                          </IS>
 45                                     </ImageTexture>
 46                                </Appearance>
 47                                <Box size='1.0 1.0 1.0'/>
 48                           </Shape>
 49 
                         <!-- ROUTE information for Touch node:  [from touchTime to Timer.set_startTime ] [from touchTime to SendUrl.set_touchTime ] -->
                         <TouchSensor DEF='Touchdescription='Select to initiate button spin and scene loading'/>
 50                      </Transform>
 51 
                    <!-- ROUTE information for Timer node:  [from Touch.touchTime to set_startTime ] [from fraction_changed to Rotator.set_fraction ] -->
                    <TimeSensor DEF='TimerstopTime='1.0'/>
 52 
                    <!-- ROUTE information for Rotator node:  [from Timer.fraction_changed to set_fraction ] [from value_changed to Trans.set_rotation ] -->
                    <OrientationInterpolator DEF='Rotatorkey='0.0 1.0keyValue='0.0 1.0 0.0 0.0 0.0 1.0 0.0 1.571'/>
 53 
                    <!-- ROUTE information for SendUrl node:  [from Touch.touchTime to set_touchTime ] -->
                    <Script DEF='SendUrl'>
 54                           <field name='sendUrltype='MFStringaccessType='initializeOnly'/>
 55                           <field name='set_touchTimetype='SFTimeaccessType='inputOnly'/>
 56                           <field name='url_changedtype='MFStringaccessType='outputOnly'/>
 57                           <IS>
 58                                <connect nodeField='sendUrlprotoField='url'/>
 59                                <connect nodeField='url_changedprotoField='url_changed'/>
 60                           </IS>
  <![CDATA[
          
ecmascript:
	function set_touchTime( tm, ts ) {
		url_changed = sendUrl;
	}

        
]]>
 62                      </Script>
 63                      < ROUTE  fromNode='Touch' fromField='touchTime' toNode='Timer' toField='set_startTime'/>
 64                      < ROUTE  fromNode='Timer' fromField='fraction_changed' toNode='Rotator' toField='set_fraction'/>
 65                      < ROUTE  fromNode='Rotator' fromField='value_changed' toNode='Trans' toField='set_rotation'/>
 66                      < ROUTE  fromNode='Touch' fromField='touchTime' toNode='SendUrl' toField='set_touchTime'/>
 67                 </ProtoBody>
 68            </ProtoDeclare>
 69            <!-- Display scene instructions for viewing an example scene with a corresponding prototype instance -->
 70            <Background skyColor='0 0.333333 0.66667'/>
 71            <Anchor description='select text to view parent scene'   url=' "Loader.x3d" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Loader.x3d" "Loader.wrl" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Loader.wrl" '>
 72                 <Shape>
 73                      <Text string='"Button.x3d scene holds" "a prototype declaration" "" "Select this text to view example" "use in Loader.x3d scene"'>
 74                           <FontStyle justify='"MIDDLE" "MIDDLE"style='BOLD'/>
 75                      </Text>
 76                      <Appearance>
 77                           <Material diffuseColor='1 0.9 0.4'/>
 78                      </Appearance>
 79                 </Shape>
 80                 <!-- Selectable text: invisible box behind text makes selection easier -->
 81                 <Shape>
 82                      <Box size='12 5 0.1'/>
 83                      <Appearance>
 84                           <Material transparency='1'/>
 85                      </Appearance>
 86                 </Shape>
 87            </Anchor>
 88       </Scene>
 89  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->

<!-- to top Index for DEF nodes: Rotator, SendUrl, Timer, Touch, Trans

Index for ProtoDeclare definition: Button
-->
X3D Tooltips element index: Anchor, Appearance, Background, Box, connect, field, FontStyle, head, ImageTexture, IS, Material, meta, OrientationInterpolator, ProtoBody, ProtoDeclare, ProtoInterface, ROUTE, Scene, Script, Shape, Text, TimeSensor, TouchSensor, Transform, WorldInfo, X3D, accessType and type, XML data types, field types

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

Touch
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
Timer
TimeSensor
set_startTime
SFTime
then
 
 
 
Timer
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(2)
Rotator
OrientationInterpolator
set_fraction
SFFloat
then
 
 
 
Rotator
OrientationInterpolator
value_changed
SFRotation

ROUTE
event to
(3)
Trans
Transform
set_rotation
SFRotation
Touch
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
SendUrl
Script
set_touchTime
SFTime


Anchor
description='select text to view parent scene' 
User-interaction hint for this node. 
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/Vrml2Sourcebook/Siggraph98Course/ButtonIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Button.x3d -->

<!-- Color 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)
    <ProtoDeclare name='ProtoName'> <field name='fieldName'/> </ProtoDeclare> -->

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