<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "http://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 =' http://www.web3d.org/specifications/x3d-3.0.xsd '>
<head>
<meta name='titlecontent='Room.x3d'/>
<meta name='descriptioncontent='A simple room containing protoype instances for chair, desk lamp, wall clock, etc.'/>
<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/Room.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../license.html'/>
</head>
<!--

Index for ExternProtoDeclare definitions : Chair, Desk, WallLamp

Index for DEF nodes : clock, grinding_door, open_door, open_door_js, touch_door, transform_door, wall, wallpaper

Index for Viewpoint image : Viewpoint_1
-->
<Scene>
<!-- externprodeclare : chair -->
<WorldInfo title='Room.x3d'/>
<ExternProtoDeclare name='Chair'
  url=' "Chair.x3d#Chair" "https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/Chair.x3d#Chair" "Chair.wrl#Chair" "https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/Chair.wrl#Chair" '>
<field name='diffuseColortype='SFColoraccessType='inputOutput'/>
</ExternProtoDeclare>
<ExternProtoDeclare name='Desk'
  url=' "Desk.x3d#Desk" "https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/Desk.x3d#Desk" "Desk.wrl#Desk" "https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/Desk.wrl#Desk" '>
<field name='diffuseColortype='SFColoraccessType='inputOutput'/>
</ExternProtoDeclare>
<ExternProtoDeclare name='WallLamp'
  url=' "WallLamp.x3d#WallLamp" "https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/WallLamp.x3d#WallLamp" "WallLamp.wrl#WallLamp" "https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/WallLamp.wrl#WallLamp" '>
<field name='lampColortype='SFColoraccessType='inputOutput'/>
<field name='lightColortype='SFColoraccessType='inputOutput'/>
<field name='lightIntensitytype='SFFloataccessType='inputOutput'/>
<field name='lightAttenuationtype='SFVec3faccessType='inputOutput'/>
<field name='radiustype='SFFloataccessType='inputOutput'/>
<field name='lightLocationtype='SFVec3faccessType='inputOutput'/>
</ExternProtoDeclare>
<NavigationInfo headlight='false'/>
<Viewpoint description='entryorientation='1 0 0 -0.2position='16 23 75'/>
<Transform scale='0.4 0.4 0.6'>
<Group>
<!-- floor -->
<Shape DEF='wall'>
<ElevationGrid solid='falsexDimension='9xSpacing='10zDimension='9zSpacing='10height='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0'/>
<Appearance DEF='wallpaper'>
<ImageTexture
  url=' "WallPaper.jpg" "https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/WallPaper.jpg" '/>

<TextureTransform scale='2 2'/>
<Material/>
</Appearance>
</Shape>
<!-- left wall -->
<Transform rotation='0 0 1 1.57'>
<Shape USE='wall'/>
</Transform>
<!-- right wall -->
<Transform rotation='0 0 1 1.57translation='80 0 0'>
<Shape USE='wall'/>
</Transform>
<!-- top -->
<Transform translation='0 80 0'>
<Shape USE='wall'/>
</Transform>
<!-- front wall -->
<Transform rotation='1 0 0 1.57'>
<Shape>
<Appearance USE='wallpaper'/>
<IndexedFaceSet solid='falsecoordIndex='0 1 2 7 -1 2 3 6 7 -1 4 5 6 3 -1'>
<Coordinate point='0 0 0 25 0 0 25 0 -45 55 0 -45 55 0 0 80 0 0 80 0 -80 0 0 -80'/>
</IndexedFaceSet>
</Shape>
</Transform>
<!-- door with its interpalotors and sensors -->
<!-- ROUTE information for transform_door node:  [from open_door.value_changed to set_rotation ] -->
<Transform DEF='transform_doorcenter='25 0 0'>
<Transform translation='40 22.5 0'>
<Shape>
<Appearance> </Appearance>
<Box size='30 44.5 2'/>
</Shape>
<!-- ROUTE information for touch_door node:  [from touchTime to clock.startTime ] [from touchTime to open_door_js.set_open ] [from touchTime to grinding_door.startTime ] -->
<TouchSensor DEF='touch_doordescription='touch door to open/close'/>
</Transform>
<!-- ROUTE information for open_door_js node:  [from touch_door.touchTime to set_open ] [from keyValue_changed to open_door.set_keyValue ] -->
<Script DEF='open_door_js'>
<field name='set_opentype='SFTimeaccessType='inputOnly'/>
<field name='keyValue_changedtype='MFRotationaccessType='outputOnly'/>
<field name='opentype='SFBoolvalue='falseaccessType='initializeOnly'/>
<![CDATA[
            
ecmascript:

function set_open() {
    keyValue_changed[0][0] = 0;
    keyValue_changed[0][1] = 1;
    keyValue_changed[0][2] = 0;
    keyValue_changed[1][0] = 0;
    keyValue_changed[1][1] = 1;
    keyValue_changed[1][2] = 0;
    keyValue_changed[1][3] = -0.754;
    keyValue_changed[2][0] = 0;
    keyValue_changed[2][1] = 1;
    keyValue_changed[2][2] = 0;

  if(open == false) {
    keyValue_changed[0][3] = 0;
    keyValue_changed[2][3] = -1.57;
    open = true;
  } else {
      if(open == true) {
         keyValue_changed[0][3] = -1.57;
         keyValue_changed[2][3] = 0;
         open = false;
      }
   }
}

          
]]>
</Script>
<!-- ROUTE information for clock node:  [from touch_door.touchTime to startTime ] [from fraction_changed to open_door.set_fraction ] -->
<TimeSensor DEF='clockcycleInterval='4.5'/>
<!-- ROUTE information for open_door node:  [from open_door_js.keyValue_changed to set_keyValue ] [from clock.fraction_changed to set_fraction ] [from value_changed to transform_door.set_rotation ] -->
<OrientationInterpolator DEF='open_doorkey='0 0.5 1keyValue='0 1 0 0 0 1 0 0 0 1 0 0'/>
</Transform>
<!-- link to nps site -->
<Anchor description='link to NPS web page'
  url=' "http://www.nps.edu" '>
