{ "X3D": {
    "encoding":"UTF-8",
    "@profile":"Immersive",
    "@version":"3.0",
    "@xsd:noNamespaceSchemaLocation":"http://www.web3d.org/specifications/x3d-3.0.xsd",
    "JSON schema":"http://www.web3d.org/specifications/x3d-3.3-JSONSchema.json",
    "head": {
        "meta": [
          {
            "@name":"title",
            "@content":"Figure09.9DeskLampWithAxes.x3d"
          },
          {
            "@name":"creator",
            "@content":"Figure 9.9, The VRML 2.0 Sourcebook, Copyright [1997] By Andrea L. Ames, David R. Nadeau, and John L. Moreland"
          },
          {
            "@name":"reference",
            "@content":"http://www.wiley.com/legacy/compbooks/vrml2sbk/ch09/09fig09.htm"
          },
          {
            "@name":"transcriber",
            "@content":"Don Brutzman"
          },
          {
            "@name":"created",
            "@content":"12 August 2000"
          },
          {
            "@name":"modified",
            "@content":"9 March 2014"
          },
          {
            "@name":"Image",
            "@content":"Figure09.9DeskLampWithAxes.SlideshowSnapshot.png"
          },
          {
            "@name":"description",
            "@content":"A desk lamp with arm angles that can be adjusted using nested sensors, with coordinate axes superimposed to show X3D/VRML directions."
          },
          {
            "@name":"identifier",
            "@content":"http://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter09-SensingViewer/Figure09.9DeskLampWithAxes.x3d"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit"
          },
          {
            "@name":"license",
            "@content":"../../license.html"
          },
          {
            "@name":"translated",
            "@content":"19 March 2017"
          },
          {
            "@name":"generator",
            "@content":"X3dToJson.xslt, http://www.web3d.org/x3d/stylesheets/X3dToJson.html"
          },
          {
            "@name":"warning",
            "@content":"An experimental version of X3D JSON encoding is used for this scene.  Status online at http://www.web3d.org/wiki/index.php/X3D_JSON_Encoding"
          }
        ]
    },
    "Scene": {
        "-children":[
          { "Viewpoint":
            {
              "@description":"Desk lamp",
              "@orientation":[0,1,0,0.29],
              "@position":[0.3,0.2,1]
            }
          },
          {
            "#comment":"First rotate PlaneSensor to horizontal XZ (Y = 0) plane"
          },
          { "Transform":
            {
              "@rotation":[1,0,0,1.57],
              "-children":[
                { "PlaneSensor":
                  {
                    "@DEF":"MOVE_LAMP",
                    "@description":"drag to move lamp",
                    "@maxPosition":[0.1,0.1],
                    "@minPosition":[-0.1,-0.1]
                  }
                },
                { "Transform":
                  {
                    "@DEF":"LAMP_TRANSFORM",
                    "-children":[
                      {
                        "#comment":"Note that we are connecting a chain of behavior engines in these ROUTEs. The event types passed via each ROUTE must each match."
                      },
                      { "ROUTE":
                        {
                          "@fromField":"translation_changed",
                          "@fromNode":"MOVE_LAMP",
                          "@toField":"set_translation",
                          "@toNode":"LAMP_TRANSFORM"
                        }
                      },
                      {
                        "#comment":"Now rotate back so that actual geometry remains in original coordinate system"
                      },
                      { "Transform":
                        {
                          "@rotation":[1,0,0,-1.57],
                          "-children":[
                            { "Shape":
                              {
                                "-geometry":
                                  { "Cylinder":
                                    {
                                      "@height":0.01,
                                      "@radius":0.1
                                    }
                                  },
                                "-appearance":
                                  { "Appearance":
                                    {
                                      "@DEF":"WHITE",
                                      "-material":
                                        { "Material":
                                          {
                                            "@diffuseColor":[0.9,0.9,0.9]
                                          }
                                        }
                                    }
                                  }
                              }
                            },
                            { "Group":
                              {
                                "-children":[
                                  { "SphereSensor":
                                    {
                                      "@DEF":"MOVE_FIRST_ARM",
                                      "@description":"rotate first arm",
                                      "@offset":[1,0,0,-0.7]
                                    }
                                  },
                                  { "Transform":
                                    {
                                      "@DEF":"FIRST_ARM_TRANSFORM",
                                      "@center":[0,-0.15,0],
                                      "@rotation":[1,0,0,-0.7],
                                      "@translation":[0,0.15,0],
                                      "-children":[
                                        { "ROUTE":
                                          {
                                            "@fromField":"rotation_changed",
                                            "@fromNode":"MOVE_FIRST_ARM",
                                            "@toField":"set_rotation",
                                            "@toNode":"FIRST_ARM_TRANSFORM"
                                          }
                                        },
                                        { "Shape":
                                          {
                                            "@DEF":"LAMP_ARM",
                                            "-appearance":
                                              { "Appearance":
                                                {
                                                  "@DEF":"LIGHT_BROWN",
                                                  "-material":
                                                    { "Material":
                                                      {
                                                        "@diffuseColor":[0.6,0.6,0.2]
                                                      }
                                                    }
                                                }
                                              },
                                            "-geometry":
                                              { "Cylinder":
                                                {
                                                  "@height":0.3,
                                                  "@radius":0.01
                                                }
                                              }
                                          }
                                        },
                                        { "Group":
                                          {
                                            "-children":[
                                              { "SphereSensor":
                                                {
                                                  "@DEF":"MOVE_SECOND_ARM",
                                                  "@description":"rotate second arm",
                                                  "@offset":[1,0,0,1.9]
                                                }
                                              },
                                              { "Transform":
                                                {
                                                  "@DEF":"SECOND_ARM_TRANSFORM",
                                                  "@center":[0,-0.15,0],
                                                  "@rotation":[1,0,0,1.9],
                                                  "@translation":[0,0.3,0],
                                                  "-children":[
                                                    { "ROUTE":
                                                      {
                                                        "@fromField":"rotation_changed",
                                                        "@fromNode":"MOVE_SECOND_ARM",
                                                        "@toField":"set_rotation",
                                                        "@toNode":"SECOND_ARM_TRANSFORM"
                                                      }
                                                    },
                                                    { "Shape":
                                                      {
                                                        "@USE":"LAMP_ARM"
                                                      }
                                                    },
                                                    { "Group":
                                                      {
                                                        "-children":[
                                                          { "SphereSensor":
                                                            {
                                                              "@DEF":"MOVE_LAMP_SHADE",
                                                              "@description":"rotate lamp shade",
                                                              "@offset":[1,0,0,-1.25]
                                                            }
                                                          },
                                                          { "Transform":
                                                            {
                                                              "@DEF":"LAMP_SHADE_TRANSFORM",
                                                              "@center":[0,0.07,0],
                                                              "@rotation":[1,0,0,-1.25],
                                                              "@translation":[0,0.075,0],
                                                              "-children":[
                                                                { "ROUTE":
                                                                  {
                                                                    "@fromField":"rotation_changed",
                                                                    "@fromNode":"MOVE_LAMP_SHADE",
                                                                    "@toField":"set_rotation",
                                                                    "@toNode":"LAMP_SHADE_TRANSFORM"
                                                                  }
                                                                },
                                                                { "Shape":
                                                                  {
                                                                    "-appearance":
                                                                      { "Appearance":
                                                                        {
                                                                          "-material":
                                                                            { "Material":
                                                                              {
                                                                                "@diffuseColor":[0.1,0.6,0.6]
                                                                              }
                                                                            }
                                                                        }
                                                                      },
                                                                    "-geometry":
                                                                      { "Cone":
                                                                        {
                                                                          "@bottom":false,
                                                                          "@bottomRadius":0.12,
                                                                          "@height":0.15
                                                                        }
                                                                      }
                                                                  }
                                                                },
                                                                { "Transform":
                                                                  {
                                                                    "@translation":[0,-0.05,0],
                                                                    "-children":[
                                                                      { "Shape":
                                                                        {
                                                                          "-appearance":
                                                                            { "Appearance":
                                                                              {
                                                                                "-material":
                                                                                  { "Material":
                                                                                    {
                                                                                      "@diffuseColor":[0.4,0.4,0.1],
                                                                                      "@emissiveColor":[0.8,0.8,0.2]
                                                                                    }
                                                                                  }
                                                                              }
                                                                            },
                                                                          "-geometry":
                                                                            { "Sphere":
                                                                              {
                                                                                "@radius":0.05
                                                                              }
                                                                            }
                                                                        }
                                                                      },
                                                                      { "SpotLight":
                                                                        {
                                                                          "@beamWidth":1.570796,
                                                                          "@color":[0.8,0.8,0.1],
                                                                          "@cutOffAngle":0.785398,
                                                                          "@direction":[0,-1,0]
                                                                        }
                                                                      }
                                                                    ]
                                                                  }
                                                                }
                                                              ]
                                                            }
                                                          }
                                                        ]
                                                      }
                                                    }
                                                  ]
                                                }
                                              }
                                            ]
                                          }
                                        }
                                      ]
                                    }
                                  }
                                ]
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                }
              ]
            }
          },
          {
            "#comment":"Adding this Inline reference to another scene superimposes X3D/VRML coordinate system axes."
          },
          { "Transform":
            {
              "@scale":[0.25,0.25,0.25],
              "-children":[
                { "Inline":
                  {
                    "@DEF":"CoordinateAxes",
                    "@url":["../../X3dForWebAuthors/Chapter03-Grouping/CoordinateAxes.x3d","http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter03-Grouping/CoordinateAxes.x3d","https://savage.nps.edu/Savage/Tools/Authoring/CoordinateAxes.x3d","../../X3dForWebAuthors/Chapter03-Grouping/CoordinateAxes.wrl","http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter03-Grouping/CoordinateAxes.wrl","https://savage.nps.edu/Savage/Tools/Authoring/CoordinateAxes.wrl"]
                  }
                }
              ]
            }
          }
        ]
    }
  }
}