X3D Model Documentation: Desk.x3d

  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='titlecontent='Desk.x3d'/>
  6            <meta name='descriptioncontent='A reusable desk prototype - click on drawers to open/shut.'/>
  7            <meta name='creatorcontent='Frederic Roussille'/>
  8            <meta name='createdcontent='1 April 2001'/>
  9            <meta name='modifiedcontent='20 October 2019'/>
 10            <meta name='identifiercontent='https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/Desk.x3d'/>
 11            <meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
 12            <meta name='licensecontent='../license.html'/>
 13       </head>
<!--

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

<!-- to top Index for DEF nodes: AnimationGroup, box, clock1, clock2, clock3, clock4, color, desk_color, drawer, drawer1, drawer1_path, drawer1_path_js, drawer2, drawer2_path, drawer2_path_js, drawer3, drawer3_path, drawer3_path_js, drawer4, drawer4_path, drawer4_path_js, gray, touch_drawer1, touch_drawer2, touch_drawer3, touch_drawer4

Index for Viewpoint node: Viewpoint_1

Index for ProtoDeclare definition: Desk
-->
 14       <Scene>
 15            <WorldInfo title='Desk.x3d'/>
 16            <ProtoDeclare name='Desk'>
 17                 <ProtoInterface>
 18                      <field name='diffuseColortype='SFColorvalue='0.5 0.4 0.2accessType='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='diffuseColorprotoField='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.57translation='-10 -10 -6.5'>
 42                                <Shape>
 43                                     <Appearance USE='desk_color'/>
 44 
                                   <!-- IndexedFaceSet box is a DEF node that has 2 USE nodes: USE_1, USE_2 -->
                                   <IndexedFaceSet DEF='boxcoordIndex='0 1 2 3 -1 1 5 6 2 -1 5 4 7 6 -1 4 0 3 7 -1 4 5 1 0 -1 9 8 11 10 -1 13 9 10 14 -1 12 13 14 15 -1 8 12 15 3 -1 9 13 12 8 -1 3 2 10 11 -1 2 6 14 10 -1 6 7 15 14 -1 7 3 11 15 -1'>
 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.57translation='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='drawer1translation='-9.5 -5.25 6'>
 58 
                              <!-- Group drawer is a DEF node that has 3 USE nodes: USE_1, USE_2, USE_3 -->
                              <Group DEF='drawer'>
 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.57translation='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.57crossSection='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 0spine='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_drawer1description='touch to open close'/>
 75                           </Transform>
 76 
                         <!-- ROUTE information for drawer2 node:  [from drawer2_path.value_changed to set_translation ] -->
                         <Transform DEF='drawer2translation='-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_drawer2description='touch to open close'/>
 79                           </Transform>
 80 
                         <!-- ROUTE information for drawer3 node:  [from drawer3_path.value_changed to set_translation ] -->
                         <Transform DEF='drawer3translation='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_drawer3description='touch to open close'/>
 83                           </Transform>
 84 
                         <!-- ROUTE information for drawer4 node:  [from drawer4_path.value_changed to set_translation ] -->
                         <Transform DEF='drawer4translation='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_drawer4description='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_pathkey='0 1keyValue='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_pathtype='SFTimeaccessType='inputOnly'/>
 94                                     <field name='keyValue_changedtype='MFVec3faccessType='outputOnly'/>
 95                                     <field name='opentype='SFBoolvalue='falseaccessType='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_pathkey='0 1keyValue='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_pathtype='SFTimeaccessType='inputOnly'/>
103                                     <field name='keyValue_changedtype='MFVec3faccessType='outputOnly'/>
104                                     <field name='opentype='SFBoolvalue='falseaccessType='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_pathkey='0 1keyValue='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_pathtype='SFTimeaccessType='inputOnly'/>
112                                     <field name='keyValue_changedtype='MFVec3faccessType='outputOnly'/>
113                                     <field name='opentype='SFBoolvalue='falseaccessType='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_pathkey='0 1keyValue='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_pathtype='SFTimeaccessType='inputOnly'/>
121                                     <field name='keyValue_changedtype='MFVec3faccessType='outputOnly'/>
122                                     <field name='opentype='SFBoolvalue='falseaccessType='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='Entryposition='0 0 40'/>
155       </Scene>
156  </X3D>
<!--

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

