<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.2//EN" "https://www.web3d.org/specifications/x3d-3.2.dtd">
<X3D profile='Immersive'  version='3.2 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation =' https://www.web3d.org/specifications/x3d-3.2.xsd ' >
<head>
<meta name='titlecontent=' TestPrototypeInterpolators.x3d '/>
<meta name='descriptioncontent='Test case for Prototype PositionInterpolator OrientationInterpolator, expected behavior: is for both sets of test Text to move identically.'/>
<meta name='creatorcontent='Don Brutzman and Jeff Weekley'/>
<meta name='createdcontent='4 April 2009'/>
<meta name='modifiedcontent='20 October 2019'/>
<meta name='referencecontent=' https://savage.nps.edu/Savage/Tools/Animation/WaypointInterpolatorPrototype.x3d '/>
<meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/Basic/development/TestPrototypeInterpolators.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../license.html'/>
</head>
<!-- -->
<Scene>
<WorldInfo title='TestPrototypeInterpolators.x3d'/>
<ProtoDeclare name='InterpolatorTestappinfo='Test output of PositionInterpolator, OrientationInterpolator when within Protototype' >
<ProtoInterface>
<field name='set_fractiontype='SFFloataccessType='inputOnly'
 appinfo='exposed PositionInterpolator and OrientationInterpolator setting' />

<field name='position_changedtype='SFVec3faccessType='outputOnly'
 appinfo='exposed PositionInterpolator setting' />

<field name='orientation_changedtype='SFRotationaccessType='outputOnly'
 appinfo='exposed OrientationInterpolator setting' />
</ProtoInterface>
<ProtoBody>
<!-- First node determines node type of this prototype -->
<Group DEF='PrototypeRootNode'>
<!-- ROUTE information for WaypointPI node:  [from value_changed to InternalTraceScript.set_position ] -->
<PositionInterpolator DEF='WaypointPIkey='0 0.5 1keyValue='0 0 0 1 1 1 2 2 2'>
<IS>
<connect nodeField='set_fractionprotoField='set_fraction'/>
<connect nodeField='value_changedprotoField='position_changed'/>
</IS>
</PositionInterpolator>
<!-- ROUTE information for WaypointOI node:  [from value_changed to InternalTraceScript.set_rotation ] -->
<OrientationInterpolator DEF='WaypointOIkey='0 0.5 1keyValue='0 1 0 0 0.7071 0.7071 0 3.1416 0 1 0 0'>
<IS>
<connect nodeField='set_fractionprotoField='set_fraction'/>
<connect nodeField='value_changedprotoField='orientation_changed'/>
</IS>
</OrientationInterpolator>
</Group>
<!-- Subsequent nodes do not render, but still must be a valid X3D subgraph -->
<!-- ROUTE information for InternalTraceScript node:  [from WaypointPI.value_changed to set_position ] [from WaypointOI.value_changed to set_rotation ] -->
<Script DEF='InternalTraceScript'>
<field name='set_positiontype='SFVec3faccessType='inputOnly'/>
<field name='holdPositiontype='SFVec3fvalue='0.0 0.0 0.0accessType='inputOutput'/>
<field name='set_rotationtype='SFRotationaccessType='inputOnly'/>
<![CDATA[
          
ecmascript:
function set_position (value)
{
	holdPosition=value;
}
function set_rotation (value)
{
	Browser.println ('Internal position=' + holdPosition.toString() + ' , internal rotation=' + value.toString());
}

        
]]>
</Script>
< ROUTE  fromNode=' WaypointPI' fromField='value_changed' toNode=' InternalTraceScript' toField='set_position'/>
< ROUTE  fromNode=' WaypointOI' fromField='value_changed' toNode=' InternalTraceScript' toField='set_rotation'/>
</ProtoBody>
</ProtoDeclare>
<!-- ===================================== -->

<!-- ===================================== -->

<Transform DEF='LeftTexttranslation='-3 0 0'>
< ROUTE  fromNode=' Clock' fromField='fraction_changed' toNode=' InterpolatorTestInstance' toField='set_fraction'/>
< ROUTE  fromNode=' InterpolatorTestInstance' fromField='position_changed' toNode=' TrackingTransformLeft' toField='translation'/>
< ROUTE  fromNode=' InterpolatorTestInstance' fromField='orientation_changed' toNode=' TrackingTransformLeft' toField='rotation'/>
<Shape>
<Text string='"prototype interpolators"'>
<FontStyle justify='"MIDDLE" "MIDDLE"'/>
</Text>
<Appearance>
<Material diffuseColor='0.8 0.2 0.2'/>
</Appearance>
</Shape>
</Transform>
</Transform>
<!-- ===================================== -->
<!-- ROUTE information for ActualPositionInterpolator node:  [from Clock.fraction_changed to set_fraction ] [from value_changed to TrackingTransformRight.translation ] [from value_changed to ExternalTraceScript.set_position ] -->
<PositionInterpolator DEF='ActualPositionInterpolatorkey='0 0.5 1keyValue='0 0 0 1 1 1 2 2 2'/>

