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=' DvdControllerExample.x3d '/> |
6 | <meta name='description' content="Digital Virtual Display (DVD) Controller interface example to control a scenario's animation timing, defined using an ExternProtoDeclare for easy reuse."/> |
7 | <meta name='creator' content='Jane Wu, Don Brutzman'/> |
8 | <meta name='created' content='10 November 2001'/> |
9 | <meta name='modified' content='5 March 2024'/> |
10 | <meta name='subject' content='DvdController animation control'/> |
11 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/DvdControllerExample.x3d '/> |
12 | <meta name='generator' content='X3D-Edit 4.0, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
13 | <meta name='license' content='../../license.html'/> |
14 | </head> |
15 | <Scene> |
16 | <WorldInfo title='DvdControllerExample.x3d'/> |
17 | <ExternProtoDeclare name='DvdController' appinfo='Digital Virtual Display (DVD) Controller Prototype is a heads=up display (HUD) to control animation timing' url=' "DvdControllerPrototype.x3d#DvdController" "../../../Savage/Tools/HeadsUpDisplays/DvdControllerPrototype.x3d#DvdController" "https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/DvdControllerPrototype.x3d#DvdController" "DvdControllerPrototype.wrl#DvdController" "../../../Savage/Tools/HeadsUpDisplays/DvdControllerPrototype.wrl#DvdController" "https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/DvdControllerPrototype.wrl#DvdController" '> |
18 |
<field name='description' type='SFString' accessType='initializeOnly'
appinfo='Short description of what is animated by this DvdController.'/> |
19 |
<field name='playEnabled' type='SFBool' accessType='initializeOnly'
appinfo='Whether or not play mode is enabled including during startup.'/> |
20 |
<field name='displayMode' type='SFString' accessType='initializeOnly'
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.'/> |
21 |
<field name='setDisplayMode' type='SFString' accessType='inputOnly'
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.'/> |
22 |
<field name='buttonColor' type='SFColor' accessType='initializeOnly'
appinfo='Default button color.'/> |
23 |
<field name='selectedButtonColor' type='SFColor' accessType='initializeOnly'
appinfo='Button color when selected by user.'/> |
24 |
<field name='labelColor' type='SFColor' accessType='initializeOnly'
appinfo='Default label color.'/> |
25 |
<field name='selectedLabelColor' type='SFColor' accessType='initializeOnly'
appinfo='Label color when selected by user.'/> |
26 |
<field name='locationOffset' type='SFVec3f' accessType='initializeOnly'
appinfo='Modified screen location and distance (for size).'/> |
27 | <field name='clockEnabled' type='SFBool' accessType='initializeOnly'/> |
28 |
<field name='cycleInterval' type='SFTime' accessType='initializeOnly'
appinfo='Time for complete loop cycle in seconds.'/> |
29 | <field name='set_cycleInterval' type='SFTime' accessType='inputOnly'/> |
30 | <field name='cycleInterval_changed' type='SFTime' accessType='outputOnly'/> |
31 |
<field name='speedFactor' type='SFFloat' accessType='initializeOnly'
appinfo='Factor used to determine the speed increase/decrease for Fast Rewind and Fast Forward action.'/> |
32 | <field name='isActive' type='SFBool' accessType='outputOnly'/> |
33 | <field name='startTime_changed' type='SFTime' accessType='outputOnly'/> |
34 | <field name='stopTime_changed' type='SFTime' accessType='outputOnly'/> |
35 | <field name='time_changed' type='SFTime' accessType='outputOnly'/> |
36 | <field name='fraction_changed' type='SFFloat' accessType='outputOnly'/> |
37 | <field name='secondsElapsed' type='SFTime' accessType='outputOnly'/> |
38 |
<field name='isMaster' type='SFBool' accessType='outputOnly'
appinfo='isMaster isRemote and isLocal are booleans represent a 3-way toggle. Only one of them can have a true value at any time.'/> |
39 |
<field name='isRemote' type='SFBool' accessType='outputOnly'
appinfo='isMaster isRemote and isLocal are booleans represent a 3-way toggle. Only one of them can have a true value at any time.'/> |
40 |
<field name='isLocal' type='SFBool' accessType='outputOnly'
appinfo='isMaster isRemote and isLocal are booleans represent a 3-way toggle. Only one of them can have a true value at any time.'/> |
41 |
<field name='isPaused' type='SFBool' accessType='outputOnly'
appinfo='isPaused and isRunning always have opposite values. When isPaused is true isRunning will be false and vice versa.'/> |
42 |
<field name='isRunning' type='SFBool' accessType='outputOnly'
appinfo='isPaused and isRunning always have opposite values. When isPaused is true isRunning will be false and vice versa.'/> |
43 |
<field name='traceEnabled' type='SFBool' accessType='initializeOnly'
appinfo='Enable/disable console output for troubleshooting.'/> |
44 | <field name='testTimeVal' type='SFTime' accessType='initializeOnly'/> |
45 | </ExternProtoDeclare> |
46 | <ExternProtoDeclare name='SingleTypeConversion' appinfo='SingleTypeConversion converts from a single typed value to various other types of values' url=' "../../../Savage/Tools/Authoring/SingleTypeConversionPrototype.x3d#SingleTypeConversion" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/SingleTypeConversionPrototype.x3d#SingleTypeConversion" "../../../Savage/Tools/Authoring/SingleTypeConversionPrototype.wrl#SingleTypeConversion" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/SingleTypeConversionPrototype.wrl#SingleTypeConversion" '> |
47 |
<field name='decimalPlaces' type='SFInt32' accessType='initializeOnly'
appinfo='decimalPlaces is the number of significant digits after the decimal point. The -1 value indicates no round off.'/> |
48 | <field name='setDecimalPlaces' type='SFInt32' accessType='inputOnly'/> |
49 | <field name='BooleanValue' type='SFBool' accessType='inputOnly'/> |
50 | <field name='FloatValue' type='SFFloat' accessType='inputOnly'/> |
51 | <field name='IntegerValue' type='SFInt32' accessType='inputOnly'/> |
52 | <field name='TimeValue' type='SFTime' accessType='inputOnly'/> |
53 | <field name='BooleanResult' type='SFBool' accessType='outputOnly'/> |
54 | <field name='FloatResult' type='SFFloat' accessType='outputOnly'/> |
55 | <field name='IntegerResult' type='SFInt32' accessType='outputOnly'/> |
56 | <field name='TimeResult' type='SFTime' accessType='outputOnly'/> |
57 | <field name='StringResult' type='SFString' accessType='outputOnly'/> |
58 | <field name='StringsResult' type='MFString' accessType='outputOnly'/> |
59 | </ExternProtoDeclare> |
60 | <!-- ============================== --> |
61 | <Transform> |
62 |
<!-- ROUTE information for DvdControllerInterface node:
[from time_changed to TimeTextScript.setCurrentTime
]
[from fraction_changed to FractionConverter.FloatValue
]
[from secondsElapsed to SecondsConverter.TimeValue
]
-->
<ProtoInstance name='DvdController' DEF='DvdControllerInterface'> |
63 | <fieldValue name='displayMode' value='PLAYBACK_SLIDER'/> |
64 | <fieldValue name='playEnabled' value='true'/> |
65 | <fieldValue name='buttonColor' value='0.655 0.655 0.655'/> |
66 | <fieldValue name='selectedButtonColor' value='0.675 0.675 0.675'/> |
67 | <fieldValue name='selectedLabelColor' value='0.9 0 0'/> |
68 | <fieldValue name='locationOffset' value='-5 -2 0'/> |
69 | <fieldValue name='cycleInterval' value='10'/> |
70 | <fieldValue name='speedFactor' value='10.0'/> |
71 | <fieldValue name='traceEnabled' value='true'/> |
72 | </ProtoInstance> |
73 | </Transform> |
74 | <Transform translation='-3 0 0'> |
75 | <Transform translation='-5 3 -5'> |
76 | <Shape> |
77 | <Appearance> |
78 | <Material/> |
79 | </Appearance> |
80 | <Text string='"fraction_changed:"'/> |
81 | </Shape> |
82 | </Transform> |
83 | <Transform translation='4 3 -5'> |
84 | <Shape> |
85 | <Appearance> |
86 | <Material/> |
87 | </Appearance> |
88 |
<!-- ROUTE information for FractionText node:
[from FractionConverter.StringsResult to set_string
]
-->
<Text DEF='FractionText' string=' "N/A" '/> |
89 | </Shape> |
90 | </Transform> |
91 | <Transform translation='-5 2 -5'> |
92 | <Shape> |
93 | <Appearance> |
94 | <Material/> |
95 | </Appearance> |
96 | <Text string='"secondsElapsed:"'/> |
97 | </Shape> |
98 | </Transform> |
99 | <Transform translation='4 2 -5'> |
100 | <Shape> |
101 | <Appearance> |
102 | <Material/> |
103 | </Appearance> |
104 |
<!-- ROUTE information for SecondsElapsedText node:
[from SecondsConverter.StringsResult to set_string
]
-->
<Text DEF='SecondsElapsedText' string=' "N/A" '/> |
105 | </Shape> |
106 | </Transform> |
107 | <Transform translation='-5 1 -5'> |
108 | <Shape> |
109 | <Appearance> |
110 | <Material/> |
111 | </Appearance> |
112 | <Text DEF='actual_time_changed' string='"local clock time:"'/> |
113 | </Shape> |
114 | </Transform> |
115 | <Transform translation='4 1 -5'> |
116 | <Shape> |
117 | <Appearance> |
118 | <Material/> |
119 | </Appearance> |
120 |
<!-- ROUTE information for TimeText node:
[from TimeTextScript.timeText to set_string
]
-->
<Text DEF='TimeText' string=' "N/A" '/> |
121 | </Shape> |
122 | </Transform> |
123 | </Transform> |
124 |
<!-- ROUTE information for TimeTextScript node:
[from DvdControllerInterface.time_changed to setCurrentTime
]
[from timeText to TimeText.set_string
]
-->
<Script DEF='TimeTextScript'> |
125 | <field name='time' type='SFTime' value='-1' accessType='initializeOnly'/> |
126 | <field name='setCurrentTime' type='SFTime' accessType='inputOnly'/> |
127 | <field name='timeText' type='MFString' accessType='outputOnly'/> |
<![CDATA[
ecmascript: function initialize () { tracePrint('initialize () complete'); } function setCurrentTime(value, timeStamp) { tracePrint('setCurrentTime(' + value + ')'); myDate = new Date(); // value unused, causes BS Contact fatal error if (myDate == null) { Browser.println ('[DvdControllerExample TimeTextScript] setCurrentTime() error: class Date not supported'); return; } numHour = myDate.getHours(); numMinute = myDate.getMinutes(); numSecond = myDate.getSeconds(); date = myDate.getDate(); monthNumber = myDate.getMonth(); year = myDate.getYear() + 1900; // javascript switch statement is convenient but not consistently supported, so test the old-fashioned way: if (monthNumber==0) { monthText ='January'; } else if (monthNumber==1) { monthText ='February'; } else if (monthNumber==2) { monthText ='March'; } else if (monthNumber==3) { monthText ='April'; } else if (monthNumber==4) { monthText ='May'; } else if (monthNumber==5) { monthText ='June'; } else if (monthNumber==6) { monthText ='July'; } else if (monthNumber==7) { monthText ='August'; } else if (monthNumber==8) { monthText ='September'; } else if (monthNumber==9) { monthText ='October'; } else if (monthNumber==10) { monthText ='November'; } else if (monthNumber==11) { monthText ='December'; } else { monthText ='(illegal month index)'; } if (numHour < 10) hour ='0' + numHour; else hour = numHour; if (numMinute < 10) minute ='0' + numMinute; else minute = numMinute; numSecond = Math.round(numSecond * 1000.0) / 1000.0; if (numSecond < 10) second ='0' + numSecond; else second = numSecond; text = hour + ':' + minute + ':' + second + ', ' + date + ' ' + monthText + ' ' + year; timeText = new MFString(text); //deprecated timeText = new MFString(myDate.toGMTString()); tracePrint ('timeText=' + timeText.toString()); } function tracePrint (text) { if (true) Browser.println ('[DvdControllerExample TimeTextScript] ' + text); }
]]>
|
|
129 | </Script> |
130 | < ROUTE fromNode='DvdControllerInterface' fromField='time_changed' toNode='TimeTextScript' toField='setCurrentTime'/> |
131 | < ROUTE fromNode='TimeTextScript' fromField='timeText' toNode='TimeText' toField='set_string'/> |
132 |
<!-- ROUTE information for FractionConverter node:
[from DvdControllerInterface.fraction_changed to FloatValue
]
[from StringsResult to FractionText.set_string
]
-->
<ProtoInstance name='SingleTypeConversion' DEF='FractionConverter'> |
133 | <fieldValue name='decimalPlaces' value='2'/> |
134 | </ProtoInstance> |
135 | < ROUTE fromNode='DvdControllerInterface' fromField='fraction_changed' toNode='FractionConverter' toField='FloatValue'/> |
136 | < ROUTE fromNode='FractionConverter' fromField='StringsResult' toNode='FractionText' toField='set_string'/> |
137 |
<!-- ROUTE information for SecondsConverter node:
[from DvdControllerInterface.secondsElapsed to TimeValue
]
[from StringsResult to SecondsElapsedText.set_string
]
-->
<ProtoInstance name='SingleTypeConversion' DEF='SecondsConverter'> |
138 | <fieldValue name='decimalPlaces' value='2'/> |
139 | </ProtoInstance> |
140 | < ROUTE fromNode='DvdControllerInterface' fromField='secondsElapsed' toNode='SecondsConverter' toField='TimeValue'/> |
141 | < ROUTE fromNode='SecondsConverter' fromField='StringsResult' toNode='SecondsElapsedText' toField='set_string'/> |
142 | </Scene> |
143 | </X3D> |
Event Graph ROUTE Table entries with 6 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.
TimeTextScript
Script timeText MFString |
TimeText
Text set_string MFString |
DvdControllerInterface
ProtoInstance time_changed SFTime |
TimeTextScript
Script setCurrentTime SFTime |
then
|
TimeTextScript
Script timeText MFString |
TimeText
Text set_string MFString |
||
DvdControllerInterface
ProtoInstance fraction_changed SFFloat |
FractionConverter
ProtoInstance FloatValue SFFloat |
then
|
FractionConverter
ProtoInstance StringsResult MFString |
FractionText
Text set_string MFString |
||
DvdControllerInterface
ProtoInstance secondsElapsed SFTime |
SecondsConverter
ProtoInstance TimeValue SFTime |
then
|
SecondsConverter
ProtoInstance StringsResult MFString |
SecondsElapsedText
Text set_string MFString |
FractionConverter
ProtoInstance StringsResult MFString |
FractionText
Text set_string MFString |
SecondsConverter
ProtoInstance StringsResult MFString |
SecondsElapsedText
Text set_string MFString |
<!--
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.
-->