X3D Model Documentation: TestPrototypeInterpolators.x3d

  1  <?xml version="1.0" encoding="UTF-8"?>
  2  <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.2//EN" "https://www.web3d.org/specifications/x3d-3.2.dtd">
  3  <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'>
  4       <head>
  5            <meta name='titlecontent='TestPrototypeInterpolators.x3d'/>
  6            <meta name='descriptioncontent='Test case for Prototype PositionInterpolator OrientationInterpolator, expected behavior: is for both sets of test Text to move identically.'/>
  7            <meta name='creatorcontent='Don Brutzman and Jeff Weekley'/>
  8            <meta name='createdcontent='4 April 2009'/>
  9            <meta name='modifiedcontent='20 October 2019'/>
 10            <meta name='referencecontent='https://savage.nps.edu/Savage/Tools/Animation/WaypointInterpolatorPrototype.x3d'/>
 11            <meta name='identifiercontent='https://www.web3d.org/x3d/content/examples/Basic/development/TestPrototypeInterpolators.x3d'/>
 12            <meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
 13            <meta name='licensecontent='../license.html'/>
 14       </head>
<!--

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

<!-- to top Index for DEF nodes: ActualOrientationInterpolator, ActualPositionInterpolator, Clock, ExternalTraceScript, InternalTraceScript, InterpolatorTestInstance, LeftText, PrototypeRootNode, RightText, TrackingTransformLeft, TrackingTransformRight, WaypointOI, WaypointPI