<!-- ROUTE information for ActualOrientationInterpolator node:  [from Clock.fraction_changed to set_fraction ] [from value_changed to TrackingTransformRight.rotation ] [from value_changed to ExternalTraceScript.set_rotation ] -->
<OrientationInterpolator DEF='ActualOrientationInterpolatorkey='0 0.5 1keyValue='0 1 0 0 0.7071 0.7071 0 3.1416 0 1 0 0'/>

<Transform DEF='RightTexttranslation='-3 -2 0'>
< ROUTE  fromNode=' Clock' fromField='fraction_changed' toNode=' ActualPositionInterpolator' toField='set_fraction'/>
< ROUTE  fromNode=' Clock' fromField='fraction_changed' toNode=' ActualOrientationInterpolator' toField='set_fraction'/>
< ROUTE  fromNode=' ActualPositionInterpolator' fromField='value_changed' toNode=' TrackingTransformRight' toField='translation'/>
< ROUTE  fromNode=' ActualOrientationInterpolator' fromField='value_changed' toNode=' TrackingTransformRight' toField='rotation'/>
<Shape>
<Text string='"native interpolators"'/>
<Appearance>
<Material diffuseColor='0.2 0.8 0.2'/>
</Appearance>
</Shape>
</Transform>
</Transform>
<field name='set_positiontype='SFVec3faccessType='inputOnly'/>
<field name='holdPositiontype='SFVec3fvalue='0.0 0.0 0.0accessType='inputOutput'/>
<field name='set_rotationtype='SFRotationaccessType='inputOnly'/>
<![CDATA[
      
ecmascript:
function set_position (value)
{
	holdPosition=value;
}
function set_rotation (value)
{
	 Browser.println ('External position=' + holdPosition.toString() + ' , external rotation=' + value.toString());
}

    
]]>
</Script>
< ROUTE  fromNode=' ActualPositionInterpolator' fromField='value_changed' toNode=' ExternalTraceScript' toField='set_position'/>
< ROUTE  fromNode=' ActualOrientationInterpolator' fromField='value_changed' toNode=' ExternalTraceScript' toField='set_rotation'/>
</Scene>
</X3D>
<!--

to top <!-- Event Graph ROUTE Table shows event connections -->
 
<!-- Index for DEF nodes: ActualOrientationInterpolator, ActualPositionInterpolator, Clock, ExternalTraceScript, InternalTraceScript, InterpolatorTestInstance, LeftText, PrototypeRootNode, RightText, TrackingTransformLeft, TrackingTransformRight, WaypointOI, WaypointPI

Index for ProtoDeclare definition: InterpolatorTest
-->

Event Graph ROUTE Table entries with 11 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.

Clock
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(1)
InterpolatorTestInstance
ProtoInstance
set_fraction
SFFloat

 
 
then
InterpolatorTestInstance
ProtoInstance
orientation_changed
SFRotation

ROUTE
event to
(2)
TrackingTransformLeft
Transform
rotation
SFRotation
 
 
 
then
InterpolatorTestInstance
ProtoInstance
position_changed
SFVec3f

ROUTE
event to
(2)
TrackingTransformLeft
Transform
translation
SFVec3f
Clock
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(1)
ActualPositionInterpolator
PositionInterpolator
set_fraction
SFFloat

 
 
then
ActualPositionInterpolator
PositionInterpolator
value_changed
SFVec3f

ROUTE
event to
(2)
TrackingTransformRight
Transform
translation
SFVec3f
 
 
 
then
ActualPositionInterpolator
PositionInterpolator
value_changed
SFVec3f

ROUTE
event to
(2)
ExternalTraceScript
Script
set_position
SFVec3f
Clock
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(1)
ActualOrientationInterpolator
OrientationInterpolator
set_fraction
SFFloat

 
 
then
ActualOrientationInterpolator
OrientationInterpolator
value_changed
SFRotation

ROUTE
event to
(2)
TrackingTransformRight
Transform
rotation
SFRotation
 
 
 
then
ActualOrientationInterpolator
OrientationInterpolator
value_changed
SFRotation

ROUTE
event to
(2)
ExternalTraceScript
Script
set_rotation
SFRotation


      InterpolatorTestInstance
ProtoInstance
position_changed
SFVec3f

ROUTE
event to
(1)
TrackingTransformLeft
Transform
translation
SFVec3f
InterpolatorTestInstance
ProtoInstance
orientation_changed
SFRotation

ROUTE
event to
(1)
TrackingTransformLeft
Transform
rotation
SFRotation


-->

<!-- Online at
https://www.web3d.org/x3d/content/examples/Basic/development/TestPrototypeInterpolatorsIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Basic/development/TestPrototypeInterpolators.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. -->