X3D Model Documentation: Room.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='Room.x3d'/>
  6            <meta name='descriptioncontent='A simple room containing protoype instances for chair, desk lamp, wall clock, etc.'/>
  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/Room.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: 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
-->
 14       <Scene>
 15            <!-- externprodeclare : chair -->
 16            <WorldInfo title='Room.x3d'/>
 17            <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" '>
 18                 <field name='diffuseColortype='SFColoraccessType='inputOutput'/>
 19            </ExternProtoDeclare>
 20            <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" '>
 21                 <field name='diffuseColortype='SFColoraccessType='inputOutput'/>
 22            </ExternProtoDeclare>
 23            <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" '>
 24                 <field name='lampColortype='SFColoraccessType='inputOutput'/>
 25                 <field name='lightColortype='SFColoraccessType='inputOutput'/>
 26                 <field name='lightIntensitytype='SFFloataccessType='inputOutput'/>
 27                 <field name='lightAttenuationtype='SFVec3faccessType='inputOutput'/>
 28                 <field name='radiustype='SFFloataccessType='inputOutput'/>
 29                 <field name='lightLocationtype='SFVec3faccessType='inputOutput'/>
 30            </ExternProtoDeclare>
 31            <NavigationInfo headlight='false'/>
 32            <Viewpoint description='entryorientation='1 0 0 -0.2position='16 23 75'/>
 33            <Transform scale='0.4 0.4 0.6'>
 34                 <Group>
 35                      <!-- floor -->
 36 
                    <!-- Shape wall is a DEF node that has 3 USE nodes: USE_1, USE_2, USE_3 -->
                    <Shape DEF='wall'>
 37                           <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'/>
 38 
                         <!-- Appearance wallpaper is a DEF node that has 1 USE node: USE_1 -->
                         <Appearance DEF='wallpaper'>
 39                                <ImageTexture   url=' "WallPaper.jpg " "https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/WallPaper.jpg " '/>
 40                                <TextureTransform scale='2 2'/>
 41                                <Material/>
 42                           </Appearance>
 43                      </Shape>
 44                      <!-- left wall -->
 45                      <Transform rotation='0 0 1 1.57'>
 46                           <Shape USE='wall'/>
 47                      </Transform>
 48                      <!-- right wall -->
 49                      <Transform rotation='0 0 1 1.57translation='80 0 0'>
 50                           <Shape USE='wall'/>
 51                      </Transform>
 52                      <!-- top -->
 53                      <Transform translation='0 80 0'>
 54                           <Shape USE='wall'/>
 55                      </Transform>
 56                      <!-- front wall -->
 57                      <Transform rotation='1 0 0 1.57'>
 58                           <Shape>
 59                                <Appearance USE='wallpaper'/>
 60                                <IndexedFaceSet solid='falsecoordIndex='0 1 2 7 -1 2 3 6 7 -1 4 5 6 3 -1'>
 61                                     <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'/>
 62                                </IndexedFaceSet>
 63                           </Shape>
 64                      </Transform>
 65                      <!-- door with its interpalotors and sensors -->
 66 
                    <!-- ROUTE information for transform_door node:  [from open_door.value_changed to set_rotation ] -->
                    <Transform DEF='transform_doorcenter='25 0 0'>
 67                           <Transform translation='40 22.5 0'>
 68                                <Shape>
 69                                     <Appearance>
 70                                          <ImageTexture   url=' "Door.jpg " "https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/Door.jpg " '/>
 71                                     </Appearance>
 72                                     <Box size='30 44.5 2'/>
 73                                </Shape>
 74 
                              <!-- 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'/>
 75                           </Transform>
 76 
                         <!-- 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'>
 77                                <field name='set_opentype='SFTimeaccessType='inputOnly'/>
 78                                <field name='keyValue_changedtype='MFRotationaccessType='outputOnly'/>
 79                                <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;
      }
   }
}

          
]]>
 81                           </Script>
 82 
                         <!-- ROUTE information for clock node:  [from touch_door.touchTime to startTime ] [from fraction_changed to open_door.set_fraction ] -->
                         <TimeSensor DEF='clockcycleInterval='4.5'/>
 83 
                         <!-- 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'/>
 84                      </Transform>
 85                      <!-- link to nps site -->
 86                      <Anchor description='link to NPS web page'   url=' "https://www.nps.edu" '>
 87                           <Transform translation='40 22.5 -20'>
 88                                <Shape>
 89                                     <Appearance>
 90                                          <Material diffuseColor='0 0 0'/>
 91                                     </Appearance>
 92                                     <Box size='30 44.5 1'/>
 93                                </Shape>
 94                           </Transform>
 95                      </Anchor>
 96                 </Group>
 97                 <!-- Door sound -->
 98                 <Sound direction='0 1 1location='40 0 0maxBack='150maxFront='150'>
 99 
                    <!-- 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" '/>
