X3D Model Documentation: PixelTextureInterpolatorPrototype.x3d

  1  <?xml version="1.0" encoding="UTF-8"?>
  2  <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.1//EN" "https://www.web3d.org/specifications/x3d-3.1.dtd">
  3  <X3D profile='Immersive' version='3.1 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.1.xsd'>
  4       <head>
  5            <meta name='titlecontent='PixelTextureInterpolatorPrototype.x3d'/>
  6            <meta name='descriptioncontent='Create Script prototype to modify a PixelTexture as an image morph'/>
  7            <meta name='creatorcontent='Don Brutzman'/>
  8            <meta name='createdcontent='14 April 2008'/>
  9            <meta name='modifiedcontent='20 October 2019'/>
 10            <meta name=' warning content=' under development '/>
 11            <meta name='subjectcontent='2D image PixelTexture morph'/>
 12            <meta name='identifiercontent='https://savage.nps.edu/Savage/Tools/Authoring/PixelTextureInterpolatorPrototype.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: ImageInterpolatorScript, PixelColors, PixelTextureInterpolatorExample, Time

Index for ProtoDeclare definition: PixelTextureInterpolator
-->
 16       <Scene>
 17            <WorldInfo title='PixelTextureInterpolatorPrototype.x3d'/>
 18            <ProtoDeclare name='PixelTextureInterpolator'>
 19                 <ProtoInterface>
 20                      <field name='set_fractiontype='SFFloataccessType='inputOnly'/>
 21                      <field name='keytype='MFFloataccessType='initializeOnly'/>
 22                      <field name='keyValuetype='MFNodeaccessType='initializeOnly'/>
 23                      <field name='value_changedtype='SFImageaccessType='outputOnly'/>
 24                      <field name='traceEnabledtype='SFBoolvalue='trueaccessType='initializeOnly'
                     appinfo='enable console output to trace script computations and prototype progress'/>
 25                 </ProtoInterface>
 26                 <ProtoBody>
 27                      <!-- First node determines node type of prototype -->
 28                      <Script DEF='ImageInterpolatorScript'   url=' "PixelTextureInterpolator.js" "https://savage.nps.edu/Savage/Tools/Authoring/PixelTextureInterpolator.js" '>
 29                           <field name='set_fractiontype='SFFloataccessType='inputOnly'/>
 30                           <field name='keytype='MFFloataccessType='initializeOnly'/>
 31                           <field name='keyValuetype='MFNodeaccessType='initializeOnly'>
 32                                <!-- initialization nodes (if any) go here -->
 33                           </field>
 34                           <field name='value_changedtype='SFImageaccessType='outputOnly'/>
 35                           <field name='traceEnabledtype='SFBoolaccessType='initializeOnly'/>
 36                           <IS>
 37                                <connect nodeField='set_fractionprotoField='set_fraction'/>
 38                                <connect nodeField='keyprotoField='key'/>
 39                                <connect nodeField='keyValueprotoField='keyValue'/>
 40                                <connect nodeField='value_changedprotoField='value_changed'/>
 41                                <connect nodeField='traceEnabledprotoField='traceEnabled'/>
 42                           </IS>
 43                      </Script>
 44                      <!-- Subsequent nodes do not render, but still must be a valid X3D subgraph -->
 45                 </ProtoBody>
 46            </ProtoDeclare>
 47            <!-- renderable scene graph begins here -->
 48            <Shape>
 49                 <Box/>
 50                 <Appearance>
 51 
                    <!-- ROUTE information for PixelColors node:  [from PixelTextureInterpolatorExample.value_changed to image ] -->
                    <PixelTexture DEF='PixelColorsimage='2 4 3 0xff0000 0xffff00 0x007700 0xff0077 0x0000ff 0xff7700 0x00ff77 0x888888'/>
 52                 </Appearance>
 53            </Shape>
 54            <!-- set of images, interpolated as a 2D morph -->
 55 
          <!-- ROUTE information for PixelTextureInterpolatorExample node:  [from Time.fraction_changed to set_fraction ] [from value_changed to PixelColors.image ] -->
          <ProtoInstance name='PixelTextureInterpolatorDEF='PixelTextureInterpolatorExample'>
 56                 <fieldValue name='keyvalue='0 0.25 0.5 0.75 1'/>
 57                 <fieldValue name='keyValue'>
 58                      <!-- rotate two image values in each PixelTexture -->
 59                      <PixelTexture image='2 4 3 0xff0000 0xffff00 0x007700 0xff0077 0x0000ff 0xff7700 0x00ff77 0x888888'/>
 60                      <PixelTexture image='2 4 3 0x007700 0xff0077 0x0000ff 0xff7700 0x00ff77 0x888888 0xff0000 0xffff00'/>
 61                      <PixelTexture image='2 4 3 0x0000ff 0xff7700 0x00ff77 0x888888 0xff0000 0xffff00 0x007700 0xff0077'/>
 62                      <PixelTexture image='2 4 3 0x00ff77 0x888888 0xff0000 0xffff00 0x007700 0xff0077 0x0000ff 0xff7700'/>
 63                      <!-- last PixelTexture matches first, would like to DEF and USE within a fieldValue initialization -->
 64                      <PixelTexture image='2 4 3 0xff0000 0xffff00 0x007700 0xff0077 0x0000ff 0xff7700 0x00ff77 0x888888'/>
 65                 </fieldValue>
 66                 <fieldValue name='traceEnabledvalue='true'/>
 67            </ProtoInstance>
 68 
          <!-- ROUTE information for Time node:  [from fraction_changed to PixelTextureInterpolatorExample.set_fraction ] -->
          <TimeSensor DEF='TimecycleInterval='4'/>
 69            < ROUTE  fromNode='PixelTextureInterpolatorExample' fromField='value_changed' toNode='PixelColors' toField='image'/>
 70            < ROUTE  fromNode='Time' fromField='fraction_changed' toNode='PixelTextureInterpolatorExample' toField='set_fraction'/>
 71       </Scene>
 72  </X3D>
<!--

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

<!-- to top Index for DEF nodes: ImageInterpolatorScript, PixelColors, PixelTextureInterpolatorExample, Time

Index for ProtoDeclare definition: PixelTextureInterpolator
-->
X3D Tooltips element index: Appearance, Box, connect, field, fieldValue, head, IS, meta, PixelTexture, ProtoBody, ProtoDeclare, ProtoInstance, ProtoInterface, ROUTE, Scene, Script, Shape, TimeSensor, WorldInfo, X3D, accessType and type, XML data types, field types

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.

Time
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(1)
PixelTextureInterpolatorExample
ProtoInstance
set_fraction
SFFloat
then
 
 
 
PixelTextureInterpolatorExample
ProtoInstance
value_changed
SFImage

ROUTE
event to
(2)
PixelColors
PixelTexture
image
SFImage

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://savage.nps.edu/Savage/Tools/Authoring/PixelTextureInterpolatorPrototypeIndex.html -->
<!-- Version control at
https://gitlab.nps.edu/Savage/Savage/Tools/Authoring/PixelTextureInterpolatorPrototype.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)
    <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. -->