#VRML V2.0 utf8 # X3D-to-VRML-97 XSL translation autogenerated by X3dToVrml97.xsl # http://www.web3D.org/TaskGroups/x3d/translation/X3dToVrml97.xsl # [X3D] VRML V3.0 utf8 # [head] # [meta] filename: DvdControllerPrototype.x3d # [meta] description: Digital Virtual Display (DVD) Controller Prototype definition to control a scenario's animation timing. Heads-up display keeps DVD Controller on screen. # [meta] author: Jane Wu, Don Brutzman, Jonathan Roberts, updated for blaxxun by Nicholas Polys # [meta] created: 19 July 2001 # [meta] revised: 29 December 2002 , July 23 2003 # [meta] keywords: DVD animation control # [meta] url: http://web.nps.navy.mil/~brutzman/Savage/Tools/HeadsUpDisplays/DvdControllerPrototype.x3d # [meta] generator: X3D-Edit, http://www.web3d.org/TaskGroups/x3d/translation/README.X3D-Edit.html # [Scene] EXTERNPROTO SliderFloat [ # [appInfo] This is a vertical slider. The top end is at (0,0,0). field SFFloat height field SFFloat radius field SFFloat barRadius field SFColor sliderBarColor field SFColor sliderBallColor field SFColor sliderEndColor field SFFloat min field SFFloat max field SFFloat value eventIn SFFloat setMin eventIn SFFloat setMax eventIn SFFloat setValue eventOut SFFloat valueChanged eventOut SFBool isDragged field SFBool dragEnabled eventIn SFBool setDragEnabled eventOut SFBool dragEnabledChanged field SFBool clickEnabled eventIn SFBool setClickEnabled eventOut SFBool clickEnabledChanged ][ "SliderFloatPrototype.wrl#SliderFloat" "" "" "http://web.nps.navy.mil/~brutzman/Savage/Tools/Animation/SliderFloatPrototype.wrl#SliderFloat" "" "" "http://web.nps.navy.mil/~brutzman/Savage/Tools/Animation/SliderFloatPrototype.x3d#SliderFloat" ] EXTERNPROTO SingleTypeConversion [ field SFInt32 decimalPlaces eventIn SFInt32 setDecimalPlaces eventIn SFBool BooleanValue eventIn SFFloat FloatValue eventIn SFInt32 IntegerValue eventIn SFTime TimeValue eventOut SFBool BooleanResult eventOut SFFloat FloatResult eventOut SFInt32 IntegerResult eventOut SFTime TimeResult eventOut SFString StringResult eventOut MFString StringsResult ][ "SingleTypeConversionPrototype.wrl#SingleTypeConversion" "" "http://web.nps.navy.mil/~brutzman/Savage/Tools/Authoring/SingleTypeConversionPrototype.wrl#SingleTypeConversion" "" "http://web.nps.navy.mil/~brutzman/Savage/Tools/Authoring/SingleTypeConversionPrototype.x3d#SingleTypeConversion" ] PROTO DvdController [ field MFString description [ "" ] field SFBool playEnabled FALSE field SFString displayMode "PLAYBACK_SLIDER" # [appInfo] Initializes how control buttons and slider are displayed. The control buttons include DIS control (i.e. Master, Ghost, Local) and Playback control (i.e. Reset to Start, Fast Rewind, Rewind, Pause, Play, Fast Forward, Reset to End). Possible values are (case sensitive): ALL, DIS_ONLY, PLAYBACK_ONLY, SLIDER_ONLY, DIS_PLAYBACK, DIS_SLIDER, PLAYBACK_SLIDER, and NONE. eventIn SFString setDisplayMode # [appInfo] Sets how control buttons and slider are displayed. The control buttons include DIS control (i.e. Master, Ghost, Local) and Playback control (i.e. Reset to Start, Fast Rewind, Rewind, Pause, Play, Fast Forward, Reset to End). Possible values are (case sensitive): ALL, DIS_ONLY, PLAYBACK_ONLY, SLIDER_ONLY, DIS_PLAYBACK, DIS_SLIDER, PLAYBACK_SLIDER, and NONE. field SFColor buttonColor .55, .55, .55 field SFColor selectedButtonColor .75, .75, .75 field SFColor labelColor 0 0 0 field SFColor selectedLabelColor .1, .65, .2 field SFVec3f locationOffset -2, -2, 0 field SFBool clockEnabled TRUE field SFTime cycleInterval 1 eventIn SFTime setCycleInterval eventOut SFTime cycleIntervalChanged field SFFloat speedFactor 10 # [appInfo] Factor used to determine the speed for Fast Rewind and Fast Forward action. eventOut SFBool isActive eventOut SFTime startTimeChanged eventOut SFTime stopTimeChanged eventOut SFTime timeChanged eventOut SFFloat fractionChanged eventOut SFTime secondsElapsed eventOut SFBool isMaster # [appInfo] isMaster, isRemote and isLocal are booleans represent a 3-way toggle. Only one of them can have a true value at any time. eventOut SFBool isRemote # [appInfo] isMaster, isRemote and isLocal are booleans represent a 3-way toggle. Only one of them can have a true value at any time. eventOut SFBool isLocal # [appInfo] isMaster, isRemote and isLocal are booleans represent a 3-way toggle. Only one of them can have a true value at any time. eventOut SFBool isPaused # [appInfo] isPaused and isRunning always have opposite values. When isPaused is true, isRunning will be false, and vice versa. eventOut SFBool isRunning # [appInfo] isPaused and isRunning always have opposite values. When isPaused is true, isRunning will be false, and vice versa. field SFBool traceEnabled FALSE ] { Group { children [ DEF WhereSensor ProximitySensor { size 1000000000 1000000000 1000000000 } DEF FixedLocation Transform { # [ HUD ROUTES here ] children [ DEF MovableLocation Transform { children [ DEF LocationOffset Transform { translation IS locationOffset children [ ############################################# ################################################## Transform { scale .018 .016 .02 #.02 ,02 ,02 translation .16 .048 0 # -.5 children [ DEF PlaneMovementSensorGroup Group { children [ DEF PlaneMovementSensor PlaneSensor { offset IS locationOffset } DEF MovementVisibilitySensor VisibilitySensor { } DEF VisibilityControlScript Script { field SFBool traceEnabled IS traceEnabled field SFBool isVisible FALSE field SFVec3f planeSensorTranslation 0 0 0 eventIn SFBool setIsVisible eventIn SFBool setPlaneSensorIsActive eventIn SFVec3f setPlaneSensorTranslation eventOut SFVec3f translationChanged eventOut SFVec3f translationOffsetChanged url [ "javascript: function tracePrint (text) { if (traceEnabled) print('[ DvdControllerPrototype ] ' + text); } function setIsVisible (value, timeStamp) { isVisible = value; tracePrint('isVisible=' + value); } function setPlaneSensorIsActive (value, timeStamp) { tracePrint('PlaneSensor isActive=' + value); if (value == false) { tracePrint('planeSensorTranslation=' + planeSensorTranslation); if (isVisible) { translationChanged = planeSensorTranslation; } else { translationChanged = new SFVec3f(0, 0, 0); translationOffsetChanged = new SFVec3f(0, 0, 0); } } } function setPlaneSensorTranslation (value, timeStamp) { planeSensorTranslation = value; tracePrint('planeSensorTranslation=' + value); } " ] } DEF MovementControlSwitch Switch { whichChoice 0 choice [ DEF AllLayer Transform { translation -.25 0 0 children [ Shape { appearance DEF MovementControlAppearance Appearance { material Material { diffuseColor .65 .65 .65 } } geometry Box { size .25 1.75 .05 } } ] } DEF TwoLayer Transform { translation -.25 -.285 0 children [ Shape { appearance USE MovementControlAppearance geometry Box { size .25 1.175 .05 } } ] } DEF OneLayer Transform { translation -.25 -.575 0 children [ Shape { appearance USE MovementControlAppearance geometry Box { size .25 .6 .05 } } ] } ] } ] ROUTE PlaneMovementSensor.isActive TO VisibilityControlScript.setPlaneSensorIsActive ROUTE PlaneMovementSensor.translation_changed TO VisibilityControlScript.setPlaneSensorTranslation ROUTE MovementVisibilitySensor.isActive TO VisibilityControlScript.setIsVisible } DEF DisplayControlSwitch Switch { whichChoice 0 choice [ DEF DisplayAllLayer Transform { children [ DEF DisplayAllToggle Transform { children [ Shape { appearance DEF ButtonBaseAppearance Appearance { material Material { diffuseColor .65 .65 .65 } } geometry Box { size .25 1.75 .05 } } DEF DisplayAllSensor TouchSensor { } Shape { appearance Appearance { material DEF DisplayAllMaterial Material { diffuseColor 0 .35 .8 } } geometry Cylinder { height 1.65 radius .1 } } ] } DEF DisplayTopLayerToggle Transform { translation .25 .575 0 children [ Shape { appearance USE ButtonBaseAppearance geometry Box { size .25 .6 .05 } } DEF DisplayTopLayerSensor TouchSensor { } Shape { appearance Appearance { material DEF DisplayControlMaterial Material { diffuseColor 0 .35 .8 } } geometry Cylinder { height .5 radius .1 } } ] } DEF DisplayMidLayerToggle Transform { translation .25 0 0 children [ Shape { appearance USE ButtonBaseAppearance geometry Box { size .25 .6 .05 } } DEF DisplayMidLayerSensor TouchSensor { } Shape { appearance Appearance { material USE DisplayControlMaterial } geometry Cylinder { height .5 radius .1 } } ] } DEF DisplayBottomLayerToggle Transform { translation .25 -.575 0 children [ Shape { appearance USE ButtonBaseAppearance geometry Box { size .25 .6 .05 } } DEF DisplayBottomLayerSensor TouchSensor { } Shape { appearance Appearance { material USE DisplayControlMaterial } geometry Cylinder { height .5 radius .1 } } ] } ] } DEF DisplayTwoLayer Transform { children [ DEF DisplayTwoToggle Transform { translation 0 -.285 0 children [ Shape { appearance USE ButtonBaseAppearance geometry Box { size .25 1.175 .05 } } USE DisplayAllSensor Shape { appearance Appearance { material USE DisplayAllMaterial } geometry Cylinder { height 1.025 radius .1 } } ] } USE DisplayMidLayerToggle USE DisplayBottomLayerToggle ] } DEF DisplayOneLayer Transform { children [ DEF DisplayOneToggle Transform { translation 0 -.575 0 children [ Shape { appearance USE ButtonBaseAppearance geometry Box { size .25 .6 .05 } } USE DisplayAllSensor Shape { appearance Appearance { material USE DisplayAllMaterial } geometry Cylinder { height .5 radius .1 } } ] } USE DisplayBottomLayerToggle ] } DEF DisplayNoLayer Transform { children [ DEF DisplayNoToggle Transform { translation 0 -.575 0 children [ Shape { appearance USE ButtonBaseAppearance geometry Box { size .25 .6 .05 } } USE DisplayAllSensor Shape { appearance Appearance { material USE DisplayAllMaterial } geometry Cylinder { height .5 radius .1 } } ] } ] } ] } DEF DisplayLayerScript Script { field SFBool traceEnabled IS traceEnabled field SFString displayMode IS displayMode eventIn SFString setDisplayMode IS setDisplayMode field SFInt32 currentSwitchSelection 0 field SFBool displayAllToggleArmed FALSE field SFBool topLayerToggleArmed FALSE field SFBool midLayerToggleArmed FALSE field SFBool bottomLayerToggleArmed FALSE eventIn SFBool displayAllToggleEnabled eventIn SFBool topLayerToggleEnabled eventIn SFBool midLayerToggleEnabled eventIn SFBool bottomLayerToggleEnabled eventOut SFColor displayAllColor eventOut SFInt32 movementControlSwitchSelection # [appInfo] 0 - Display all three animation controls (DIS Mode Selection, Playback Controls, and Time scale) in a three layer stack. 1 - Display two of the three animation controls in a two layer stack. 2 - Display one of the three animation controls in a one layer stack. eventOut SFInt32 displayControlSwitchSelection # [appInfo] 0 - Display all three animation controls (DIS Mode Selection, Playback Controls, and Time scale) in a three layer stack. 1 - Display two of the three animation controls in a two layer stack. 2 - Display one of the three animation controls in a one layer stack. 3 - Display no layers of animation controls. eventOut SFInt32 topLayerSwitchSelection # [appInfo] 0 - Display DIS Mode (Master, Remote, Local) Selection at top layer. 1 - Do not display anything at top layer. eventOut SFInt32 midLayerSwitchSelection # [appInfo] 0 - Display Playback Control Buttons (Reset to Start, Fast Rewind, Rewind, Pause, Play, Fast Forward, Reset To End) at the mid layer. 1 - Display DIS Mode Selection at the mid layer. 2 - Display nothing at the mid layer. eventOut SFInt32 bottomLayerSwitchSelection # [appInfo] 0 - Display Time Scale at the bottom layer. 1 - Display DIS Mode Selection at the bottom layer. 2 - Display Playback Control Buttons at the bottom layer. 3 - Display nothing at the bottom layer. url [ "javascript: function initialize() // timeStamp { setDisplayMode(displayMode); } function tracePrint (text) //, timeStamp { if (traceEnabled) print('[ DvdControllerPrototype ] ' + text); } function setDisplayMode(value) //, timeStamp { if (displayMode == 'ALL'){ movementControlSwitchSelection = 0; //AllLayer displayControlSwitchSelection = 0; //DisplayAllLayer displayAllColor = new SFColor(0, 0.35, 0.8); topLayerSwitchSelection = 0; midLayerSwitchSelection = 0; bottomLayerSwitchSelection = 0; } if (displayMode == 'DIS_ONLY'){ movementControlSwitchSelection = 2; //OneLayer displayControlSwitchSelection = 2; //DisplayOneLayer displayAllColor = new SFColor(1, 0, 0); topLayerSwitchSelection = 1; //DisplayNoneTop midLayerSwitchSelection = 2; //DisplayNoneMid bottomLayerSwitchSelection = 1; //DisplayDISModeBottom } if (displayMode == 'PLAYBACK_ONLY'){ movementControlSwitchSelection = 2; //OneLayer displayControlSwitchSelection = 2; //DisplayOneLayer displayAllColor = new SFColor(1, 0, 0); topLayerSwitchSelection = 1; //DisplayNoneTop midLayerSwitchSelection = 2; //DisplayNoneMid bottomLayerSwitchSelection = 2; //DisplayPlaybackButtonsBottom } if (displayMode == 'SLIDER_ONLY'){ movementControlSwitchSelection = 2; //OneLayer displayControlSwitchSelection = 2; //DisplayOneLayer displayAllColor = new SFColor(1, 0, 0); topLayerSwitchSelection = 1; //DisplayNoneTop midLayerSwitchSelection = 2; //DisplayNoneMid bottomLayerSwitchSelection = 0; //DiaplaySliderBottom } if (displayMode == 'DIS_PLAYBACK'){ movementControlSwitchSelection = 1; //TwoLayer displayControlSwitchSelection = 1; //DisplayTwoLayer displayAllColor = new SFColor(1, 0, 0); topLayerSwitchSelection = 1; //DisplayNoneTop midLayerSwitchSelection = 1; //DisplayDISModeMid bottomLayerSwitchSelection = 2; //DisplayPlaybackButtonsBottom } if (displayMode == 'DIS_SLIDER'){ movementControlSwitchSelection = 1; //TwoLayer displayControlSwitchSelection = 1; //DisplayTwoLayer displayAllColor = new SFColor(1, 0, 0); topLayerSwitchSelection = 1; //DisplayNoneTop midLayerSwitchSelection = 1; //DisplayDISModeMid bottomLayerSwitchSelection = 0; //DisplaySliderBottom } if (displayMode == 'PLAYBACK_SLIDER'){ movementControlSwitchSelection = 1; //TwoLayer displayControlSwitchSelection = 1; //DisplayTwoLayer displayAllColor = new SFColor(1, 0, 0); topLayerSwitchSelection = 1; //DisplayNoneTop midLayerSwitchSelection = 0; //DisplayPlaybackButtosMid bottomLayerSwitchSelection = 0; //DisplaySliderBottom } if (displayMode == 'NONE'){ movementControlSwitchSelection = 2; //OneLayer displayControlSwitchSelection = 3; //DisplayNoLayer displayAllColor = new SFColor(1, 0, 0); topLayerSwitchSelection = 1; //DisplayNoneTop midLayerSwitchSelection = 2; //DisplayNoneMid bottomLayerSwitchSelection = 3; //DisplayNoneBottom } } function displayAllToggleEnabled(value, timeStamp) { if (displayAllToggleArmed == false) { displayAllToggleArmed = true; if (displayControlSwitchSelection == 0) { movementControlSwitchSelection = 2; displayControlSwitchSelection = 3; displayAllColor = new SFColor(1, 0, 0); topLayerSwitchSelection = 1; midLayerSwitchSelection = 2; bottomLayerSwitchSelection = 3; tracePrint('movementControlSwitchSelection = ' + movementControlSwitchSelection); tracePrint('displayControlSwitchSelection = ' + displayControlSwitchSelection); tracePrint('topLayerSwitchSelection = ' + topLayerSwitchSelection); tracePrint('midLayerSwitchSelection = ' + midLayerSwitchSelection); tracePrint('bottomLayerSwitchSelection = ' + bottomLayerSwitchSelection); } else //displayControlSwitchSelection not 0 { movementControlSwitchSelection = 0; displayControlSwitchSelection = 0; displayAllColor = new SFColor(0, 0.35, 0.8); topLayerSwitchSelection = 0; midLayerSwitchSelection = 0; bottomLayerSwitchSelection = 0; tracePrint('movementControlSwitchSelection = ' + movementControlSwitchSelection); tracePrint('displayControlSwitchSelection = ' + displayControlSwitchSelection); tracePrint('topLayerSwitchSelection = ' + topLayerSwitchSelection); tracePrint('midLayerSwitchSelection = ' + midLayerSwitchSelection); tracePrint('bottomLayerSwitchSelection = ' + bottomLayerSwitchSelection); } } else { displayAllToggleArmed = false; return; } } function topLayerToggleEnabled(value, timeStamp) { if (topLayerToggleArmed == false) { topLayerToggleArmed = true; displayControlSwitchSelection += 1; if (displayControlSwitchSelection == 3) movementControlSwitchSelection = 2; else movementControlSwitchSelection = displayControlSwitchSelection; displayAllColor = new SFColor(1, 0, 0); topLayerSwitchSelection = 1; tracePrint('movementControlSwitchSelection = ' + movementControlSwitchSelection); tracePrint('displayControlSwitchSelection = ' + displayControlSwitchSelection); tracePrint('topLayerSwitchSelection = ' + topLayerSwitchSelection); } else { topLayerToggleArmed = false; return; } } function midLayerToggleEnabled(value, timeStamp) { if (midLayerToggleArmed == false) { midLayerToggleArmed = true; displayControlSwitchSelection += 1; if (displayControlSwitchSelection == 3) movementControlSwitchSelection = 2; else movementControlSwitchSelection = displayControlSwitchSelection; displayAllColor = new SFColor(1, 0, 0); if (topLayerSwitchSelection == 0) { topLayerSwitchSelection = 1; midLayerSwitchSelection = 1; } else { midLayerSwitchSelection = 2; } tracePrint('movementControlSwitchSelection = ' + movementControlSwitchSelection); tracePrint('displayControlSwitchSelection = ' + displayControlSwitchSelection); tracePrint('topLayerSwitchSelection = ' + topLayerSwitchSelection); tracePrint('midLayerSwitchSelection = ' + midLayerSwitchSelection); } else { midLayerToggleArmed = false; return; } } function bottomLayerToggleEnabled(value, timeStamp) { if (bottomLayerToggleArmed == false) { bottomLayerToggleArmed = true; displayControlSwitchSelection += 1; if (displayControlSwitchSelection == 3) movementControlSwitchSelection = 2; else movementControlSwitchSelection = displayControlSwitchSelection; displayAllColor = new SFColor(1, 0, 0); if (topLayerSwitchSelection == 0) //if top display animation mode selection { topLayerSwitchSelection = 1; //top display nothing midLayerSwitchSelection = 1; //mid display animation mode selection bottomLayerSwitchSelection = 2; //bottom display playback control buttons } else if (midLayerSwitchSelection == 0) //if mid display playback control buttons { //top display nothing implied midLayerSwitchSelection = 2; //mid display nothing bottomLayerSwitchSelection = 2; //bottom display playback control buttons } else if (midLayerSwitchSelection == 1) //if mid display animation mode selection { //top display nothing implied midLayerSwitchSelection = 2; //mid display nothing bottomLayerSwitchSelection = 1; //bottom display animation mode selection } else //if mid display nothing { //top display nothing implied //mid display nothing implied bottomLayerSwitchSelection = 3; //bottom display nothing } tracePrint('movementControlSwitchSelection = ' + movementControlSwitchSelection); tracePrint('displayControlSwitchSelection = ' + displayControlSwitchSelection); tracePrint('topLayerSwitchSelection = ' + topLayerSwitchSelection); tracePrint('midLayerSwitchSelection = ' + midLayerSwitchSelection); tracePrint('bottomLayerSwitchSelection = ' + bottomLayerSwitchSelection); } else { bottomLayerToggleArmed = false; return; } } " ] } DEF TopLayerSwitch Switch { whichChoice 0 choice [ DEF DisplayDISModeTop Transform { translation 2.86 .58 0 children [ DEF DISModeButtons Transform { children [ DEF GroupButtonBaseShape Shape { appearance USE ButtonBaseAppearance geometry Box { size 5 .6 .05 } } Transform { translation -1.6 0 0 children [ DEF MasterSensor TouchSensor { } DEF PushButton Shape { appearance Appearance { material DEF MasterButtonMaterial Material { diffuseColor .9 .9 .9 transparency 1 } } geometry DEF DISModePushButton IndexedFaceSet { ccw FALSE coordIndex [ 0 1 2 3 0 -1 ] solid FALSE coord Coordinate { point [ -.8 .25 .05, .8 .25 .05, .8 -.25 .05, -.8 -.25 .05 ] } } } Transform { translation 0 0 .15 children [ Shape { appearance Appearance { material DEF MasterLabelMaterial Material { } } geometry Text { string [ "networkWriter" ] fontStyle DEF LabelFont FontStyle { justify [ "MIDDLE" "MIDDLE" ] size .25 style "BOLD" } } } ] } ] } Transform { children [ DEF RemoteSensor TouchSensor { } USE PushButton Transform { translation 0 0 .15 children [ Shape { appearance Appearance { material DEF RemoteLabelMaterial Material { } } geometry Text { string [ "networkReader" ] fontStyle USE LabelFont } } ] } ] } Transform { translation 1.6 0 0 children [ DEF LocalSensor TouchSensor { } USE PushButton Transform { translation 0 0 .15 children [ Shape { appearance Appearance { material DEF LocalLabelMaterial Material { } } geometry Text { string [ "standAlone" ] fontStyle USE LabelFont } } ] } ] } DEF DISModeScript Script { field SFColor buttonColor IS buttonColor field SFColor activeButtonColor IS selectedButtonColor field SFColor labelColor IS labelColor field SFColor activeLabelColor IS selectedLabelColor field SFFloat button_r 1 field SFFloat button_g 1 field SFFloat button_b 1 field SFFloat aButton_r 1 field SFFloat aButton_g 1 field SFFloat aButton_b 1 field SFFloat label_r 1 field SFFloat label_g 1 field SFFloat label_b 1 field SFFloat aLabel_r 1 field SFFloat aLabel_g 1 field SFFloat aLabel_b 1 eventIn SFBool masterToggleEnabled eventIn SFBool remoteToggleEnabled eventIn SFBool localToggleEnabled eventOut SFColor masterButtonColor eventOut SFColor masterLabelColor eventOut SFColor remoteButtonColor eventOut SFColor remoteLabelColor eventOut SFColor localButtonColor eventOut SFColor localLabelColor eventOut SFBool isMaster IS isMaster eventOut SFBool isRemote IS isRemote eventOut SFBool isLocal IS isLocal eventOut SFBool isPlaybackButtonsActive eventOut SFColor playbackButtonLabelColor eventOut SFBool resetToStartEnabled url [ "javascript: function initialize() { // timeStamp button_r = buttonColor[0]; button_g = buttonColor[1]; button_b = buttonColor[2]; aButton_r = activeButtonColor[0]; aButton_g = activeButtonColor[1]; aButton_b = activeButtonColor[2]; label_r = labelColor[0]; label_g = labelColor[1]; label_b = labelColor[2]; aLabel_r = activeLabelColor[0]; aLabel_g = activeLabelColor[1]; aLabel_b = activeLabelColor[2]; masterButtonColor = new SFColor(button_r, button_g, button_b); remoteButtonColor = new SFColor(button_r, button_g, button_b); localButtonColor = new SFColor(button_r, button_g, button_b); masterLabelColor = new SFColor(label_r, label_g, label_b); remoteLabelColor = new SFColor(label_r, label_g, label_b); localLabelColor = new SFColor(label_r, label_g, label_b); isMaster = false; isRemote = false; isLocal = true; isPlaybackButtonsActive = true; //set default mode localToggleEnabled(true); //, timeStamp } function masterToggleEnabled(value, timeStamp) { masterButtonColor = new SFColor(aButton_r, aButton_g, aButton_b); remoteButtonColor = new SFColor(button_r, button_g, button_b); localButtonColor = new SFColor(button_r, button_g, button_b); masterLabelColor = new SFColor(aLabel_r, aLabel_g, aLabel_b); remoteLabelColor = new SFColor(label_r, label_g, label_b); localLabelColor = new SFColor(label_r, label_g, label_b); isMaster = true; isRemote = false; isLocal = false; if (!isPlaybackButtonsActive) playbackButtonLabelColor = new SFColor(label_r, label_g, label_b); isPlaybackButtonsActive = true; } function remoteToggleEnabled(value, timeStamp) { masterButtonColor = new SFColor(button_r, button_g, button_b); remoteButtonColor = new SFColor(aButton_r, aButton_g, aButton_b); localButtonColor = new SFColor(button_r, button_g, button_b); masterLabelColor = new SFColor(label_r, label_g, label_b); remoteLabelColor = new SFColor(aLabel_r, aLabel_g, aLabel_b); localLabelColor = new SFColor(label_r, label_g, label_b); isMaster = false; isRemote = true; isLocal = false; isPlaybackButtonsActive = false; playbackButtonLabelColor = new SFColor(0.25, 0.25, 0.25); resetToStartEnabled = true; } function localToggleEnabled(value, timeStamp) { masterButtonColor = new SFColor(button_r, button_g, button_b); remoteButtonColor = new SFColor(button_r, button_g, button_b); localButtonColor = new SFColor(aButton_r, aButton_g, aButton_b); masterLabelColor = new SFColor(label_r, label_g, label_b); remoteLabelColor = new SFColor(label_r, label_g, label_b); localLabelColor = new SFColor(aLabel_r, aLabel_g, aLabel_b); isMaster = false; isRemote = false; isLocal = true; if (!isPlaybackButtonsActive) playbackButtonLabelColor = new SFColor(label_r, label_g, label_b); isPlaybackButtonsActive = true; } " ] } ] ROUTE DISModeScript.masterButtonColor TO MasterButtonMaterial.diffuseColor ROUTE DISModeScript.masterLabelColor TO MasterLabelMaterial.diffuseColor ROUTE DISModeScript.remoteLabelColor TO RemoteLabelMaterial.diffuseColor ROUTE DISModeScript.localLabelColor TO LocalLabelMaterial.diffuseColor ROUTE MasterSensor.isActive TO DISModeScript.masterToggleEnabled ROUTE RemoteSensor.isActive TO DISModeScript.remoteToggleEnabled ROUTE LocalSensor.isActive TO DISModeScript.localToggleEnabled } ] } DEF DisplayNoneTop Transform { } ] } DEF MidLayerSwitch Switch { whichChoice 0 choice [ DEF DisplayPlaybackButtonsMid Transform { translation 2.86 0 0 children [ DEF PlaybackButtons Transform { children [ USE GroupButtonBaseShape Transform { translation -2.05 0 0 children [ DEF ResetToStartSensor TouchSensor { } Shape { appearance Appearance { material DEF ResetToStartButtonMaterial Material { transparency .9 } } geometry DEF PlaybackButton IndexedFaceSet { coordIndex [ 3 2 1 0 3 -1 ] solid FALSE coord Coordinate { point [ -.375 .25 .05, .375 .25 .05, .375 -.25 .05, -.375 -.25 .05 ] } } } Transform { children [ Transform { translation -.12 0 0 children [ Shape { appearance Appearance { material DEF ResetToStartLabelMaterial Material { } } geometry DEF Bar Box { size .04 .3 .12 } } ] } Transform { translation .01 0 0 children [ Shape { appearance Appearance { material USE ResetToStartLabelMaterial } geometry DEF Triangle IndexedFaceSet { coordIndex [ 0 1 2 -1 ] coord Coordinate { point [ -.15 0 .051, .15 -.15 .051, .15 .15 .051 ] } } } ] } ] } ] } Transform { translation -1.36 0 0 children [ DEF FastRewindSensor TouchSensor { } Shape { appearance Appearance { material DEF FastRewindButtonMaterial Material { transparency .9 } } geometry USE PlaybackButton } Transform { children [ Transform { translation -.15 0 0 children [ Shape { appearance Appearance { material DEF FastRewindLabelMaterial Material { } } geometry USE Triangle } ] } Transform { translation .1 0 0 children [ Shape { appearance Appearance { material USE FastRewindLabelMaterial } geometry USE Triangle } ] } ] } ] } Transform { translation -.68 0 0 children [ DEF RewindSensor TouchSensor { } Shape { appearance Appearance { material DEF RewindButtonMaterial Material { transparency .9 } } geometry USE PlaybackButton } Transform { children [ Shape { appearance Appearance { material DEF RewindLabelMaterial Material { } } geometry USE Triangle } ] } ] } Transform { children [ DEF PauseSensor TouchSensor { } Shape { appearance Appearance { material DEF PauseButtonMaterial Material { transparency .9 } } geometry USE PlaybackButton } Transform { children [ Transform { translation -.05 0 0 children [ Shape { appearance Appearance { material DEF PauseLabelMaterial Material { } } geometry USE Bar } ] } Transform { translation .085 0 0 children [ Shape { appearance Appearance { material USE PauseLabelMaterial } geometry USE Bar } ] } ] } ] } Transform { translation .68 0 0 children [ DEF PlaySensor TouchSensor { } Shape { appearance Appearance { material DEF PlayButtonMaterial Material { transparency .9 } } geometry USE PlaybackButton } Transform { rotation 0 0 1 3.14 translation .05 0 0 children [ Shape { appearance Appearance { material DEF PlayLabelMaterial Material { } } geometry USE Triangle } ] } ] } Transform { translation 1.36 0 0 children [ DEF FastForwardSensor TouchSensor { } Shape { appearance Appearance { material DEF FastForwardButtonMaterial Material { transparency .9} } geometry USE PlaybackButton } Transform { rotation 0 0 1 3.14 children [ Transform { translation -.15 0 0 children [ Shape { appearance Appearance { material DEF FastForwardLabelMaterial Material { } } geometry USE Triangle } ] } Transform { translation .1 0 0 children [ Shape { appearance Appearance { material USE FastForwardLabelMaterial } geometry USE Triangle } ] } ] } ] } Transform { translation 2.05 0 0 children [ DEF ResetToEndSensor TouchSensor { } Shape { appearance Appearance { material DEF ResetToEndButtonMaterial Material { transparency .9 } } geometry USE PlaybackButton } Transform { children [ Transform { rotation 0 0 1 3.14 children [ Shape { appearance Appearance { material DEF ResetToEndLabelMaterial Material { } } geometry USE Triangle } ] } Transform { translation .12 0 0 children [ Shape { appearance Appearance { material USE ResetToEndLabelMaterial } geometry USE Bar } ] } ] } ] } DEF PlaybackControlScript Script { field SFBool playEnabled IS playEnabled field SFColor buttonColor IS buttonColor field SFColor activeButtonColor IS selectedButtonColor field SFColor labelColor IS labelColor field SFColor activeLabelColor IS selectedLabelColor field SFBool isActive TRUE eventIn SFBool setIsActive field SFBool resetToStartToggleArmed FALSE field SFBool fastRewindToggleArmed FALSE field SFBool rewindToggleArmed FALSE field SFBool pauseToggleArmed FALSE field SFBool playToggleArmed FALSE field SFBool fastForwardToggleArmed FALSE field SFBool resetToEndToggleArmed FALSE field SFFloat r 1 field SFFloat g 1 field SFFloat b 1 field SFFloat label_r 1 field SFFloat label_g 1 field SFFloat label_b 1 field SFFloat active_r 1 field SFFloat active_g 1 field SFFloat active_b 1 field SFFloat aLabel_r 1 field SFFloat aLabel_g 1 field SFFloat aLabel_b 1 eventIn SFBool resetToStartToggleEnabled eventIn SFBool fastRewindToggleEnabled eventIn SFBool rewindToggleEnabled eventIn SFBool pauseToggleEnabled eventIn SFBool playToggleEnabled eventIn SFBool fastForwardToggleEnabled eventIn SFBool resetToEndToggleEnabled eventOut SFColor resetToStartButtonColor eventOut SFColor resetToStartLabelColor eventOut SFColor fastRewindButtonColor eventOut SFColor fastRewindLabelColor eventOut SFColor rewindButtonColor eventOut SFColor rewindLabelColor eventOut SFColor pauseButtonColor eventOut SFColor pauseLabelColor eventOut SFColor playButtonColor eventOut SFColor playLabelColor eventOut SFColor fastForwardButtonColor eventOut SFColor fastForwardLabelColor eventOut SFColor resetToEndButtonColor eventOut SFColor resetToEndLabelColor eventOut SFBool isPaused IS isPaused eventOut SFBool isRunning IS isRunning eventOut SFBool resetToStartChanged eventOut SFBool fastRewindChanged eventOut SFBool rewindChanged eventOut SFBool pauseChanged eventOut SFBool playChanged eventOut SFBool fastForwardChanged eventOut SFBool resetToEndChanged url [ "javascript: function initialize() // timeStamp { r = buttonColor[0]; g = buttonColor[1]; b = buttonColor[2]; active_r = activeButtonColor[0]; active_g = activeButtonColor[1]; active_b = activeButtonColor[2]; label_r = labelColor[0]; label_g = labelColor[1]; label_b = labelColor[2]; aLabel_r = activeLabelColor[0]; aLabel_g = activeLabelColor[1]; aLabel_b = activeLabelColor[2]; if (!playEnabled) { resetToStartButtonColor = new SFColor(r, g, b); fastRewindButtonColor = new SFColor(r, g, b); rewindButtonColor = new SFColor(r, g, b); pauseButtonColor = new SFColor(r, g, b); playButtonColor = new SFColor(r, g, b); fastForwardButtonColor = new SFColor(r, g, b); resetToEndButtonColor = new SFColor(r, g, b); resetToStartLabelColor = new SFColor(label_r, label_g, label_b); fastRewindLabelColor = new SFColor(label_r, label_g, label_b); rewindLabelColor = new SFColor(label_r, label_g, label_b); pauseLabelColor = new SFColor(label_r, label_g, label_b); playLabelColor = new SFColor(label_r, label_g, label_b); fastForwardLabelColor = new SFColor(label_r, label_g, label_b); resetToEndLabelColor = new SFColor(label_r, label_g, label_b); isPaused = true; isRunning = false; } else //playEnabled == true { playToggleEnabled(true); //, timeStamp playToggleArmed = false; } } function setIsActive(value, timeStamp) { isActive = value; } function resetToStartToggleEnabled(value, timeStamp) { if (!resetToStartToggleArmed) { resetToStartButtonColor = new SFColor(active_r, active_g, active_b); resetToStartLabelColor = new SFColor(aLabel_r, aLabel_g, aLabel_b); resetToStartToggleArmed = true; return; } resetToStartToggleArmed = false; isPaused = true; isRunning = false; resetToStartChanged = true; if (!isActive) return; resetToStartButtonColor = new SFColor(active_r, active_g, active_b); fastRewindButtonColor = new SFColor(r, g, b); rewindButtonColor = new SFColor(r, g, b); pauseButtonColor = new SFColor(r, g, b); playButtonColor = new SFColor(r, g, b); fastForwardButtonColor = new SFColor(r, g, b); resetToEndButtonColor = new SFColor(r, g, b); resetToStartLabelColor = new SFColor(aLabel_r, aLabel_g, aLabel_b); fastRewindLabelColor = new SFColor(label_r, label_g, label_b); rewindLabelColor = new SFColor(label_r, label_g, label_b); pauseLabelColor = new SFColor(label_r, label_g, label_b); playLabelColor = new SFColor(label_r, label_g, label_b); fastForwardLabelColor = new SFColor(label_r, label_g, label_b); resetToEndLabelColor = new SFColor(label_r, label_g, label_b); } function fastRewindToggleEnabled(value, timeStamp) { if (fastRewindToggleArmed) { fastRewindToggleArmed = false; return; } fastRewindToggleArmed = true; isPaused = true; isRunning = false; fastRewindChanged = true; if (!isActive) return; resetToStartButtonColor = new SFColor(r, g, b); fastRewindButtonColor = new SFColor(active_r, active_g, active_b); rewindButtonColor = new SFColor(r, g, b); pauseButtonColor = new SFColor(r, g, b); playButtonColor = new SFColor(r, g, b); fastForwardButtonColor = new SFColor(r, g, b); resetToEndButtonColor = new SFColor(r, g, b); resetToStartLabelColor = new SFColor(label_r, label_g, label_b); fastRewindLabelColor = new SFColor(aLabel_r, aLabel_g, aLabel_b); rewindLabelColor = new SFColor(label_r, label_g, label_b); pauseLabelColor = new SFColor(label_r, label_g, label_b); playLabelColor = new SFColor(label_r, label_g, label_b); fastForwardLabelColor = new SFColor(label_r, label_g, label_b); resetToEndLabelColor = new SFColor(label_r, label_g, label_b); } function rewindToggleEnabled(value, timeStamp) { if (rewindToggleArmed) { rewindToggleArmed = false; return; } rewindToggleArmed = true; isPaused = true; isRunning = false; rewindChanged = true; if (!isActive) return; resetToStartButtonColor = new SFColor(r, g, b); fastRewindButtonColor = new SFColor(r, g, b); rewindButtonColor = new SFColor(active_r, active_g, active_b); pauseButtonColor = new SFColor(r, g, b); playButtonColor = new SFColor(r, g, b); fastForwardButtonColor = new SFColor(r, g, b); resetToEndButtonColor = new SFColor(r, g, b); resetToStartLabelColor = new SFColor(label_r, label_g, label_b); fastRewindLabelColor = new SFColor(label_r, label_g, label_b); rewindLabelColor = new SFColor(aLabel_r, aLabel_g, aLabel_b); pauseLabelColor = new SFColor(label_r, label_g, label_b); playLabelColor = new SFColor(label_r, label_g, label_b); fastForwardLabelColor = new SFColor(label_r, label_g, label_b); resetToEndLabelColor = new SFColor(label_r, label_g, label_b); } function pauseToggleEnabled(value, timeStamp) { if (pauseToggleArmed) { pauseToggleArmed = false; return; } pauseToggleArmed = true; isPaused = true; isRunning = false; pauseChanged = true; if (!isActive) return; resetToStartButtonColor = new SFColor(r, g, b); fastRewindButtonColor = new SFColor(r, g, b); rewindButtonColor = new SFColor(r, g, b); pauseButtonColor = new SFColor(active_r, active_g, active_b); playButtonColor = new SFColor(r, g, b); fastForwardButtonColor = new SFColor(r, g, b); resetToEndButtonColor = new SFColor(r, g, b); resetToStartLabelColor = new SFColor(label_r, label_g, label_b); fastRewindLabelColor = new SFColor(label_r, label_g, label_b); rewindLabelColor = new SFColor(label_r, label_g, label_b); pauseLabelColor = new SFColor(aLabel_r, aLabel_g, aLabel_b); playLabelColor = new SFColor(label_r, label_g, label_b); fastForwardLabelColor = new SFColor(label_r, label_g, label_b); resetToEndLabelColor = new SFColor(label_r, label_g, label_b); } function playToggleEnabled(value, timeStamp) { if (playToggleArmed) { playToggleArmed = false; return; } playToggleArmed = true; isPaused = false; isRunning = true; playChanged = true; if (!isActive) return; resetToStartButtonColor = new SFColor(r, g, b); fastRewindButtonColor = new SFColor(r, g, b); rewindButtonColor = new SFColor(r, g, b); pauseButtonColor = new SFColor(r, g, b); playButtonColor = new SFColor(active_r, active_g, active_b); fastForwardButtonColor = new SFColor(r, g, b); resetToEndButtonColor = new SFColor(r, g, b); resetToStartLabelColor = new SFColor(label_r, label_g, label_b); fastRewindLabelColor = new SFColor(label_r, label_g, label_b); rewindLabelColor = new SFColor(label_r, label_g, label_b); pauseLabelColor = new SFColor(label_r, label_g, label_b); playLabelColor = new SFColor(aLabel_r, aLabel_g, aLabel_b); fastForwardLabelColor = new SFColor(label_r, label_g, label_b); resetToEndLabelColor = new SFColor(label_r, label_g, label_b); } function fastForwardToggleEnabled(value, timeStamp) { if (fastForwardToggleArmed) { fastForwardToggleArmed = false; return; } fastForwardToggleArmed = true; isPaused = false; isRunning = true; fastForwardChanged = true; if (!isActive) return; resetToStartButtonColor = new SFColor(r, g, b); fastRewindButtonColor = new SFColor(r, g, b); rewindButtonColor = new SFColor(r, g, b); pauseButtonColor = new SFColor(r, g, b); playButtonColor = new SFColor(r, g, b); fastForwardButtonColor = new SFColor(active_r, active_g, active_b); resetToEndButtonColor = new SFColor(r, g, b); resetToStartLabelColor = new SFColor(label_r, label_g, label_b); fastRewindLabelColor = new SFColor(label_r, label_g, label_b); rewindLabelColor = new SFColor(label_r, label_g, label_b); pauseLabelColor = new SFColor(label_r, label_g, label_b); playLabelColor = new SFColor(label_r, label_g, label_b); fastForwardLabelColor = new SFColor(aLabel_r, aLabel_g, aLabel_b); resetToEndLabelColor = new SFColor(label_r, label_g, label_b); } function resetToEndToggleEnabled(value, timeStamp) { if (!resetToEndToggleArmed) { resetToEndButtonColor = new SFColor(active_r, active_g, active_b); resetToEndLabelColor = new SFColor(aLabel_r, aLabel_g, aLabel_b); resetToEndToggleArmed = true; return; } resetToEndToggleArmed = false; isPaused = true; isRunning = false; resetToEndChanged = true; if (!isActive) return; resetToStartButtonColor = new SFColor(r, g, b); fastRewindButtonColor = new SFColor(r, g, b); rewindButtonColor = new SFColor(r, g, b); pauseButtonColor = new SFColor(r, g, b); playButtonColor = new SFColor(r, g, b); fastForwardButtonColor = new SFColor(r, g, b); resetToEndButtonColor = new SFColor(active_r, active_g, active_b); resetToStartLabelColor = new SFColor(label_r, label_g, label_b); fastRewindLabelColor = new SFColor(label_r, label_g, label_b); rewindLabelColor = new SFColor(label_r, label_g, label_b); pauseLabelColor = new SFColor(label_r, label_g, label_b); playLabelColor = new SFColor(label_r, label_g, label_b); fastForwardLabelColor = new SFColor(label_r, label_g, label_b); resetToEndLabelColor = new SFColor(aLabel_r, aLabel_g, aLabel_b); } " ] } ] ROUTE DISModeScript.isPlaybackButtonsActive TO PlaybackControlScript.setIsActive ROUTE DISModeScript.resetToStartEnabled TO PlaybackControlScript.resetToStartToggleEnabled ROUTE DISModeScript.playbackButtonLabelColor TO ResetToStartLabelMaterial.diffuseColor ROUTE DISModeScript.playbackButtonLabelColor TO FastRewindLabelMaterial.diffuseColor ROUTE DISModeScript.playbackButtonLabelColor TO RewindLabelMaterial.diffuseColor ROUTE DISModeScript.playbackButtonLabelColor TO PauseLabelMaterial.diffuseColor ROUTE DISModeScript.playbackButtonLabelColor TO PlayLabelMaterial.diffuseColor ROUTE DISModeScript.playbackButtonLabelColor TO FastForwardLabelMaterial.diffuseColor ROUTE DISModeScript.playbackButtonLabelColor TO ResetToEndLabelMaterial.diffuseColor ROUTE DISModeScript.isPlaybackButtonsActive TO ResetToStartSensor.enabled ROUTE DISModeScript.isPlaybackButtonsActive TO FastRewindSensor.enabled ROUTE DISModeScript.isPlaybackButtonsActive TO RewindSensor.enabled ROUTE DISModeScript.isPlaybackButtonsActive TO PauseSensor.enabled ROUTE DISModeScript.isPlaybackButtonsActive TO PlaySensor.enabled ROUTE DISModeScript.isPlaybackButtonsActive TO FastForwardSensor.enabled ROUTE DISModeScript.isPlaybackButtonsActive TO ResetToEndSensor.enabled ROUTE PlaybackControlScript.resetToStartButtonColor TO ResetToStartButtonMaterial.diffuseColor ROUTE PlaybackControlScript.resetToStartLabelColor TO ResetToStartLabelMaterial.diffuseColor ROUTE PlaybackControlScript.fastRewindButtonColor TO FastRewindButtonMaterial.diffuseColor ROUTE PlaybackControlScript.fastRewindLabelColor TO FastRewindLabelMaterial.diffuseColor ROUTE PlaybackControlScript.rewindButtonColor TO RewindButtonMaterial.diffuseColor ROUTE PlaybackControlScript.rewindLabelColor TO RewindLabelMaterial.diffuseColor ROUTE PlaybackControlScript.pauseButtonColor TO PauseButtonMaterial.diffuseColor ROUTE PlaybackControlScript.pauseLabelColor TO PauseLabelMaterial.diffuseColor ROUTE PlaybackControlScript.playButtonColor TO PlayButtonMaterial.diffuseColor ROUTE PlaybackControlScript.playLabelColor TO PlayLabelMaterial.diffuseColor ROUTE PlaybackControlScript.fastForwardButtonColor TO FastForwardButtonMaterial.diffuseColor ROUTE PlaybackControlScript.fastForwardLabelColor TO FastForwardLabelMaterial.diffuseColor ROUTE PlaybackControlScript.resetToEndButtonColor TO ResetToEndButtonMaterial.diffuseColor ROUTE PlaybackControlScript.resetToEndLabelColor TO ResetToEndLabelMaterial.diffuseColor ROUTE ResetToStartSensor.isActive TO PlaybackControlScript.resetToStartToggleEnabled ROUTE FastRewindSensor.isActive TO PlaybackControlScript.fastRewindToggleEnabled ROUTE RewindSensor.isActive TO PlaybackControlScript.rewindToggleEnabled ROUTE PauseSensor.isActive TO PlaybackControlScript.pauseToggleEnabled ROUTE PlaySensor.isActive TO PlaybackControlScript.playToggleEnabled ROUTE FastForwardSensor.isActive TO PlaybackControlScript.fastForwardToggleEnabled ROUTE ResetToEndSensor.isActive TO PlaybackControlScript.resetToEndToggleEnabled } ] } DEF DisplayDISModeMid Transform { translation 2.86 0 0 children [ USE DISModeButtons ] } DEF DisplayNoneMid Transform { } ] } DEF BottomLayerSwitch Switch { whichChoice 0 choice [ DEF DisplaySliderBottom Transform { translation 2.86 -.58 0 children [ DEF TimeScale Transform { children [ USE GroupButtonBaseShape Transform { rotation 0 0 1 -1.57 translation 0 -.15 0 children [ DEF Slider SliderFloat { min 0 max 1 height 4.725 radius .1 barRadius .035 value 0 clickEnabled FALSE } ] } Transform { translation 0 0 .05 children [ Transform { translation -2.4 0 0 children [ Shape { appearance Appearance { material DEF TimeLabelMaterial Material { diffuseColor IS labelColor } } geometry DEF DurationText Text { string [ "00h00m00s" ] fontStyle DEF TimeLabelFont FontStyle { size .35 style "BOLDITALIC" } } } ] } Transform { translation -.3 0 0 children [ Shape { appearance Appearance { material USE TimeLabelMaterial } geometry Text { string [ "Elapsed:" ] fontStyle USE TimeLabelFont } } ] } Transform { translation .9 0 0 children [ Shape { appearance Appearance { material USE TimeLabelMaterial } geometry DEF ElapsedText Text { string [ "00h00m00s" ] fontStyle USE TimeLabelFont } } ] } DEF TimeScaleScript Script { field SFTime duration IS cycleInterval eventIn SFTime setDuration IS setCycleInterval field SFTime secondsElapsed -1 eventIn SFTime setSecondsElapsed eventOut MFString durationOutput eventOut MFString elapsedOutput url [ "javascript: function initialize() //timeStamp { setDuration(duration); //, timeStamp elapsedOutput = new MFString('00h00m00s'); } function setDuration(value, timeStamp) { duration = Math.floor(value); durationOutput = new MFString(printTime(duration)); } function setSecondsElapsed(value, timeStamp) { secondsElapsed = Math.floor(value); elapsedOutput = new MFString(printTime(secondsElapsed)); } function printTime(value) { timeInSeconds = value; seconds = timeInSeconds % 60; minute = ((timeInSeconds - seconds) / 60) % 60; hour = (timeInSeconds - minute * 60 - seconds) / 3600; hStr = (hour < 10 ? '0' + hour : '' + hour); mStr = (minute < 10 ? '0' + minute : '' + minute); sStr = (seconds < 10 ? '0' + seconds : '' + seconds); timeStr = hStr + 'h' + mStr + 'm' + sStr + 's'; return timeStr; } " ] } ] ROUTE TimeScaleScript.durationOutput TO DurationText.string ROUTE TimeScaleScript.elapsedOutput TO ElapsedText.string } ] } ] } DEF DisplayDISModeBottom Transform { translation 2.86 -.58 0 children [ USE DISModeButtons ] } DEF DisplayPlaybackButtonsBottom Transform { translation 2.86 -.58 0 children [ USE PlaybackButtons ] } DEF DisplayNoneBottom Transform { } ] } DEF HUDa Transform { children [ PointLight {location 1 0 .5 intensity .4} DEF trans_bottom Transform { children Shape { appearance Appearance { material Material { ambientIntensity 0 diffuseColor 1 1 1 shininess .93 transparency .5 } texture ImageTexture { url "" } } geometry DEF _108 IndexedFaceSet { coord Coordinate { point [ -.405 1 0, 2.8 1 0, 2.8 -1 0, -.405 -1 0, ] } coordIndex [ 0 1 2 3 -1, ] solid FALSE } } #translation -.840293 -1.23771 -2.23959 scale 3 1 1 #scale 3.02946 .478301 .542679 } ] translation .7 -.7 -.08 #rotation 0 -1 0 1.56074 scale 1 1 1} ] ROUTE DisplayAllSensor.isActive TO DisplayLayerScript.displayAllToggleEnabled ROUTE DisplayTopLayerSensor.isActive TO DisplayLayerScript.topLayerToggleEnabled ROUTE DisplayMidLayerSensor.isActive TO DisplayLayerScript.midLayerToggleEnabled ROUTE DisplayBottomLayerSensor.isActive TO DisplayLayerScript.bottomLayerToggleEnabled ROUTE DisplayLayerScript.movementControlSwitchSelection TO MovementControlSwitch.whichChoice ROUTE DisplayLayerScript.displayControlSwitchSelection TO DisplayControlSwitch.whichChoice ROUTE DisplayLayerScript.displayAllColor TO DisplayAllMaterial.diffuseColor ROUTE DisplayLayerScript.topLayerSwitchSelection TO TopLayerSwitch.whichChoice ROUTE DisplayLayerScript.midLayerSwitchSelection TO MidLayerSwitch.whichChoice ROUTE DisplayLayerScript.bottomLayerSwitchSelection TO BottomLayerSwitch.whichChoice } ] } ] ROUTE PlaneMovementSensor.translation_changed TO MovableLocation.set_translation ROUTE VisibilityControlScript.translationChanged TO MovableLocation.set_translation ROUTE VisibilityControlScript.translationOffsetChanged TO PlaneMovementSensor.set_offset } ] } DEF ForwardClock TimeSensor { } DEF FastForwardClock TimeSensor { } DEF RewindClock TimeSensor { } DEF FastRewindClock TimeSensor { } DEF SliderClock TimeSensor { } DEF ClockScript Script { field SFBool traceEnabled IS traceEnabled field SFTime duration IS cycleInterval field SFFloat r 1 field SFFloat g 1 field SFFloat b 1 field SFFloat label_r 1 field SFFloat label_g 1 field SFFloat label_b 1 field SFFloat active_r 1 field SFFloat active_g 1 field SFFloat active_b 1 field SFFloat aLabel_r 1 field SFFloat aLabel_g 1 field SFFloat aLabel_b 1 field SFFloat rewindStart_fraction 0 field SFFloat fastRewindStart_fraction 0 field SFFloat sliderClockStart_fraction 0 field SFFloat fastRewind_level 0 field SFFloat fastForward_level 0 field SFFloat preDrag_fraction 0 field SFBool drag_forward FALSE field SFBool drag_backward FALSE eventIn SFTime setDuration IS setCycleInterval eventOut SFTime durationChanged IS cycleIntervalChanged eventOut SFTime forwardCycleInterval eventOut SFTime fastForwardCycleInterval eventOut SFTime rewindCycleInterval eventOut SFTime fastRewindCycleInterval eventOut SFTime sliderClockCycleInterval field SFFloat speedFactor IS speedFactor field SFTime startTime -1 eventOut SFTime startTimeChanged IS startTimeChanged field SFTime stopTime -1 eventOut SFTime stopTimeChanged IS stopTimeChanged eventOut SFTime rewindStartTime eventOut SFTime rewindStopTime eventOut SFTime fastForwardStartTime eventOut SFTime fastForwardStopTime eventOut SFTime fastRewindStartTime eventOut SFTime fastRewindStopTime eventOut SFTime sliderClockStartTime eventOut SFTime sliderClockStopTime field SFTime time -1 eventIn SFTime setTime eventOut SFTime timeChanged IS timeChanged field SFBool isClockActive FALSE eventIn SFBool setIsClockActive eventOut SFBool isClockActiveChanged IS isActive eventOut SFTime secondsElapsed IS secondsElapsed field SFFloat fraction 0 eventIn SFFloat setFraction eventIn SFFloat setFastForwardFraction eventIn SFFloat setRewindFraction eventIn SFFloat setFastRewindFraction eventIn SFFloat setSliderDragFraction eventIn SFFloat setSliderClockFraction eventOut SFFloat fractionChanged IS fractionChanged eventOut SFBool isResetToStart eventIn SFBool setResetToStart eventOut SFBool isFastRewind eventIn SFBool setFastRewind eventOut SFBool isRewinding eventIn SFBool setRewind eventIn SFBool setPaused eventOut SFBool isPlaying eventIn SFBool setPlay eventOut SFBool isFastForward eventIn SFBool setFastForward eventOut SFBool isResetToEnd eventIn SFBool setResetToEnd eventOut SFBool sliderClockEnabled field SFBool sliderDragArmed FALSE eventIn SFBool setSliderDragged field SFTime pauseTime -1 field SFColor activateButtonColor IS selectedButtonColor field SFColor activateLabelColor IS selectedLabelColor field SFColor deactivateButtonColor IS buttonColor field SFBool isPlaybackButtonsActive TRUE eventIn SFBool setIsPlaybackButtonsActive eventOut SFColor deactivateButtonColorChanged field SFColor deactivateLabelColor IS labelColor eventOut SFColor deactivateLabelColorChanged eventOut SFColor playButtonActivateColorChanged eventOut SFColor playLabelActivateColorChanged eventOut SFColor rewindButtonActivateColorChanged eventOut SFColor rewindLabelActivateColorChanged url [ "javascript: function tracePrint (text) { if (traceEnabled) print('[ DvdControllerPrototype ] ' + text); } function forcePrint(output) { print('[ DvdControllerPrototype ] ' + output); } function initialize(timeStamp) { r = deactivateButtonColor[0]; g = deactivateButtonColor[1]; b = deactivateButtonColor[2]; active_r = activateButtonColor[0]; active_g = activateButtonColor[1]; active_b = activateButtonColor[2]; label_r = deactivateLabelColor[0]; label_g = deactivateLabelColor[1]; label_b = deactivateLabelColor[2]; aLabel_r = activateLabelColor[0]; aLabel_g = activateLabelColor[1]; aLabel_b = activateLabelColor[2]; isResetToStart = false; isFastRewind = false; isRewinding = false; isPlaying = false; isFastForward = false; isResetToEnd = false; durationChanged = duration; forwardCycleInterval = duration; fastForwardCycleInterval = duration; rewindCycleInterval = duration; fastRewindCycleInterval = duration; sliderClockCycleInterval = duration; fraction = 0; fastRewind_level = 0; fastForward_level = 0; sliderClockStart_fraction = 0; } function setDuration(value, timeStamp) { duration = value; durationChanged = value; forwardCycleInterval = duration; fastForwardCycleInterval = duration; rewindCycleInterval = duration; fastRewindCycleInterval = duration; sliderClockCycleInterval = duration; } function setIsPlaybackButtonsActive(value, timeStamp) { isPlaybackButtonsActive = value; } function setIsClockActive(value, timeStamp) { isClockActive = isClockActiveChanged = value; tracePrint('clock isActive: ' + value); } function setResetToStart(value, timeStamp) { isResetToStart = true; //Stop all clocks isPlaying = false; isRewinding = false; isFastForward = false; isFastRewind = false; sliderClockEnabled = false; fraction = fractionChanged = 0.0; secondsElapsed = 0.0; startTime = startTimeChanged = timeStamp; stopTime = stopTimeChanged = startTime + duration; deactivateButtonColorChanged = new SFColor(r, g, b); if (!isPlaybackButtonsActive) return; deactivateLabelColorChanged = new SFColor(label_r, label_g, label_b); } function setFastRewind(value, timeStamp) { if (!isFastRewind) fastRewindStart_fraction = fraction; isFastRewind = true; isPlaying = false; isRewinding = false; isFastForward = false; sliderClockEnabled = false; if (fastRewind_level < 1) { ++fastRewind_level; fastRewindCycleInterval = duration / (speedFactor * fastRewind_level); } if (fraction == 0) //start reached { deactivateButtonColorChanged = new SFColor(r, g, b); deactivateLabelColorChanged = new SFColor(label_r, label_g, label_b); return; } fastRewindStartTime = timeStamp; fastRewindStopTime = fastRewindStartTime + secondsElapsed / (speedFactor * fastRewind_level); startTime = startTimeChanged = fastRewindStopTime; } function setRewind(value, timeStamp) { if (!isRewinding) rewindStart_fraction = fraction; isRewinding = true; isPlaying = false; isFastForward = false; isFastRewind = false; sliderClockEnabled = false; fastRewind_level = 0; //reset rewindCycleInterval = duration; if (fraction == 0) //start reached { deactivateButtonColorChanged = new SFColor(r, g, b); deactivateLabelColorChanged = new SFColor(label_r, label_g, label_b); return; } rewindStartTime = timeStamp; rewindStopTime = rewindStartTime + secondsElapsed; startTime = startTimeChanged = rewindStopTime; } function setPaused(value, timeStamp) { if (value == true) { var now = new Date(); pauseTime = now.getTime() / 1000.0; isFastRewind = false; isRewinding = false; isPlaying = false; isFastForward = false; sliderClockEnabled = false; } } function setPlay(value, timeStamp) { isPlaying = true; isRewinding = false; isFastForward = false; isFastRewind = false; sliderClockEnabled = false; fastRewind_level = 0; //reset fast rewind forwardCycleInterval = duration; if (fraction == 0 || fraction == 1) //start or restart from beginning { startTime = startTimeChanged = timeStamp; stopTime = stopTimeChanged = startTime + duration; } else { startTime = startTimeChanged = timeStamp - secondsElapsed; stopTime = stopTimeChanged = startTime + duration; } } function setFastForward(value, timeStamp) { isFastForward = true; isPlaying = false; isRewinding = false; isFastRewind = false; sliderClockEnabled = false; if (fastForward_level < 1) { ++fastForward_level; fastForwardCycleInterval = duration / (speedFactor * fastForward_level); } fastForwardStartTime = timeStamp - secondsElapsed / (speedFactor * fastForward_level); fastForwardStopTime = fastForwardStartTime + duration / (speedFactor * fastForward_level); startTime = startTimeChanged = fastForwardStartTime; } function setResetToEnd(value, timeStamp) { isResetToEnd = true; //Stop all clocks isPlaying = false; isRewinding = false; isFastForward = false; isFastRewind = false; sliderClockEnabled = false; fraction = fractionChanged = 1.0; secondsElapsed = duration; stopTime = stopTimeChanged = timeStamp; startTime = startTimeChanged = stopTime - duration; deactivateButtonColorChanged = new SFColor(r, g, b); deactivateLabelColorChanged = new SFColor(label_r, label_g, label_b); } function setFraction(value, timeStamp) { if (isRewinding || isFastForward || isFastRewind || sliderClockEnabled || sliderDragArmed) return; if (isResetToStart) { isResetToStart = false; //reset return; } else if (isResetToEnd) { isResetToEnd = false; //reset return; } fraction = fractionChanged = value; if (fraction >= 1) //end reached { deactivateButtonColorChanged = new SFColor(r, g, b); deactivateLabelColorChanged = new SFColor(label_r, label_g, label_b); fraction = fractionChanged = 1.0; } } function setFastForwardFraction(value, timeStamp) { if (isPlaying || isFastRewind || isRewinding || sliderClockEnabled || sliderDragArmed) return; if (isResetToStart) { isResetToStart = false; //reset return; } else if (isResetToEnd) { isResetToEnd = false; //reset return; } fraction = fractionChanged = value; if (fraction >= 1) //end reached { deactivateButtonColorChanged = new SFColor(r, g, b); deactivateLabelColorChanged = new SFColor(label_r, label_g, label_b); isFastForward = false; fraction = fractionChanged = 1.0; secondsElapsed = duration; } } function setRewindFraction(value, timeStamp) { if (isPlaying || isFastForward || isFastRewind || sliderClockEnabled || sliderDragArmed) return; if (isResetToStart) { isResetToStart = false; //reset return; } else if (isResetToEnd) { isResetToEnd = false; //reset return; } fraction = fractionChanged = 1 - value - (1 - rewindStart_fraction); if (fraction <= 0.0000001) //start reached - rounded off { deactivateButtonColorChanged = new SFColor(r, g, b); deactivateLabelColorChanged = new SFColor(label_r, label_g, label_b); isRewinding = false; fraction = fractionChanged = 0.0; secondsElapsed = 0.0; } } function setFastRewindFraction(value, timeStamp) { if (isPlaying || isFastForward || isRewinding || sliderClockEnabled || sliderDragArmed) return; if (isResetToStart) { isResetToStart = false; //reset return; } else if (isResetToEnd) { isResetToEnd = false; //reset return; } fraction = fractionChanged = 1 - value - (1 - fastRewindStart_fraction); if (fraction <= 0.0000001) //start reached - rounded off { deactivateButtonColorChanged = new SFColor(r, g, b); deactivateLabelColorChanged = new SFColor(label_r, label_g, label_b); isFastRewind = false; fraction = fractionChanged = 0.0; fastRewindStart_fraction = -1; //reset secondsElapsed = 0.0; } } function setTime(value, timeStamp) { //Check if pause option is selected if (!isPlaying && !isRewinding && !isFastForward && !isFastRewind && !sliderClockEnabled) return; time = timeChanged = value; secondsElapsed = Math.abs(value - startTime); if (isFastRewind) secondsElapsed = secondsElapsed * (speedFactor * fastRewind_level); else if (isFastForward) secondsElapsed = secondsElapsed * (speedFactor * fastForward_level); if (fraction == 0) secondsElapsed = 0.0; else if (fraction == 1) secondsElapsed = duration; } function setSliderDragged(value, timeStamp) { if (value == true) //Drag started { preDrag_fraction = fraction; sliderDragArmed = true; isPlaying = false; isRewinding = false; isFastForward = false; isFastRewind = false; sliderClockEnabled = false; } else //Drag finished { deactivateButtonColorChanged = new SFColor(r, g, b); deactivateLabelColorChanged = new SFColor(label_r, label_g, label_b); sliderDragArmed = false; secondsElapsed = duration * fraction; sliderClockEnabled = true; if (fraction == 0 || fraction == 1) //start or end reached return; sliderClockCycleInterval = duration; if (fraction >= preDrag_fraction) //play { drag_forward = true; drag_backward = false; sliderClockStartTime = timeStamp - secondsElapsed; sliderClockStopTime = sliderClockStartTime + duration; startTime = startTimeChanged = sliderClockStartTime; playButtonActivateColorChanged = new SFColor(active_r, active_g, active_b); playLabelActivateColorChanged = new SFColor(aLabel_r, aLabel_g, aLabel_b); } else if (fraction < preDrag_fraction) //rewind { drag_forward = false; drag_backward = true; sliderClockStartTime = timeStamp; sliderClockStopTime = timeStamp + secondsElapsed; startTime = startTimeChanged = sliderClockStopTime; rewindButtonActivateColorChanged = new SFColor(active_r, active_g, active_b); rewindLabelActivateColorChanged = new SFColor(aLabel_r, aLabel_g, aLabel_b); } sliderClockStart_fraction = fraction; } } function setSliderDragFraction(value, timeStamp) { if (isPlaying || isRewinding || isFastForward || isFastRewind || sliderClockEnabled) return; if (sliderDragArmed) fraction = fractionChanged = value; } function setSliderClockFraction(value, timeStamp) { if (isPlaying || isRewinding || isFastForward || isFastRewind) return; if (isResetToStart) { isResetToStart = false; //reset return; } else if (isResetToEnd) { isResetToEnd = false; //reset return; } if (drag_forward) fraction = fractionChanged = value; else if (drag_backward) fraction = fractionChanged = 1 - value - (1 - sliderClockStart_fraction); if (fraction <= 0.0000001) { deactivateButtonColorChanged = new SFColor(r, g, b); deactivateLabelColorChanged = new SFColor(label_r, label_g, label_b); sliderClockEnabled = false; fraction = fractionChanged = 0.0; secondsElapsed = 0.0; } else if (fraction >= 1) { deactivateButtonColorChanged = new SFColor(r, g, b); deactivateLabelColorChanged = new SFColor(label_r, label_g, label_b); sliderClockEnabled = false; fraction = fractionChanged = 1.0; secondsElapsed = duration; } } " ] } ] ROUTE WhereSensor.position_changed TO FixedLocation.set_translation ROUTE WhereSensor.orientation_changed TO FixedLocation.set_rotation ROUTE DISModeScript.isPlaybackButtonsActive TO ClockScript.setIsPlaybackButtonsActive ROUTE DISModeScript.isPlaybackButtonsActive TO Slider.setDragEnabled ROUTE PlaybackControlScript.resetToStartChanged TO ClockScript.setResetToStart ROUTE PlaybackControlScript.fastRewindChanged TO ClockScript.setFastRewind ROUTE PlaybackControlScript.rewindChanged TO ClockScript.setRewind ROUTE PlaybackControlScript.pauseChanged TO ClockScript.setPaused ROUTE PlaybackControlScript.playChanged TO ClockScript.setPlay ROUTE PlaybackControlScript.fastForwardChanged TO ClockScript.setFastForward ROUTE PlaybackControlScript.resetToEndChanged TO ClockScript.setResetToEnd ROUTE ForwardClock.isActive TO ClockScript.setIsClockActive ROUTE ForwardClock.fraction_changed TO ClockScript.setFraction ROUTE ForwardClock.time_changed TO ClockScript.setTime ROUTE RewindClock.isActive TO ClockScript.setIsClockActive ROUTE RewindClock.fraction_changed TO ClockScript.setRewindFraction ROUTE RewindClock.time_changed TO ClockScript.setTime ROUTE FastForwardClock.isActive TO ClockScript.setIsClockActive ROUTE FastForwardClock.fraction_changed TO ClockScript.setFastForwardFraction ROUTE FastForwardClock.time_changed TO ClockScript.setTime ROUTE FastRewindClock.isActive TO ClockScript.setIsClockActive ROUTE FastRewindClock.fraction_changed TO ClockScript.setFastRewindFraction ROUTE FastRewindClock.time_changed TO ClockScript.setTime ROUTE SliderClock.isActive TO ClockScript.setIsClockActive ROUTE SliderClock.fraction_changed TO ClockScript.setSliderClockFraction ROUTE SliderClock.time_changed TO ClockScript.setTime ROUTE ClockScript.isPlaying TO ForwardClock.set_enabled ROUTE ClockScript.isRewinding TO RewindClock.set_enabled ROUTE ClockScript.isFastForward TO FastForwardClock.set_enabled ROUTE ClockScript.isFastRewind TO FastRewindClock.set_enabled ROUTE ClockScript.sliderClockEnabled TO SliderClock.set_enabled ROUTE ClockScript.forwardCycleInterval TO ForwardClock.set_cycleInterval ROUTE ClockScript.rewindCycleInterval TO RewindClock.set_cycleInterval ROUTE ClockScript.fastForwardCycleInterval TO FastForwardClock.set_cycleInterval ROUTE ClockScript.fastRewindCycleInterval TO FastRewindClock.set_cycleInterval ROUTE ClockScript.sliderClockCycleInterval TO SliderClock.set_cycleInterval ROUTE ClockScript.startTimeChanged TO ForwardClock.set_startTime ROUTE ClockScript.stopTimeChanged TO ForwardClock.set_stopTime ROUTE ClockScript.rewindStartTime TO RewindClock.set_startTime ROUTE ClockScript.rewindStopTime TO RewindClock.set_stopTime ROUTE ClockScript.fastForwardStartTime TO FastForwardClock.set_startTime ROUTE ClockScript.fastForwardStopTime TO FastForwardClock.set_stopTime ROUTE ClockScript.fastRewindStartTime TO FastRewindClock.set_startTime ROUTE ClockScript.fastRewindStopTime TO FastRewindClock.set_stopTime ROUTE ClockScript.sliderClockStartTime TO SliderClock.set_startTime ROUTE ClockScript.sliderClockStopTime TO SliderClock.set_stopTime ROUTE ClockScript.fractionChanged TO Slider.setValue ROUTE ClockScript.deactivateButtonColorChanged TO ResetToStartButtonMaterial.diffuseColor ROUTE ClockScript.deactivateLabelColorChanged TO ResetToStartLabelMaterial.diffuseColor ROUTE ClockScript.deactivateButtonColorChanged TO FastRewindButtonMaterial.diffuseColor ROUTE ClockScript.deactivateLabelColorChanged TO FastRewindLabelMaterial.diffuseColor ROUTE ClockScript.deactivateButtonColorChanged TO RewindButtonMaterial.diffuseColor ROUTE ClockScript.deactivateLabelColorChanged TO RewindLabelMaterial.diffuseColor ROUTE ClockScript.deactivateButtonColorChanged TO PauseButtonMaterial.diffuseColor ROUTE ClockScript.deactivateLabelColorChanged TO PauseLabelMaterial.diffuseColor ROUTE ClockScript.deactivateButtonColorChanged TO PlayButtonMaterial.diffuseColor ROUTE ClockScript.deactivateLabelColorChanged TO PlayLabelMaterial.diffuseColor ROUTE ClockScript.deactivateButtonColorChanged TO FastForwardButtonMaterial.diffuseColor ROUTE ClockScript.deactivateLabelColorChanged TO FastForwardLabelMaterial.diffuseColor ROUTE ClockScript.deactivateButtonColorChanged TO ResetToEndButtonMaterial.diffuseColor ROUTE ClockScript.deactivateLabelColorChanged TO ResetToEndLabelMaterial.diffuseColor ROUTE ClockScript.playButtonActivateColorChanged TO PlayButtonMaterial.diffuseColor ROUTE ClockScript.playLabelActivateColorChanged TO PlayLabelMaterial.diffuseColor ROUTE ClockScript.rewindButtonActivateColorChanged TO RewindButtonMaterial.diffuseColor ROUTE ClockScript.rewindLabelActivateColorChanged TO RewindLabelMaterial.diffuseColor ROUTE Slider.valueChanged TO ClockScript.setSliderDragFraction ROUTE Slider.isDragged TO ClockScript.setSliderDragged ROUTE ClockScript.secondsElapsed TO TimeScaleScript.setSecondsElapsed } } # ==================== NavigationInfo { type [ "EXAMINE" "ANY" ] } Anchor { description "DvdControllerExample" parameter [ "target=_blank" ] url [ "DvdControllerExample.wrl" "http://web.nps.navy.mil/~brutzman/Savage/Tools/HeadsUpDisplays/DvdControllerExample.wrl" "data/DvdControllerExample.x3d" "http://web.nps.navy.mil/~brutzman/Savage/Tools/HeadsUpDisplays/DvdControllerExample.x3d" ] children [ Shape { appearance Appearance { material Material { diffuseColor 0 1 1 emissiveColor 0 1 1 } } geometry Text { string [ "DvdControllerPrototype.wrl" "is a Prototype definition file." "" "To see an example scene" "using this new node," "click this text and view" "DvdControllerExample.wrl" ] fontStyle FontStyle { justify [ "MIDDLE" "MIDDLE" ] size .8 } } } ] }