{ "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":"EventMonitorTest.x3d"
          },
          {
            "@name":"description",
            "@content":"This scene demonstrates how to receive a simple event and report it graphically, repeating every few seconds. Scene conversion from the XML encoding (.x3d) is then used to demonstrate X3DOM event handling within a web page (.xhtml)."
          },
          {
            "@name":"creator",
            "@content":"Don Brutzman"
          },
          {
            "@name":"acknowledgements",
            "@content":"Chris Peri, Dave Arendash and Damon Hernandez"
          },
          {
            "@name":"created",
            "@content":"15 March 2014"
          },
          {
            "@name":"modified",
            "@content":"31 October 2021"
          },
          {
            "@name":"TODO",
            "@content":"record log outputs, compare various X3D players"
          },
          {
            "@name":"reference",
            "@content":"AEC Hackathon v1.1, Facebook Menlo Park California"
          },
          {
            "@name":"reference",
            "@content":"http://www.aechackathon.org"
          },
          {
            "@name":"identifier",
            "@content":"https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/UserExperienceUX/EventMonitorTest.x3d"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 4.0, https://www.web3d.org/x3d/tools/X3D-Edit"
          },
          {
            "@name":"generator",
            "@content":"https://www.web3d.org/x3d/stylesheets/X3dToX3dom.xslt"
          },
          {
            "@name":"license",
            "@content":"../license.html"
          },
          {
            "@name":"translated",
            "@content":"31 August 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":"=================================================="
          },
          {
            "#comment":"Reusable code block for X3DOM: indicate event status"
          },
          { "WorldInfo":
            {
              "@title":"EventMonitorTest.x3d"
            }
          },
          { "Background":
            {
              "@skyColor":[0.4,0.6,1]
            }
          },
          { "Viewpoint":
            {
              "@description":"Event Monitor Text",
              "@position":[0,0,6]
            }
          },
          { "Transform":
            {
              "@translation":[-0.6,1.2,0],
              "-children":[
                { "Shape":
                  {
                    "-geometry":
                      { "Text":
                        {
                          "@string":["Event Status"],
                          "-fontStyle":
                            { "FontStyle":
                              {
                                "@DEF":"Font",
                                "@justify":["MIDDLE","MIDDLE"],
                                "@style":"BOLD"
                              }
                            }
                        }
                      },
                    "-appearance":
                      { "Appearance":
                        {
                          "-material":
                            { "Material":
                              {
                                "@DEF":"TextMaterial",
                                "@diffuseColor":[0.7,0.7,0.1]
                              }
                            }
                        }
                      }
                  }
                }
              ]
            }
          },
          { "Switch":
            {
              "@DEF":"EventSwitch",
              "@whichChoice":0,
              "-children":[
                { "Group":
                  {
                    "@DEF":"DisplayUp",
                    "-children":[
                      { "Shape":
                        {
                          "-geometry":
                            { "Text":
                              {
                                "@string":["UP"],
                                "-fontStyle":
                                  { "FontStyle":
                                    {
                                      "@USE":"Font"
                                    }
                                  }
                              }
                            },
                          "-appearance":
                            { "Appearance":
                              {
                                "-material":
                                  { "Material":
                                    {
                                      "@DEF":"UpColor",
                                      "@diffuseColor":[0.2,0.7,0.3]
                                    }
                                  }
                              }
                            }
                        }
                      },
                      { "Transform":
                        {
                          "@translation":[-2.5,0,0],
                          "-children":[
                            { "Shape":
                              {
                                "-geometry":
                                  { "Cone":
                                    {
                                      "@DEF":"SmallCone",
                                      "@bottomRadius":0.4,
                                      "@height":0.6
                                    }
                                  },
                                "-appearance":
                                  { "Appearance":
                                    {
                                      "-material":
                                        { "Material":
                                          {
                                            "@USE":"UpColor"
                                          }
                                        }
                                    }
                                  }
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                },
                { "Group":
                  {
                    "@DEF":"DisplayDown",
                    "-children":[
                      { "Shape":
                        {
                          "-geometry":
                            { "Text":
                              {
                                "@string":["DOWN"],
                                "-fontStyle":
                                  { "FontStyle":
                                    {
                                      "@USE":"Font"
                                    }
                                  }
                              }
                            },
                          "-appearance":
                            { "Appearance":
                              {
                                "-material":
                                  { "Material":
                                    {
                                      "@DEF":"DownColor",
                                      "@diffuseColor":[1,0.2,0.2]
                                    }
                                  }
                              }
                            }
                        }
                      },
                      { "Transform":
                        {
                          "@rotation":[1,0,0,3.14159],
                          "@translation":[-2.5,0,0],
                          "-children":[
                            { "Shape":
                              {
                                "-geometry":
                                  { "Cone":
                                    {
                                      "@USE":"SmallCone"
                                    }
                                  },
                                "-appearance":
                                  { "Appearance":
                                    {
                                      "-material":
                                        { "Material":
                                          {
                                            "@USE":"DownColor"
                                          }
                                        }
                                    }
                                  }
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                }
              ]
            }
          },
          {
            "#comment":"=================================================="
          },
          {
            "#comment":"Test harness: produce true/false events, flip the Switch"
          },
          { "IntegerTrigger":
            {
              "@DEF":"EventTrueTrigger",
              "@integerKey":0
            }
          },
          { "ROUTE":
            {
              "@fromField":"triggerValue",
              "@fromNode":"EventTrueTrigger",
              "@toField":"whichChoice",
              "@toNode":"EventSwitch"
            }
          },
          { "IntegerTrigger":
            {
              "@DEF":"EventFalseTrigger",
              "@integerKey":1
            }
          },
          { "ROUTE":
            {
              "@fromField":"triggerValue",
              "@fromNode":"EventFalseTrigger",
              "@toField":"whichChoice",
              "@toNode":"EventSwitch"
            }
          },
          { "Script":
            {
              "@DEF":"EventReceiverScript",
              "field": [
                {
                  "@name":"input",
                  "@accessType":"inputOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"eventIsTrue",
                  "@accessType":"outputOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"eventIsFalse",
                  "@accessType":"outputOnly",
                  "@type":"SFBool"
                }
              ],
              "#sourceCode":[
"",
"",
"ecmascript:",
"",
"function input (eventValue) // input eventValue received for inputOnly field",
"{",
"   if (eventValue) eventIsTrue  = true;",
"   else            eventIsFalse = true;",
"}",
"",
""
]
            }
          },
          { "ROUTE":
            {
              "@fromField":"eventIsTrue",
              "@fromNode":"EventReceiverScript",
              "@toField":"set_boolean",
              "@toNode":"EventTrueTrigger"
            }
          },
          { "ROUTE":
            {
              "@fromField":"eventIsFalse",
              "@fromNode":"EventReceiverScript",
              "@toField":"set_boolean",
              "@toNode":"EventFalseTrigger"
            }
          },
          {
            "#comment":"Testing block: alternate true/false"
          },
          { "BooleanSequencer":
            {
              "@DEF":"BooleanSwitcher",
              "@key":[0,0.5,1],
              "@keyValue":[true,false,false]
            }
          },
          { "ROUTE":
            {
              "@fromField":"value_changed",
              "@fromNode":"BooleanSwitcher",
              "@toField":"input",
              "@toNode":"EventReceiverScript"
            }
          },
          { "TimeSensor":
            {
              "@DEF":"SwitchTestClock",
              "@cycleInterval":6,
              "@loop":true
            }
          },
          { "ROUTE":
            {
              "@fromField":"fraction_changed",
              "@fromNode":"SwitchTestClock",
              "@toField":"set_fraction",
              "@toNode":"BooleanSwitcher"
            }
          }
        ]
    }
  }
}