{ "X3D": {
    "encoding":"UTF-8",
    "@profile":"Immersive",
    "@version":"3.0",
    "@xsd:noNamespaceSchemaLocation":"https://www.web3d.org/specifications/x3d-3.0.xsd",
    "JSON schema":"https://www.web3d.org/specifications/x3d-4.0-JSONSchema.autogenerated.json",
    "head": {
        "meta": [
          {
            "@name":"title",
            "@content":"Room.x3d"
          },
          {
            "@name":"description",
            "@content":"A simple room containing protoype instances for chair, desk lamp, wall clock, etc."
          },
          {
            "@name":"creator",
            "@content":"Frederic Roussille"
          },
          {
            "@name":"created",
            "@content":"1 April 2001"
          },
          {
            "@name":"modified",
            "@content":"20 October 2019"
          },
          {
            "@name":"identifier",
            "@content":"https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/Room.x3d"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit"
          },
          {
            "@name":"license",
            "@content":"../license.html"
          },
          {
            "@name":"translated",
            "@content":"02 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":[
          {
            "#comment":"externprodeclare : chair"
          },
          { "WorldInfo":
            {
              "@title":"Room.x3d"
            }
          },
          { "ExternProtoDeclare":
            {
              "@name":"Chair",
              "@url":["Chair.x3d#Chair","https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/Chair.x3d#Chair","Chair.wrl#Chair","https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/Chair.wrl#Chair"],
              "field": [
                {
                  "@name":"diffuseColor",
                  "@accessType":"inputOutput",
                  "@type":"SFColor"
                }
              ]
            }
          },
          { "ExternProtoDeclare":
            {
              "@name":"Desk",
              "@url":["Desk.x3d#Desk","https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/Desk.x3d#Desk","Desk.wrl#Desk","https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/Desk.wrl#Desk"],
              "field": [
                {
                  "@name":"diffuseColor",
                  "@accessType":"inputOutput",
                  "@type":"SFColor"
                }
              ]
            }
          },
          { "ExternProtoDeclare":
            {
              "@name":"WallLamp",
              "@url":["WallLamp.x3d#WallLamp","https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/WallLamp.x3d#WallLamp","WallLamp.wrl#WallLamp","https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/WallLamp.wrl#WallLamp"],
              "field": [
                {
                  "@name":"lampColor",
                  "@accessType":"inputOutput",
                  "@type":"SFColor"
                },
                {
                  "@name":"lightColor",
                  "@accessType":"inputOutput",
                  "@type":"SFColor"
                },
                {
                  "@name":"lightIntensity",
                  "@accessType":"inputOutput",
                  "@type":"SFFloat"
                },
                {
                  "@name":"lightAttenuation",
                  "@accessType":"inputOutput",
                  "@type":"SFVec3f"
                },
                {
                  "@name":"radius",
                  "@accessType":"inputOutput",
                  "@type":"SFFloat"
                },
                {
                  "@name":"lightLocation",
                  "@accessType":"inputOutput",
                  "@type":"SFVec3f"
                }
              ]
            }
          },
          { "NavigationInfo":
            {
              "@headlight":false
            }
          },
          { "Viewpoint":
            {
              "@description":"entry",
              "@orientation":[1,0,0,-0.2],
              "@position":[16,23,75]
            }
          },
          { "Transform":
            {
              "@scale":[0.4,0.4,0.6],
              "-children":[
                { "Group":
                  {
                    "-children":[
                      {
                        "#comment":"floor"
                      },
                      { "Shape":
                        {
                          "@DEF":"wall",
                          "-geometry":
                            { "ElevationGrid":
                              {
                                "@height":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
                                "@solid":false,
                                "@xDimension":9,
                                "@xSpacing":10,
                                "@zDimension":9,
                                "@zSpacing":10
                              }
                            },
                          "-appearance":
                            { "Appearance":
                              {
                                "@DEF":"wallpaper",
                                "-texture":
                                  { "ImageTexture":
                                    {
                                      "@url":["WallPaper.jpg","https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/WallPaper.jpg"]
                                    }
                                  },
                                "-textureTransform":
                                  { "TextureTransform":
                                    {
                                      "@scale":[2,2]
                                    }
                                  },
                                "-material":
                                  { "Material":
                                    {
                                    }
                                  }
                              }
                            }
                        }
                      },
                      {
                        "#comment":"left wall"
                      },
                      { "Transform":
                        {
                          "@rotation":[0,0,1,1.57],
                          "-children":[
                            { "Shape":
                              {
                                "@USE":"wall"
                              }
                            }
                          ]
                        }
                      },
                      {
                        "#comment":"right wall"
                      },
                      { "Transform":
                        {
                          "@rotation":[0,0,1,1.57],
                          "@translation":[80,0,0],
                          "-children":[
                            { "Shape":
                              {
                                "@USE":"wall"
                              }
                            }
                          ]
                        }
                      },
                      {
                        "#comment":"top"
                      },
                      { "Transform":
                        {
                          "@translation":[0,80,0],
                          "-children":[
                            { "Shape":
                              {
                                "@USE":"wall"
                              }
                            }
                          ]
                        }
                      },
                      {
                        "#comment":"front wall"
                      },
                      { "Transform":
                        {
                          "@rotation":[1,0,0,1.57],
                          "-children":[
                            { "Shape":
                              {
                                "-appearance":
                                  { "Appearance":
                                    {
                                      "@USE":"wallpaper"
                                    }
                                  },
                                "-geometry":
                                  { "IndexedFaceSet":
                                    {
                                      "@coordIndex":[0,1,2,7,-1,2,3,6,7,-1,4,5,6,3,-1],
                                      "@solid":false,
                                      "-coord":
                                        { "Coordinate":
                                          {
                                            "@point":[0,0,0,25,0,0,25,0,-45,55,0,-45,55,0,0,80,0,0,80,0,-80,0,0,-80]
                                          }
                                        }
                                    }
                                  }
                              }
                            }
                          ]
                        }
                      },
                      {
                        "#comment":"door with its interpalotors and sensors"
                      },
                      { "Transform":
                        {
                          "@DEF":"transform_door",
                          "@center":[25,0,0],
                          "-children":[
                            { "Transform":
                              {
                                "@translation":[40,22.5,0],
                                "-children":[
                                  { "Shape":
                                    {
                                      "-appearance":
                                        { "Appearance":
                                          {
                                            "-texture":
                                              { "ImageTexture":
                                                {
                                                  "@url":["Door.jpg","https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/Door.jpg"]
                                                }
                                              }
                                          }
                                        },
                                      "-geometry":
                                        { "Box":
                                          {
                                            "@size":[30,44.5,2]
                                          }
                                        }
                                    }
                                  },
                                  { "TouchSensor":
                                    {
                                      "@DEF":"touch_door",
                                      "@description":"touch door to open/close"
                                    }
                                  }
                                ]
                              }
                            },
                            { "Script":
                              {
                                "@DEF":"open_door_js",
                                "field": [
                                  {
                                    "@name":"set_open",
                                    "@accessType":"inputOnly",
                                    "@type":"SFTime"
                                  },
                                  {
                                    "@name":"keyValue_changed",
                                    "@accessType":"outputOnly",
                                    "@type":"MFRotation"
                                  },
                                  {
                                    "@name":"open",
                                    "@accessType":"initializeOnly",
                                    "@type":"SFBool",
                                    "@value":false
                                  }
                                ],
                                "#sourceCode":[
"",
"",
"ecmascript:",
"",
"function set_open() {",
"    keyValue_changed[0][0] = 0;",
"    keyValue_changed[0][1] = 1;",
"    keyValue_changed[0][2] = 0;",
"    keyValue_changed[1][0] = 0;",
"    keyValue_changed[1][1] = 1;",
"    keyValue_changed[1][2] = 0;",
"    keyValue_changed[1][3] = -0.754;",
"    keyValue_changed[2][0] = 0;",
"    keyValue_changed[2][1] = 1;",
"    keyValue_changed[2][2] = 0;",
"",
"  if(open == false) {",
"    keyValue_changed[0][3] = 0;",
"    keyValue_changed[2][3] = -1.57;",
"    open = true;",
"  } else {",
"      if(open == true) {",
"         keyValue_changed[0][3] = -1.57;",
"         keyValue_changed[2][3] = 0;",
"         open = false;",
"      }",
"   }",
"}",
"",
""
]
                              }
                            },
                            { "TimeSensor":
                              {
                                "@DEF":"clock",
                                "@cycleInterval":4.5
                              }
                            },
                            { "OrientationInterpolator":
                              {
                                "@DEF":"open_door",
                                "@key":[0,0.5,1],
                                "@keyValue":[0,1,0,0,0,1,0,0,0,1,0,0]
                              }
                            }
                          ]
                        }
                      },
                      {
                        "#comment":"link to nps site"
                      },
                      { "Anchor":
                        {
                          "@description":"link to NPS web page",
                          "@url":["https://www.nps.edu"],
                          "-children":[
                            { "Transform":
                              {
                                "@translation":[40,22.5,-20],
                                "-children":[
                                  { "Shape":
                                    {
                                      "-appearance":
                                        { "Appearance":
                                          {
                                            "-material":
                                              { "Material":
                                                {
                                                  "@diffuseColor":[0,0,0]
                                                }
                                              }
                                          }
                                        },
                                      "-geometry":
                                        { "Box":
                                          {
                                            "@size":[30,44.5,1]
                                          }
                                        }
                                    }
                                  }
                                ]
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                },
                {
                  "#comment":"Door sound"
                },
                { "Sound":
                  {
                    "@direction":[0,1,1],
                    "@location":[40,0,0],
                    "@maxBack":150,
                    "@maxFront":150,
                    "-source":
                      { "AudioClip":
                        {
                          "@DEF":"grinding_door",
                          "@description":"GrindingDoor",
                          "@url":["GrindingDoor.wav","https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/GrindingDoor.wav"]
                        }
                      }
                  }
                }
              ]
            }
          },
          {
            "#comment":"chair inserted"
          },
          { "Transform":
            {
              "@scale":[1.5,1.5,1.5],
              "@translation":[10,5.3,35],
              "-children":[
                { "ProtoInstance":
                  {
                    "@name":"Chair",
                    "fieldValue": [
                      {
                        "@name":"diffuseColor",
                        "@value":[0,0.3,0.7]
                      }
                    ]
                  }
                }
              ]
            }
          },
          {
            "#comment":"desk inserted"
          },
          { "Transform":
            {
              "@rotation":[0,1,0,-0.754],
              "@scale":[0.8,0.8,0.7],
              "@translation":[18,8.1,28],
              "-children":[
                { "ProtoInstance":
                  {
                    "@name":"Desk"
                  }
                }
              ]
            }
          },
          {
            "#comment":"left wall_lamp"
          },
          { "Transform":
            {
              "@rotation":[0,1,0,1.57],
              "@scale":[2,2,2],
              "@translation":[0.05,23,20],
              "-children":[
                { "ProtoInstance":
                  {
                    "@name":"WallLamp",
                    "fieldValue": [
                      {
                        "@name":"lampColor",
                        "@value":[0,0,1]
                      },
                      {
                        "@name":"lightColor",
                        "@value":[1,1,1]
                      },
                      {
                        "@name":"lightIntensity",
                        "@value":0.8
                      },
                      {
                        "@name":"lightAttenuation",
                        "@value":[0,0,0]
                      },
                      {
                        "@name":"radius",
                        "@value":100
                      },
                      {
                        "@name":"lightLocation",
                        "@value":[0,0,5]
                      }
                    ]
                  }
                }
              ]
            }
          },
          {
            "#comment":"right wall_lamp"
          },
          { "Transform":
            {
              "@rotation":[0,1,0,-1.57],
              "@scale":[2,2,2],
              "@translation":[31.99,23,20],
              "-children":[
                { "ProtoInstance":
                  {
                    "@name":"WallLamp",
                    "fieldValue": [
                      {
                        "@name":"lampColor",
                        "@value":[0,0,1]
                      },
                      {
                        "@name":"lightColor",
                        "@value":[1,1,1]
                      },
                      {
                        "@name":"lightIntensity",
                        "@value":0.8
                      },
                      {
                        "@name":"lightAttenuation",
                        "@value":[0,0,0]
                      },
                      {
                        "@name":"radius",
                        "@value":100
                      },
                      {
                        "@name":"lightLocation",
                        "@value":[0,0,-5]
                      }
                    ]
                  }
                }
              ]
            }
          },
          {
            "#comment":"clock inserted on the wall"
          },
          { "Transform":
            {
              "@translation":[16,22.5,0],
              "-children":[
                { "Inline":
                  {
                    "@url":["WallClock.x3d","https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/WallClock.x3d","WallClock.wrl","https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/WallClock.wrl"]
                  }
                }
              ]
            }
          },
          {
            "#comment":"desk lamp inserted in the scene"
          },
          { "Transform":
            {
              "@scale":[15,15,15],
              "@translation":[16,8.6,25],
              "-children":[
                { "Inline":
                  {
                    "@url":["DeskLamp.x3d","https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/DeskLamp.x3d","DeskLamp.wrl","https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/DeskLamp.wrl"]
                  }
                }
              ]
            }
          },
          {
            "#comment":"routes for the door"
          },
          { "ROUTE":
            {
              "@fromField":"touchTime",
              "@fromNode":"touch_door",
              "@toField":"startTime",
              "@toNode":"clock"
            }
          },
          { "ROUTE":
            {
              "@fromField":"touchTime",
              "@fromNode":"touch_door",
              "@toField":"set_open",
              "@toNode":"open_door_js"
            }
          },
          { "ROUTE":
            {
              "@fromField":"touchTime",
              "@fromNode":"touch_door",
              "@toField":"startTime",
              "@toNode":"grinding_door"
            }
          },
          { "ROUTE":
            {
              "@fromField":"keyValue_changed",
              "@fromNode":"open_door_js",
              "@toField":"set_keyValue",
              "@toNode":"open_door"
            }
          },
          { "ROUTE":
            {
              "@fromField":"fraction_changed",
              "@fromNode":"clock",
              "@toField":"set_fraction",
              "@toNode":"open_door"
            }
          },
          { "ROUTE":
            {
              "@fromField":"value_changed",
              "@fromNode":"open_door",
              "@toField":"set_rotation",
              "@toNode":"transform_door"
            }
          }
        ]
    }
  }
}