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

Don Brutzman brutzman at nps.edu
Thu Oct 16 22:44:26 PDT 2014


On 10/16/2014 9:09 AM, Cecile Muller wrote:
> Hi Don,
>
>
>> a.  how is
>>        "_type": "Shape",
>>
>> different than
>>       "Shape": [
>>
>> The "_type" doesn't add any information per se.
>
> The main reason is because it results in less deeply nested structures.
> The full reply (which was a bit too long for an email) is posted there:
> https://github.com/wildpeaks/json-scenegraph/issues/1

Wow very interesting Cecile.

Something that jumps out is when you say "How would you make a Group that contains a Shape, a Transform and another Shape ?
It can't be the following because an Object can't define property Shape twice"

That is indeed a serious constraint, if it is indeed correct - that wasn't clear about Javascript.  (got a reference?)  Wondering then, what about your repeated use of "_type", isn't that the same sort of repetition as repeating "Shape" and "Transform" ?

             "_type": "Shape"
             ...
         },
         {
             "_type": "Transform"
             ...
         },
         {
             "_type": "Shape"


pending that answer, wondering then whether this slight variation using field name (containerField) is an alternative option:



             "_children": "Shape"
             ...
         },
         {
             "_children": "Transform"
             ...
         },
         {
             "_children": "Shape"


>> b. how is
>>        translation: _data.translation || [0, 0, 0],
>>
>> different than
>>
>>        "@translation": [ 0, -2, 0 ],
>> Also wondering what the || (inclusive or) operator is doing there.  It does not appear in the JSON specification.  This appears to be a mix of JSON Data Interchange Format (ECMA-404) and javascript source.
>
> That part was just Javascript: it's not something that would be in the JSON file, just an example of an alternative way to make extra node types using an arbitrary 3D engine's own language; you can ignore that part if you want the full implementation inside JSON.

very good, that's what I thought you were doing, thanks for confirming.

>> c.  What precisely are
>>
>>        "appearance": {
>>        "material": {
>
> It's the container field.

OK.  Not decapitalized Node name.  But essentially the same information regardless.  Guess that gets us back to the first example above.

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