100                 </Sound>
101            </Transform>
102            <!-- chair inserted -->
103            <Transform scale='1.5 1.5 1.5translation='10 5.3 35'>
104                 <ProtoInstance name='Chair'>
105                      <fieldValue name='diffuseColorvalue='0 0.3 0.7'/>
106                 </ProtoInstance>
107            </Transform>
108            <!-- desk inserted -->
109            <Transform rotation='0 1 0 -0.754scale='0.8 0.8 0.7translation='18 8.1 28'>
110                 <ProtoInstance name='Desk'/>
111            </Transform>
112            <!-- left wall_lamp -->
113            <Transform rotation='0 1 0 1.57scale='2 2 2translation='0.05 23 20'>
114                 <ProtoInstance name='WallLamp'>
115                      <fieldValue name='lampColorvalue='0 0 1'/>
116                      <fieldValue name='lightColorvalue='1 1 1'/>
117                      <fieldValue name='lightIntensityvalue='0.8'/>
118                      <fieldValue name='lightAttenuationvalue='0 0 0'/>
119                      <fieldValue name='radiusvalue='100'/>
120                      <fieldValue name='lightLocationvalue='0 0 5'/>
121                 </ProtoInstance>
122            </Transform>
123            <!-- right wall_lamp -->
124            <Transform rotation='0 1 0 -1.57scale='2 2 2translation='31.99 23 20'>
125                 <ProtoInstance name='WallLamp'>
126                      <fieldValue name='lampColorvalue='0 0 1'/>
127                      <fieldValue name='lightColorvalue='1 1 1'/>
128                      <fieldValue name='lightIntensityvalue='0.8'/>
129                      <fieldValue name='lightAttenuationvalue='0 0 0'/>
130                      <fieldValue name='radiusvalue='100'/>
131                      <fieldValue name='lightLocationvalue='0 0 -5'/>
132                 </ProtoInstance>
133            </Transform>
134            <!-- clock inserted on the wall -->
135            <Transform translation='16 22.5 0'>
136                 <Inline   url=' "WallClock.x3d" "https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/WallClock.x3d" "WallClock.wrl" "https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/WallClock.wrl" '/>
137            </Transform>
138            <!-- desk lamp inserted in the scene -->
139            <Transform scale='15 15 15translation='16 8.6 25'>
140                 <Inline   url=' "DeskLamp.x3d" "https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/DeskLamp.x3d" "DeskLamp.wrl" "https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/DeskLamp.wrl" '/>
141            </Transform>
142            <!-- routes for the door -->
143            < ROUTE  fromNode='touch_door' fromField='touchTime' toNode='clock' toField='startTime'/>
144            < ROUTE  fromNode='touch_door' fromField='touchTime' toNode='open_door_js' toField='set_open'/>
145            < ROUTE  fromNode='touch_door' fromField='touchTime' toNode='grinding_door' toField='startTime'/>
146            < ROUTE  fromNode='open_door_js' fromField='keyValue_changed' toNode='open_door' toField='set_keyValue'/>
147            < ROUTE  fromNode='clock' fromField='fraction_changed' toNode='open_door' toField='set_fraction'/>
148            < ROUTE  fromNode='open_door' fromField='value_changed' toNode='transform_door' toField='set_rotation'/>
149       </Scene>
150  </X3D>
<!--

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

<!-- to top 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
-->
X3D Tooltips element index: Anchor, Appearance, AudioClip, Box, Coordinate, ElevationGrid, ExternProtoDeclare, field, fieldValue, Group, head, ImageTexture, IndexedFaceSet, Inline, Material, meta, NavigationInfo, OrientationInterpolator, ProtoInstance, ROUTE, Scene, Script, Shape, Sound, TextureTransform, TimeSensor, TouchSensor, Transform, Viewpoint, WorldInfo, X3D, accessType and type, XML data types, field types

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


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. 


ProtoInstance
WallLamp
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. 


ProtoInstance
WallLamp
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. 


Anchor
description='link to NPS web page' 
User-interaction hint for this node. 
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/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. -->