<Transform translation='40 22.5 -20'>
<Shape>
<Appearance>
<Material diffuseColor='0 0 0'/>
</Appearance>
<Box size='30 44.5 1'/>
</Shape>
</Transform>
</Anchor>
</Group>
<!-- Door sound -->
<Sound direction='0 1 1location='40 0 0maxBack='150maxFront='150'>
<!-- ROUTE information for grinding_door node:  [from touch_door.touchTime to startTime ] -->
<AudioClip DEF='grinding_doordescription='GrindingDoor'
  url=' "GrindingDoor.wav" "https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/GrindingDoor.wav" '/>
</Sound>
</Transform>
<!-- chair inserted -->
<Transform scale='1.5 1.5 1.5translation='10 5.3 35'>
<ProtoInstance name='Chair'>
<fieldValue name='diffuseColorvalue='0 0.3 0.7'/>
</ProtoInstance>
</Transform>
<!-- desk inserted -->
<Transform rotation='0 1 0 -0.754scale='0.8 0.8 0.7translation='18 8.1 28'>
<ProtoInstance name='Desk'/>
</Transform>
<!-- left wall_lamp -->
<Transform rotation='0 1 0 1.57scale='2 2 2translation='0.05 23 20'>
<ProtoInstance name='WallLamp'>
<fieldValue name='lampColorvalue='0 0 1'/>
<fieldValue name='lightColorvalue='1 1 1'/>
<fieldValue name='lightIntensityvalue='0.8'/>
<fieldValue name='lightAttenuationvalue='0 0 0'/>
<fieldValue name='radiusvalue='100'/>
<fieldValue name='lightLocationvalue='0 0 5'/>
</ProtoInstance>
</Transform>
<!-- right wall_lamp -->
<Transform rotation='0 1 0 -1.57scale='2 2 2translation='31.99 23 20'>
<ProtoInstance name='WallLamp'>
<fieldValue name='lampColorvalue='0 0 1'/>
<fieldValue name='lightColorvalue='1 1 1'/>
<fieldValue name='lightIntensityvalue='0.8'/>
<fieldValue name='lightAttenuationvalue='0 0 0'/>
<fieldValue name='radiusvalue='100'/>
<fieldValue name='lightLocationvalue='0 0 -5'/>
</ProtoInstance>
</Transform>
<!-- clock inserted on the wall -->
<Transform translation='16 22.5 0'> </Transform>
<!-- desk lamp inserted in the scene -->
<Transform scale='15 15 15translation='16 8.6 25'> </Transform>
<!-- routes for the door -->
<ROUTE fromNode='touch_doorfromField='touchTimetoNode='clocktoField='startTime'/>
<ROUTE fromNode='touch_doorfromField='touchTimetoNode='open_door_jstoField='set_open'/>
<ROUTE fromNode='touch_doorfromField='touchTimetoNode='grinding_doortoField='startTime'/>
<ROUTE fromNode='open_door_jsfromField='keyValue_changedtoNode='open_doortoField='set_keyValue'/>
<ROUTE fromNode='clockfromField='fraction_changedtoNode='open_doortoField='set_fraction'/>
<ROUTE fromNode='open_doorfromField='value_changedtoNode='transform_doortoField='set_rotation'/>
</Scene>
</X3D>
<!--

Index for ExternProtoDeclare definitions : Chair, Desk, WallLamp

Index for DEF nodes : clock, grinding_door, open_door, open_door_js, touch_door, transform_door, wall, wallpaper

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