| 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='title' content=' DeskLamp.x3d '/> |
| 6 | <meta name='description' content='A file decribing a desk lamp'/> |
| 7 | <meta name='creator' content='Frederic Roussille'/> |
| 8 | <meta name='created' content='1 April 2001'/> |
| 9 | <meta name='modified' content='20 October 2019'/> |
| 10 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/DeskLamp.x3d '/> |
| 11 | <meta name='generator' content='X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
| 12 | <meta name='license' content='../license.html'/> |
| 13 | </head> |
| 14 | <Scene> |
| 15 | <WorldInfo title='DeskLamp.x3d'/> |
| 16 | <Viewpoint description='DeskLamp' position='0 0.1 1'/> |
| 17 | <Group> |
| 18 |
<!-- ROUTE information for movelamp node:
[from translation_changed to lamp.set_translation
]
-->
<PlaneSensor DEF='movelamp' description='click and drag to move lamp'/> |
| 19 |
<!-- ROUTE information for lamp node:
[from movelamp.translation_changed to set_translation
]
-->
<Transform DEF='lamp'> |
| 20 | <Shape> |
| 21 | <Appearance> |
| 22 | |
| 23 | </Appearance> |
| 24 | <Cylinder height='0.01' radius='0.1'/> |
| 25 | </Shape> |
| 26 | <Group> |
| 27 |
<!-- ROUTE information for movefirstarm node:
[from rotation_changed to firstarm.set_rotation
]
-->
<SphereSensor DEF='movefirstarm' description='click and drag to move arm' offset='1 0 0 -3.58'/> |
| 28 |
<!-- ROUTE information for firstarm node:
[from movefirstarm.rotation_changed to set_rotation
]
-->
<Transform DEF='firstarm' center='0 -0.15 0' rotation='1 0 0 -0.7' translation='0 0.15 0'> |
| 29 | |
| 30 | <Appearance> |
| 31 | <Material USE='color'/> |
| 32 | </Appearance> |
| 33 | <Cylinder height='0.3' radius='0.01'/> |
| 34 | </Shape> |
| 35 | <Group> |
| 36 |
<!-- ROUTE information for movesecondarm node:
[from rotation_changed to secondarm.set_rotation
]
-->
<SphereSensor DEF='movesecondarm' description='click and drag to move arm' offset='1 0 0 -1.25'/> |
| 37 |
<!-- ROUTE information for secondarm node:
[from movesecondarm.rotation_changed to set_rotation
]
-->
<Transform DEF='secondarm' center='0 -0.15 0' rotation='1 0 0 1.9' translation='0 0.3 0'> |
| 38 | <Shape USE='lamparm'/> |
| 39 | <Group> |
| 40 |
<!-- ROUTE information for movelampshade node:
[from rotation_changed to lampshade.set_rotation
]
-->
<SphereSensor DEF='movelampshade' description='click and drag to move shade' offset='1 0 0 -1.25'/> |
| 41 |
<!-- ROUTE information for lampshade node:
[from movelampshade.rotation_changed to set_rotation
]
-->
<Transform DEF='lampshade' center='0 0.075 0' rotation='1 0 0 -1.25' translation='0 0.075 0'> |
| 42 | <Shape> |
| 43 | <Appearance> |
| 44 | <Material USE='color'/> |
| 45 | </Appearance> |
| 46 | <Cone bottom='false' bottomRadius='0.12' height='0.15'/> |
| 47 | </Shape> |
| 48 | <Transform translation='0 -0.05 0'> |
| 49 | <Shape> |
| 50 | <Appearance> |
| 51 |
<!-- ROUTE information for color2 node:
[from colorpath1.value_changed to set_emissiveColor
]
[from colorpath2.value_changed to set_emissiveColor
]
-->
<Material DEF='color2' diffuseColor='0.4 0.4 0.4'/> |
| 52 | </Appearance> |
| 53 | <Sphere radius='0.05'/> |
| 54 | </Shape> |
| 55 |
<!-- ROUTE information for clock1 node:
[from touch1.touchTime to set_startTime
]
[from fraction_changed to colorpath1.set_fraction
]
-->
<TimeSensor DEF='clock1' cycleInterval='0.5'/> |
| 56 |
<!-- ROUTE information for colorpath1 node:
[from clock1.fraction_changed to set_fraction
]
[from value_changed to color2.set_emissiveColor
]
-->
<ColorInterpolator DEF='colorpath1' key='0 1' keyValue='0.4 0.4 0.4 1 1 0'/> |
| 57 |
<!-- ROUTE information for colorpath2 node:
[from clock2.fraction_changed to set_fraction
]
[from value_changed to color2.set_emissiveColor
]
-->
<ColorInterpolator DEF='colorpath2' key='0 1' keyValue='1 1 0 0.4 0.4 0.4'/> |
| 58 |
<!-- ROUTE information for clock2 node:
[from touch2.touchTime to set_startTime
]
[from fraction_changed to colorpath2.set_fraction
]
-->
<TimeSensor DEF='clock2' cycleInterval='0.5'/> |
| 59 |
<!-- ROUTE information for light node:
[from code1.value to set_on
]
[from code2.value to set_on
]
-->
<SpotLight DEF='light' ambientIntensity='.8' color='1 1 0' cutOffAngle='.785398' direction='0 -1 0.7' on='false' radius='20'/> |
| 60 | </Transform> |
| 61 | </Transform> |
| 62 | </Group> |
| 63 | </Transform> |
| 64 | </Group> |
| 65 | </Transform> |
| 66 | </Group> |
| 67 | <Group> |
| 68 | <Transform DEF='button1' translation='-0.02 0.015 0.05'> |
| 69 | <Shape> |
| 70 | <Appearance> |
| 71 | <Material diffuseColor='1 0 0'/> |
| 72 | </Appearance> |
| 73 | <Cylinder height='0.03' radius='0.01'/> |
| 74 | </Shape> |
| 75 |
<!-- ROUTE information for touch1 node:
[from touchTime to clock1.set_startTime
]
[from touchTime to code1.set_light
]
-->
<TouchSensor DEF='touch1' description='click to turn on'/> |
| 76 |
<!-- ROUTE information for code1 node:
[from touch1.touchTime to set_light
]
[from value to light.set_on
]
-->
<Script DEF='code1'> |
| 77 | <field name='value' type='SFBool' accessType='outputOnly'/> |
| 78 | <field name='set_light' type='SFTime' accessType='inputOnly'/> |
<![CDATA[
ecmascript:
function set_light() {
value = true;
}
]]>
|
|
| 80 | </Script> |
| 81 | </Transform> |
| 82 | <Transform DEF='button2' translation='0.02 0.015 0.05'> |
| 83 | <Shape> |
| 84 | <Appearance> |
| 85 | <Material diffuseColor='0 0 1'/> |
| 86 | </Appearance> |
| 87 | <Cylinder height='0.03' radius='0.01'/> |
| 88 | </Shape> |
| 89 |
<!-- ROUTE information for touch2 node:
[from touchTime to clock2.set_startTime
]
[from touchTime to code2.set_light
]
-->
<TouchSensor DEF='touch2' description='click to turn off'/> |
| 90 |
<!-- ROUTE information for code2 node:
[from touch2.touchTime to set_light
]
[from value to light.set_on
]
-->
<Script DEF='code2'> |
| 91 | <field name='value' type='SFBool' accessType='outputOnly'/> |
| 92 | <field name='set_light' type='SFTime' accessType='inputOnly'/> |
<![CDATA[
ecmascript:
function set_light() {
value = false;
}
]]>
|
|
| 94 | </Script> |
| 95 | </Transform> |
| 96 | </Group> |
| 97 | </Transform> |
| 98 | </Group> |
| 99 | < ROUTE fromNode='movelamp' fromField='translation_changed' toNode='lamp' toField='set_translation'/> |
| 100 | < ROUTE fromNode='movefirstarm' fromField='rotation_changed' toNode='firstarm' toField='set_rotation'/> |
| 101 | < ROUTE fromNode='movesecondarm' fromField='rotation_changed' toNode='secondarm' toField='set_rotation'/> |
| 102 | < ROUTE fromNode='movelampshade' fromField='rotation_changed' toNode='lampshade' toField='set_rotation'/> |
| 103 | < ROUTE fromNode='touch1' fromField='touchTime' toNode='clock1' toField='set_startTime'/> |
| 104 | < ROUTE fromNode='clock1' fromField='fraction_changed' toNode='colorpath1' toField='set_fraction'/> |
| 105 | < ROUTE fromNode='colorpath1' fromField='value_changed' toNode='color2' toField='set_emissiveColor'/> |
| 106 | < ROUTE fromNode='touch2' fromField='touchTime' toNode='clock2' toField='set_startTime'/> |
| 107 | < ROUTE fromNode='clock2' fromField='fraction_changed' toNode='colorpath2' toField='set_fraction'/> |
| 108 | < ROUTE fromNode='colorpath2' fromField='value_changed' toNode='color2' toField='set_emissiveColor'/> |
| 109 | < ROUTE fromNode='touch1' fromField='touchTime' toNode='code1' toField='set_light'/> |
| 110 | < ROUTE fromNode='code1' fromField='value' toNode='light' toField='set_on'/> |
| 111 | < ROUTE fromNode='touch2' fromField='touchTime' toNode='code2' toField='set_light'/> |
| 112 | < ROUTE fromNode='code2' fromField='value' toNode='light' toField='set_on'/> |
| 113 | </Scene> |
| 114 | </X3D> |
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 |
clock1
TimeSensor set_startTime SFTime |
then
|
clock1
TimeSensor fraction_changed SFFloat |
colorpath1
ColorInterpolator set_fraction SFFloat |
then
|
colorpath1
ColorInterpolator value_changed SFColor |
color2
Material set_emissiveColor SFColor |
|
touch1
TouchSensor touchTime SFTime |
code1
Script set_light SFTime |
then
|
code1
Script value SFBool |
light
SpotLight set_on SFBool |
|
touch2
TouchSensor touchTime SFTime |
clock2
TimeSensor set_startTime SFTime |
then
|
clock2
TimeSensor fraction_changed SFFloat |
colorpath2
ColorInterpolator set_fraction SFFloat |
then
|
colorpath2
ColorInterpolator value_changed SFColor |
color2
Material set_emissiveColor SFColor |
|
touch2
TouchSensor touchTime SFTime |
code2
Script set_light SFTime |
then
|
code2
Script value SFBool |
light
SpotLight set_on SFBool |
|
movefirstarm
SphereSensor rotation_changed SFRotation |
firstarm
Transform set_rotation SFRotation |
|
movelampshade
SphereSensor rotation_changed SFRotation |
lampshade
Transform set_rotation SFRotation |
|
movesecondarm
SphereSensor rotation_changed SFRotation |
secondarm
Transform set_rotation SFRotation |
|
movelamp
PlaneSensor translation_changed SFVec3f |
lamp
Transform set_translation SFVec3f |
<!--
Color-coding 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)
-->
<!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->