Index for ProtoDeclare definition: InterpolatorTest
-->
 15       <Scene>
 16            <WorldInfo title='TestPrototypeInterpolators.x3d'/>
 17            <ProtoDeclare name='InterpolatorTestappinfo='Test output of PositionInterpolator, OrientationInterpolator when within Protototype'>
 18                 <ProtoInterface>
 19                      <field name='set_fractiontype='SFFloataccessType='inputOnly'
                     appinfo='exposed PositionInterpolator and OrientationInterpolator setting'/>
 20                      <field name='position_changedtype='SFVec3faccessType='outputOnly'
                     appinfo='exposed PositionInterpolator setting'/>
 21                      <field name='orientation_changedtype='SFRotationaccessType='outputOnly'
                     appinfo='exposed OrientationInterpolator setting'/>
 22                 </ProtoInterface>
 23                 <ProtoBody>
 24                      <!-- First node determines node type of this prototype -->
 25                      <Group DEF='PrototypeRootNode'>
 26 
                         <!-- 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'>
 27                                <IS>
 28                                     <connect nodeField='set_fractionprotoField='set_fraction'/>
 29                                     <connect nodeField='value_changedprotoField='position_changed'/>
 30                                </IS>
 31                           </PositionInterpolator>
 32 
                         <!-- 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'>
 33                                <IS>
 34                                     <connect nodeField='set_fractionprotoField='set_fraction'/>
 35                                     <connect nodeField='value_changedprotoField='orientation_changed'/>
 36                                </IS>
 37                           </OrientationInterpolator>
 38                      </Group>
 39                      <!-- Subsequent nodes do not render, but still must be a valid X3D subgraph -->
 40 
                    <!-- ROUTE information for InternalTraceScript node:  [from WaypointPI.value_changed to set_position ] [from WaypointOI.value_changed to set_rotation ] -->
                    <Script DEF='InternalTraceScript'>
 41                           <field name='set_positiontype='SFVec3faccessType='inputOnly'/>
 42                           <field name='holdPositiontype='SFVec3fvalue='0.0 0.0 0.0accessType='inputOutput'/>
 43                           <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());
}

        
]]>
 45                      </Script>
 46                      < ROUTE  fromNode='WaypointPI' fromField='value_changed' toNode='InternalTraceScript' toField='set_position'/>
 47                      < ROUTE  fromNode='WaypointOI' fromField='value_changed' toNode='InternalTraceScript' toField='set_rotation'/>
 48                 </ProtoBody>
 49            </ProtoDeclare>
 50            <!-- ===================================== -->
 51 
          <!-- ROUTE information for Clock node:  [from fraction_changed to InterpolatorTestInstance.set_fraction ] [from fraction_changed to ActualPositionInterpolator.set_fraction ] [from fraction_changed to ActualOrientationInterpolator.set_fraction ] -->
          <TimeSensor DEF='ClockcycleInterval='6loop='true'/>
 52            <!-- ===================================== -->
 53 
 54            <Transform DEF='LeftTexttranslation='-3 0 0'>
 55 
               <!-- ROUTE information for TrackingTransformLeft node:  [from InterpolatorTestInstance.position_changed to translation ] [from InterpolatorTestInstance.orientation_changed to rotation ] -->
               <Transform DEF='TrackingTransformLeft'>
 56                      < ROUTE  fromNode='Clock' fromField='fraction_changed' toNode='InterpolatorTestInstance' toField='set_fraction'/>
 57                      < ROUTE  fromNode='InterpolatorTestInstance' fromField='position_changed' toNode='TrackingTransformLeft' toField='translation'/>
 58                      < ROUTE  fromNode='InterpolatorTestInstance' fromField='orientation_changed' toNode='TrackingTransformLeft' toField='rotation'/>
 59                      <Shape>
 60                           <Text string='"prototype interpolators"'>
 61                                <FontStyle justify='"MIDDLE" "MIDDLE"'/>
 62                           </Text>
 63                           <Appearance>
 64                                <Material diffuseColor='0.8 0.2 0.2'/>
 65                           </Appearance>
 66                      </Shape>
 67                 </Transform>
 68            </Transform>
 69            <!-- ===================================== -->
 70 
          <!-- 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'/>
 71 
          <!-- 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'/>
 72            <Transform DEF='RightTexttranslation='-3 -2 0'>
 73 
               <!-- ROUTE information for TrackingTransformRight node:  [from ActualPositionInterpolator.value_changed to translation ] [from ActualOrientationInterpolator.value_changed to rotation ] -->
               <Transform DEF='TrackingTransformRight'>
 74                      < ROUTE  fromNode='Clock' fromField='fraction_changed' toNode='ActualPositionInterpolator' toField='set_fraction'/>
 75                      < ROUTE  fromNode='Clock' fromField='fraction_changed' toNode='ActualOrientationInterpolator' toField='set_fraction'/>
 76                      < ROUTE  fromNode='ActualPositionInterpolator' fromField='value_changed' toNode='TrackingTransformRight' toField='translation'/>
 77                      < ROUTE  fromNode='ActualOrientationInterpolator' fromField='value_changed' toNode='TrackingTransformRight' toField='rotation'/>
 78                      <Shape>
 79                           <Text string='"native interpolators"'/>
 80                           <Appearance>
 81                                <Material diffuseColor='0.2 0.8 0.2'/>
 82                           </Appearance>
 83                      </Shape>
 84                 </Transform>
 85            </Transform>
 86 
          <!-- ROUTE information for ExternalTraceScript node:  [from ActualPositionInterpolator.value_changed to set_position ] [from ActualOrientationInterpolator.value_changed to set_rotation ] -->
          <Script DEF='ExternalTraceScript'>
 87                 <field name='set_positiontype='SFVec3faccessType='inputOnly'/>
 88                 <field name='holdPositiontype='SFVec3fvalue='0.0 0.0 0.0accessType='inputOutput'/>
 89                 <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());
}

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

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

<!-- to top Index for DEF nodes: ActualOrientationInterpolator, ActualPositionInterpolator, Clock, ExternalTraceScript, InternalTraceScript, InterpolatorTestInstance, LeftText, PrototypeRootNode, RightText, TrackingTransformLeft, TrackingTransformRight, WaypointOI, WaypointPI

Index for ProtoDeclare definition: InterpolatorTest
-->
X3D Tooltips element index: Appearance, connect, field, FontStyle, Group, head, IS, Material, meta, OrientationInterpolator, PositionInterpolator, ProtoBody, ProtoDeclare, ProtoInstance, ProtoInterface, ROUTE, Scene, Script, Shape, Text, TimeSensor, Transform, WorldInfo, X3D, accessType and type, XML data types, field types

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

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