{ "X3D": {
    "encoding":"UTF-8",
    "@profile":"Immersive",
    "@version":"3.3",
    "@xsd:noNamespaceSchemaLocation":"https://www.web3d.org/specifications/x3d-3.3.xsd",
    "JSON schema":"https://www.web3d.org/specifications/x3d-4.0-JSONSchema.autogenerated.json",
    "head": {
        "meta": [
          {
            "@name":"title",
            "@content":"Loader.x3d"
          },
          {
            "@name":"description",
            "@content":"This example illustrates use of JavaScript to load a scene from a file through use of the Browser object. When a button is selected to provide a new url for a file to load, the Script adds the new world, waits for the load to complete, then adds the loaded Shape into a rendered group."
          },
          {
            "@name":"creator",
            "@content":"David R. Nadeau"
          },
          {
            "@name":"translator",
            "@content":"Don Brutzman"
          },
          {
            "@name":"created",
            "@content":"1 July 1998"
          },
          {
            "@name":"translated",
            "@content":"2 February 2014"
          },
          {
            "@name":"modified",
            "@content":"20 October 2019"
          },
          {
            "@name":"Image",
            "@content":"Loader.png"
          },
          {
            "@name":"reference",
            "@content":"Button.x3d"
          },
          {
            "@name":"reference",
            "@content":"originals/loader.wrl"
          },
          {
            "@name":"reference",
            "@content":"http://www.siggraph.org/s98"
          },
          {
            "@name":"reference",
            "@content":"http://www.siggraph.org/s98/conference/courses/18.html"
          },
          {
            "@name":"reference",
            "@content":"http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/slides/mt0469.htm"
          },
          {
            "@name":"reference",
            "@content":"http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/vrml97.htm"
          },
          {
            "@name":"reference",
            "@content":"https://www.web3d.org/x3d/content/examples/X3dResources.html"
          },
          {
            "@name":"identifier",
            "@content":"https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Loader.x3d"
          },
          {
            "@name":"generator",
            "@content":"Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit, https://www.web3d.org/x3d/tools/X3D-Edit"
          },
          {
            "@name":"license",
            "@content":"../license.html"
          },
          {
            "@name":"translated",
            "@content":"01 September 2025"
          },
          {
            "@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":
            {
              "@info":["Copyright (c) 1998, David R. Nadeau"],
              "@title":"Load VRML using a script"
            }
          },
          { "NavigationInfo":
            {
            }
          },
          { "Viewpoint":
            {
              "@description":"Entry view"
            }
          },
          { "Background":
            {
              "@skyAngle":[1.37,1.57,1.77],
              "@skyColor":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.8,0.2,0.0,0.0,0.0]
            }
          },
          { "ExternProtoDeclare":
            {
              "@name":"Button",
              "@url":["Button.x3d#Button","https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Button.x3d#Button","Button.wrl#Button","https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Button.wrl#Button"],
              "field": [
                {
                  "@name":"url",
                  "@accessType":"inputOutput",
                  "@type":"MFString"
                },
                {
                  "@name":"textureUrl",
                  "@accessType":"inputOutput",
                  "@type":"MFString"
                },
                {
                  "@name":"url_changed",
                  "@accessType":"outputOnly",
                  "@type":"MFString"
                },
                {
                  "@name":"translation",
                  "@accessType":"initializeOnly",
                  "@type":"SFVec3f"
                }
              ]
            }
          },
          { "ProtoInstance":
            {
              "@name":"Button",
              "@DEF":"Button1",
              "fieldValue": [
                {
                  "@name":"url",
                  "@value":["One.x3d","https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/One.x3d"]
                },
                {
                  "@name":"textureUrl",
                  "@value":["one.jpg"]
                },
                {
                  "@name":"translation",
                  "@value":[-4.0,2.0,0.0]
                }
              ]
            }
          },
          { "ProtoInstance":
            {
              "@name":"Button",
              "@DEF":"Button2",
              "fieldValue": [
                {
                  "@name":"url",
                  "@value":["Two.x3d","https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Two.x3d"]
                },
                {
                  "@name":"textureUrl",
                  "@value":["two.jpg"]
                },
                {
                  "@name":"translation",
                  "@value":[-4.0,0.0,0.0]
                }
              ]
            }
          },
          { "ProtoInstance":
            {
              "@name":"Button",
              "@DEF":"Button3",
              "fieldValue": [
                {
                  "@name":"url",
                  "@value":["Three.x3d","https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Three.x3d"]
                },
                {
                  "@name":"textureUrl",
                  "@value":["three.jpg"]
                },
                {
                  "@name":"translation",
                  "@value":[-4.0,-2.0,0.0]
                }
              ]
            }
          },
          { "Transform":
            {
              "@translation":[-4.0,-3.5,0.0],
              "-children":[
                { "Shape":
                  {
                    "-appearance":
                      { "Appearance":
                        {
                          "-material":
                            { "Material":
                              {
                              }
                            }
                        }
                      },
                    "-geometry":
                      { "Text":
                        {
                          "@DEF":"Label",
                          "-fontStyle":
                            { "FontStyle":
                              {
                                "@justify":["MIDDLE","MIDDLE"],
                                "@size":0.75
                              }
                            }
                        }
                      }
                  }
                }
              ]
            }
          },
          { "Transform":
            {
              "@DEF":"Loaded",
              "@translation":[1.0,0.0,0.0],
              "-children":[
                {
                  "#comment":"load result goes here"
                }
              ]
            }
          },
          { "Script":
            {
              "@DEF":"Loader",
              "@directOutput":true,
              "field": [
                {
                  "@name":"lastUrl",
                  "@accessType":"initializeOnly",
                  "@type":"MFString",
                  "@value":[""]
                },
                {
                  "@name":"loadUrl",
                  "@accessType":"inputOnly",
                  "@type":"MFString"
                },
                {
                  "@name":"vrmlLoaded",
                  "@accessType":"inputOnly",
                  "@type":"MFNode"
                },
                {
                  "@name":"node_changed",
                  "@accessType":"outputOnly",
                  "@type":"MFNode"
                },
                {
                  "@name":"string_changed",
                  "@accessType":"outputOnly",
                  "@type":"MFString"
                },
                {
                  "@name":"myself",
                  "@accessType":"initializeOnly",
                  "@type":"SFNode",
                  "-children":[
                    { "Script":
                      {
                        "@USE":"Loader"
                      }
                    }
                  ]
                }
              ],
              "#sourceCode":[
"",
"",
"ecmascript:",
"",
"function loadUrl( str, ts )",
"{",
"        lastUrl = str;",
"        Browser.createVrmlFromURL( str, myself, 'vrmlLoaded' );",
"        string_changed[0] = 'Loading...';",
"}",
"function vrmlLoaded( nd, ts )",
"{",
"        node_changed = nd;",
"        string_changed[0] = lastUrl[0];",
"}",
"",
""
]
            }
          },
          { "ROUTE":
            {
              "@fromField":"url_changed",
              "@fromNode":"Button1",
              "@toField":"loadUrl",
              "@toNode":"Loader"
            }
          },
          { "ROUTE":
            {
              "@fromField":"url_changed",
              "@fromNode":"Button2",
              "@toField":"loadUrl",
              "@toNode":"Loader"
            }
          },
          { "ROUTE":
            {
              "@fromField":"url_changed",
              "@fromNode":"Button3",
              "@toField":"loadUrl",
              "@toNode":"Loader"
            }
          },
          { "ROUTE":
            {
              "@fromField":"node_changed",
              "@fromNode":"Loader",
              "@toField":"set_children",
              "@toNode":"Loaded"
            }
          },
          { "ROUTE":
            {
              "@fromField":"string_changed",
              "@fromNode":"Loader",
              "@toField":"set_string",
              "@toNode":"Label"
            }
          }
        ]
    }
  }
}