<?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='Immersiveversion='3.0xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation=' http://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 2002'/>
<meta name='identifiercontent=' http://www.web3d.org/x3d/content/examples/Basic/StudentProjects/DeskLamp.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.2, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent='../license.html'/>
</head>
<!--

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 image: Viewpoint_1
-->
<Scene>
<Viewpoint description='DeskLampposition='0 0.1 1'/>
<Group>
<!-- movelamp ROUTE:  [from translation_changed to lamp.set_translation ] -->
<PlaneSensor DEF='movelampdescription='click and drag to move lamp'/>
<!-- lamp ROUTE:  [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>
<!-- movefirstarm ROUTE:  [from rotation_changed to firstarm.set_rotation ] -->
<SphereSensor DEF='movefirstarmdescription='click and drag to move armoffset='1 0 0 -3.58'/>
<!-- firstarm ROUTE:  [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>
<!-- movesecondarm ROUTE:  [from rotation_changed to secondarm.set_rotation ] -->
<SphereSensor DEF='movesecondarmdescription='click and drag to move armoffset='1 0 0 -1.25'/>
<!-- secondarm ROUTE:  [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>
<!-- movelampshade ROUTE:  [from rotation_changed to lampshade.set_rotation ] -->
<SphereSensor DEF='movelampshadedescription='click and drag to move shadeoffset='1 0 0 -1.25'/>
<!-- lampshade ROUTE:  [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>
<!-- color2 ROUTEs:  [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>
<!-- clock1 ROUTEs:  [from touch1.touchTime to set_startTime ] [from fraction_changed to colorpath1.set_fraction ] -->
<TimeSensor DEF='clock1cycleInterval='0.5'/>
<!-- colorpath1 ROUTEs:  [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'/>
<!-- colorpath2 ROUTEs:  [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'/>
<!-- clock2 ROUTEs:  [from touch2.touchTime to set_startTime ] [from fraction_changed to colorpath2.set_fraction ] -->
<TimeSensor DEF='clock2cycleInterval='0.5'/>
<!-- light ROUTEs:  [from code1.value to set_on ] [from code2.value to set_on ] -->
<SpotLight DEF='lightambientIntensity='.8beamWidth='.785398color='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>
<!-- touch1 ROUTEs:  [from touchTime to clock1.set_startTime ] [from touchTime to code1.set_light ] -->
<TouchSensor DEF='touch1description='click to turn on'/>
<!-- code1 ROUTEs:  [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>
<!-- touch2 ROUTEs:  [from touchTime to clock2.set_startTime ] [from touchTime to code2.set_light ] -->
<TouchSensor DEF='touch2description='click to turn off'/>
<!-- code2 ROUTEs:  [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='movelampfromField='translation_changedtoNode='lamptoField='set_translation'/>
<ROUTE fromNode='movefirstarmfromField='rotation_changedtoNode='firstarmtoField='set_rotation'/>
<ROUTE fromNode='movesecondarmfromField='rotation_changedtoNode='secondarmtoField='set_rotation'/>
<ROUTE fromNode='movelampshadefromField='rotation_changedtoNode='lampshadetoField='set_rotation'/>
<ROUTE fromNode='touch1fromField='touchTimetoNode='clock1toField='set_startTime'/>
<ROUTE fromNode='clock1fromField='fraction_changedtoNode='colorpath1toField='set_fraction'/>
<ROUTE fromNode='colorpath1fromField='value_changedtoNode='color2toField='set_emissiveColor'/>
<ROUTE fromNode='touch2fromField='touchTimetoNode='clock2toField='set_startTime'/>
<ROUTE fromNode='clock2fromField='fraction_changedtoNode='colorpath2toField='set_fraction'/>
<ROUTE fromNode='colorpath2fromField='value_changedtoNode='color2toField='set_emissiveColor'/>
<ROUTE fromNode='touch1fromField='touchTimetoNode='code1toField='set_light'/>
<ROUTE fromNode='code1fromField='valuetoNode='lighttoField='set_on'/>
<ROUTE fromNode='touch2fromField='touchTimetoNode='code2toField='set_light'/>
<ROUTE fromNode='code2fromField='valuetoNode='lighttoField='set_on'/>
</Scene>
</X3D>
<!--

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

<!-- Tag color codes: <Node DEF='idName' attribute='value'/> -->