<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
<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 ' >
<head>
<meta name='titlecontent='AnimatedGrid.x3d'/>
<meta name='descriptioncontent='Animated grid world illustrates the use of a script to change the whichChoice field of a Switch node. When animated, this enables switching among different pieces of geometry, such as the separate ElevationGrid scenes shown in this example.'/>
<meta name='creatorcontent='John L. Moreland'/>
<meta name='translatorcontent='Don Brutzman'/>
<meta name='createdcontent='1 July 1998'/>
<meta name='translatedcontent='2 February 2014'/>
<meta name='modifiedcontent='20 October 2019'/>
<meta name='referencecontent='originals/animgrid.wrl'/>
<meta name='referencecontent=' http://www.siggraph.org/s98 '/>
<meta name='referencecontent=' http://www.siggraph.org/s98/conference/courses/18.html '/>
<meta name='referencecontent=' http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/slides/mt0495.htm '/>
<meta name='referencecontent=' http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/vrml97.htm '/>
<meta name='referencecontent=' https://www.web3d.org/x3d/content/examples/X3dResources.html '/>
<meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/AnimatedGrid.x3d '/>
<meta name='generatorcontent='Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html'/>
<meta name='generatorcontent='X3D-Edit, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../license.html'/>
</head>
<!--

to top <!-- Event Graph ROUTE Table shows event connections -->
 
<!-- Index for DEF nodes: Clock, Grids, Switcher

Index for Viewpoint node: Viewpoint_1
-->
<Scene>
<WorldInfo info='"Copyright (c) 1998, John L. Moreland"title='Animated grid'/>
<Viewpoint description='Entry vieworientation='1.0 0.0 0.0 -0.83position='0.0 12.0 12.0'/>
<NavigationInfo headlight='falsetype='"EXAMINE"'/>
<DirectionalLight direction='1.0 -1.0 -1.0'/>
<DirectionalLight direction='-1.0 1.0 1.0'/>
<!-- ROUTE information for Grids node:  [from Switcher.choice_changed to set_whichChoice ] -->
<Switch DEF='GridswhichChoice='0'>
<Inline bboxSize='14.0 5.0 14.0'
  url=' "Terrain00.x3d" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Terrain00.x3d" "Terrain00.wrl" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Terrain00.wrl" ' />

<Inline bboxSize='14.0 5.0 14.0'
  url=' "Terrain01.x3d" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Terrain01.x3d" "Terrain01.wrl" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Terrain01.wrl" ' />

<Inline bboxSize='14.0 5.0 14.0'
  url=' "Terrain02.x3d" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Terrain02.x3d" "Terrain02.wrl" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Terrain02.wrl" ' />

<Inline bboxSize='14.0 5.0 14.0'
  url=' "Terrain03.x3d" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Terrain03.x3d" "Terrain03.wrl" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Terrain03.wrl" ' />

<Inline bboxSize='14.0 5.0 14.0'
  url=' "Terrain04.x3d" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Terrain04.x3d" "Terrain04.wrl" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Terrain04.wrl" ' />

<Inline bboxSize='14.0 5.0 14.0'
  url=' "Terrain05.x3d" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Terrain05.x3d" "Terrain05.wrl" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Terrain05.wrl" ' />

<Inline bboxSize='14.0 5.0 14.0'
  url=' "Terrain06.x3d" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Terrain06.x3d" "Terrain06.wrl" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Terrain06.wrl" ' />

<Inline bboxSize='14.0 5.0 14.0'
  url=' "Terrain07.x3d" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Terrain07.x3d" "Terrain07.wrl" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Terrain07.wrl" ' />

<Inline bboxSize='14.0 5.0 14.0'
  url=' "Terrain08.x3d" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Terrain08.x3d" "Terrain08.wrl" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Terrain08.wrl" ' />

<Inline bboxSize='14.0 5.0 14.0'
  url=' "Terrain09.x3d" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Terrain09.x3d" "Terrain09.wrl" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Terrain09.wrl" ' />
</Switch>
<!-- ROUTE information for Clock node:  [from fraction_changed to Switcher.set_fraction ] -->
<TimeSensor DEF='ClockcycleInterval='2.0loop='truestartTime='1.0'/>

<!-- ROUTE information for Switcher node:  [from Clock.fraction_changed to set_fraction ] [from choice_changed to Grids.set_whichChoice ] -->
<Script DEF='Switcher'>
<field name='choice_changedtype='SFInt32accessType='outputOnly'/>
<field name='numberOfChoicestype='SFInt32value='10accessType='initializeOnly'/>
<field name='set_fractiontype='SFFloataccessType='inputOnly'/>
<![CDATA[
      
ecmascript:
    function set_fraction( frac, stamp ) {
            choice_changed = frac * numberOfChoices;
    }

    
]]>
</Script>
< ROUTE  fromNode=' Clock' fromField='fraction_changed' toNode=' Switcher' toField='set_fraction'/>
< ROUTE  fromNode=' Switcher' fromField='choice_changed' toNode=' Grids' toField='set_whichChoice'/>
</Scene>
</X3D>
<!--

to top <!-- Event Graph ROUTE Table shows event connections -->
 
<!-- Index for DEF nodes: Clock, Grids, Switcher

Index for Viewpoint node: Viewpoint_1
-->

Event Graph ROUTE Table entries with 2 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.

Clock
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(1)
Switcher
Script
set_fraction
SFFloat

 
 
then
Switcher
Script
choice_changed
SFInt32

ROUTE
event to
(2)
Grids
Switch
set_whichChoice
SFInt32



-->

<!-- Online at
https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/AnimatedGridIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/AnimatedGrid.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. -->