X3D Model Documentation: HudControlPanelExample.x3d

  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='titlecontent=' HudControlPanelExample.x3d '/>
  6            <meta name='descriptioncontent="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='creatorcontent='Leonard Daly'/>
  8            <meta name='translatorcontent='Dan Kucik'/>
  9            <meta name='createdcontent='1999'/>
 10            <meta name='translatedcontent='8 June 2003'/>
 11            <meta name='modifiedcontent='28 November 2019'/>
 12            <meta name=' error content=' HUD does not sit still when navigating '/>
 13            <meta name='referencecontent='http://www.realism.com/Web3D/Examples/examples.cgi?ID=5'/>
 14            <meta name='rightscontent='This code may be reused in part or total. Please include this paragraph when it is used. Copyright 1999, Leonard Daly #****************'/>
 15            <meta name='Imagecontent='http://www.realism.com/vrml/Example/HUD/CP.gif'/>
 16            <meta name='subjectcontent='Heads-up display example'/>
 17            <meta name='referencecontent='Original VRML File: http://www.realism.com/vrml/Example/HUD/HUD.wrl'/>
 18            <meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/HudControlPanelExample.x3d '/>
 19            <meta name='generatorcontent=' Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html '/>
 20            <meta name='generatorcontent='X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit'/>
 21            <meta name='licensecontent='../../license.html'/>
 22       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top DEF nodes index: Body1, Body2, Controller, HUD, NavInfo, Revolver, SIDE_VP, Spinner, Timer1, Timer2, TOP_VP, Tumble, Where

Index for Viewpoint nodes: SIDE_VP, TOP_VP

Index for ExternProtoDeclare definition: HudControlPanel
-->
 23       <Scene>
 24            <WorldInfo title='HudControlPanelExample.x3d'/>
 25            <ExternProtoDeclare name='HudControlPanelappinfo='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='translationtype='SFVec3faccessType='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='orientationtype='SFRotationaccessType='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='isOvertype='SFBoolaccessType='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_changedtype='SFVec2faccessType='outputOnly'
                appinfo="Out - SFVec2f The X/Y normalized coordinates (S and T) of the cursor location when 'isOver' is true."/>
 30                 <field name='borderColortype='SFColoraccessType='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='scaletype='SFVec3faccessType='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='positiontype='SFVec3faccessType='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='textureMaptype='MFStringaccessType='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='touchTimetype='SFTimeaccessType='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='isActivetype='SFBoolaccessType='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='NavInfotype='"FLY" "EXAMINE" "ANY"'/>
 38            <Viewpoint DEF='SIDE_VPdescription='Side Viewjump='false'/>
 39            <Viewpoint DEF='TOP_VPdescription='Top Viewjump='falseorientation='1.0 0.0 0.0 -1.57position='0.0 10.0 0.0'/>
 40 
          <!-- ROUTE information for Revolver node:  [from Spinner.value_changed to rotation ] -->
          <Transform DEF='Revolver'>
 41                 <Transform DEF='Body1translation='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.0emissiveColor='0.0 0.0 1.0specularColor='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='Body2translation='-3.0 0.0 0.0'>
 51                      <SpotLight beamWidth='1.57direction='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.75height='1.5'/>
 57                      </Shape>
 58                 </Transform>
 59            </Transform>
 60 
          <!-- ROUTE information for Timer1 node:  [from fraction_changed to Spinner.set_fraction ] -->
          <TimeSensor DEF='Timer1cycleInterval='5.0loop='truestartTime='1.0'/>
 61 
          <!-- ROUTE information for Timer2 node:  [from fraction_changed to Tumble.set_fraction ] -->
          <TimeSensor DEF='Timer2cycleInterval='3.0loop='truestartTime='1.0'/>
 62 
          <!-- ROUTE information for Spinner node:  [from Timer1.fraction_changed to set_fraction ] [from value_changed to Revolver.rotation ] -->
          <OrientationInterpolator DEF='Spinnerkey='0.0 0.333 0.667 1.0keyValue='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='Tumblekey='0.0 0.14 0.28 0.43 0.57 0.71 0.86 1.0keyValue='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='HudControlPanelDEF='HUD'>
 69                 <fieldValue name='translationvalue='4 -2 -10'/>
 70                 <fieldValue name='orientationvalue='0.0 1.0 0.0 0.0'/>
 71                 <fieldValue name='borderColorvalue='0.0 0.4 0.0'/>
 72                 <fieldValue name='scalevalue='2.5 1.5 0.05'/>
 73                 <fieldValue name='positionvalue='0.0 0.0 0.0'/>
 74                 <fieldValue name='textureMapvalue=' "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='Wheresize='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='Headlighttype='SFBoolaccessType='outputOnly'/>
 79                 <field name='Positiontype='SFVec2faccessType='inputOnly'/>
 80                 <field name='Touchtype='SFTimeaccessType='inputOnly'/>
 81                 <field name='Lighttype='SFBoolvalue='trueaccessType='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 shows event connections.
-->
<!-- to top DEF nodes index: Body1, Body2, Controller, HUD, NavInfo, Revolver, SIDE_VP, Spinner, Timer1, Timer2, TOP_VP, Tumble, Where

Index for Viewpoint nodes: SIDE_VP, TOP_VP

Index for ExternProtoDeclare definition: HudControlPanel
-->
X3D Tooltips element index: Appearance, Cone, ExternProtoDeclare, field, fieldValue, head, Material, meta, NavigationInfo, OrientationInterpolator, PointLight, ProtoInstance, ProximitySensor, ROUTE, Scene, Script, Shape, Sphere, SpotLight, TimeSensor, Transform, Viewpoint, WorldInfo, X3D, plus documentation for accessType definitions, type definitions, XML data types, and field types

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

ROUTE
event to
(1)
Spinner
OrientationInterpolator
set_fraction
SFFloat
then
 
 
 
Spinner
OrientationInterpolator
value_changed
SFRotation

ROUTE
event to
(2)
Revolver
Transform
rotation
SFRotation

Timer2
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(1)
Tumble
OrientationInterpolator
set_fraction
SFFloat
then
 
 
 
Tumble
OrientationInterpolator
value_changed
SFRotation

ROUTE
event to
(2)
Body2
Transform
rotation
SFRotation

HUD
ProtoInstance
hitTexCoord_changed
SFVec2f

ROUTE
event to
(1)
Controller
Script
Position
SFVec2f
then
 
 
 
Controller
Script
Headlight
SFBool

ROUTE
event to
(2)
NavInfo
NavigationInfo
headlight
SFBool
HUD
ProtoInstance
touchTime
SFTime

ROUTE
event to
(1)
Controller
Script
Touch
SFTime
then
 
 
 
Controller
Script
Headlight
SFBool

ROUTE
event to
(2)
NavInfo
NavigationInfo
headlight
SFBool

Additional guidance on X3D animation can be found in the 10-Step Animation Design Process and Event Tracing hint sheets. Have fun with X3D! 😀

-->
<!-- Online at
https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/HudControlPanelExampleIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/HudControlPanelExample.x3d -->

<!-- Color-coding legend: X3D terminology <X3dNode  DEF='idNamefield='value'/> matches XML terminology <XmlElement  DEF='idNameattribute='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> -->

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