<div dir="ltr">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.<div><br>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.<br><div><br></div><div>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:</div><div><br></div><div><a href="https://coderextreme.net/X3DJSONLD/src/main/html/index.html">https://coderextreme.net/X3DJSONLD/src/main/html/index.html</a></div><div><br></div><div>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.</div><div><br></div><div>This isn't "smoke and mirrors."   It's merely undocumented features.  All the code is on github, or in the dev version of x3dom.</div><div><br></div><div>You can download the actual rubik.json from here:</div><div><br></div><div><a href="https://coderextreme.net/X3DJSONLD/src/main/data/rubik.json">https://coderextreme.net/X3DJSONLD/src/main/data/rubik.json</a></div><div><br></div><div>Then paste into JSON text area (a good test), then click here [ sic ] above textarea on index.html page.</div><div><br></div><div>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!</div><div><br></div><div>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.</div><div><br></div><div>I want something that adds value to my X3DJSONLD (or other visualization) project, not only X3DOM.   What do I get out of it?</div><div><br></div><div>I can think of a few things.</div><div><br></div><div>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:  <a href="https://graphics.stanford.edu/papers/spark/spark_preprint.pdf">https://graphics.stanford.edu/papers/spark/spark_preprint.pdf</a>   Being able to process spherical coordinates is.</div><div><br></div><div>2. Subdivisions of Shapes appearing in X3DOM advanced to the X3D standard, at least for spheres, and appearing in X_ITE.</div><div><br></div><div>3. Automatic vector normal computation of meshes in 1.</div><div><br></div><div>Number 2 will be sufficient for now.</div><div><br></div><div>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?</div><div><br></div><div>John</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 26, 2020 at 10:00 PM Don Brutzman <<a href="mailto:brutzman@nps.edu">brutzman@nps.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">As discussed Monday: Prototype Expander may have general value, but primary need is adding Prototype support to X3DOM.<br>
<br>
Recommend scrapping all options as distracting alternative future work.<br>
<br>
Simply focus on the X3DOM prize in JavaScript.  Path to get there is a straight line:<br>
<br>
1. Concept: ProtoDeclare is a template definition, ProtoInstance creates a scene subgraph.<br>
<br>
2. Thus the only resulting code of interest looks like X3DOM scene subgraph.<br>
<br>
3. Collect and create corresponding pairs of (a) inputs (ProtoDeclare/ProtoInstance) and (b) outputs (X3DOM scene subgraph).<br>
<br>
4. The ProtoExpander is native X3DOM javascript code reads 3(a) and creates 3(b).<br>
<br>
====================<br>
<br>
That's it.  No really.<br>
<br>
Recommended first model for input/output inventory: ArtDeco00, which is a simple Material node.<br>
<br>
* <a href="https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaMaterials/ArtDecoPrototypesIndex.html" rel="noreferrer" target="_blank">https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaMaterials/ArtDecoPrototypesIndex.html</a><br>
* <a href="https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaMaterials/ArtDecoPrototypes.json" rel="noreferrer" target="_blank">https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaMaterials/ArtDecoPrototypes.json</a><br>
* <a href="https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaMaterials/ArtDecoExamplesIndex.html" rel="noreferrer" target="_blank">https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaMaterials/ArtDecoExamplesIndex.html</a><br>
* <a href="https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaMaterials/ArtDecoExamples.json" rel="noreferrer" target="_blank">https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaMaterials/ArtDecoExamples.json</a><br>
<br>
JSON input<br>
<br>
{ "ProtoDeclare":<br>
   {<br>
     "@name":"ArtDeco00",<br>
     "@appinfo":"UniversalMediaMaterials prototype",<br>
     "@documentation":"<a href="https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaMaterials" rel="noreferrer" target="_blank">https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaMaterials</a>",<br>
     "ProtoBody": {<br>
         "-children":[<br>
           { "Material":<br>
             {<br>
               "@ambientIntensity":0.25,<br>
               "@diffuseColor":[0.282435,0.085159,0.134462],<br>
               "@shininess":0.127273,<br>
               "@specularColor":[0.276305,0.11431,0.139857]<br>
             }<br>
           }<br>
         ]<br>
     }<br>
   }<br>
},<br>
<br>
JSON result of interest:<br>
<br>
           { "Material":<br>
             {<br>
               "@ambientIntensity":0.25,<br>
               "@diffuseColor":[0.282435,0.085159,0.134462],<br>
               "@shininess":0.127273,<br>
               "@specularColor":[0.276305,0.11431,0.139857]<br>
             }<br>
<br>
First draft of converter: extract everything inside ProtoBody, ignore the rest.<br>
<br>
So you are now halfway to first example.  If that is how JSON says it in JavaScript, how does X3DOM say it in JavaScript?<br>
<br>
If still puzzled, here is a second-opinion point of comparison: how does X_ITE say it?<br>
<br>
Have fun with X3D JavaScript, I hope...<br>
<br>
On 5/26/2020 9:29 AM, John Carlson wrote:<br>
> There's also choice of data structure<br>
> <br>
> 1.  Mostly DOM/JDON, relying on functions<br>
> 2.  Full X3DJSAIL-like data structure<br>
> 3.  Just the Proto classes.<br>
> <br>
> On Tue, May 26, 2020 at 2:59 AM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a> <mailto:<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>>> wrote:<br>
> <br>
>     1.  Keep current implementation, debug it<br>
>     2.  Add XML -> JSON -> XML to current implementation.  Code is written, but not tested extensively<br>
>     3.  Write a new version in XML<br>
>     4.  Copy and port X_ITE's Proto code.<br>
>     5.  Write a new XML based proto expander.<br>
> <br>
>     We *do* want at least an XML proto expander.<br>
> <br>
>     Anyone want to help with any of these?  There are a lot of options.<br>
> <br>
> <br>
> <br>
> _______________________________________________<br>
> X3dom-users mailing list<br>
> <a href="mailto:X3dom-users@lists.sourceforge.net" target="_blank">X3dom-users@lists.sourceforge.net</a><br>
> <a href="https://lists.sourceforge.net/lists/listinfo/x3dom-users" rel="noreferrer" target="_blank">https://lists.sourceforge.net/lists/listinfo/x3dom-users</a><br>
> <br>
<br>
all the best, Don<br>
-- <br>
Don Brutzman  Naval Postgraduate School, Code USW/Br       <a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a><br>
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149<br>
X3D graphics, virtual worlds, navy robotics <a href="http://faculty.nps.edu/brutzman" rel="noreferrer" target="_blank">http://faculty.nps.edu/brutzman</a><br>
</blockquote></div>