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

Leonard Daly web3d at realism.com
Mon Oct 13 11:02:22 PDT 2014


>> There are very few examples in the JSON spec.  A strict reading there 
>> seems to permit either form: an array with a single value, or else a 
>> singleton number with no surrounding brackets.
>>
>> JSON question #2, wondering which is correct for an MFVec3f value, 
>> single array or array of arrays?
>>
>>     "keyValue": [0 0 0 1 1 1 2 2 2],
>> or
>>     "keyValue": [ [0 0 0], [1 1 1], [2 2 2] ],
>
> Revised candidates, with required commas:
>
>     "keyValue": [ 0, 0, 0, 1, 1, 1, 2, 2, 2 ],
> or
>      "keyValue": [ [0, 0, 0], [1, 1, 1], [2, 2, 2] ],
>
> Still wondering.  This is likely a player question, what form is 
> preferred for efficient operations.  Will assume the second form 
> (array of arrays) unless someone argues otherwise.


I prefer the second case. That way the elements of the array are the 
points, colors, rotations, etc. and the elements of each array element 
are the particular coordinate-value. Otherwise it would be necessary to 
compute the indices.

Now I see that people seem to like the first version, so I'll supply 
more reasoning.

I am looking at this from the standpoint of a 3D developer who needs to 
(programmatically) work with the elements of the array. For this 
discussion, assume this is a point array with each point having 3 
coordinates (point field in a Coordinate node).  If I wish to morph the 
existing shape into something else, I want to work with the points (as a 
3-tuple) of the shape. It is creates much clearer code to reference 
something like p[27] than (p[27*3], p[27*3+1], p[27*3+2]).

I also think that we need a means for importing large data so that it is 
not necessary to store all scene data (not scene structure) together 
with the structure. This would allow geometry, animations, normals, etc. 
to be stored separately and transmitted in an efficient manner (binary, 
compressed, etc.) into the scene. This capability would apply to all 
encodings.


-- 
*Leonard Daly*
X3D Co-Chair
Cloud Consultant
President, Daly Realism - /Creating the Future/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20141013/990ea055/attachment.html>


More information about the X3D-Public mailing list