[X3D-Public] [x3dom-developers] initial X3D JSON conversion support using X3dToJson.xslt

Don Brutzman brutzman at nps.edu
Thu Oct 16 22:50:10 PDT 2014


abject pleading follows   8)

On 10/13/2014 12:47 PM, Don Brutzman wrote:
> [...]
> d. still not seeing an X3DOM example of JSON.parse() and .json scene (though have asked several times).
>
> as before, if X3DOM has an internal X3D model with corresponding parsable JSON, that will be very helpful.
>
> is anything online, hopefully showing loading and parsing?
>
> if not, OK.  even draft-y or different-ish examples will likely aid understanding.
>
> i think that the current HelloWorld.json example seems perfectly parsable already, and it would be good to see how much close the result is to how X3DOM works.

It would be great if someone experienced could uncover or spin together some kind of JSON.parse() conversion code that loads the attached .json syntax into X3DOM.

This will get some good visibility at the VR Hackathon this weekend, all contributions welcome and will be fully credited.

Of course am willing to vary the encoding pattern if that helps simplify the loading - that is the whole goal, find the right balance.

Not sure our Javascript skills are up to the task, but we will struggle with it.   :0

Thanks for any help.

all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman
-------------- next part --------------
{
  "#comment": "Example scene to illustrate X3D nodes and fields (XML elements and attributes)",
  "Group": [
  {
    "Viewpoint": {
      "@DEF": "ViewUpClose",
      "@centerOfRotation": [ 0, -1, 0 ],
      "@description": "Hello world!",
      "@position": [ 0, -1, 7 ]
    },
    "Transform": [
    {
      "@rotation": [ 0, 1, 0, 3 ],
      "Shape": [
      {
        "Sphere": {
        },
        "Appearance": [
        {
          "#comment": "added transparency value to test JSON conversion of single number",
          "Material": {
            "@DEF": "MaterialLightBlue",
            "@diffuseColor": [ 0.1, 0.5, 1 ],
            "@transparency": 0.1
          },
          "ImageTexture": {
            "@DEF": "ImageCloudlessEarth",
            "@url": [ "earth-topo.png", "earth-topo.jpg", "earth-topo-small.gif", "http://www.web3d.org/x3d/content/examples/Basic/earth-topo.png", "http://www.web3d.org/x3d/content/examples/Basic/earth-topo.jpg", "http://www.web3d.org/x3d/content/examples/Basic/earth-topo-small.gif" ]
          }
        }
        ]
      }
      ]
    }
    ],
    "Transform": [
    {
      "@translation": [ 0, -2, 0 ],
      "Shape": [
      {
        "Text": [
        {
          "@DEF": "TextMessage",
          "@string": [ "Hello", "world!" ],
          "FontStyle": {
            "@justify": [ "MIDDLE", "MIDDLE" ]
          }
        }
        ],
        "Appearance": [
        {
          "Material": {
            "@USE": "MaterialLightBlue"
          }
        }
        ]
      }
      ]
    }
    ]
  }
  ]
}


More information about the X3D-Public mailing list