X3D Model Documentation: MaterialToggleExample.x3d

  1  <?xml version="1.0" encoding="UTF-8"?>
  2 
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
  3  <X3D profile='Immersive' version='3.0 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.0.xsd'>
  4       <head>
  5            <meta name='titlecontent=' MaterialToggleExample.x3d '/>
  6            <meta name='descriptioncontent='Example for toggle-able Material node that can switch between 2 sets of material values, selectable at run time.'/>
  7            <meta name='creatorcontent='Don Brutzman and MV4205 class'/>
  8            <meta name='createdcontent='2 May 2004'/>
  9            <meta name='modifiedcontent='28 November 2019'/>
 10            <meta name='referencecontent=' MaterialTogglePrototype.x3d '/>
 11            <meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/MaterialToggleExample.x3d '/>
 12            <meta name='generatorcontent='X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit'/>
 13            <meta name='licensecontent='../../license.html'/>
 14       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top DEF nodes index: MT, TS

Index for Viewpoint node: Viewpoint_1

Index for ExternProtoDeclare definition: MaterialToggle
-->
 15       <Scene>
 16            <WorldInfo title='MaterialToggleExample.x3d'/>
 17            <ExternProtoDeclare name='MaterialToggleappinfo='MaterialToggle selects one of two different Material values'   url=' "MaterialTogglePrototype.x3d#MaterialToggle" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/MaterialTogglePrototype.x3d#MaterialToggle" "MaterialTogglePrototype.wrl#MaterialToggle" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/MaterialTogglePrototype.wrl#MaterialToggle" '>
 18                 <field name='set_toggletype='SFBoolaccessType='inputOnly'/>
 19                 <field name='toggletype='SFBoolaccessType='initializeOnly'
                appinfo='whether to use DefaultMaterial or ToggleMaterial'/>
 20                 <field name='toggle_changedtype='SFBoolaccessType='outputOnly'/>
 21                 <field name='defaultMaterialtype='SFNodeaccessType='initializeOnly'
                appinfo='Material node that is enabled when toggle=false'/>
 22                 <field name='toggleMaterialtype='SFNodeaccessType='initializeOnly'
                appinfo='Material node that is enabled when toggle=true'/>
 23                 <field name='set_defaultMaterialtype='SFNodeaccessType='inputOnly'
                appinfo='provide replacement default Material node'/>
 24                 <field name='set_toggleMaterialtype='SFNodeaccessType='inputOnly'
                appinfo='provide replacement toggle Material node'/>
 25            </ExternProtoDeclare>
 26            <!-- ==================== -->
 27            <Viewpoint description='touch box to toggle materialorientation='1 0 0 -0.79position='0 5 5'/>
 28            <Transform rotation='0 1 0 0.79'>
 29                 <Shape>
 30                      <Box/>
 31                      <Appearance>
 32 
                         <!-- ROUTE information for MT node:  [from TS.isActive to set_toggle ] -->
                         <ProtoInstance name='MaterialToggleDEF='MTcontainerField='material'>
 33                                <fieldValue name='togglevalue='true'/>
 34                                <fieldValue name='defaultMaterial'>
 35                                     <Material ambientIntensity='0.24diffuseColor='1 0.452381 0.40339shininess='0.9specularColor='0.686486 0.396903 0.419275'>
 36                                          <!-- Universal Media Library: ArtDeco 3 -->
 37                                     </Material>
 38                                </fieldValue>
 39                                <fieldValue name='toggleMaterial'>
 40                                     <Material ambientIntensity='0.24diffuseColor='0.330519 0.3389 0.6shininess='0.78specularColor='0.290909 0.290909 0.290909'>
 41                                          <!-- Universal Media Library: ArtDeco 8 -->
 42                                     </Material>
 43                                </fieldValue>
 44                           </ProtoInstance>
 45                      </Appearance>
 46                 </Shape>
 47 
               <!-- ROUTE information for TS node:  [from isActive to MT.set_toggle ] -->
               <TouchSensor DEF='TSdescription='touch to toggle'/>
 48                 < ROUTE  fromNode='TS' fromField='isActive' toNode='MT' toField='set_toggle'/>
 49            </Transform>
 50       </Scene>
 51  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top DEF nodes index: MT, TS

Index for Viewpoint node: Viewpoint_1

Index for ExternProtoDeclare definition: MaterialToggle
-->
X3D Tooltips element index: Appearance, Box, ExternProtoDeclare, field, fieldValue, head, Material, meta, ProtoInstance, ROUTE, Scene, Shape, TouchSensor, Transform, Viewpoint, WorldInfo, X3D, plus documentation for accessType definitions, type definitions, XML data types, and field types

Event Graph ROUTE Table with 1 ROUTE connection 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.

TS
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
MT
ProtoInstance
set_toggle
SFBool

      MT
ProtoInstance
MaterialToggle
No direct ROUTE connection found for events to/from this node.
This ProtoInstance contains SFNode/MFNode fieldValue declarations with
direct access to other nodes, and thus has potential to produce run-time animation. 

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/Savage/Tools/Animation/MaterialToggleExampleIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Savage/Tools/Animation/MaterialToggleExample.x3d -->

<!-- Color-coding legend: X3D terminology <X3dNode  DEF='idNamefield='value'/> matches XML terminology <XmlElement  DEF='idNameattribute='value'/>
(Light-blue background: event-based behavior node or statement) (Grey background inside box: inserted documentation) (Magenta background: X3D Extensibility)
    <ProtoInstance name='ProtoName'> <field name='fieldName'/> </ProtoInstance> -->

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