a json encoding for x3d
play

A JSON encoding for X3D Roy Walmsley roy.walmsley@ntlworld.com Don - PowerPoint PPT Presentation

Consortium A JSON encoding for X3D Roy Walmsley roy.walmsley@ntlworld.com Don Brutzman brutzman@nps.edu John Carlson john@carlsonsolutiondesign.com Web3D 2016, Anaheim, California 23 rd July 2016 1 Consortium Contents ISO/IEC standards


  1. Consortium A JSON encoding for X3D Roy Walmsley roy.walmsley@ntlworld.com Don Brutzman brutzman@nps.edu John Carlson john@carlsonsolutiondesign.com Web3D 2016, Anaheim, California 23 rd July 2016 1

  2. Consortium Contents • ISO/IEC standards • Requirements • JSON structure • Methodology • Encoding of nodes • Encoding of fields • Validation • Implementations Web3D 2016, Anaheim, California 23 rd July 2016 2

  3. Consortium ISO/IEC standards Series Series Title Title Part Part Content Content 1 1 Architecture Architecture 19775 19775 X3D X3D 2 2 Scene access interface (SAI) Scene access interface (SAI) 1 1 XML (.x3d) XML (.x3d) 19776 File encodings 2 2 Classic VRML (.x3dv) Classic VRML (.x3dv) 19776 File encodings 3 3 Compressed Binary (.x3db) Compressed Binary (.x3db) 5 1 JSON (.x3dj or .json) ECMAScript 19777 Language bindings 2 1 Java ECMAScript 19777 Language bindings 2 Java Web3D 2016, Anaheim, California 23 rd July 2016 3

  4. Consortium Requirements • Must fully specify everything defined in the X3D abstract specification. – Nodes and fields – Statements and other constructs – Comments – Scripts and Shader code • "Round trippable" with no loss of X3D content for any of the file encodings. Web3D 2016, Anaheim, California 23 rd July 2016 4

  5. Consortium JSON structure • Two primary data structures – Objects: An unordered collection of name/value pairs – Arrays: An ordered collection of values • JSON value – Object, array, number, string, true, false, null • Structural tokens – { } [ ] : , – Strings delimited by " • JSON doesn't have specific comments structures Web3D 2016, Anaheim, California 23 rd July 2016 5

  6. Consortium Methodology • Examples archive – stylesheet conversion • JSON validation • Specific issues: – Handling of ROUTEs and Comments – Character escaping – No hexadecimal number representation • X3D JSON Validation • Implementation Web3D 2016, Anaheim, California 23 rd July 2016 6

  7. Consortium Encoding of nodes • Nodes encoded: – In XML as elements, e.g. <Group/> – In JSON as objects, e.g. "Group":{} • Node type is name in name/value pair • Empty object means all attributes have default values Web3D 2016, Anaheim, California 23 rd July 2016 7

  8. Consortium Encoding of fields • Usefully categorized as follows: – 'value field', holds numbers, strings, or boolean true/false – 'node field', holds references to other nodes • Field names are strings, so to distinguish them from other strings a name is prepended with: – '@' for value fields – '-' for node fields Web3D 2016, Anaheim, California 23 rd July 2016 8

  9. Consortium Encoding of value fields • In XML fields are attributes of elements (nodes), e.g.: <Group bboxSize='-1 -1 -1'/> • In JSON fields are properties of objects (nodes), e.g.: "Group": { "@bboxSize":[-1,-1,-1] } Web3D 2016, Anaheim, California 23 rd July 2016 9

  10. Consortium Encoding on node fields • In XML referenced nodes are child elements, e.g. <Group bboxSize='-1 -1 -1'> <Viewpoint containerField='children'/> <Group/> • In JSON the field is a property of the containing node, and the referenced node is an object, e.g. "Group": { "@bboxSize":[-1,-1,-1], "-children": [ { "Viewpoint": {} } ] Web3D 2016, Anaheim, California 23 rd July 2016 10

  11. Consortium Comments / ROUTEs, etc. • In XML: <!–- This is a comment --> • In JSON: "#comment":"This is a comment" "Group":{ <Group bboxSize='-1 -1 -1'> "Group":{ "@bboxSIze":[-1,-1,-1], "@bboxSIze":[-1,-1,-1], <!–- Before Viewpoint --> "-children":[ "#comment":"Before Viewpoint", <Viewpoint containerField='children'/> {"#comment":"Before Viewpoint"}, "-children":[ <!-- After Viewpoint --> {"Viewpoint":{}}, {"Viewpoint":{}} <Group/> {"#comment":"After Viewpoint"} ], ] "#comment":"After Viewpoint" } } Web3D 2016, Anaheim, California 23 rd July 2016 11

  12. Consortium Validation • Like XML, use a Schema – Covers all X3D nodes, statements, etc. – Available online at: http://www.web3d.org/specifications/x3d-3.3-JSONSchema.json • JSON schema has improved validation capabilities: – Validates child node content of individual node fields – Validates individual array elements Web3D 2016, Anaheim, California 23 rd July 2016 12

  13. Consortium Implementations • For web browsers: – X3DOM and Cobweb use XML encoded files – JSON loader developed. Either: • Loads directly into DOM, or • Via XML to X3DOM or Cobweb • A standalone C++ application – Uses XML encoded files – JSON loader / validator developed Web3D 2016, Anaheim, California 23 rd July 2016 13

  14. Consortium Questions Web3D 2016, Anaheim, California 23 rd July 2016 14

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend