<?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=' 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>
<!--

to top <!-- Event Graph ROUTE Table shows event connections -->
 
<!-- Index for DEF nodes: clock, grinding_door, open_door, open_door_js, touch_door, transform_door, wall, wallpaper

Index for Viewpoint node: Viewpoint_1 Index for ExternProtoDeclare definitions: Chair, Desk, WallLamp
-->
<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>
</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=' "https://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_door' fromField='touchTime' toNode=' clock' toField='startTime'/>
< ROUTE  fromNode=' touch_door' fromField='touchTime' toNode=' open_door_js' toField='set_open'/>
< ROUTE  fromNode=' touch_door' fromField='touchTime' toNode=' grinding_door' toField='startTime'/>
< ROUTE  fromNode=' open_door_js' fromField='keyValue_changed' toNode=' open_door' toField='set_keyValue'/>
< ROUTE  fromNode=' clock' fromField='fraction_changed' toNode=' open_door' toField='set_fraction'/>
< ROUTE  fromNode=' open_door' fromField='value_changed' toNode=' transform_door' toField='set_rotation'/>
</Scene>
</X3D>
<!--

to top <!-- Event Graph ROUTE Table shows event connections -->
 
<!-- Index for DEF nodes: clock, grinding_door, open_door, open_door_js, touch_door, transform_door, wall, wallpaper

Index for Viewpoint node: Viewpoint_1 Index for ExternProtoDeclare definitions: Chair, Desk, WallLamp
-->

Event Graph ROUTE Table entries with 6 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_door
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
clock
TimeSensor
startTime
SFTime

 
 
then
clock
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(2)
open_door
OrientationInterpolator
set_fraction
SFFloat

 
 
then
open_door
OrientationInterpolator
value_changed
SFRotation

ROUTE
event to
(3)
transform_door
Transform
set_rotation
SFRotation
touch_door
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
open_door_js
Script
set_open
SFTime

 
 
then
open_door_js
Script
keyValue_changed
MFRotation

ROUTE
event to
(2)
open_door
OrientationInterpolator
set_keyValue
MFRotation

 
 
then
open_door
OrientationInterpolator
value_changed
SFRotation

ROUTE
event to
(3)
transform_door
Transform
set_rotation
SFRotation
touch_door
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
grinding_door
AudioClip
startTime
SFTime



ProtoInstance
Chair
No ROUTE connection found for output from this node.
Contains SFNode/MFNode field with indirect access to other nodes. 



ProtoInstance
Desk
No ROUTE connection found for output from this node.
Contains SFNode/MFNode field with indirect access to other nodes. 



ProtoInstance
WallLamp
No ROUTE connection found for output from this node.
Contains SFNode/MFNode field with indirect access to other nodes. 



ProtoInstance
WallLamp
No ROUTE connection found for output from this node.
Contains SFNode/MFNode field with indirect access to other nodes. 



-->

<!-- Online at
https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/RoomIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Basic/StudentProjects/Room.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. -->