<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "http://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D profile='Immersive' version='3.0 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation =' http://www.web3d.org/specifications/x3d-3.0.xsd '>
<head>
<meta name='titlecontent='LODlevelChangedExample.x3d'/>
<meta name='descriptioncontent='Example use of (proposed) LOD level_changed outputOnly field to trigger loading of Inline nodes in subsequent levels.'/>
<meta name='creatorcontent='Don Brutzman'/>
<meta name='motivationcontent='Chris Thorne'/>
<meta name='createdcontent='26 May 2004'/>
<meta name='modifiedcontent='12 January 2014'/>
<meta name=' warning content=' under development, evaluating a proposed specification change '/>
<meta name='identifiercontent=' http://www.web3d.org/x3d/content/examples/Basic/development/LODlevelChangedExample.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../license.html'/>
</head>
<!-- -->
<Scene>
<!-- ROUTE information for activeLOD node:  [from level_changed to PreloadLevelsScript.level_changed ] -->
<LOD DEF='activeLODrange='6 10'>
<Shape DEF='ShapeLevel0'>
<Text string='"developmental test scene" "LODlevelChangedExample"'>
<FontStyle justify='"MIDDLE" "MIDDLE"'/>
</Text>
</Shape>
<!-- ROUTE information for InlineLevel1 node:  [from PreloadLevelsScript.activateLevel1 to load ] -->
<Inline DEF='InlineLevel1load='false'/>
<!-- ROUTE information for InlineLevel2 node:  [from PreloadLevelsScript.activateLevel2 to load ] -->
<Inline DEF='InlineLevel2load='false'/>
<!-- etc. -->
</LOD>
<Group DEF='PreloadActivationGroup'>
<!-- ROUTE information for PreloadLevelsScript node:  [from activeLOD.level_changed to level_changed ] [from activateLevel1 to InlineLevel1.load ] [from activateLevel2 to InlineLevel2.load ] -->
<Script DEF='PreloadLevelsScript'>
<field name='level_changedtype='SFInt32accessType='inputOnly'/>
<field name='activateLevel1type='SFBoolaccessType='outputOnly'/>
<field name='activateLevel2type='SFBoolaccessType='outputOnly'/>
<![CDATA[
        
ecmascript:

function level_changed (value, timestamp)
{
	Browser.print ('level=' + value);
	if      (value == 1) activateLevel1 = true;
	else if (value == 2) activateLevel2 = true;
	// etc.
}

      
]]>
</Script>
<ROUTE fromNode='activeLODfromField='level_changedtoNode='PreloadLevelsScripttoField='level_changed'/>
<ROUTE fromNode='PreloadLevelsScriptfromField='activateLevel1toNode='InlineLevel1toField='load'/>
<ROUTE fromNode='PreloadLevelsScriptfromField='activateLevel2toNode='InlineLevel2toField='load'/>
</Group>
<Group DEF='ViewpointGroup'>
<Viewpoint description='level 0position='0 0 4'/>
<Viewpoint description='level 1position='0 0 8'/>
<Viewpoint description='level 2position='0 0 12'/>
</Group>
</Scene>
</X3D>
<!--

Index for DEF nodes : activeLOD, InlineLevel1, InlineLevel2, PreloadActivationGroup, PreloadLevelsScript, ShapeLevel0, ViewpointGroup

Index for Viewpoint images : Viewpoint_1, Viewpoint_2, Viewpoint_3
-->

<!-- Color key: <X3dNode DEF='idName' field='value'/> matches <XmlElement DEF='idName' attribute='value'/>
(Light blue background: behavior node) (Grey background: inserted documentation) (Magenta background: X3D extensibility)
-->

<!-- Additional help information about X3D scenes: X3D Resources, X3D Scene Authoring Hints and X3D Tooltips -->