{ "X3D": {
    "encoding":"UTF-8",
    "@profile":"Immersive",
    "@version":"3.2",
    "@xsd:noNamespaceSchemaLocation":"https://www.web3d.org/specifications/x3d-3.2.xsd",
    "JSON schema":"https://www.web3d.org/specifications/x3d-4.0-JSONSchema.autogenerated.json",
    "head": {
        "meta": [
          {
            "@name":"title",
            "@content":"TestPrototypeInterpolators.x3d"
          },
          {
            "@name":"description",
            "@content":"Test case for Prototype PositionInterpolator OrientationInterpolator, expected behavior: is for both sets of test Text to move identically."
          },
          {
            "@name":"creator",
            "@content":"Don Brutzman and Jeff Weekley"
          },
          {
            "@name":"created",
            "@content":"4 April 2009"
          },
          {
            "@name":"modified",
            "@content":"20 October 2019"
          },
          {
            "@name":"reference",
            "@content":"https://savage.nps.edu/Savage/Tools/Animation/WaypointInterpolatorPrototype.x3d"
          },
          {
            "@name":"identifier",
            "@content":"https://www.web3d.org/x3d/content/examples/Basic/development/TestPrototypeInterpolators.x3d"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit"
          },
          {
            "@name":"license",
            "@content":"../license.html"
          },
          {
            "@name":"translated",
            "@content":"20 April 2026"
          },
          {
            "@name":"generator",
            "@content":"X3dToJson.xslt, https://www.web3d.org/x3d/stylesheets/X3dToJson.html"
          },
          {
            "@name":"reference",
            "@content":"X3D JSON encoding: https://www.web3d.org/wiki/index.php/X3D_JSON_Encoding"
          }
        ]
    },
    "Scene": {
        "-children":[
          { "WorldInfo":
            {
              "@title":"TestPrototypeInterpolators.x3d"
            }
          },
          { "ProtoDeclare":
            {
              "@name":"InterpolatorTest",
              "@appinfo":"Test output of PositionInterpolator, OrientationInterpolator when within Protototype",
              "ProtoInterface": {
                  "field": [
                    {
                      "@name":"set_fraction",
                      "@accessType":"inputOnly",
                      "@appinfo":"exposed PositionInterpolator and OrientationInterpolator setting",
                      "@type":"SFFloat"
                    },
                    {
                      "@name":"position_changed",
                      "@accessType":"outputOnly",
                      "@appinfo":"exposed PositionInterpolator setting",
                      "@type":"SFVec3f"
                    },
                    {
                      "@name":"orientation_changed",
                      "@accessType":"outputOnly",
                      "@appinfo":"exposed OrientationInterpolator setting",
                      "@type":"SFRotation"
                    }
                  ]
              },
              "ProtoBody": {
                  "-children":[
                    {
                      "#comment":"First node determines node type of this prototype"
                    },
                    { "Group":
                      {
                        "@DEF":"PrototypeRootNode",
                        "-children":[
                          { "PositionInterpolator":
                            {
                              "@DEF":"WaypointPI",
                              "@key":[0,0.5,1],
                              "@keyValue":[0,0,0,1,1,1,2,2,2],
                              "IS": {
                                  "connect": [
                                    {
                                      "@nodeField":"set_fraction",
                                      "@protoField":"set_fraction"
                                    },
                                    {
                                      "@nodeField":"value_changed",
                                      "@protoField":"position_changed"
                                    }
                                  ]
                              }
                            }
                          },
                          { "OrientationInterpolator":
                            {
                              "@DEF":"WaypointOI",
                              "@key":[0,0.5,1],
                              "@keyValue":[0,1,0,0,0.7071,0.7071,0,3.1416,0,1,0,0],
                              "IS": {
                                  "connect": [
                                    {
                                      "@nodeField":"set_fraction",
                                      "@protoField":"set_fraction"
                                    },
                                    {
                                      "@nodeField":"value_changed",
                                      "@protoField":"orientation_changed"
                                    }
                                  ]
                              }
                            }
                          }
                        ]
                      }
                    },
                    {
                      "#comment":"Subsequent nodes do not render, but still must be a valid X3D subgraph"
                    },
                    { "Script":
                      {
                        "@DEF":"InternalTraceScript",
                        "field": [
                          {
                            "@name":"set_position",
                            "@accessType":"inputOnly",
                            "@type":"SFVec3f"
                          },
                          {
                            "@name":"holdPosition",
                            "@accessType":"inputOutput",
                            "@type":"SFVec3f",
                            "@value":[0.0,0.0,0.0]
                          },
                          {
                            "@name":"set_rotation",
                            "@accessType":"inputOnly",
                            "@type":"SFRotation"
                          }
                        ],
                        "#sourceCode":[
"",
"",
"ecmascript:",
"function set_position (value)",
"{",
"\tholdPosition=value;",
"}",
"function set_rotation (value)",
"{",
"\tBrowser.println ('Internal position=' + holdPosition.toString() + ' , internal rotation=' + value.toString());",
"}",
"",
""
]
                      }
                    },
                    { "ROUTE":
                      {
                        "@fromField":"value_changed",
                        "@fromNode":"WaypointPI",
                        "@toField":"set_position",
                        "@toNode":"InternalTraceScript"
                      }
                    },
                    { "ROUTE":
                      {
                        "@fromField":"value_changed",
                        "@fromNode":"WaypointOI",
                        "@toField":"set_rotation",
                        "@toNode":"InternalTraceScript"
                      }
                    }
                  ]
              }
            }
          },
          {
            "#comment":"====================================="
          },
          { "TimeSensor":
            {
              "@DEF":"Clock",
              "@cycleInterval":6,
              "@loop":true
            }
          },
          {
            "#comment":"====================================="
          },
          { "ProtoInstance":
            {
              "@name":"InterpolatorTest",
              "@DEF":"InterpolatorTestInstance"
            }
          },
          { "Transform":
            {
              "@DEF":"LeftText",
              "@translation":[-3,0,0],
              "-children":[
                { "Transform":
                  {
                    "@DEF":"TrackingTransformLeft",
                    "-children":[
                      { "ROUTE":
                        {
                          "@fromField":"fraction_changed",
                          "@fromNode":"Clock",
                          "@toField":"set_fraction",
                          "@toNode":"InterpolatorTestInstance"
                        }
                      },
                      { "ROUTE":
                        {
                          "@fromField":"position_changed",
                          "@fromNode":"InterpolatorTestInstance",
                          "@toField":"translation",
                          "@toNode":"TrackingTransformLeft"
                        }
                      },
                      { "ROUTE":
                        {
                          "@fromField":"orientation_changed",
                          "@fromNode":"InterpolatorTestInstance",
                          "@toField":"rotation",
                          "@toNode":"TrackingTransformLeft"
                        }
                      },
                      { "Shape":
                        {
                          "-geometry":
                            { "Text":
                              {
                                "@string":["prototype interpolators"],
                                "-fontStyle":
                                  { "FontStyle":
                                    {
                                      "@justify":["MIDDLE","MIDDLE"]
                                    }
                                  }
                              }
                            },
                          "-appearance":
                            { "Appearance":
                              {
                                "-material":
                                  { "Material":
                                    {
                                      "@diffuseColor":[0.8,0.2,0.2]
                                    }
                                  }
                              }
                            }
                        }
                      }
                    ]
                  }
                }
              ]
            }
          },
          {
            "#comment":"====================================="
          },
          { "PositionInterpolator":
            {
              "@DEF":"ActualPositionInterpolator",
              "@key":[0,0.5,1],
              "@keyValue":[0,0,0,1,1,1,2,2,2]
            }
          },
          { "OrientationInterpolator":
            {
              "@DEF":"ActualOrientationInterpolator",
              "@key":[0,0.5,1],
              "@keyValue":[0,1,0,0,0.7071,0.7071,0,3.1416,0,1,0,0]
            }
          },
          { "Transform":
            {
              "@DEF":"RightText",
              "@translation":[-3,-2,0],
              "-children":[
                { "Transform":
                  {
                    "@DEF":"TrackingTransformRight",
                    "-children":[
                      { "ROUTE":
                        {
                          "@fromField":"fraction_changed",
                          "@fromNode":"Clock",
                          "@toField":"set_fraction",
                          "@toNode":"ActualPositionInterpolator"
                        }
                      },
                      { "ROUTE":
                        {
                          "@fromField":"fraction_changed",
                          "@fromNode":"Clock",
                          "@toField":"set_fraction",
                          "@toNode":"ActualOrientationInterpolator"
                        }
                      },
                      { "ROUTE":
                        {
                          "@fromField":"value_changed",
                          "@fromNode":"ActualPositionInterpolator",
                          "@toField":"translation",
                          "@toNode":"TrackingTransformRight"
                        }
                      },
                      { "ROUTE":
                        {
                          "@fromField":"value_changed",
                          "@fromNode":"ActualOrientationInterpolator",
                          "@toField":"rotation",
                          "@toNode":"TrackingTransformRight"
                        }
                      },
                      { "Shape":
                        {
                          "-geometry":
                            { "Text":
                              {
                                "@string":["native interpolators"]
                              }
                            },
                          "-appearance":
                            { "Appearance":
                              {
                                "-material":
                                  { "Material":
                                    {
                                      "@diffuseColor":[0.2,0.8,0.2]
                                    }
                                  }
                              }
                            }
                        }
                      }
                    ]
                  }
                }
              ]
            }
          },
          { "Script":
            {
              "@DEF":"ExternalTraceScript",
              "field": [
                {
                  "@name":"set_position",
                  "@accessType":"inputOnly",
                  "@type":"SFVec3f"
                },
                {
                  "@name":"holdPosition",
                  "@accessType":"inputOutput",
                  "@type":"SFVec3f",
                  "@value":[0.0,0.0,0.0]
                },
                {
                  "@name":"set_rotation",
                  "@accessType":"inputOnly",
                  "@type":"SFRotation"
                }
              ],
              "#sourceCode":[
"",
"",
"ecmascript:",
"function set_position (value)",
"{",
"\tholdPosition=value;",
"}",
"function set_rotation (value)",
"{",
"\t Browser.println ('External position=' + holdPosition.toString() + ' , external rotation=' + value.toString());",
"}",
"",
""
]
            }
          },
          { "ROUTE":
            {
              "@fromField":"value_changed",
              "@fromNode":"ActualPositionInterpolator",
              "@toField":"set_position",
              "@toNode":"ExternalTraceScript"
            }
          },
          { "ROUTE":
            {
              "@fromField":"value_changed",
              "@fromNode":"ActualOrientationInterpolator",
              "@toField":"set_rotation",
              "@toNode":"ExternalTraceScript"
            }
          }
        ]
    }
  }
}