<p dir="ltr">Yeah, I am pretty excited although one does need an appreciation for these abstract concepts of DOM vs. scene graph.</p>
<p dir="ltr">The idea is have both in parallel with synchronization. In my example I use the DOM MutationObserver facility to trigger x3d updates after changes to the DOM which seems to be a good fit especially since it works for unknown HTML elements.</p>
<p dir="ltr">The practical goal is to make Cobweb easy to use for JS web programmers.</p>
<p dir="ltr">Andreas<br><br></p>
<div class="gmail_extra"><br><div class="gmail_quote">On Sep 4, 2016 1:20 AM, "John Carlson" <<a href="mailto:yottzumm@gmail.com">yottzumm@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">I THINK THIS MESSAGE NEEDS BIG BOLD CAPS.</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Sep 4, 2016 12:41 AM, "Andreas Plesch" <<a href="mailto:andreasplesch@gmail.com" target="_blank">andreasplesch@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Here is a thought experiment which developed into a strawman implementation.</div><div><br></div><div>First the result:</div><div><br></div><div><a href="https://andreasplesch.github.io/cobweb_dom/index.xhtml" target="_blank">https://andreasplesch.github.i<wbr>o/cobweb_dom/index.xhtml</a><br></div><div><br></div><div>After clicking the new color button, and moving the mouse, the color of the box should change.</div><div><br></div><div>The interesting feature here is that the color change is triggered by a modification of the diffuseColor _attribute_ of the Material _html_ element, in a way that should be possible to generalize to most (all) fields in x3d nodes.</div><div><br></div><div>This is the x3dom pattern of controlling a x3d scene. But here I use cobweb as the x3d browser. Cobweb has very good coverage of the x3d standard including Prototypes, scripting and the SAI. Being able to use both, internal x3d scripting and external control using the DOM could be quite fruitful.</div><div><br></div><div>I had to modify cobweb only slightly based on an idea developed during the discussion around the id attribute inspired by x3dom. The main change is to attach a reference to the generated x3d scene graph node from the DOM element during parsing. This then enables access from the DOM to the x3d node.</div><div><br></div><div>The next step would be to expand to all field types, perhaps reusing the cobweb parser, or SAI functions. and to allow for removal and addition of nodes.</div><div><br></div><div>[If all works, there is the issue of <script> being claimed by the web browser. I think the only solution may be to break backward compatibility and allow <x3dScript> as an alias to <script>]</div><div><br></div><div>The examples also shows how to use inline x3d rather than an url with cobweb. Since cobweb is strict about XML, this is only possible if the html page has xhtml encoding. xhtml in turn triggered an issue with the fps counter display and the context menu, as a side note.</div><div><br></div><div>The code is all on github: <a href="https://github.com/andreasplesch/cobweb_dom" target="_blank">https://github.com/and<wbr>reasplesch/cobweb_dom</a></div><div><br></div><div>I had to learn a lot about cobweb (and jquery and AMD...) and look forward to any feedback or even hands-on contributions ? Perhaps the cobweb team is also interested ?</div><div><br></div><div>-Andreas</div><div><br></div>-- <br><div>Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453</div>
</div>
<br>______________________________<wbr>_________________<br>
x3d-public mailing list<br>
<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a><br>
<a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noreferrer" target="_blank">http://web3d.org/mailman/listi<wbr>nfo/x3d-public_web3d.org</a><br>
<br></blockquote></div></div>
</blockquote></div></div>