<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
<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 ' >
<head>
<meta name='titlecontent='Button.x3d'/>
<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".'/>
<meta name='creatorcontent='David R. Nadeau'/>
<meta name='translatorcontent='Don Brutzman'/>
<meta name='createdcontent='1 July 1998'/>
<meta name='translatedcontent='2 February 2014'/>
<meta name='modifiedcontent='20 October 2019'/>
<meta name='referencecontent='Loader.x3d'/>
<meta name='referencecontent='originals/button.wrl'/>
<meta name='referencecontent=' http://www.siggraph.org/s98 '/>
<meta name='referencecontent=' http://www.siggraph.org/s98/conference/courses/18.html '/>
<meta name='referencecontent=' http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/slides/mt0469.htm '/>
<meta name='referencecontent=' http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/vrml97.htm '/>
<meta name='referencecontent=' https://www.web3d.org/x3d/content/examples/X3dResources.html '/>
<meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Button.x3d '/>
<meta name='generatorcontent='Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html'/>
<meta name='generatorcontent='X3D-Edit, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../license.html'/>
</head>
<!--

to top <!-- Event Graph ROUTE Table shows event connections -->
 
<!-- Index for DEF nodes: Rotator, SendUrl, Timer, Touch, Trans

Index for ProtoDeclare definition: Button
-->
<Scene>
<WorldInfo info='"Copyright (c) 1998, David R. Nadeau"title='Simple Button'/>
<ProtoDeclare name='Button'>
<ProtoInterface>
<field name='urltype='MFStringvalue=' ""
accessType='inputOutput'/>

<field name='textureUrltype='MFStringvalue=' ""
accessType='inputOutput'/>

<field name='url_changedtype='MFStringaccessType='outputOnly'/>
<field name='translationtype='SFVec3fvalue='0.0 0.0 0.0accessType='initializeOnly'/>
</ProtoInterface>
<ProtoBody>
<!-- ROUTE information for Trans node:  [from Rotator.value_changed to set_rotation ] -->
<Transform DEF='Trans'>
<IS>
<connect nodeField='translationprotoField='translation'/>
</IS>
<Shape>
<Appearance>
<Material diffuseColor='1.0 1.0 1.0'/>
<ImageTexture>
<IS>
<connect nodeField='urlprotoField='textureUrl'/>
</IS>
</ImageTexture>
</Appearance>
<Box size='1.0 1.0 1.0'/>
</Shape>
<!-- 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'/>
</Transform>
<!-- ROUTE information for Timer node:  [from Touch.touchTime to set_startTime ] [from fraction_changed to Rotator.set_fraction ] -->
<TimeSensor DEF='TimerstopTime='1.0'/>

<!-- 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'/>

<!-- ROUTE information for SendUrl node:  [from Touch.touchTime to set_touchTime ] -->
<Script DEF='SendUrl'>
<field name='sendUrltype='MFStringaccessType='initializeOnly'/>
<field name='set_touchTimetype='SFTimeaccessType='inputOnly'/>
<field name='url_changedtype='MFStringaccessType='outputOnly'/>
<IS>
<connect nodeField='sendUrlprotoField='url'/>
<connect nodeField='url_changedprotoField='url_changed'/>
</IS>
<![CDATA[
          
ecmascript:
	function set_touchTime( tm, ts ) {
		url_changed = sendUrl;
	}

        
]]>
</Script>
< ROUTE  fromNode=' Touch' fromField='touchTime' toNode=' Timer' toField='set_startTime'/>
< ROUTE  fromNode=' Timer' fromField='fraction_changed' toNode=' Rotator' toField='set_fraction'/>
< ROUTE  fromNode=' Rotator' fromField='value_changed' toNode=' Trans' toField='set_rotation'/>
< ROUTE  fromNode=' Touch' fromField='touchTime' toNode=' SendUrl' toField='set_touchTime'/>
</ProtoBody>
</ProtoDeclare>
<!-- Display scene instructions for viewing an example scene with a corresponding prototype instance -->
<Background skyColor='0 0.333333 0.66667'/>
<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" ' >
<Shape>
<Text string='"Button.x3d scene holds" "a prototype declaration" "" "Select this text to view example" "use in Loader.x3d scene"'>
<FontStyle justify='"MIDDLE" "MIDDLE"style='BOLD'/>
</Text>
<Appearance>
<Material diffuseColor='1 0.9 0.4'/>
</Appearance>
</Shape>
<!-- Selectable text: invisible box behind text makes selection easier -->
<Shape>
<Box size='12 5 0.1'/>
<Appearance>
<Material transparency='1'/>
</Appearance>
</Shape>
</Anchor>
</Scene>
</X3D>
<!--

to top <!-- Event Graph ROUTE Table shows event connections -->
 
<!-- Index for DEF nodes: Rotator, SendUrl, Timer, Touch, Trans

Index for ProtoDeclare definition: Button
-->

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



-->

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