| 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
|
| 3 | <X3D profile='Immersive' version='3.3' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.3.xsd'> |
| 4 | <head> |
| 5 | <meta name='title' content=' SoundLoadSensorTest.x3d '/> |
| 6 | <meta name='description' content='UsingLoadSensor to test when AudioClip loading is complete'/> |
| 7 | <meta name='created' content='19 July 2008'/> |
| 8 | <meta name='modified' content='20 October 2019'/> |
| 9 | <meta name='creator' content='Leonard Daly and Don Brutzman'/> |
| 10 | <meta name='reference' content='https://X3dGraphics.com'/> |
| 11 | <meta name='reference' content=' https://www.web3d.org/x3d/content/examples/X3dResources.html '/> |
| 12 | <meta name='rights' content='Copyright 2006, Daly Realism and Don Brutzman'/> |
| 13 | <meta name='subject' content='X3D book, X3D graphics, X3D-Edit, http://www.x3dGraphics.com'/> |
| 14 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter12EnvironmentSensorSound/SoundLoadSensorTest.x3d '/> |
| 15 | <meta name='generator' content='X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
| 16 | <meta name='license' content='../license.html'/> |
| 17 | </head> |
| 18 | <Scene> |
| 19 | <!-- Sound location y-value is 1.6 in order to match typical avatar height (in meters) --> |
| 20 | <WorldInfo title='SoundLoadSensorTest.x3d'/> |
| 21 | <Sound DEF='SomeSound' location='0 1.6 0' maxBack='100' maxFront='100' minBack='10' minFront='10'> |
| 22 |
<!-- AudioClip
WaterSounds is a DEF node that has 1 USE node: USE_1
<!-- ROUTE information for WaterSounds node: [from ReportWhenLoaded.loadTime to startTime ] --> <AudioClip DEF='WaterSounds' description='Running Water' url=' "aqua.wav" "https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter12EnvironmentSensorSound/aqua.wav" '/> |
| 23 | </Sound> |
| 24 |
<!-- ROUTE information for ReportWhenLoaded node:
[from loadTime to WaterSounds.startTime
]
[from isLoaded to ConsoleReport.loadComplete
]
[from loadTime to ConsoleReport.loadTime
]
[from loadTime to SignRotationClock.startTime
]
-->
<LoadSensor DEF='ReportWhenLoaded'> |
| 25 | <AudioClip USE='WaterSounds' containerField='watchList'/> |
| 26 | </LoadSensor> |
| 27 | < ROUTE fromNode='ReportWhenLoaded' fromField='loadTime' toNode='WaterSounds' toField='startTime'/> |
| 28 | <!-- send completion report to console --> |
| 29 |
<!-- ROUTE information for ConsoleReport node:
[from ReportWhenLoaded.isLoaded to loadComplete
]
[from ReportWhenLoaded.loadTime to loadTime
]
-->
<Script DEF='ConsoleReport'> |
| 30 | <field name='loadComplete' type='SFBool' accessType='inputOnly'/> |
| 31 | <field name='loadTime' type='SFTime' accessType='inputOnly'/> |
<![CDATA[
ecmascript:
function initialize ()
{
Browser.println ('Script initialize() complete');
}
function loadComplete (value)
{
Browser.println ('LoadSensor AudioClip isLoaded=' + value);
}
function loadTime (value)
{
Browser.println ('LoadSensor AudioClip loadTime=' + value);
}
]]>
|
|
| 33 | </Script> |
| 34 | < ROUTE fromNode='ReportWhenLoaded' fromField='isLoaded' toNode='ConsoleReport' toField='loadComplete'/> |
| 35 | < ROUTE fromNode='ReportWhenLoaded' fromField='loadTime' toNode='ConsoleReport' toField='loadTime'/> |
| 36 | <!-- show visible indication of load waiting, complete --> |
| 37 |
<!-- ROUTE information for PivotTextSigns node:
[from SignRotationInterpolator.value_changed to rotation
]
-->
<Transform DEF='PivotTextSigns'> |
| 38 | <!-- First sign indicates waiting... --> |
| 39 | <Shape> |
| 40 | <Text string='"LoadSensor waiting for AudioClip..."'> |
| 41 | <FontStyle justify='"MIDDLE" "MIDDLE"' size='0.7' style='ITALIC'/> |
| 42 | </Text> |
| 43 | <Appearance> |
| 44 | <Material emissiveColor='0.878431 0.262745 0'/> |
| 45 | </Appearance> |
| 46 | </Shape> |
| 47 | <!-- Second sign indicates completed, initially rotated 90 degrees out of view --> |
| 48 | <Transform rotation='0 1 0 1.57'> |
| 49 | <Shape> |
| 50 | <Text string='"LoadSensor reports AudioClip loading complete."'> |
| 51 | <FontStyle justify='"MIDDLE" "MIDDLE"' size='0.7' style='ITALIC'/> |
| 52 | </Text> |
| 53 | <Appearance> |
| 54 | <Material emissiveColor='0 0.278431 0.027451'/> |
| 55 | </Appearance> |
| 56 | </Shape> |
| 57 | </Transform> |
| 58 | </Transform> |
| 59 |
<!-- ROUTE information for SignRotationInterpolator node:
[from SignRotationClock.fraction_changed to set_fraction
]
[from value_changed to PivotTextSigns.rotation
]
-->
<OrientationInterpolator DEF='SignRotationInterpolator' key='0 1' keyValue='0 1 0 0 0 1 0 -1.57'/> |
| 60 |
<!-- ROUTE information for SignRotationClock node:
[from ReportWhenLoaded.loadTime to startTime
]
[from fraction_changed to SignRotationInterpolator.set_fraction
]
-->
<TimeSensor DEF='SignRotationClock' cycleInterval='0.8'/> |
| 61 | < ROUTE fromNode='ReportWhenLoaded' fromField='loadTime' toNode='SignRotationClock' toField='startTime'/> |
| 62 | < ROUTE fromNode='SignRotationClock' fromField='fraction_changed' toNode='SignRotationInterpolator' toField='set_fraction'/> |
| 63 | < ROUTE fromNode='SignRotationInterpolator' fromField='value_changed' toNode='PivotTextSigns' toField='rotation'/> |
| 64 | </Scene> |
| 65 | </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.
|
ConsoleReport
Script |
No direct ROUTE connection found for events to/from this node. This Script has no direct access to other nodes. |
|
ReportWhenLoaded
LoadSensor loadTime SFTime |
WaterSounds
AudioClip startTime SFTime |
|||||||||
|
ReportWhenLoaded
LoadSensor isLoaded SFBool |
ConsoleReport
Script loadComplete SFBool |
|||||||||
|
ReportWhenLoaded
LoadSensor loadTime SFTime |
ConsoleReport
Script loadTime SFTime |
|||||||||
|
ReportWhenLoaded
LoadSensor loadTime SFTime |
SignRotationClock
TimeSensor startTime SFTime |
then
|
SignRotationClock
TimeSensor fraction_changed SFFloat |
SignRotationInterpolator
OrientationInterpolator set_fraction SFFloat |
then
|
SignRotationInterpolator
OrientationInterpolator value_changed SFRotation |
PivotTextSigns
Transform rotation SFRotation |
<!--
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)
-->
<!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->