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

John Carlson yottzumm at gmail.com
Wed May 27 10:35:13 PDT 2020


Don, I pretty much know the ProtoExpander requirements.  The questions out
there and yet to be answered are things like namespace, what's the best way
to do that?  Since multiple ProtoInstances are in the same namespace, do we
need to change the expanded ROUTEs to support unique toNode and fromNode
SFStrings (I'm not quite clear on this)?  So there's not only ProtoDeclare
and ProtoInstance.  I'm going to include Doug on the conversation, since he
has experience doing Proto namespaces with SFStrings in a previous
incarnation of FreeWRL.

I jumped down the simple, "cookie cutter" approach last time, and it ended
a mess, but fairly functional.  If you like, I can put an "ArtDeco" example
on my website. I know it doesn't work *all the time* and I know it must.
Most of the time, I chalk it up to too many OpenGL contexts and reload.

If you want to see the Proto Expander working on live files, I suggest
selecting ./data/rubik.json (or your own JSON) when you have the Proto
Expander checked or unchecked on this site:

https://coderextreme.net/X3DJSONLD/src/main/html/index.html

Then peruse the JSON (and maybe even XML, not sure).  You can check and
uncheck as you please, but alternate files, please.  Note that the X3DOM
browser uses x3dom ProtoExpander, so it is unaffected.

This isn't "smoke and mirrors."   It's merely undocumented features.  All
the code is on github, or in the dev version of x3dom.

You can download the actual rubik.json from here:

https://coderextreme.net/X3DJSONLD/src/main/data/rubik.json

Then paste into JSON text area (a good test), then click here [ sic ] above
textarea on index.html page.

What we don't have is something that works on DOM (well, we kind of do, we
have an XML to JSON converter, a JSON proto expander, and a JSON to DOM/XML
train).  Recall that JSON is in "competition" with DOM, but strangely
enough, X3DJSONLD is reliant on DOM.  Go figure!

I am willing to create something that works standalone from X3DOM with DOM,
but I doubt that I'll be much more successful (that is,
readable/maintainable) without a good, somewhat detailed functional design
document--I can help with it, describing the functionality we need.

I want something that adds value to my X3DJSONLD (or other visualization)
project, not only X3DOM.   What do I get out of it?

I can think of a few things.

1.  A standardized, declarative shading language.  I am thinking of
something related to FVRML and FX3D, or perhaps Alan Kay's NSF grant
project where they rewrote the graphics backend.  I want to be able to
raytrace/prismatize/animate my mathematical equations/flowers on modern
graphics hardware, with a high level declarative terminology essentially.
I don't know if this is relevant or not:
https://graphics.stanford.edu/papers/spark/spark_preprint.pdf   Being able
to process spherical coordinates is.

2. Subdivisions of Shapes appearing in X3DOM advanced to the X3D standard,
at least for spheres, and appearing in X_ITE.

3. Automatic vector normal computation of meshes in 1.

Number 2 will be sufficient for now.

I already have a nearly complete server side XML proto expander (minus
scripts)--but it goes through JSON.   Do we need a client side proto
expander?

John

On Tue, May 26, 2020 at 10: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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20200527/426efe9f/attachment-0001.html>


More information about the x3d-public mailing list