1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
|
3 | <X3D profile='Immersive' version='3.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.0.xsd'> |
4 | <head> |
5 | <meta name='title' content='Desk.x3d'/> |
6 | <meta name='description' content='A reusable desk prototype - click on drawers to open/shut.'/> |
7 | <meta name='creator' content='Frederic Roussille'/> |
8 | <meta name='created' content='1 April 2001'/> |
9 | <meta name='modified' content='20 October 2019'/> |
10 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/Desk.x3d'/> |
11 | <meta name='generator' content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/> |
12 | <meta name='license' content='../license.html'/> |
13 | </head> |
14 | <Scene> |
15 | <WorldInfo title='Desk.x3d'/> |
16 | <ProtoDeclare name='Desk'> |
17 | <ProtoInterface> |
18 | <field name='diffuseColor' type='SFColor' value='0.5 0.4 0.2' accessType='inputOutput'/> |
19 | </ProtoInterface> |
20 | <ProtoBody> |
21 | <Group> |
22 | <!-- top of the desk --> |
23 | <Shape> |
24 |
<!-- Appearance
desk_color is a DEF node that has 4 USE nodes: USE_1, USE_2, USE_3, USE_4 -->
<Appearance DEF='desk_color'> |
25 | <Material DEF='color'> |
26 | <IS> |
27 | <connect nodeField='diffuseColor' protoField='diffuseColor'/> |
28 | </IS> |
29 | </Material> |
30 | </Appearance> |
31 | <Box size='20 1 13'/> |
32 | </Shape> |
33 | <Transform translation='0 -5 -6'> |
34 | <!-- back of the desk --> |
35 | <Shape> |
36 | <Appearance USE='desk_color'/> |
37 | <Box size='20 10 1'/> |
38 | </Shape> |
39 | </Transform> |
40 | <!-- left box --> |
41 | <Transform rotation='1 0 0 1.57' translation='-10 -10 -6.5'> |
42 | <Shape> |
43 | <Appearance USE='desk_color'/> |
44 | |
45 | <Coordinate point='0 0 0 5 0 0 5 12.5 0 0 12.5 0 0 0 -9.5 5 0 -9.5 5 12.5 -9.5 0 12.5 -9.5 0.5 0.5 -0.5 4.5 0.5 -0.5 4.5 12.5 -0.5 0.5 12.5 -0.5 0.5 0.5 -9 4.5 0.5 -9 4.5 12.5 -9 0.5 12.5 -9'/> |
46 | </IndexedFaceSet> |
47 | </Shape> |
48 | </Transform> |
49 | <!-- right box --> |
50 | <Transform rotation='1 0 0 1.57' translation='5 -10 -6.5'> |
51 | <Shape> |
52 | <Appearance USE='desk_color'/> |
53 | <IndexedFaceSet USE='box'/> |
54 | </Shape> |
55 | </Transform> |
56 | <!-- drawers --> |
57 |
<!-- ROUTE information for drawer1 node:
[from drawer1_path.value_changed to set_translation
]
-->
<Transform DEF='drawer1' translation='-9.5 -5.25 6'> |
58 | |
59 | <Transform scale='0.8 0.34 1.2105'> |
60 | <Shape> |
61 | <Appearance USE='desk_color'/> |
62 | <IndexedFaceSet USE='box'/> |
63 | </Shape> |
64 | </Transform> |
65 | <Transform rotation='1 0 0 1.57' translation='1 2.125 -0.05'> |
66 | <Shape> |
67 | <Appearance DEF='gray'> |
68 | <Material diffuseColor='0.5 0.5 0.5'/> |
69 | </Appearance> |
70 | <Extrusion creaseAngle='1.57' crossSection='0.1 0 0.092 -0.038 0.071 -0.071 0.038 -0.092 0 -0.1 -0.038 -0.092 -0.071 -0.071 -0.092 -0.038 -0.1 0 -0.092 0.038 -0.071 0.071 -0.038 0.092 0 0.1 0.038 0.092 0.071 0.071 0.092 0.038 0.1 0' spine='0 0 0 0.5 0.5 0 1.5 0.5 0 2 0 0'/> |
71 | </Shape> |
72 | </Transform> |
73 | </Group> |
74 |
<!-- ROUTE information for touch_drawer1 node:
[from touchTime to clock1.startTime
]
[from touchTime to drawer1_path_js.set_path
]
-->
<TouchSensor DEF='touch_drawer1' description='touch to open close'/> |
75 | </Transform> |
76 |
<!-- ROUTE information for drawer2 node:
[from drawer2_path.value_changed to set_translation
]
-->
<Transform DEF='drawer2' translation='-9.5 -9.5 6'> |
77 | <Group USE='drawer'/> |
78 |
<!-- ROUTE information for touch_drawer2 node:
[from touchTime to clock2.startTime
]
[from touchTime to drawer2_path_js.set_path
]
-->
<TouchSensor DEF='touch_drawer2' description='touch to open close'/> |
79 | </Transform> |
80 |
<!-- ROUTE information for drawer3 node:
[from drawer3_path.value_changed to set_translation
]
-->
<Transform DEF='drawer3' translation='5.5 -5.25 6'> |
81 | <Group USE='drawer'/> |
82 |
<!-- ROUTE information for touch_drawer3 node:
[from touchTime to clock3.startTime
]
[from touchTime to drawer3_path_js.set_path
]
-->
<TouchSensor DEF='touch_drawer3' description='touch to open close'/> |
83 | </Transform> |
84 |
<!-- ROUTE information for drawer4 node:
[from drawer4_path.value_changed to set_translation
]
-->
<Transform DEF='drawer4' translation='5.5 -9.5 6'> |
85 | <Group USE='drawer'/> |
86 |
<!-- ROUTE information for touch_drawer4 node:
[from touchTime to clock4.startTime
]
[from touchTime to drawer4_path_js.set_path
]
-->
<TouchSensor DEF='touch_drawer4' description='touch to open close'/> |
87 | </Transform> |
88 | <Group DEF='AnimationGroup'> |
89 | <!-- path for drawer 1 --> |
90 |
<!-- ROUTE information for clock1 node:
[from touch_drawer1.touchTime to startTime
]
[from fraction_changed to drawer1_path.set_fraction
]
-->
<TimeSensor DEF='clock1'/> |
91 |
<!-- ROUTE information for drawer1_path node:
[from drawer1_path_js.keyValue_changed to set_keyValue
]
[from clock1.fraction_changed to set_fraction
]
[from value_changed to drawer1.set_translation
]
-->
<PositionInterpolator DEF='drawer1_path' key='0 1' keyValue='0 0 0 0 0 0'/> |
92 |
<!-- ROUTE information for drawer1_path_js node:
[from touch_drawer1.touchTime to set_path
]
[from keyValue_changed to drawer1_path.set_keyValue
]
-->
<Script DEF='drawer1_path_js'> |
93 | <field name='set_path' type='SFTime' accessType='inputOnly'/> |
94 | <field name='keyValue_changed' type='MFVec3f' accessType='outputOnly'/> |
95 | <field name='open' type='SFBool' value='false' accessType='initializeOnly'/> |
<![CDATA[
ecmascript: function set_path() { keyValue_changed[0][0]= -9.5; keyValue_changed[0][1]= -5.25; keyValue_changed[1][0]= -9.5; keyValue_changed[1][1]= -5.25; if (open==false) { keyValue_changed[0][2]= 6; keyValue_changed[1][2]= 12; open = true; } else { if (open==true) { keyValue_changed[0][2]= 12; keyValue_changed[1][2]= 6; open = false; } } }
]]>
|
|
97 | </Script> |
98 | <!-- path for drawer 3 --> |
99 |
<!-- ROUTE information for clock3 node:
[from touch_drawer3.touchTime to startTime
]
[from fraction_changed to drawer3_path.set_fraction
]
-->
<TimeSensor DEF='clock3'/> |
100 |
<!-- ROUTE information for drawer3_path node:
[from drawer3_path_js.keyValue_changed to set_keyValue
]
[from clock3.fraction_changed to set_fraction
]
[from value_changed to drawer3.set_translation
]
-->
<PositionInterpolator DEF='drawer3_path' key='0 1' keyValue='0 0 0 0 0 0'/> |
101 |
<!-- ROUTE information for drawer3_path_js node:
[from touch_drawer3.touchTime to set_path
]
[from keyValue_changed to drawer3_path.set_keyValue
]
-->
<Script DEF='drawer3_path_js'> |
102 | <field name='set_path' type='SFTime' accessType='inputOnly'/> |
103 | <field name='keyValue_changed' type='MFVec3f' accessType='outputOnly'/> |
104 | <field name='open' type='SFBool' value='false' accessType='initializeOnly'/> |
<![CDATA[
ecmascript: function set_path() { keyValue_changed[0][0]= 5.5; keyValue_changed[0][1]= -5.25; keyValue_changed[1][0]= 5.5; keyValue_changed[1][1]= -5.25; if (open==false) { keyValue_changed[0][2]= 6; keyValue_changed[1][2]= 12; open = true; } else { if (open==true) { keyValue_changed[0][2]= 12; keyValue_changed[1][2]= 6; open = false; } } }
]]>
|
|
106 | </Script> |
107 | <!-- path for drawer 2 --> |
108 |
<!-- ROUTE information for clock2 node:
[from touch_drawer2.touchTime to startTime
]
[from fraction_changed to drawer2_path.set_fraction
]
-->
<TimeSensor DEF='clock2'/> |
109 |
<!-- ROUTE information for drawer2_path node:
[from drawer2_path_js.keyValue_changed to set_keyValue
]
[from clock2.fraction_changed to set_fraction
]
[from value_changed to drawer2.set_translation
]
-->
<PositionInterpolator DEF='drawer2_path' key='0 1' keyValue='0 0 0 0 0 0'/> |
110 |
<!-- ROUTE information for drawer2_path_js node:
[from touch_drawer2.touchTime to set_path
]
[from keyValue_changed to drawer2_path.set_keyValue
]
-->
<Script DEF='drawer2_path_js'> |
111 | <field name='set_path' type='SFTime' accessType='inputOnly'/> |
112 | <field name='keyValue_changed' type='MFVec3f' accessType='outputOnly'/> |
113 | <field name='open' type='SFBool' value='false' accessType='initializeOnly'/> |
<![CDATA[
ecmascript: function set_path() { keyValue_changed[0][0]= -9.5; keyValue_changed[0][1]= -9.5; keyValue_changed[1][0]= -9.5; keyValue_changed[1][1]= -9.5; if (open==false) { keyValue_changed[0][2]= 6; keyValue_changed[1][2]= 12; open = true; } else { if (open==true) { keyValue_changed[0][2]= 12; keyValue_changed[1][2]= 6; open = false; } } }
]]>
|
|
115 | </Script> |
116 | <!-- path for drawer 4 --> |
117 |
<!-- ROUTE information for clock4 node:
[from touch_drawer4.touchTime to startTime
]
[from fraction_changed to drawer4_path.set_fraction
]
-->
<TimeSensor DEF='clock4'/> |
118 |
<!-- ROUTE information for drawer4_path node:
[from drawer4_path_js.keyValue_changed to set_keyValue
]
[from clock4.fraction_changed to set_fraction
]
[from value_changed to drawer4.set_translation
]
-->
<PositionInterpolator DEF='drawer4_path' key='0 1' keyValue='0 0 0 0 0 0'/> |
119 |
<!-- ROUTE information for drawer4_path_js node:
[from touch_drawer4.touchTime to set_path
]
[from keyValue_changed to drawer4_path.set_keyValue
]
-->
<Script DEF='drawer4_path_js'> |
120 | <field name='set_path' type='SFTime' accessType='inputOnly'/> |
121 | <field name='keyValue_changed' type='MFVec3f' accessType='outputOnly'/> |
122 | <field name='open' type='SFBool' value='false' accessType='initializeOnly'/> |
<![CDATA[
ecmascript: function set_path() { keyValue_changed[0][0]= 5.5; keyValue_changed[0][1]= -9.5; keyValue_changed[1][0]= 5.5; keyValue_changed[1][1]= -9.5; if (open==false) { keyValue_changed[0][2]= 6; keyValue_changed[1][2]= 12; open = true; } else { if (open==true) { keyValue_changed[0][2]= 12; keyValue_changed[1][2]= 6; open = false; } } }
]]>
|
|
124 | </Script> |
125 | <!-- Routes for drawer 1 --> |
126 | < ROUTE fromNode='touch_drawer1' fromField='touchTime' toNode='clock1' toField='startTime'/> |
127 | < ROUTE fromNode='touch_drawer1' fromField='touchTime' toNode='drawer1_path_js' toField='set_path'/> |
128 | < ROUTE fromNode='drawer1_path_js' fromField='keyValue_changed' toNode='drawer1_path' toField='set_keyValue'/> |
129 | < ROUTE fromNode='clock1' fromField='fraction_changed' toNode='drawer1_path' toField='set_fraction'/> |
130 | < ROUTE fromNode='drawer1_path' fromField='value_changed' toNode='drawer1' toField='set_translation'/> |
131 | <!-- Routes for drawer 3 --> |
132 | < ROUTE fromNode='touch_drawer3' fromField='touchTime' toNode='clock3' toField='startTime'/> |
133 | < ROUTE fromNode='touch_drawer3' fromField='touchTime' toNode='drawer3_path_js' toField='set_path'/> |
134 | < ROUTE fromNode='drawer3_path_js' fromField='keyValue_changed' toNode='drawer3_path' toField='set_keyValue'/> |
135 | < ROUTE fromNode='clock3' fromField='fraction_changed' toNode='drawer3_path' toField='set_fraction'/> |
136 | < ROUTE fromNode='drawer3_path' fromField='value_changed' toNode='drawer3' toField='set_translation'/> |
137 | <!-- Route for drawer 2 --> |
138 | < ROUTE fromNode='touch_drawer2' fromField='touchTime' toNode='clock2' toField='startTime'/> |
139 | < ROUTE fromNode='touch_drawer2' fromField='touchTime' toNode='drawer2_path_js' toField='set_path'/> |
140 | < ROUTE fromNode='drawer2_path_js' fromField='keyValue_changed' toNode='drawer2_path' toField='set_keyValue'/> |
141 | < ROUTE fromNode='clock2' fromField='fraction_changed' toNode='drawer2_path' toField='set_fraction'/> |
142 | < ROUTE fromNode='drawer2_path' fromField='value_changed' toNode='drawer2' toField='set_translation'/> |
143 | <!-- Route for drawer 4 --> |
144 | < ROUTE fromNode='touch_drawer4' fromField='touchTime' toNode='clock4' toField='startTime'/> |
145 | < ROUTE fromNode='touch_drawer4' fromField='touchTime' toNode='drawer4_path_js' toField='set_path'/> |
146 | < ROUTE fromNode='drawer4_path_js' fromField='keyValue_changed' toNode='drawer4_path' toField='set_keyValue'/> |
147 | < ROUTE fromNode='clock4' fromField='fraction_changed' toNode='drawer4_path' toField='set_fraction'/> |
148 | < ROUTE fromNode='drawer4_path' fromField='value_changed' toNode='drawer4' toField='set_translation'/> |
149 | </Group> |
150 | </Group> |
151 | </ProtoBody> |
152 | </ProtoDeclare> |
153 | <ProtoInstance name='Desk'/> |
154 | <Viewpoint description='Entry' position='0 0 40'/> |
155 | </Scene> |
156 | </X3D> |
Event Graph ROUTE Table entries with 20 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_drawer1
TouchSensor touchTime SFTime |
clock1
TimeSensor startTime SFTime |
then
|
clock1
TimeSensor fraction_changed SFFloat |
drawer1_path
PositionInterpolator set_fraction SFFloat |
then
|
drawer1_path
PositionInterpolator value_changed SFVec3f |
drawer1
Transform set_translation SFVec3f |
|||
touch_drawer1
TouchSensor touchTime SFTime |
drawer1_path_js
Script set_path SFTime |
then
|
drawer1_path_js
Script keyValue_changed MFVec3f |
drawer1_path
PositionInterpolator set_keyValue MFVec3f |
then
|
drawer1_path
PositionInterpolator value_changed SFVec3f |
drawer1
Transform set_translation SFVec3f |
touch_drawer2
TouchSensor touchTime SFTime |
clock2
TimeSensor startTime SFTime |
then
|
clock2
TimeSensor fraction_changed SFFloat |
drawer2_path
PositionInterpolator set_fraction SFFloat |
then
|
drawer2_path
PositionInterpolator value_changed SFVec3f |
drawer2
Transform set_translation SFVec3f |
|||
touch_drawer2
TouchSensor touchTime SFTime |
drawer2_path_js
Script set_path SFTime |
then
|
drawer2_path_js
Script keyValue_changed MFVec3f |
drawer2_path
PositionInterpolator set_keyValue MFVec3f |
then
|
drawer2_path
PositionInterpolator value_changed SFVec3f |
drawer2
Transform set_translation SFVec3f |
touch_drawer3
TouchSensor touchTime SFTime |
clock3
TimeSensor startTime SFTime |
then
|
clock3
TimeSensor fraction_changed SFFloat |
drawer3_path
PositionInterpolator set_fraction SFFloat |
then
|
drawer3_path
PositionInterpolator value_changed SFVec3f |
drawer3
Transform set_translation SFVec3f |
|||
touch_drawer3
TouchSensor touchTime SFTime |
drawer3_path_js
Script set_path SFTime |
then
|
drawer3_path_js
Script keyValue_changed MFVec3f |
drawer3_path
PositionInterpolator set_keyValue MFVec3f |
then
|
drawer3_path
PositionInterpolator value_changed SFVec3f |
drawer3
Transform set_translation SFVec3f |
touch_drawer4
TouchSensor touchTime SFTime |
clock4
TimeSensor startTime SFTime |
then
|
clock4
TimeSensor fraction_changed SFFloat |
drawer4_path
PositionInterpolator set_fraction SFFloat |
then
|
drawer4_path
PositionInterpolator value_changed SFVec3f |
drawer4
Transform set_translation SFVec3f |
|||
touch_drawer4
TouchSensor touchTime SFTime |
drawer4_path_js
Script set_path SFTime |
then
|
drawer4_path_js
Script keyValue_changed MFVec3f |
drawer4_path
PositionInterpolator set_keyValue MFVec3f |
then
|
drawer4_path
PositionInterpolator value_changed SFVec3f |
drawer4
Transform set_translation SFVec3f |
ProtoInstance Desk |
No ROUTE connection found for output events from this node. This ProtoInstance contains SFNode/MFNode fieldValue declarations with direct access to other nodes, and thus has potential to produce run-time animation. |
<!--
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)
<ProtoInstance
name='ProtoName'>
<field
name='fieldName'/> </ProtoInstance>
-->
<!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->