X3D Model Documentation: BackgroundSelector.x3d

  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='titlecontent='BackgroundSelector.x3d'/>
  6            <meta name='descriptioncontent='Select one of four Background nodes to show a time-of-day effect.'/>
  7            <meta name='creatorcontent='Dale Tourtelotte, Don Brutzman and MV4205 class'/>
  8            <meta name='createdcontent='20 April 2009'/>
  9            <meta name='modifiedcontent='20 October 2019'/>
 10            <meta name='referencecontent='https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter11LightingEnvironment/BackgroundColorsOnly.x3d'/>
 11            <meta name='subjectcontent='X3D Background example'/>
 12            <meta name='identifiercontent='https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter11LightingEnvironmentalEffects/BackgroundSelector.x3d'/>
 13            <meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
 14            <meta name='licensecontent='../license.html'/>
 15       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->

<!-- to top Index for DEF nodes: BackgroundSequencer, HighNoonSky, NightSky, SelectorScript, SunRiseSky, SunsetSky, TimeOfDayClock
-->
 16       <Scene>
 17            <WorldInfo title='BackgroundSelector.x3d'/>
 18            <Transform translation='0 3 0'>
 19                 <Shape>
 20                      <Text string='"Background Selector"'>
 21                           <FontStyle justify='"MIDDLE" "MIDDLE"'/>
 22                      </Text>
 23                      <Appearance>
 24                           <Material/>
 25                      </Appearance>
 26                 </Shape>
 27            </Transform>
 28 
          <!-- ROUTE information for TimeOfDayClock node:  [from fraction_changed to BackgroundSequencer.set_fraction ] -->
          <TimeSensor DEF='TimeOfDayClockcycleInterval='6loop='true'/>
 29 
          <!-- ROUTE information for BackgroundSequencer node:  [from TimeOfDayClock.fraction_changed to set_fraction ] [from value_changed to SelectorScript.whichBackground ] -->
          <IntegerSequencer DEF='BackgroundSequencerkey='0 0.25 0.5 0.75 1keyValue='0 1 2 3 0'/>
 30            < ROUTE  fromNode='TimeOfDayClock' fromField='fraction_changed' toNode='BackgroundSequencer' toField='set_fraction'/>
 31 
 32                 <field name='whichBackgroundtype='SFInt32accessType='inputOnly'/>
 33                 <field name='bind0type='SFBoolaccessType='outputOnly'/>
 34                 <field name='bind1type='SFBoolaccessType='outputOnly'/>
 35                 <field name='bind2type='SFBoolaccessType='outputOnly'/>
 36                 <field name='bind3type='SFBoolaccessType='outputOnly'/>
  <![CDATA[
      
ecmascript:
function whichBackground (inputValue)
{
    if      (whichBackground == 0) bind0 = true;
    else if (whichBackground == 1) bind1 = true;
    else if (whichBackground == 2) bind2 = true;
    else if (whichBackground == 3) bind3 = true;
}

    
]]>
 38            </Script>
 39            < ROUTE  fromNode='BackgroundSequencer' fromField='value_changed' toNode='SelectorScript' toField='whichBackground'/>
 40 
          <!-- ROUTE information for SunRiseSky node:  [from SelectorScript.bind0 to set_bind ] -->
          <Background DEF='SunRiseSkygroundAngle='0.75 1.2 1.25 1.26 1.5 1.57groundColor='0.133333 0.419608 0 0.36 0.1 0 1 0.74 0.4 1 0.74 0.4 0 0 0.5 0 0 0.2 0 0.231373 0.380392skyAngle='0.5 0.7 1.35 1.45 1.57skyColor='0 0.035 0.34 0 0.015 0.44 0 0.05 0.5 0 0.1 0.6 0.44 0.8 1 1 1 0.7'/>
 41 
          <!-- ROUTE information for HighNoonSky node:  [from SelectorScript.bind1 to set_bind ] -->
          <Background DEF='HighNoonSkygroundAngle='0.75 1.2 1.25 1.26 1.57groundColor='0.133333 0.419608 0 0.36 0.1 0 1 0.74 0.4 1 0.74 0.4 0 0.2 0.75 0 0.1 0.5skyAngle='0.05 0.07 1.57skyColor='1 1 0.2 1 1 0 0.36 0.63 1 0 0.4 1'/>
 42 
          <!-- ROUTE information for SunsetSky node:  [from SelectorScript.bind2 to set_bind ] -->
          <Background DEF='SunsetSkygroundAngle='0.75 1.2 1.25 1.26 1.57groundColor='0.133333 0.419608 0 0.36 0.1 0 1 0.74 0.4 1 0.74 0.4 0 0 0.5 0 0 0.2skyAngle='0.5 0.7 1.2 1.4 1.57skyColor='0 0 0.38 0 0 0.68 0.5 0.2 1 0.5 0.2 1 1 0.3 0 1 0.2 0.8'/>
 43 
          <!-- ROUTE information for NightSky node:  [from SelectorScript.bind3 to set_bind ] -->
          <Background DEF='NightSkygroundAngle='0.75 1.2 1.25 1.26 1.57groundColor='0.133333 0.419608 0 0.36 0.1 0 1 0.74 0.4 1 0.74 0.4 0 0 0.5 0 0 0.2skyAngle='0.03 0.05 1.57skyColor='1 1 1 0.8 0.8 0.8 0.1 0.1 0.1 0 0 0'/>
 44            < ROUTE  fromNode='SelectorScript' fromField='bind0' toNode='SunRiseSky' toField='set_bind'/>
 45            < ROUTE  fromNode='SelectorScript' fromField='bind1' toNode='HighNoonSky' toField='set_bind'/>
 46            < ROUTE  fromNode='SelectorScript' fromField='bind2' toNode='SunsetSky' toField='set_bind'/>
 47            < ROUTE  fromNode='SelectorScript' fromField='bind3' toNode='NightSky' toField='set_bind'/>
 48       </Scene>
 49  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->

<!-- to top Index for DEF nodes: BackgroundSequencer, HighNoonSky, NightSky, SelectorScript, SunRiseSky, SunsetSky, TimeOfDayClock
-->
X3D Tooltips element index: Appearance, Background, field, FontStyle, head, IntegerSequencer, Material, meta, ROUTE, Scene, Script, Shape, Text, TimeSensor, Transform, WorldInfo, X3D, accessType and type, XML data types, field types

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.

TimeOfDayClock
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(1)
BackgroundSequencer
IntegerSequencer
set_fraction
SFFloat
then
 
 
 
BackgroundSequencer
IntegerSequencer
value_changed
SFInt32

ROUTE
event to
(2)
SelectorScript
Script
whichBackground
SFInt32
then
 
 
 
SelectorScript
Script
bind0
SFBool

ROUTE
event to
(3)
SunRiseSky
Background
set_bind
SFBool
  then
 
 
 
SelectorScript
Script
bind1
SFBool

ROUTE
event to
(3)
HighNoonSky
Background
set_bind
SFBool
  then
 
 
 
SelectorScript
Script
bind2
SFBool

ROUTE
event to
(3)
SunsetSky
Background
set_bind
SFBool
  then
 
 
 
SelectorScript
Script
bind3
SFBool

ROUTE
event to
(3)
NightSky
Background
set_bind
SFBool

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

-->
<!-- Online at
https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter11LightingEnvironmentalEffects/BackgroundSelectorIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter11LightingEnvironmentalEffects/BackgroundSelector.x3d -->

<!-- Color 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)
-->

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