[x3d-public] [x3dom-users] Whither protoexpander in X3DOM? umm, just define input-to-output and write code

Andreas Plesch andreasplesch at gmail.com
Wed May 27 05:52:09 PDT 2020


In x3dom, I think Inline is most similar to a ProtoInstance in that it
places a subgraph in a scene. So I would start there to see how in
x3dom a subgraph is generated from XML (or json), with its own
namescope. A ProtoInstance node would do the same but with the
corresponding ProtoBody definition.
Then a first ProtoBody/ProtoInstance pair to get to work would be
without custom fields, just a series of fixed nodes. It would be
equivalent to a DEF/USE pair.
Then do the field mapping, first without node fields.
-Andreas

On Tue, May 26, 2020 at 11:00 PM Don Brutzman <brutzman at nps.edu> wrote:
>
> As discussed Monday: Prototype Expander may have general value, but primary need is adding Prototype support to X3DOM.
>
> Recommend scrapping all options as distracting alternative future work.
>
> Simply focus on the X3DOM prize in JavaScript.  Path to get there is a straight line:
>
> 1. Concept: ProtoDeclare is a template definition, ProtoInstance creates a scene subgraph.
>
> 2. Thus the only resulting code of interest looks like X3DOM scene subgraph.
>
> 3. Collect and create corresponding pairs of (a) inputs (ProtoDeclare/ProtoInstance) and (b) outputs (X3DOM scene subgraph).
>
> 4. The ProtoExpander is native X3DOM javascript code reads 3(a) and creates 3(b).
>
> ====================
>
> That's it.  No really.
>
> Recommended first model for input/output inventory: ArtDeco00, which is a simple Material node.
>
> * https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaMaterials/ArtDecoPrototypesIndex.html
> * https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaMaterials/ArtDecoPrototypes.json
> * https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaMaterials/ArtDecoExamplesIndex.html
> * https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaMaterials/ArtDecoExamples.json
>
> JSON input
>
> { "ProtoDeclare":
>    {
>      "@name":"ArtDeco00",
>      "@appinfo":"UniversalMediaMaterials prototype",
>      "@documentation":"https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaMaterials",
>      "ProtoBody": {
>          "-children":[
>            { "Material":
>              {
>                "@ambientIntensity":0.25,
>                "@diffuseColor":[0.282435,0.085159,0.134462],
>                "@shininess":0.127273,
>                "@specularColor":[0.276305,0.11431,0.139857]
>              }
>            }
>          ]
>      }
>    }
> },
>
> JSON result of interest:
>
>            { "Material":
>              {
>                "@ambientIntensity":0.25,
>                "@diffuseColor":[0.282435,0.085159,0.134462],
>                "@shininess":0.127273,
>                "@specularColor":[0.276305,0.11431,0.139857]
>              }
>
> First draft of converter: extract everything inside ProtoBody, ignore the rest.
>
> So you are now halfway to first example.  If that is how JSON says it in JavaScript, how does X3DOM say it in JavaScript?
>
> If still puzzled, here is a second-opinion point of comparison: how does X_ITE say it?
>
> Have fun with X3D JavaScript, I hope...
>
> On 5/26/2020 9:29 AM, John Carlson wrote:
> > There's also choice of data structure
> >
> > 1.  Mostly DOM/JDON, relying on functions
> > 2.  Full X3DJSAIL-like data structure
> > 3.  Just the Proto classes.
> >
> > On Tue, May 26, 2020 at 2:59 AM John Carlson <yottzumm at gmail.com <mailto:yottzumm at gmail.com>> wrote:
> >
> >     1.  Keep current implementation, debug it
> >     2.  Add XML -> JSON -> XML to current implementation.  Code is written, but not tested extensively
> >     3.  Write a new version in XML
> >     4.  Copy and port X_ITE's Proto code.
> >     5.  Write a new XML based proto expander.
> >
> >     We *do* want at least an XML proto expander.
> >
> >     Anyone want to help with any of these?  There are a lot of options.
> >
> >
> >
> > _______________________________________________
> > X3dom-users mailing list
> > X3dom-users at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/x3dom-users
> >
>
> 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



-- 
Andreas Plesch
Waltham, MA 02453



More information about the x3d-public mailing list