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='Interactive' 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='Figure09_9DeskLamp.x3d'/> |
6 | <meta name='creator' content='Figure 9.9, The VRML 2.0 Sourcebook, Copyright [1997] By Andrea L. Ames, David R. Nadeau, and John L. Moreland'/> |
7 | <meta name='reference' content='http://www.wiley.com/legacy/compbooks/vrml2sbk/ch09/09fig09.htm'/> |
8 | <meta name='translator' content='Don Brutzman'/> |
9 | <meta name='created' content='12 August 2000'/> |
10 | <meta name='modified' content='20 October 2019'/> |
11 | <meta name='description' content='A desk lamp with arm angles that can be adjusted using nested sensors.'/> |
12 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter09SensingViewer/Figure09_9DeskLamp.x3d'/> |
13 | <meta name='generator' content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/> |
14 | <meta name='license' content='../../license.html'/> |
15 | </head> |
16 | <Scene> |
17 | <WorldInfo title='Figure09_9DeskLamp.x3d'/> |
18 | <Viewpoint description='Desk lamp' position='0 0.2 1'/> |
19 | <!-- First rotate PlaneSensor to horizontal XZ (Y = 0) plane --> |
20 | <Transform rotation='1 0 0 1.57'> |
21 |
<!-- ROUTE information for MOVE_LAMP node:
[from translation_changed to LAMP_TRANSFORM.set_translation
]
-->
<PlaneSensor DEF='MOVE_LAMP' description='drag to move lamp' maxPosition='0.1 0.1' minPosition='-0.1 -0.1'/> |
22 |
<!-- ROUTE information for LAMP_TRANSFORM node:
[from MOVE_LAMP.translation_changed to set_translation
]
-->
<Transform DEF='LAMP_TRANSFORM'> |
23 | <!-- Note that we are connecting a chain of behavior engines in these ROUTEs. The event types passed via each ROUTE must each match. --> |
24 | < ROUTE fromNode='MOVE_LAMP' fromField='translation_changed' toNode='LAMP_TRANSFORM' toField='set_translation'/> |
25 | <!-- Now rotate back so that actual geometry remains in original coordinate system --> |
26 | <Transform rotation='1 0 0 -1.57'> |
27 | <Shape> |
28 | <Cylinder height='0.01' radius='0.1'/> |
29 | <Appearance DEF='WHITE'> |
30 | <Material diffuseColor='.9 .9 .9'/> |
31 | </Appearance> |
32 | </Shape> |
33 | <Group> |
34 |
<!-- ROUTE information for MOVE_FIRST_ARM node:
[from rotation_changed to FIRST_ARM_TRANSFORM.set_rotation
]
-->
<SphereSensor DEF='MOVE_FIRST_ARM' description='rotate first arm' offset='1 0 0 -0.7'/> |
35 |
<!-- ROUTE information for FIRST_ARM_TRANSFORM node:
[from MOVE_FIRST_ARM.rotation_changed to set_rotation
]
-->
<Transform DEF='FIRST_ARM_TRANSFORM' center='0 -0.15 0' rotation='1 0 0 -0.7' translation='0 0.15 0'> |
36 | < ROUTE fromNode='MOVE_FIRST_ARM' fromField='rotation_changed' toNode='FIRST_ARM_TRANSFORM' toField='set_rotation'/> |
37 | |
38 | <Appearance DEF='LIGHT_BROWN'> |
39 | <Material diffuseColor='.6 .6 .2'/> |
40 | </Appearance> |
41 | <Cylinder height='0.3' radius='0.01'/> |
42 | </Shape> |
43 | <Group> |
44 |
<!-- ROUTE information for MOVE_SECOND_ARM node:
[from rotation_changed to SECOND_ARM_TRANSFORM.set_rotation
]
-->
<SphereSensor DEF='MOVE_SECOND_ARM' description='rotate second arm' offset='1 0 0 1.9'/> |
45 |
<!-- ROUTE information for SECOND_ARM_TRANSFORM node:
[from MOVE_SECOND_ARM.rotation_changed to set_rotation
]
-->
<Transform DEF='SECOND_ARM_TRANSFORM' center='0 -0.15 0' rotation='1 0 0 1.9' translation='0 0.3 0'> |
46 | < ROUTE fromNode='MOVE_SECOND_ARM' fromField='rotation_changed' toNode='SECOND_ARM_TRANSFORM' toField='set_rotation'/> |
47 | <Shape USE='LAMP_ARM'/> |
48 | <Group> |
49 |
<!-- ROUTE information for MOVE_LAMP_SHADE node:
[from rotation_changed to LAMP_SHADE_TRANSFORM.set_rotation
]
-->
<SphereSensor DEF='MOVE_LAMP_SHADE' description='rotate lamp shade' offset='1 0 0 -1.25'/> |
50 |
<!-- ROUTE information for LAMP_SHADE_TRANSFORM node:
[from MOVE_LAMP_SHADE.rotation_changed to set_rotation
]
-->
<Transform DEF='LAMP_SHADE_TRANSFORM' center='0 0.07 0' rotation='1 0 0 -1.25' translation='0 0.075 0'> |
51 | < ROUTE fromNode='MOVE_LAMP_SHADE' fromField='rotation_changed' toNode='LAMP_SHADE_TRANSFORM' toField='set_rotation'/> |
52 | <Shape> |
53 | <Appearance> |
54 | <Material diffuseColor='.1 .6 .6'/> |
55 | </Appearance> |
56 | <Cone bottom='false' bottomRadius='0.12' height='0.15'/> |
57 | </Shape> |
58 | <Transform translation='0 -0.05 0'> |
59 | <Shape> |
60 | <Appearance> |
61 | <Material diffuseColor='.4 .4 .1' emissiveColor='.8 .8 .2'/> |
62 | </Appearance> |
63 | <Sphere radius='0.05'/> |
64 | </Shape> |
65 | <SpotLight beamWidth='1.570796' color='.8 .8 .1' cutOffAngle='.785398' direction='0 -1 0'/> |
66 | </Transform> |
67 | </Transform> |
68 | </Group> |
69 | </Transform> |
70 | </Group> |
71 | </Transform> |
72 | </Group> |
73 | </Transform> |
74 | </Transform> |
75 | </Transform> |
76 | </Scene> |
77 | </X3D> |
Event Graph ROUTE Table entries with 4 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.
MOVE_FIRST_ARM
SphereSensor rotation_changed SFRotation |
FIRST_ARM_TRANSFORM
Transform set_rotation SFRotation |
MOVE_LAMP_SHADE
SphereSensor rotation_changed SFRotation |
LAMP_SHADE_TRANSFORM
Transform set_rotation SFRotation |
MOVE_SECOND_ARM
SphereSensor rotation_changed SFRotation |
SECOND_ARM_TRANSFORM
Transform set_rotation SFRotation |
MOVE_LAMP
PlaneSensor translation_changed SFVec3f |
LAMP_TRANSFORM
Transform set_translation SFVec3f |
<!--
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)
-->
<!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->