<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
<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 '>
<head>
<meta name='titlecontent='Desk.x3d'/>
<meta name='descriptioncontent='A reusable desk prototype - click on drawers to open/shut.'/>
<meta name='creatorcontent='Frederic Roussille'/>
<meta name='createdcontent='1 April 2001'/>
<meta name='modifiedcontent='20 October 2019'/>
<meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/Desk.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../license.html'/>
</head>
<!-- -->
<Scene>
<WorldInfo title='Desk.x3d'/>
<ProtoDeclare name='Desk'>
<ProtoInterface>
<field name='diffuseColortype='SFColorvalue='0.5 0.4 0.2accessType='inputOutput'/>
</ProtoInterface>
<ProtoBody>
<Group>
<!-- top of the desk -->
<Shape>
<Appearance DEF='desk_color'>
<Material DEF='color'>
<IS>
<connect nodeField='diffuseColorprotoField='diffuseColor'/>
</IS>
</Material>
</Appearance>
<Box size='20 1 13'/>
</Shape>
<Transform translation='0 -5 -6'>
<!-- back of the desk -->
<Shape>
<Appearance USE='desk_color'/>
<Box size='20 10 1'/>
</Shape>
</Transform>
<!-- left box -->
<Transform rotation='1 0 0 1.57translation='-10 -10 -6.5'>
<Shape>
<Appearance USE='desk_color'/>
<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'>
<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'/>
</IndexedFaceSet>
</Shape>
</Transform>
<!-- right box -->
<Transform rotation='1 0 0 1.57translation='5 -10 -6.5'>
<Shape>
<Appearance USE='desk_color'/>
<IndexedFaceSet USE='box'/>
</Shape>
</Transform>
<!-- drawers -->
<!-- ROUTE information for drawer1 node:  [from drawer1_path.value_changed to set_translation ] -->
<Transform DEF='drawer1translation='-9.5 -5.25 6'>
<Group DEF='drawer'>
<Transform scale='0.8 0.34 1.2105'>
<Shape>
<Appearance USE='desk_color'/>
<IndexedFaceSet USE='box'/>
</Shape>
</Transform>
<Transform rotation='1 0 0 1.57translation='1 2.125 -0.05'>
<Shape>
<Appearance DEF='gray'>
<Material diffuseColor='0.5 0.5 0.5'/>
</Appearance>
<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'/>
</Shape>
</Transform>
</Group>
<!-- 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'/>
</Transform>
<!-- ROUTE information for drawer2 node:  [from drawer2_path.value_changed to set_translation ] -->
<Transform DEF='drawer2translation='-9.5 -9.5 6'>
<Group USE='drawer'/>
<!-- 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'/>
</Transform>
<!-- ROUTE information for drawer3 node:  [from drawer3_path.value_changed to set_translation ] -->
<Transform DEF='drawer3translation='5.5 -5.25 6'>
<Group USE='drawer'/>
<!-- 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'/>
</Transform>
<!-- ROUTE information for drawer4 node:  [from drawer4_path.value_changed to set_translation ] -->
<Transform DEF='drawer4translation='5.5 -9.5 6'>
<Group USE='drawer'/>
<!-- 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'/>
</Transform>
<Group DEF='AnimationGroup'>
<!-- path for drawer 1 -->
<!-- ROUTE information for clock1 node:  [from touch_drawer1.touchTime to startTime ] [from fraction_changed to drawer1_path.set_fraction ] -->
<TimeSensor DEF='clock1'/>
<!-- 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'/>
<!-- 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'>
<field name='set_pathtype='SFTimeaccessType='inputOnly'/>
<field name='keyValue_changedtype='MFVec3faccessType='outputOnly'/>
<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;
     }
    }
}

            
]]>
</Script>
<!-- path for drawer 3 -->
<!-- ROUTE information for clock3 node:  [from touch_drawer3.touchTime to startTime ] [from fraction_changed to drawer3_path.set_fraction ] -->
<TimeSensor DEF='clock3'/>
<!-- 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'/>
<!-- 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'>
<field name='set_pathtype='SFTimeaccessType='inputOnly'/>
<field name='keyValue_changedtype='MFVec3faccessType='outputOnly'/>
<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;
     }
    }
}

            
]]>
</Script>
<!-- path for drawer 2 -->
<!-- ROUTE information for clock2 node:  [from touch_drawer2.touchTime to startTime ] [from fraction_changed to drawer2_path.set_fraction ] -->
<TimeSensor DEF='clock2'/>
<!-- 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'/>
<!-- 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'>
<field name='set_pathtype='SFTimeaccessType='inputOnly'/>
<field name='keyValue_changedtype='MFVec3faccessType='outputOnly'/>
<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;
     }
    }
}

            
]]>
</Script>
<!-- path for drawer 4 -->
<!-- ROUTE information for clock4 node:  [from touch_drawer4.touchTime to startTime ] [from fraction_changed to drawer4_path.set_fraction ] -->
<TimeSensor DEF='clock4'/>
<!-- 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'/>
<!-- 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'>
<field name='set_pathtype='SFTimeaccessType='inputOnly'/>
<field name='keyValue_changedtype='MFVec3faccessType='outputOnly'/>
<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;
     }
    }
}

            
]]>
</Script>
<!-- Routes for drawer 1 -->
<ROUTE fromNode='touch_drawer1fromField='touchTimetoNode='clock1toField='startTime'/>
<ROUTE fromNode='touch_drawer1fromField='touchTimetoNode='drawer1_path_jstoField='set_path'/>
<ROUTE fromNode='drawer1_path_jsfromField='keyValue_changedtoNode='drawer1_pathtoField='set_keyValue'/>
<ROUTE fromNode='clock1fromField='fraction_changedtoNode='drawer1_pathtoField='set_fraction'/>
<ROUTE fromNode='drawer1_pathfromField='value_changedtoNode='drawer1toField='set_translation'/>
<!-- Routes for drawer 3 -->
<ROUTE fromNode='touch_drawer3fromField='touchTimetoNode='clock3toField='startTime'/>
<ROUTE fromNode='touch_drawer3fromField='touchTimetoNode='drawer3_path_jstoField='set_path'/>
<ROUTE fromNode='drawer3_path_jsfromField='keyValue_changedtoNode='drawer3_pathtoField='set_keyValue'/>
<ROUTE fromNode='clock3fromField='fraction_changedtoNode='drawer3_pathtoField='set_fraction'/>
<ROUTE fromNode='drawer3_pathfromField='value_changedtoNode='drawer3toField='set_translation'/>
<!-- Route for drawer 2 -->
<ROUTE fromNode='touch_drawer2fromField='touchTimetoNode='clock2toField='startTime'/>
<ROUTE fromNode='touch_drawer2fromField='touchTimetoNode='drawer2_path_jstoField='set_path'/>
<ROUTE fromNode='drawer2_path_jsfromField='keyValue_changedtoNode='drawer2_pathtoField='set_keyValue'/>
<ROUTE fromNode='clock2fromField='fraction_changedtoNode='drawer2_pathtoField='set_fraction'/>
<ROUTE fromNode='drawer2_pathfromField='value_changedtoNode='drawer2toField='set_translation'/>
<!-- Route for drawer 4 -->
<ROUTE fromNode='touch_drawer4fromField='touchTimetoNode='clock4toField='startTime'/>
<ROUTE fromNode='touch_drawer4fromField='touchTimetoNode='drawer4_path_jstoField='set_path'/>
<ROUTE fromNode='drawer4_path_jsfromField='keyValue_changedtoNode='drawer4_pathtoField='set_keyValue'/>
<ROUTE fromNode='clock4fromField='fraction_changedtoNode='drawer4_pathtoField='set_fraction'/>
<ROUTE fromNode='drawer4_pathfromField='value_changedtoNode='drawer4toField='set_translation'/>
</Group>
</Group>
</ProtoBody>
</ProtoDeclare>
<ProtoInstance name='Desk'/>
<Viewpoint description='Entryposition='0 0 40'/>
</Scene>
</X3D>
<!--

Index for ProtoDeclare definition : Desk

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 image : Viewpoint_1
-->

<!-- Color key: <X3dNode DEF='idName' field='value'/> matches <XmlElement DEF='idName' attribute='value'/>
(Light blue background: behavior node) (Grey background: inserted documentation) (Magenta background: X3D Extensibility)
    <Prototype name='ProtoName'> <field name='fieldName'/> </Prototype> -->

<!-- Additional help information about X3D scenes: X3D Resources, X3D Scene Authoring Hints and X3D Tooltips -->