{ "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": {
        "component": [
          {
            "@name":"DIS",
            "@level":1
          }
        ],
        "meta": [
          {
            "@name":"title",
            "@content":"NetworkedCamera.x3d"
          },
          {
            "@name":"description",
            "@content":"Networked control of master/slave viewpoints using DIS EspduTransform node."
          },
          {
            "@name":"creator",
            "@content":"Alan Hudson and Don Brutzman"
          },
          {
            "@name":"translator",
            "@content":"LT Patrick Sullivan"
          },
          {
            "@name":"created",
            "@content":"19 April 2005"
          },
          {
            "@name":"translated",
            "@content":"19 April 2005"
          },
          {
            "@name":"modified",
            "@content":"9 October 2023"
          },
          {
            "@name":"warning",
            "@content":"under development. will split into simple Inline-capable camera scene and usage example. Xj3D chat-server fallback needs to be checked."
          },
          {
            "@name":"reference",
            "@content":"http://www.xj3d.org/extensions/DIS.html"
          },
          {
            "@name":"reference",
            "@content":"http://www.yumetech.com"
          },
          {
            "@name":"identifier",
            "@content":"https://www.web3d.org/x3d/content/examples/Basic/DistributedInteractiveSimulation/NetworkedCamera.x3d"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 4.0, 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":"NetworkedCamera.x3d"
            }
          },
          { "Background":
            {
              "@groundAngle":[1.45,1.57],
              "@groundColor":[0.005,0.05,0.03,0.01,0.13,0.09,0.025,0.22,0.17],
              "@skyAngle":[0.9,1.57],
              "@skyColor":[0,0,0.2,0.1,0.1,0.8,0.7,0.7,1]
            }
          },
          { "Viewpoint":
            {
              "@description":"Free Navigation",
              "@position":[28.85,3.978,-98.85]
            }
          },
          { "Viewpoint":
            {
              "@DEF":"MasterViewpoint",
              "@description":"Master Viewpoint",
              "@orientation":[0.001188,-1,-0.008389,-2.86],
              "@position":[28.85,3.978,-98.85]
            }
          },
          { "ProximitySensor":
            {
              "@DEF":"WorldProximitySensor",
              "@size":[1000000,1000000,1000000]
            }
          },
          { "EspduTransform":
            {
              "@DEF":"CameraEspduTransform",
              "@address":"224.2.181.145",
              "@networkMode":"networkWriter",
              "@port":62040,
              "@writeInterval":0.01,
              "-children":[
                { "Viewpoint":
                  {
                    "@DEF":"SlavedViewpoint",
                    "@description":"Slaved Viewpoint",
                    "@position":[0,0,0]
                  }
                }
              ]
            }
          },
          { "Script":
            {
              "@DEF":"ViewpointControlScript",
              "field": [
                {
                  "@name":"bindMaster",
                  "@accessType":"inputOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"bindSlave",
                  "@accessType":"inputOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"user_translation",
                  "@accessType":"inputOnly",
                  "@type":"SFVec3f"
                },
                {
                  "@name":"user_rotation",
                  "@accessType":"inputOnly",
                  "@type":"SFRotation"
                },
                {
                  "@name":"sharedTranslation",
                  "@accessType":"outputOnly",
                  "@type":"SFVec3f"
                },
                {
                  "@name":"sharedRotation",
                  "@accessType":"outputOnly",
                  "@type":"SFRotation"
                },
                {
                  "@name":"networkMode",
                  "@accessType":"outputOnly",
                  "@type":"SFString"
                },
                {
                  "@name":"isMaster",
                  "@accessType":"initializeOnly",
                  "@type":"SFBool",
                  "@value":false
                },
                {
                  "@name":"isSlave",
                  "@accessType":"initializeOnly",
                  "@type":"SFBool",
                  "@value":false
                }
              ],
              "#sourceCode":[
"",
"",
"ecmascript:",
"",
"function bindMaster (value)",
"{",
"\tBrowser.println ('[NetworkedCamera] Master viewpoint bound');",
"\tisMaster = value;",
"\tif (isMaster) networkMode ='networkWriter';",
"}",
"",
"function bindSlave (value)",
"{",
"\tBrowser.println ('[NetworkedCamera] Slave viewpoint bound');",
"\tisSlave = value;",
"\tif (isSlave) networkMode ='networkReader';",
"}",
"",
"function user_translation(value)",
"{",
"\tif (isMaster) sharedTranslation = value;",
"}",
"",
"function user_rotation(value)",
"{",
"\tif (isMaster) sharedRotation = value;",
"}",
"",
""
]
            }
          },
          { "ROUTE":
            {
              "@fromField":"isBound",
              "@fromNode":"MasterViewpoint",
              "@toField":"bindMaster",
              "@toNode":"ViewpointControlScript"
            }
          },
          { "ROUTE":
            {
              "@fromField":"isBound",
              "@fromNode":"MasterViewpoint",
              "@toField":"enabled",
              "@toNode":"WorldProximitySensor"
            }
          },
          { "ROUTE":
            {
              "@fromField":"isBound",
              "@fromNode":"SlavedViewpoint",
              "@toField":"bindSlave",
              "@toNode":"ViewpointControlScript"
            }
          },
          { "ROUTE":
            {
              "@fromField":"position_changed",
              "@fromNode":"WorldProximitySensor",
              "@toField":"user_translation",
              "@toNode":"ViewpointControlScript"
            }
          },
          { "ROUTE":
            {
              "@fromField":"orientation_changed",
              "@fromNode":"WorldProximitySensor",
              "@toField":"user_rotation",
              "@toNode":"ViewpointControlScript"
            }
          },
          { "ROUTE":
            {
              "@fromField":"sharedTranslation",
              "@fromNode":"ViewpointControlScript",
              "@toField":"set_translation",
              "@toNode":"CameraEspduTransform"
            }
          },
          { "ROUTE":
            {
              "@fromField":"sharedRotation",
              "@fromNode":"ViewpointControlScript",
              "@toField":"set_rotation",
              "@toNode":"CameraEspduTransform"
            }
          },
          { "ROUTE":
            {
              "@fromField":"networkMode",
              "@fromNode":"ViewpointControlScript",
              "@toField":"networkMode",
              "@toNode":"CameraEspduTransform"
            }
          },
          {
            "#comment":"======================================================"
          },
          {
            "#comment":"Integrate heads-up display with onscreen networkMode selection and position/orientation tracing"
          },
          {
            "#comment":"use of HeadsUpDislay and ViewPositionOrientation prototypes will be helpful if Xj3D supports them"
          },
          {
            "#comment":"consider entity discovery as well"
          },
          {
            "#comment":"======================================================"
          },
          {
            "#comment":"Example background viewing scene, split out into separate example next"
          },
          { "Background":
            {
              "@groundAngle":[1.45,1.57],
              "@groundColor":[0.005,0.05,0.03,0.01,0.13,0.09,0.025,0.22,0.17],
              "@skyAngle":[0.9,1.57],
              "@skyColor":[0,0,0.2,0.1,0.1,0.8,0.7,0.7,1]
            }
          },
          { "NavigationInfo":
            {
              "@speed":10,
              "@type":["WALK","ANY"]
            }
          },
          { "Transform":
            {
              "@translation":[0,-0.1,0],
              "-children":[
                { "Shape":
                  {
                    "-appearance":
                      { "Appearance":
                        {
                          "-texture":
                            { "PixelTexture":
                              {
                                "@DEF":"PT",
                                "@image":[2,2,3,0,65280,255,16711680]
                              }
                            },
                          "-textureTransform":
                            { "TextureTransform":
                              {
                                "@scale":[100,100]
                              }
                            }
                        }
                      },
                    "-geometry":
                      { "IndexedFaceSet":
                        {
                          "@colorPerVertex":false,
                          "@coordIndex":[0,1,2,3,0,-1],
                          "-coord":
                            { "Coordinate":
                              {
                                "@point":[1000,0,1000,1000,0,-1000,-1000,0,-1000,-1000,0,1000]
                              }
                            }
                        }
                      }
                  }
                }
              ]
            }
          }
        ]
    }
  }
}