<!-- to top Index for DEF nodes: AnimationGroup, box, clock1, clock2, clock3, clock4, color, desk_color, drawer, drawer1, drawer1_path, drawer1_path_js, drawer2, drawer2_path, drawer2_path_js, drawer3, drawer3_path, drawer3_path_js, drawer4, drawer4_path, drawer4_path_js, gray, touch_drawer1, touch_drawer2, touch_drawer3, touch_drawer4

Index for Viewpoint node: Viewpoint_1

Index for ProtoDeclare definition: Desk
-->
X3D Tooltips element index: Appearance, Box, connect, Coordinate, Extrusion, field, Group, head, IndexedFaceSet, IS, Material, meta, PositionInterpolator, ProtoBody, ProtoDeclare, ProtoInstance, ProtoInterface, ROUTE, Scene, Script, Shape, TimeSensor, TouchSensor, Transform, Viewpoint, WorldInfo, X3D, accessType and type, XML data types, field types

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

ROUTE
event to
(1)
clock1
TimeSensor
startTime
SFTime
then
 
 
 
clock1
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(2)
drawer1_path
PositionInterpolator
set_fraction
SFFloat
then
 
 
 
drawer1_path
PositionInterpolator
value_changed
SFVec3f

ROUTE
event to
(3)
drawer1
Transform
set_translation
SFVec3f
touch_drawer1
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
drawer1_path_js
Script
set_path
SFTime
then
 
 
 
drawer1_path_js
Script
keyValue_changed
MFVec3f

ROUTE
event to
(2)
drawer1_path
PositionInterpolator
set_keyValue
MFVec3f
then
 
 
 
drawer1_path
PositionInterpolator
value_changed
SFVec3f

ROUTE
event to
(3)
drawer1
Transform
set_translation
SFVec3f

touch_drawer2
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
clock2
TimeSensor
startTime
SFTime
then
 
 
 
clock2
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(2)
drawer2_path
PositionInterpolator
set_fraction
SFFloat
then
 
 
 
drawer2_path
PositionInterpolator
value_changed
SFVec3f

ROUTE
event to
(3)
drawer2
Transform
set_translation
SFVec3f
touch_drawer2
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
drawer2_path_js
Script
set_path
SFTime
then
 
 
 
drawer2_path_js
Script
keyValue_changed
MFVec3f

ROUTE
event to
(2)
drawer2_path
PositionInterpolator
set_keyValue
MFVec3f
then
 
 
 
drawer2_path
PositionInterpolator
value_changed
SFVec3f

ROUTE
event to
(3)
drawer2
Transform
set_translation
SFVec3f

touch_drawer3
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
clock3
TimeSensor
startTime
SFTime
then
 
 
 
clock3
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(2)
drawer3_path
PositionInterpolator
set_fraction
SFFloat
then
 
 
 
drawer3_path
PositionInterpolator
value_changed
SFVec3f

ROUTE
event to
(3)
drawer3
Transform
set_translation
SFVec3f
touch_drawer3
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
drawer3_path_js
Script
set_path
SFTime
then
 
 
 
drawer3_path_js
Script
keyValue_changed
MFVec3f

ROUTE
event to
(2)
drawer3_path
PositionInterpolator
set_keyValue
MFVec3f
then
 
 
 
drawer3_path
PositionInterpolator
value_changed
SFVec3f

ROUTE
event to
(3)
drawer3
Transform
set_translation
SFVec3f

touch_drawer4
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
clock4
TimeSensor
startTime
SFTime
then
 
 
 
clock4
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(2)
drawer4_path
PositionInterpolator
set_fraction
SFFloat
then
 
 
 
drawer4_path
PositionInterpolator
value_changed
SFVec3f

ROUTE
event to
(3)
drawer4
Transform
set_translation
SFVec3f
touch_drawer4
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
drawer4_path_js
Script
set_path
SFTime
then
 
 
 
drawer4_path_js
Script
keyValue_changed
MFVec3f

ROUTE
event to
(2)
drawer4_path
PositionInterpolator
set_keyValue
MFVec3f
then
 
 
 
drawer4_path
PositionInterpolator
value_changed
SFVec3f

ROUTE
event to
(3)
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. 
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/Basic/StudentProjects/DeskIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Basic/StudentProjects/Desk.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)
    <ProtoInstance name='ProtoName'> <field name='fieldName'/> </ProtoInstance> -->

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