[x3d-public] [x3dom-users] simple X3D -> JSON -> X3DOM, D3.js

Don Brutzman brutzman at nps.edu
Wed Feb 25 13:58:16 PST 2015


That excerpt is an excellent example of VRML-style encoding with field names as local keys.  Also referred to in this thread as "explicit" encoding that includes SFNode/MFNode field names, similarly in .x3d as containerField values.

One difference is use of strings everywhere, I believe that consensus is to use numbers and booleans where possible.

On 2/25/2015 12:10 PM, John Carlson wrote:
> The JSON that was produced by flipper.html has 3 viewpoints.  That is because they are in an array wrapping objects, like so:
>
>> "children": [
>>
>>             {
>>
>>                 "Viewpoint": {
>>
>>                     "bind": "false",
>>
>>                     "centerOfRotation": "0,0,0",
>>
>>                     "description": "cam0",
>>
>>                     "fieldOfView": "0.785398",
>>
>>                     "isActive": "true",
>>
>>                     "metadata": null,
>>
>>                     "orientation": "0,0,0,0",
>>
>>                     "position": "0,0,800",
>>
>>                     "zFar": "-1",
>>
>>                     "zNear": "-1"
>>
>>                 }
>>
>>             },
>>
>>             {
>>
>>                 "Viewpoint": {
>>
>>                     "bind": "false",
>>
>>                     "centerOfRotation": "0,0,0",
>>
>>                     "description": "cam1",
>>
>>                     "fieldOfView": "0.785398",
>>
>>                     "isActive": "false",
>>
>>                     "metadata": null,
>>
>>                     "orientation": "0,0,0,0",
>>
>>                     "position": "0,0,2000",
>>
>>                     "zFar": "-1",
>>
>>                     "zNear": "-1"
>>
>>                 }
>>
>>             },
>>
>>             {
>>
>>                 "Viewpoint": {
>>
>>                     "bind": "false",
>>
>>                     "centerOfRotation": "0,0,0",
>>
>>                     "description": "cam2",
>>
>>                     "fieldOfView": "0.785398",
>>
>>                     "isActive": "false",
>>
>>                     "metadata": null,
>>
>>                     "orientation": "0,0,0,0",
>>
>>                     "position": "0,200,1000",
>>
>>                     "zFar": "-1",
>>
>>                     "zNear": "-1"
>>
>>                 }
>>
>> },
>
> The Transforms in HelloWorld.json are not in such an array wrapping objects, and thus only the last one is kept.  If we do something similar with Transforms that flipper.html did with Viewpoints, I will be satisfied.

agreed

> John

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



More information about the x3d-public mailing list