<?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='MaterialModulatorExamples.x3d'/>
<meta name='descriptioncontent='Demonstrate multiple instances of an external prototype.'/>
<meta name='hintcontent='Learning suggestion for authors: try changing the modulation script so that it goes from [0 ... 1] and then [1 ... 0] alternating, rather than abruptly shifting from 1 immediately back to 0.'/>
<meta name='creatorcontent='Don Brutzman'/>
<meta name='createdcontent='7 September 2017'/>
<meta name='modifiedcontent='20 October 2019'/>
<meta name='subjectcontent='X3D prototype instances DEF USE'/>
<meta name='Imagecontent='MaterialModulator.png'/>
<meta name='Imagecontent='MaterialModulatorExamples.png'/>
<meta name='identifiercontent=' https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/MaterialModulatorExamples.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../license.html'/>
</head>
<!--

Index for ExternProtoDeclare definition : MaterialModulator

Index for DEF nodes : EventToggler, MaterialModulatorInstance, ModulatingBoxShape, TextAppearance, TouchTextInterface
-->
<Scene>
<WorldInfo title='MaterialModulatorExamples.x3d'/>
<ExternProtoDeclare name='MaterialModulatorappinfo='mimic a Material node and modulate the diffuseColor field as an animation effect' documentation=' https://x3dgraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/MaterialModulatorIndex.html '
  url=' "MaterialModulator.x3d#MaterialModulator" "https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/MaterialModulator.x3d#MaterialModulator" '>
<field name='enabledtype='SFBoolaccessType='inputOutput'
 appinfo='default value true'/>

<field name='diffuseColortype='SFColoraccessType='inputOutput'
 appinfo='default value 0.8 0.8 0.8'/>

<field name='emissiveColortype='SFColoraccessType='inputOutput'
 appinfo='default value 0 0 0'/>

<field name='specularColortype='SFColoraccessType='inputOutput'
 appinfo='default value 0 0 0'/>

<field name='transparencytype='SFFloataccessType='inputOutput'
 appinfo='default value 0.0'/>

<field name='shininesstype='SFFloataccessType='inputOutput'
 appinfo='default value 0.2'/>

<field name='ambientIntensitytype='SFFloataccessType='inputOutput'
 appinfo='default value 0.2'/>
</ExternProtoDeclare>
<!-- Rendered geometry for the ProtoInstance now follows external prototype declaration -->
<Transform rotation='-0.8 0.93923 0.18785 5.759586translation='-2 1 0'>
<Shape DEF='ModulatingBoxShape'>
<Box/>
<Appearance>
<!-- ROUTE information for MaterialModulatorInstance node:  [from EventToggler.toggle to enabled ] -->
<ProtoInstance name='MaterialModulatorDEF='MaterialModulatorInstancecontainerField='material'>
<fieldValue name='enabledvalue='true'/>
<fieldValue name='diffuseColorvalue='0.5 0.1 0.1'/>
<!-- fieldValue declarations for other Material attributes can appear here -->
</ProtoInstance>
</Appearance>
</Shape>
</Transform>
<Transform rotation='1 0 0 0.523599translation='2 1 0'>
<Shape>
<Cylinder/>
<Appearance>
<!-- note that ProtoInstance USE does not require name='MaterialModulator' -->
<ProtoInstance USE='MaterialModulatorInstancecontainerField='material'/>
</Appearance>
</Shape>
</Transform>
<Transform translation='-2 3.5 0'>
<Shape>
<Text string='"DEF original"'>
<FontStyle family='"SANS"justify='"MIDDLE" "MIDDLE"size='0.5style='BOLD'/>
</Text>
<Appearance DEF='TextAppearance'>
<Material diffuseColor='0.9 0.9 0.9'/>
</Appearance>
</Shape>
</Transform>
<Transform translation='2 3.5 0'>
<Shape>
<Text string='"USE copy"'>
<FontStyle family='"SANS"justify='"MIDDLE" "MIDDLE"size='0.5style='BOLD'/>
</Text>
<Appearance USE='TextAppearance'/>
</Shape>
</Transform>
<Transform translation='0 -2 0'>
<Shape>
<Text string=' "enable/disable"
"MaterialModulator"
'>
<FontStyle family='"SANS"justify='"MIDDLE" "MIDDLE"style='BOLD'/>
</Text>
<Appearance USE='TextAppearance'/>
</Shape>
<!-- Selectable Text design pattern has transparent Box and TouchSensor description as a tooltip -->
<Shape>
<Box size='8 2 .001'/>
<Appearance>
<Material transparency='1'/>
</Appearance>
</Shape>
<!-- Toggle text to enable/disable MaterialModulator -->
<!-- ROUTE information for TouchTextInterface node:  [from isActive to EventToggler.set_boolean ] -->
<TouchSensor DEF='TouchTextInterfacedescription='Select text to enable/disable MaterialModulator'/>
<!-- ROUTE information for EventToggler node:  [from TouchTextInterface.isActive to set_boolean ] [from toggle to MaterialModulatorInstance.enabled ] -->
<BooleanToggle DEF='EventTogglercontainerField='children'/>
<ROUTE fromNode='TouchTextInterfacefromField='isActivetoNode='EventTogglertoField='set_boolean'/>
<ROUTE fromNode='EventTogglerfromField='toggletoNode='MaterialModulatorInstancetoField='enabled'/>
</Transform>
</Scene>
</X3D>
<!--

Index for ExternProtoDeclare definition : MaterialModulator

Index for DEF nodes : EventToggler, MaterialModulatorInstance, ModulatingBoxShape, TextAppearance, TouchTextInterface
-->

<!-- 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)
    <Prototype name='ProtoName'> <field name='fieldName'/> </Prototype> -->

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