<?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=' DeskLamp.x3d '/>
<meta name='descriptioncontent='A file decribing a desk lamp'/>
<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/DeskLamp.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../license.html'/>
</head>
<!-- -->
<Scene>
<WorldInfo title='DeskLamp.x3d'/>
<Viewpoint description='DeskLampposition='0 0.1 1'/>
<Group>
<!-- ROUTE information for movelamp node:  [from translation_changed to lamp.set_translation ] -->
<PlaneSensor DEF='movelampdescription='click and drag to move lamp'/>

<!-- ROUTE information for lamp node:  [from movelamp.translation_changed to set_translation ] -->
<Transform DEF='lamp'>
<Shape>
<Appearance>
<Material DEF='colordiffuseColor='0.8 0 0.6'/>
</Appearance>
<Cylinder height='0.01radius='0.1'/>
</Shape>
<Group>
<!-- ROUTE information for movefirstarm node:  [from rotation_changed to firstarm.set_rotation ] -->
<SphereSensor DEF='movefirstarmdescription='click and drag to move armoffset='1 0 0 -3.58'/>

<!-- ROUTE information for firstarm node:  [from movefirstarm.rotation_changed to set_rotation ] -->
<Transform DEF='firstarmcenter='0 -0.15 0rotation='1 0 0 -0.7translation='0 0.15 0'>
<Shape DEF='lamparm'>
<Appearance>
<Material USE=' color'/>
</Appearance>
<Cylinder height='0.3radius='0.01'/>
</Shape>
<Group>
<!-- ROUTE information for movesecondarm node:  [from rotation_changed to secondarm.set_rotation ] -->
<SphereSensor DEF='movesecondarmdescription='click and drag to move armoffset='1 0 0 -1.25'/>

<!-- ROUTE information for secondarm node:  [from movesecondarm.rotation_changed to set_rotation ] -->
<Transform DEF='secondarmcenter='0 -0.15 0rotation='1 0 0 1.9translation='0 0.3 0'>
<Shape USE=' lamparm'/>
<Group>
<!-- ROUTE information for movelampshade node:  [from rotation_changed to lampshade.set_rotation ] -->
<SphereSensor DEF='movelampshadedescription='click and drag to move shadeoffset='1 0 0 -1.25'/>

<!-- ROUTE information for lampshade node:  [from movelampshade.rotation_changed to set_rotation ] -->
<Transform DEF='lampshadecenter='0 0.075 0rotation='1 0 0 -1.25translation='0 0.075 0'>
<Shape>
<Appearance>
<Material USE=' color'/>
</Appearance>
<Cone bottom='falsebottomRadius='0.12height='0.15'/>
</Shape>
<Transform translation='0 -0.05 0'>
<Shape>
<Appearance>
<!-- ROUTE information for color2 node:  [from colorpath1.value_changed to set_emissiveColor ] [from colorpath2.value_changed to set_emissiveColor ] -->
<Material DEF='color2diffuseColor='0.4 0.4 0.4'/>
</Appearance>
<Sphere radius='0.05'/>
</Shape>
<!-- ROUTE information for clock1 node:  [from touch1.touchTime to set_startTime ] [from fraction_changed to colorpath1.set_fraction ] -->
<TimeSensor DEF='clock1cycleInterval='0.5'/>

<!-- ROUTE information for colorpath1 node:  [from clock1.fraction_changed to set_fraction ] [from value_changed to color2.set_emissiveColor ] -->
<ColorInterpolator DEF='colorpath1key='0 1keyValue='0.4 0.4 0.4 1 1 0'/>

<!-- ROUTE information for colorpath2 node:  [from clock2.fraction_changed to set_fraction ] [from value_changed to color2.set_emissiveColor ] -->
<ColorInterpolator DEF='colorpath2key='0 1keyValue='1 1 0 0.4 0.4 0.4'/>

<!-- ROUTE information for clock2 node:  [from touch2.touchTime to set_startTime ] [from fraction_changed to colorpath2.set_fraction ] -->
<TimeSensor DEF='clock2cycleInterval='0.5'/>

<!-- ROUTE information for light node:  [from code1.value to set_on ] [from code2.value to set_on ] -->
<SpotLight DEF='lightambientIntensity='.8color='1 1 0cutOffAngle='.785398direction='0 -1 0.7on='falseradius='20'/>
</Transform>
</Transform>
</Group>
</Transform>
</Group>
</Transform>
</Group>
<Group>
<Transform DEF='button1translation='-0.02 0.015 0.05'>
<Shape>
<Appearance>
<Material diffuseColor='1 0 0'/>
</Appearance>
<Cylinder height='0.03radius='0.01'/>
</Shape>
<!-- ROUTE information for touch1 node:  [from touchTime to clock1.set_startTime ] [from touchTime to code1.set_light ] -->
<TouchSensor DEF='touch1description='click to turn on'/>

