<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.1//EN" "https://www.web3d.org/specifications/x3d-3.1.dtd">
<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 ' >
<head>
<meta name='titlecontent=' PixelTextureInterpolatorPrototype.x3d '/>
<meta name='descriptioncontent='Create Script prototype to modify a PixelTexture as an image morph'/>
<meta name='creatorcontent='Don Brutzman'/>
<meta name='createdcontent='14 April 2008'/>
<meta name='modifiedcontent='20 October 2019'/>
<meta name=' warning content=' under development '/>
<meta name='subjectcontent='2D image PixelTexture morph'/>
<meta name='identifiercontent=' https://savage.nps.edu/Savage/Tools/Authoring/PixelTextureInterpolatorPrototype.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.3, 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: ImageInterpolatorScript, PixelColors, PixelTextureInterpolatorExample, Time

Index for ProtoDeclare definition: PixelTextureInterpolator
-->
<Scene>
<WorldInfo title='PixelTextureInterpolatorPrototype.x3d'/>
<ProtoDeclare name='PixelTextureInterpolator'>
<ProtoInterface>
<field name='set_fractiontype='SFFloataccessType='inputOnly'/>
<field name='keytype='MFFloataccessType='initializeOnly'/>
<field name='keyValuetype='MFNodeaccessType='initializeOnly'/>
<field name='value_changedtype='SFImageaccessType='outputOnly'/>
<field name='traceEnabledtype='SFBoolvalue='trueaccessType='initializeOnly'
 appinfo='enable console output to trace script computations and prototype progress' />
</ProtoInterface>
<ProtoBody>
<!-- First node determines node type of prototype -->
<Script DEF='ImageInterpolatorScript'
  url=' "PixelTextureInterpolator.js" "https://savage.nps.edu/Savage/Tools/Authoring/PixelTextureInterpolator.js" ' >
<field name='set_fractiontype='SFFloataccessType='inputOnly'/>
<field name='keytype='MFFloataccessType='initializeOnly'/>
<field name='keyValuetype='MFNodeaccessType='initializeOnly'>
<!-- initialization nodes (if any) go here -->
</field>
<field name='value_changedtype='SFImageaccessType='outputOnly'/>
<field name='traceEnabledtype='SFBoolaccessType='initializeOnly'/>
<IS>
<connect nodeField='set_fractionprotoField='set_fraction'/>
<connect nodeField='keyprotoField='key'/>
<connect nodeField='keyValueprotoField='keyValue'/>
<connect nodeField='value_changedprotoField='value_changed'/>
<connect nodeField='traceEnabledprotoField='traceEnabled'/>
</IS>
</Script>
<!-- Subsequent nodes do not render, but still must be a valid X3D subgraph -->
</ProtoBody>
</ProtoDeclare>
<!-- renderable scene graph begins here -->
<Shape>
<Box/>
<Appearance>
<!-- 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'/>
</Appearance>
</Shape>
<!-- set of images, interpolated as a 2D morph -->
<!-- ROUTE information for PixelTextureInterpolatorExample node:  [from Time.fraction_changed to set_fraction ] [from value_changed to PixelColors.image ] -->
<ProtoInstance name='PixelTextureInterpolatorDEF='PixelTextureInterpolatorExample'>
<fieldValue name='keyvalue='0 0.25 0.5 0.75 1'/>
<fieldValue name='keyValue'>
<!-- rotate two image values in each PixelTexture -->
<PixelTexture image='2 4 3 0xff0000 0xffff00 0x007700 0xff0077 0x0000ff 0xff7700 0x00ff77 0x888888'/>
<PixelTexture image='2 4 3 0x007700 0xff0077 0x0000ff 0xff7700 0x00ff77 0x888888 0xff0000 0xffff00'/>
<PixelTexture image='2 4 3 0x0000ff 0xff7700 0x00ff77 0x888888 0xff0000 0xffff00 0x007700 0xff0077'/>
<PixelTexture image='2 4 3 0x00ff77 0x888888 0xff0000 0xffff00 0x007700 0xff0077 0x0000ff 0xff7700'/>
<!-- last PixelTexture matches first, would like to DEF and USE within a fieldValue initialization -->
<PixelTexture image='2 4 3 0xff0000 0xffff00 0x007700 0xff0077 0x0000ff 0xff7700 0x00ff77 0x888888'/>
</fieldValue>
<fieldValue name='traceEnabledvalue='true'/>
</ProtoInstance>
<!-- ROUTE information for Time node:  [from fraction_changed to PixelTextureInterpolatorExample.set_fraction ] -->
<TimeSensor DEF='TimecycleInterval='4'/>

< ROUTE  fromNode=' PixelTextureInterpolatorExample' fromField='value_changed' toNode=' PixelColors' toField='image'/>
< ROUTE  fromNode=' Time' fromField='fraction_changed' toNode=' PixelTextureInterpolatorExample' toField='set_fraction'/>
</Scene>
</X3D>
<!--

to top <!-- Event Graph ROUTE Table shows event connections -->
 
<!-- Index for DEF nodes: ImageInterpolatorScript, PixelColors, PixelTextureInterpolatorExample, Time

Index for ProtoDeclare definition: PixelTextureInterpolator
-->

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


      PixelTextureInterpolatorExample
ProtoInstance
value_changed
SFImage

ROUTE
event to
(1)
PixelColors
PixelTexture
image
SFImage


-->

<!-- 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. -->