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='Button.x3d'/> |
6 | <meta name='description' content='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='creator' content='David R. Nadeau'/> |
8 | <meta name='translator' content='Don Brutzman'/> |
9 | <meta name='created' content='1 July 1998'/> |
10 | <meta name='translated' content='2 February 2014'/> |
11 | <meta name='modified' content='19 August 2024'/> |
12 | <meta name='reference' content='Loader.x3d'/> |
13 | <meta name='reference' content='originals/button.wrl'/> |
14 | <meta name='reference' content='http://www.siggraph.org/s98'/> |
15 | <meta name='reference' content='http://www.siggraph.org/s98/conference/courses/18.html'/> |
16 | <meta name='reference' content='http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/slides/mt0469.htm'/> |
17 | <meta name='reference' content='http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/vrml97.htm'/> |
18 | <meta name='reference' content='https://www.web3d.org/x3d/content/examples/X3dResources.html'/> |
19 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Button.x3d'/> |
20 | <meta name='generator' content='Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html'/> |
21 | <meta name='generator' content='X3D-Edit, https://savage.nps.edu/X3D-Edit'/> |
22 | <meta name='license' content='../license.html'/> |
23 | </head> |
24 | <Scene> |
25 | <WorldInfo info='"Copyright (c) 1998, David R. Nadeau"' title='Simple Button'/> |
26 | <ProtoDeclare name='Button'> |
27 | <ProtoInterface> |
28 | <field name='url' type='MFString' value=' "" ' accessType='initializeOnly'/> |
29 | <field name='textureUrl' type='MFString' value=' "" ' accessType='inputOutput'/> |
30 | <field name='url_changed' type='MFString' accessType='outputOnly'/> |
31 | <field name='translation' type='SFVec3f' value='0.0 0.0 0.0' accessType='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='translation' protoField='translation'/> |
37 | </IS> |
38 | <Shape> |
39 | <Appearance> |
40 | <Material diffuseColor='1.0 1.0 1.0'/> |
41 | <ImageTexture> |
42 | <IS> |
43 | <connect nodeField='url' protoField='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='Touch' description='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='Timer' stopTime='1.0'/> |
52 |
<!-- ROUTE information for Rotator node:
[from Timer.fraction_changed to set_fraction
]
[from value_changed to Trans.set_rotation
]
-->
<OrientationInterpolator DEF='Rotator' key='0.0 1.0' keyValue='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='sendUrl' type='MFString' accessType='initializeOnly'/> |
55 | <field name='set_touchTime' type='SFTime' accessType='inputOnly'/> |
56 | <field name='url_changed' type='MFString' accessType='outputOnly'/> |
57 | <IS> |
58 | <connect nodeField='sendUrl' protoField='url'/> |
59 | <connect nodeField='url_changed' protoField='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 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 |
Timer
TimeSensor set_startTime SFTime |
then
|
Timer
TimeSensor fraction_changed SFFloat |
Rotator
OrientationInterpolator set_fraction SFFloat |
then
|
Rotator
OrientationInterpolator value_changed SFRotation |
Trans
Transform set_rotation SFRotation |
|||
Touch
TouchSensor touchTime SFTime |
SendUrl
Script set_touchTime SFTime |
Anchor |
description='select text to view parent scene' User-interaction hint for this node. |
<!--
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>
-->
<!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->