<!-- ROUTE information for code1 node:  [from touch1.touchTime to set_light ] [from value to light.set_on ] -->
<Script DEF='code1'>
<field name='valuetype='SFBoolaccessType='outputOnly'/>
<field name='set_lighttype='SFTimeaccessType='inputOnly'/>
<![CDATA[
              
ecmascript:
function set_light() {
 value = true;
}

            
]]>
</Script>
</Transform>
<Transform DEF='button2translation='0.02 0.015 0.05'>
<Shape>
<Appearance>
<Material diffuseColor='0 0 1'/>
</Appearance>
<Cylinder height='0.03radius='0.01'/>
</Shape>
<!-- ROUTE information for touch2 node:  [from touchTime to clock2.set_startTime ] [from touchTime to code2.set_light ] -->
<TouchSensor DEF='touch2description='click to turn off'/>

<!-- ROUTE information for code2 node:  [from touch2.touchTime to set_light ] [from value to light.set_on ] -->
<Script DEF='code2'>
<field name='valuetype='SFBoolaccessType='outputOnly'/>
<field name='set_lighttype='SFTimeaccessType='inputOnly'/>
<![CDATA[
              
ecmascript:
function set_light() {
 value = false;
}

            
]]>
</Script>
</Transform>
</Group>
</Transform>
</Group>
< ROUTE  fromNode=' movelamp' fromField='translation_changed' toNode=' lamp' toField='set_translation'/>
< ROUTE  fromNode=' movefirstarm' fromField='rotation_changed' toNode=' firstarm' toField='set_rotation'/>
< ROUTE  fromNode=' movesecondarm' fromField='rotation_changed' toNode=' secondarm' toField='set_rotation'/>
< ROUTE  fromNode=' movelampshade' fromField='rotation_changed' toNode=' lampshade' toField='set_rotation'/>
< ROUTE  fromNode=' touch1' fromField='touchTime' toNode=' clock1' toField='set_startTime'/>
< ROUTE  fromNode=' clock1' fromField='fraction_changed' toNode=' colorpath1' toField='set_fraction'/>
< ROUTE  fromNode=' colorpath1' fromField='value_changed' toNode=' color2' toField='set_emissiveColor'/>
< ROUTE  fromNode=' touch2' fromField='touchTime' toNode=' clock2' toField='set_startTime'/>
< ROUTE  fromNode=' clock2' fromField='fraction_changed' toNode=' colorpath2' toField='set_fraction'/>
< ROUTE  fromNode=' colorpath2' fromField='value_changed' toNode=' color2' toField='set_emissiveColor'/>
< ROUTE  fromNode=' touch1' fromField='touchTime' toNode=' code1' toField='set_light'/>
< ROUTE  fromNode=' code1' fromField='value' toNode=' light' toField='set_on'/>
< ROUTE  fromNode=' touch2' fromField='touchTime' toNode=' code2' toField='set_light'/>
< ROUTE  fromNode=' code2' fromField='value' toNode=' light' toField='set_on'/>
</Scene>
</X3D>
<!--

to top <!-- Event Graph ROUTE Table shows event connections -->
 
<!-- Index for DEF nodes: button1, button2, clock1, clock2, code1, code2, color, color2, colorpath1, colorpath2, firstarm, lamp, lamparm, lampshade, light, movefirstarm, movelamp, movelampshade, movesecondarm, secondarm, touch1, touch2

Index for Viewpoint node: Viewpoint_1
-->

Event Graph ROUTE Table entries with 14 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.

touch1
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
clock1
TimeSensor
set_startTime
SFTime

 
 
then
clock1
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(2)
colorpath1
ColorInterpolator
set_fraction
SFFloat

 
 
then
colorpath1
ColorInterpolator
value_changed
SFColor

ROUTE
event to
(3)
color2
Material
set_emissiveColor
SFColor
touch1
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
code1
Script
set_light
SFTime

 
 
then
code1
Script
value
SFBool

ROUTE
event to
(2)
light
SpotLight
set_on
SFBool


touch2
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
clock2
TimeSensor
set_startTime
SFTime

 
 
then
clock2
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(2)
colorpath2
ColorInterpolator
set_fraction
SFFloat

 
 
then
colorpath2
ColorInterpolator
value_changed
SFColor

ROUTE
event to
(3)
color2
Material
set_emissiveColor
SFColor
touch2
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
code2
Script
set_light
SFTime

 
 
then
code2
Script
value
SFBool

ROUTE
event to
(2)
light
SpotLight
set_on
SFBool


movefirstarm
SphereSensor
rotation_changed
SFRotation

ROUTE
event to
(1)
firstarm
Transform
set_rotation
SFRotation


movelampshade
SphereSensor
rotation_changed
SFRotation

ROUTE
event to
(1)
lampshade
Transform
set_rotation
SFRotation


movesecondarm
SphereSensor
rotation_changed
SFRotation

ROUTE
event to
(1)
secondarm
Transform
set_rotation
SFRotation


movelamp
PlaneSensor
translation_changed
SFVec3f

ROUTE
event to
(1)
lamp
Transform
set_translation
SFVec3f


-->

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

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