#X3D V3.0 utf8 PROFILE Immersive # [X3D] version=3.0 # [X3D] noNamespaceSchemaLocation=https://www.web3d.org/specifications/x3d-3.0.xsd # X3D-to-ClassicVRML XSL translation autogenerated by X3dToClassicVrmlEncoding.xslt and X3dToVrml97.xslt # https://www.web3d.org/x3d/content/X3dToClassicVrmlEncoding.xslt # https://www.web3d.org/x3d/content/X3dToVrml97.xslt # Transformation using XSLT processor: Saxonica # head META "title" "HudControlPanelPrototype.x3d" META "description" "Prototype for a \"heads-up\" control panel. This node defines an object that maintains its orientation to the current viewpoint. Also present is a border that allows the panel to be dragged anywhere on the screen. All of the touchSensor events relating to texture maps are available as output events from this node." META "creator" "Leonard Daly" META "translator" "Dan Kucik" META "created" "1999" META "translated" "8 June 2003" META "modified" "28 November 2019" META "error" "HUD does not sit still when navigating" ### Error: META "reference" "http://www.realism.com/Web3D/Examples/examples.cgi?ID=5" META "rights" "This code may be reused in part or total. Please include this paragraph when it is used. Copyright 1999, Leonard Daly #****************" META "subject" "Heads-up display example" META "reference" "Original VRML File: http://www.realism.com/vrml/Example/HUD/HUD_proto.wrl" META "identifier" "https://savage.nps.edu/Savage/Tools/HeadsUpDisplays/HudControlPanelPrototype.x3d" META "generator" "Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html" META "generator" "X3D-Edit 3.2, https://savage.nps.edu/X3D-Edit" META "license" "../../license.html" # [Scene] ========== ========== ========== WorldInfo { title "HudControlPanelPrototype.x3d" } PROTO HudControlPanel [ # [appinfo] Heads Up Display (HUD) Control Panel initializeOnly SFVec3f translation 0.0 0.0 -10.0 # [appinfo] SFVec3f Position of the panel relative to the viewpoint. The X and Y components can be changed by dragging the window around. inputOutput SFRotation orientation 0.0 1.0 0.0 0.0 # [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. outputOnly SFBool isOver # [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. outputOnly SFVec2f hitTexCoord_changed # [appinfo] Out - SFVec2f The X/Y normalized coordinates (S and T) of the cursor location when isOver is true. inputOutput SFColor borderColor 0.6 0.6 0.6 # [appinfo] SFColor The color of the panel border. This is the region that can be used to drag the panel around the screen. initializeOnly SFVec3f scale 2.5 1.5 0.05 # [appinfo] SFVec3f Size of the panel. The texture mapped area (see textureMap) is 95% in X and 90% in Y of this size. inputOutput SFVec3f position 0.0 0.0 0.0 # [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. inputOutput MFString textureMap [ "" ] # [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. outputOnly SFTime touchTime # [appinfo] Out - SFTime The time when a mouse button is released provided that the just prior to release isOver and isActive are true. outputOnly SFBool isActive # [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. ] { DEF Main Transform { translation IS position rotation IS orientation children [ DEF CtlPnlOffset Transform { translation IS translation scale IS scale children [ DirectionalLight { } DEF MovePanel PlaneSensor { description "Select item" } Shape { appearance Appearance { material DEF _IS_0 Material { diffuseColor IS borderColor } } geometry DEF Panel IndexedFaceSet { coordIndex [ 0 1 2 3 -1 ] coord Coordinate { point [ 1.0 1.0 0.0 -1.0 1.0 0.0 -1.0 -1.0 0.0 1.0 -1.0 0.0 ] } } } Transform { scale 0.95 0.9 1.0 translation 0.0 0.0 0.01 children [ TouchSensor { description "Select item" isOver IS isOver isActive IS isActive hitTexCoord_changed IS hitTexCoord_changed touchTime IS touchTime } Shape { appearance Appearance { material Material { diffuseColor 1.0 1.0 1.0 } texture DEF _IS_1 ImageTexture { url IS textureMap } } geometry USE Panel } ] } ] } ] } DEF MoveScript Script { outputOnly SFVec3f position inputOnly SFVec3f move initializeOnly SFVec3f Iscale IS scale initializeOnly SFVec3f Ioffset IS translation url [ "ecmascript: function move (value) { position = new SFVec3f (Iscale[0] * value[0] + Ioffset[0], Iscale[1] * value[1] + Ioffset[1], Ioffset[2]); } " ] } ROUTE MovePanel.translation_changed TO MoveScript.move ROUTE MoveScript.position TO CtlPnlOffset.translation } # ==================== Anchor { description "HudControlPanel Example" parameter [ "target=_blank" ] url [ "HudControlPanelExample.x3d" "https://savage.nps.edu/Savage/Tools/HeadsUpDisplays/HudControlPanelExample.x3d" "HudControlPanelExample.wrl" "https://savage.nps.edu/Savage/Tools/HeadsUpDisplays/HudControlPanelExample.wrl" ] children [ Shape { appearance Appearance { material Material { diffuseColor 0 1 1 emissiveColor 0 1 1 } } geometry Text { string [ "HudControlPanelPrototype" "is a Prototype definition file." "" "To see an example scene" "using this new node" "click this text and view" "HudControlPanelExample" ] fontStyle FontStyle { justify [ "MIDDLE" "MIDDLE" ] size 0.8 } } } ] }