| 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='title' content=' TestPrototypeInterpolators.x3d '/> |
| 6 | <meta name='description' content='Test case for Prototype PositionInterpolator OrientationInterpolator, expected behavior: is for both sets of test Text to move identically.'/> |
| 7 | <meta name='creator' content='Don Brutzman and Jeff Weekley'/> |
| 8 | <meta name='created' content='4 April 2009'/> |
| 9 | <meta name='modified' content='20 October 2019'/> |
| 10 | <meta name='reference' content=' https://savage.nps.edu/Savage/Tools/Animation/WaypointInterpolatorPrototype.x3d '/> |
| 11 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/Basic/development/TestPrototypeInterpolators.x3d '/> |
| 12 | <meta name='generator' content='X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
| 13 | <meta name='license' content='../license.html'/> |
| 14 | </head> |
| 15 | <Scene> |
| 16 | <WorldInfo title='TestPrototypeInterpolators.x3d'/> |
| 17 | <ProtoDeclare name='InterpolatorTest' appinfo='Test output of PositionInterpolator, OrientationInterpolator when within Protototype'> |
| 18 | <ProtoInterface> |
| 19 |
<field name='set_fraction' type='SFFloat' accessType='inputOnly'
appinfo='exposed PositionInterpolator and OrientationInterpolator setting'/> |
| 20 |
<field name='position_changed' type='SFVec3f' accessType='outputOnly'
appinfo='exposed PositionInterpolator setting'/> |
| 21 |
<field name='orientation_changed' type='SFRotation' accessType='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='WaypointPI' key='0 0.5 1' keyValue='0 0 0 1 1 1 2 2 2'> |
| 27 | <IS> |
| 28 | <connect nodeField='set_fraction' protoField='set_fraction'/> |
| 29 | <connect nodeField='value_changed' protoField='position_changed'/> |
| 30 | </IS> |
| 31 | </PositionInterpolator> |
| 32 |
<!-- ROUTE information for WaypointOI node:
[from value_changed to InternalTraceScript.set_rotation
]
-->
<OrientationInterpolator DEF='WaypointOI' key='0 0.5 1' keyValue='0 1 0 0 0.7071 0.7071 0 3.1416 0 1 0 0'> |
| 33 | <IS> |
| 34 | <connect nodeField='set_fraction' protoField='set_fraction'/> |
| 35 | <connect nodeField='value_changed' protoField='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_position' type='SFVec3f' accessType='inputOnly'/> |
| 42 | <field name='holdPosition' type='SFVec3f' value='0.0 0.0 0.0' accessType='inputOutput'/> |
| 43 | <field name='set_rotation' type='SFRotation' accessType='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='Clock' cycleInterval='6' loop='true'/> |
| 52 | <!-- ===================================== --> |
| 53 |
<!-- ROUTE information for InterpolatorTestInstance node:
[from Clock.fraction_changed to set_fraction
]
[from position_changed to TrackingTransformLeft.translation
]
[from orientation_changed to TrackingTransformLeft.rotation
]
-->
<ProtoInstance name='InterpolatorTest' DEF='InterpolatorTestInstance'/> |
| 54 | <Transform DEF='LeftText' translation='-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='ActualPositionInterpolator' key='0 0.5 1' keyValue='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='ActualOrientationInterpolator' key='0 0.5 1' keyValue='0 1 0 0 0.7071 0.7071 0 3.1416 0 1 0 0'/> |
| 72 | <Transform DEF='RightText' translation='-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_position' type='SFVec3f' accessType='inputOnly'/> |
| 88 | <field name='holdPosition' type='SFVec3f' value='0.0 0.0 0.0' accessType='inputOutput'/> |
| 89 | <field name='set_rotation' type='SFRotation' accessType='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 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.
|
InterpolatorTestInstance
ProtoInstance position_changed SFVec3f |
TrackingTransformLeft
Transform translation SFVec3f |
|
|
InterpolatorTestInstance
ProtoInstance orientation_changed SFRotation |
TrackingTransformLeft
Transform rotation SFRotation |
<!--
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.
-->