| 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='title' content=' PixelTextureInterpolatorPrototype.x3d '/> |
| 6 | <meta name='description' content='Create Script prototype to modify a PixelTexture as an image morph'/> |
| 7 | <meta name='creator' content='Don Brutzman'/> |
| 8 | <meta name='created' content='14 April 2008'/> |
| 9 | <meta name='modified' content='20 October 2019'/> |
| 10 | <meta name=' warning ' content=' under development '/> |
| 11 | <meta name='subject' content='2D image PixelTexture morph'/> |
| 12 | <meta name='identifier' content=' https://savage.nps.edu/Savage/Tools/Authoring/PixelTextureInterpolatorPrototype.x3d '/> |
| 13 | <meta name='generator' content='X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
| 14 | <meta name='license' content='../license.html'/> |
| 15 | </head> |
| 16 | <Scene> |
| 17 | <WorldInfo title='PixelTextureInterpolatorPrototype.x3d'/> |
| 18 | <ProtoDeclare name='PixelTextureInterpolator'> |
| 19 | <ProtoInterface> |
| 20 | <field name='set_fraction' type='SFFloat' accessType='inputOnly'/> |
| 21 | <field name='key' type='MFFloat' accessType='initializeOnly'/> |
| 22 | <field name='keyValue' type='MFNode' accessType='initializeOnly'/> |
| 23 | <field name='value_changed' type='SFImage' accessType='outputOnly'/> |
| 24 |
<field name='traceEnabled' type='SFBool' value='true' accessType='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_fraction' type='SFFloat' accessType='inputOnly'/> |
| 30 | <field name='key' type='MFFloat' accessType='initializeOnly'/> |
| 31 | <field name='keyValue' type='MFNode' accessType='initializeOnly'> |
| 32 | <!-- initialization nodes (if any) go here --> |
| 33 | </field> |
| 34 | <field name='value_changed' type='SFImage' accessType='outputOnly'/> |
| 35 | <field name='traceEnabled' type='SFBool' accessType='initializeOnly'/> |
| 36 | <IS> |
| 37 | <connect nodeField='set_fraction' protoField='set_fraction'/> |
| 38 | <connect nodeField='key' protoField='key'/> |
| 39 | <connect nodeField='keyValue' protoField='keyValue'/> |
| 40 | <connect nodeField='value_changed' protoField='value_changed'/> |
| 41 | <connect nodeField='traceEnabled' protoField='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='PixelColors' image='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='PixelTextureInterpolator' DEF='PixelTextureInterpolatorExample'> |
| 56 | <fieldValue name='key' value='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='traceEnabled' value='true'/> |
| 67 | </ProtoInstance> |
| 68 |
<!-- ROUTE information for Time node:
[from fraction_changed to PixelTextureInterpolatorExample.set_fraction
]
-->
<TimeSensor DEF='Time' cycleInterval='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 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 |
PixelTextureInterpolatorExample
ProtoInstance set_fraction SFFloat |
then
|
PixelTextureInterpolatorExample
ProtoInstance value_changed SFImage |
PixelColors
PixelTexture image SFImage |
|
PixelTextureInterpolatorExample
ProtoInstance value_changed SFImage |
PixelColors
PixelTexture image SFImage |
<!--
Color-coding 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>
-->
<!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->