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=' HudControlPanelExample.x3d '/> |
6 | <meta name='description' content="Example world using an adjustable Heads-Up Display (HUD) or control panel. The panel always appears in the same position in the brower's window, independent of view point. The HUD can be dragged around the window by grabbing onto the border and sliding."/> |
7 | <meta name='creator' content='Leonard Daly'/> |
8 | <meta name='translator' content='Dan Kucik'/> |
9 | <meta name='created' content='1999'/> |
10 | <meta name='translated' content='8 June 2003'/> |
11 | <meta name='modified' content='28 November 2019'/> |
12 | <meta name=' error ' content=' HUD does not sit still when navigating '/> |
13 | <meta name='reference' content='http://www.realism.com/Web3D/Examples/examples.cgi?ID=5'/> |
14 | <meta name='rights' content='This code may be reused in part or total. Please include this paragraph when it is used. Copyright 1999, Leonard Daly #****************'/> |
15 |
<meta name='Image' content='http://www.realism.com/vrml/Example/HUD/CP.gif'![]() |
16 | <meta name='subject' content='Heads-up display example'/> |
17 | <meta name='reference' content='Original VRML File: http://www.realism.com/vrml/Example/HUD/HUD.wrl'/> |
18 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/HudControlPanelExample.x3d '/> |
19 | <meta name='generator' content=' Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html '/> |
20 | <meta name='generator' content='X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
21 | <meta name='license' content='../../license.html'/> |
22 | </head> |
23 | <Scene> |
24 | <WorldInfo title='HudControlPanelExample.x3d'/> |
25 | <ExternProtoDeclare name='HudControlPanel' appinfo='Heads Up Display (HUD) Control Panel' url=' "HudControlPanelPrototype.x3d#HudControlPanel" "../../Tools/HeadsUpDisplays/HudControlPanelPrototype.x3d#HudControlPanel" "https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/HudControlPanelPrototype.x3d#HudControlPanel" "../../Tools/HeadsUpDisplays/HudControlPanelPrototype.wrl#HudControlPanel" "HudControlPanelPrototype.wrl#HudControlPanel" "https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/HudControlPanelPrototype.wrl#HudControlPanel" '> |
26 |
<field name='translation' type='SFVec3f' accessType='initializeOnly'
appinfo='SFVec3f Position of the panel relative to the viewpoint. The X and Y components can be changed by dragging the window around.'/> |
27 |
<field name='orientation' type='SFRotation' accessType='inputOutput'
appinfo='SFRotation This field should be the object of a ROUTE statement from the orientation_changed event from a ProximitySensor. For some reason the ProximitySensor does not correctly report the current viewpoint when the sensor is located inside of the PROTO.'/> |
28 |
<field name='isOver' type='SFBool' accessType='outputOnly'
appinfo='Out - SFBool event is generated when the cursor is over the texture mapped region of the control panel. Set to false when the cursor leaves the texture mapped region.'/> |
29 |
<field name='hitTexCoord_changed' type='SFVec2f' accessType='outputOnly'
appinfo="Out - SFVec2f The X/Y normalized coordinates (S and T) of the cursor location when 'isOver' is true."/> |
30 |
<field name='borderColor' type='SFColor' accessType='inputOutput'
appinfo='SFColor The color of the panel border. This is the region that can be used to drag the panel around the screen.'/> |
31 |
<field name='scale' type='SFVec3f' accessType='initializeOnly'
appinfo='SFVec3f Size of the panel. The texture mapped area (see textureMap) is 95% in X and 90% in Y of this size.'/> |
32 |
<field name='position' type='SFVec3f' accessType='inputOutput'
appinfo="SFVec3f This field should be the object of a ROUTE statement from the position_changed event from a ProximitySensor. See 'orientation' for more details."/> |
33 |
<field name='textureMap' type='MFString' accessType='inputOutput'
appinfo='MFString The texture map URLs. This is specified in the same manner as the URL field in ImageTexture. The first one that can be loaded is the that is displayed. If this field is not specified then this region of the object is painted white.'/> |
34 |
<field name='touchTime' type='SFTime' accessType='outputOnly'
appinfo="Out - SFTime The time when a mouse button is released provided that the just prior to release 'isOver' and 'isActive' are true."/> |
35 |
<field name='isActive' type='SFBool' accessType='outputOnly'
appinfo="Out - SFBool A true event is generated when the mouse button is depressed and the cursor is over the texture mapped region. A false event is generated when the button is released or when 'isOver' becomes false."/> |
36 | </ExternProtoDeclare> |
37 |
<!-- ROUTE information for NavInfo node:
[from Controller.Headlight to headlight
]
-->
<NavigationInfo DEF='NavInfo' type='"FLY" "EXAMINE" "ANY"'/> |
38 | <Viewpoint DEF='SIDE_VP' description='Side View' jump='false'/> |
39 | <Viewpoint DEF='TOP_VP' description='Top View' jump='false' orientation='1.0 0.0 0.0 -1.57' position='0.0 10.0 0.0'/> |
40 |
<!-- ROUTE information for Revolver node:
[from Spinner.value_changed to rotation
]
-->
<Transform DEF='Revolver'> |
41 | <Transform DEF='Body1' translation='3.0 0.0 0.0'> |
42 | <PointLight color='0.0 0.0 1.0'/> |
43 | <Shape> |
44 | <Appearance> |
45 | <Material diffuseColor='1.0 0.0 0.0' emissiveColor='0.0 0.0 1.0' specularColor='0.0 1.0 0.0'/> |
46 | </Appearance> |
47 | <Sphere radius='0.75'/> |
48 | </Shape> |
49 | </Transform> |
50 |
<!-- ROUTE information for Body2 node:
[from Tumble.value_changed to rotation
]
-->
<Transform DEF='Body2' translation='-3.0 0.0 0.0'> |
51 | <SpotLight beamWidth='1.57' direction='0.0 -1.0 0.0'/> |
52 | <Shape> |
53 | <Appearance> |
54 | <Material diffuseColor='0.0 1.0 1.0'/> |
55 | </Appearance> |
56 | <Cone bottomRadius='0.75' height='1.5'/> |
57 | </Shape> |
58 | </Transform> |
59 | </Transform> |
60 |
<!-- ROUTE information for Timer1 node:
[from fraction_changed to Spinner.set_fraction
]
-->
<TimeSensor DEF='Timer1' cycleInterval='5.0' loop='true' startTime='1.0'/> |
61 |
<!-- ROUTE information for Timer2 node:
[from fraction_changed to Tumble.set_fraction
]
-->
<TimeSensor DEF='Timer2' cycleInterval='3.0' loop='true' startTime='1.0'/> |
62 |
<!-- ROUTE information for Spinner node:
[from Timer1.fraction_changed to set_fraction
]
[from value_changed to Revolver.rotation
]
-->
<OrientationInterpolator DEF='Spinner' key='0.0 0.333 0.667 1.0' keyValue='0.0 1.0 0.0 0.0 0.0 1.0 0.0 2.09 0.0 1.0 0.0 4.18 0.0 1.0 0.0 0.0'/> |
63 |
<!-- ROUTE information for Tumble node:
[from Timer2.fraction_changed to set_fraction
]
[from value_changed to Body2.rotation
]
-->
<OrientationInterpolator DEF='Tumble' key='0.0 0.14 0.28 0.43 0.57 0.71 0.86 1.0' keyValue='0.0 1.0 0.0 0.0 0.0 1.0 0.5 0.898 0.0 0.5 1.0 1.795 0.5 0.0 1.0 2.693 1.0 0.2 0.8 3.59 1.0 0.8 0.5 4.488 0.5 1.0 0.0 5.386 0.0 1.0 0.0 6.283'/> |
64 | < ROUTE fromNode='Timer1' fromField='fraction_changed' toNode='Spinner' toField='set_fraction'/> |
65 | < ROUTE fromNode='Timer2' fromField='fraction_changed' toNode='Tumble' toField='set_fraction'/> |
66 | < ROUTE fromNode='Spinner' fromField='value_changed' toNode='Revolver' toField='rotation'/> |
67 | < ROUTE fromNode='Tumble' fromField='value_changed' toNode='Body2' toField='rotation'/> |
68 |
<!-- ROUTE information for HUD node:
[from hitTexCoord_changed to Controller.Position
]
[from touchTime to Controller.Touch
]
-->
<ProtoInstance name='HudControlPanel' DEF='HUD'> |
69 | <fieldValue name='translation' value='4 -2 -10'/> |
70 | <fieldValue name='orientation' value='0.0 1.0 0.0 0.0'/> |
71 | <fieldValue name='borderColor' value='0.0 0.4 0.0'/> |
72 | <fieldValue name='scale' value='2.5 1.5 0.05'/> |
73 | <fieldValue name='position' value='0.0 0.0 0.0'/> |
74 | <fieldValue name='textureMap' value=' "HudControlPanel.gif" "http://www.realism.com/vrml/Example/HUD/CP.gif" "https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/HudControlPanel.gif"'/> |
75 | </ProtoInstance> |
76 | <ProximitySensor DEF='Where' size='1000.0 1000.0 1000.0'/> |
77 |
<!-- ROUTE information for Controller node:
[from HUD.hitTexCoord_changed to Position
]
[from HUD.touchTime to Touch
]
[from Headlight to NavInfo.headlight
]
-->
<Script DEF='Controller'> |
78 | <field name='Headlight' type='SFBool' accessType='outputOnly'/> |
79 | <field name='Position' type='SFVec2f' accessType='inputOnly'/> |
80 | <field name='Touch' type='SFTime' accessType='inputOnly'/> |
81 | <field name='Light' type='SFBool' value='true' accessType='initializeOnly'/> |
<![CDATA[
ecmascript: function Position (value) { msg = 'Control Panel'; if (value[1] < .5) { if (value[0] > .5) { Light = false; msg = 'Headlight Off'; } else { Light = true; msg = 'Headlight On'; } } // Browser.setDescription (msg); // TODO figure this out, see Table 7.2 in Ecmascript SAI } function Touch (value) { Headlight = Light; }
]]>
|
|
83 | </Script> |
84 | < ROUTE fromNode='HUD' fromField='hitTexCoord_changed' toNode='Controller' toField='Position'/> |
85 | < ROUTE fromNode='HUD' fromField='touchTime' toNode='Controller' toField='Touch'/> |
86 | < ROUTE fromNode='Controller' fromField='Headlight' toNode='NavInfo' toField='headlight'/> |
87 | </Scene> |
88 | </X3D> |
Event Graph ROUTE Table entries with 7 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.
Timer1
TimeSensor fraction_changed SFFloat |
Spinner
OrientationInterpolator set_fraction SFFloat |
then
|
Spinner
OrientationInterpolator value_changed SFRotation |
Revolver
Transform rotation SFRotation |
Timer2
TimeSensor fraction_changed SFFloat |
Tumble
OrientationInterpolator set_fraction SFFloat |
then
|
Tumble
OrientationInterpolator value_changed SFRotation |
Body2
Transform rotation SFRotation |
HUD
ProtoInstance hitTexCoord_changed SFVec2f |
Controller
Script Position SFVec2f |
then
|
Controller
Script Headlight SFBool |
NavInfo
NavigationInfo headlight SFBool |
||
HUD
ProtoInstance touchTime SFTime |
Controller
Script Touch SFTime |
then
|
Controller
Script Headlight SFBool |
NavInfo
NavigationInfo headlight SFBool |
<!--
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)
<ProtoInstance name='ProtoName'>
<field
name='fieldName'/> </ProtoInstance>
-->
<!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->