[x3d-public] x3d script to x3dom scripting example

Andreas Plesch andreasplesch at gmail.com
Wed Sep 16 00:30:23 PDT 2015


Since I had a need to fix proper text alignment in x3dom, I ported the Nist
conformance text driver example scene:

http://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/FontStyle/driver.html

http://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/FontStyle/driver.js

to x3dom. It uses touchsensors and a x3d javascript script to modify the
text font style alignment fields. Both nodes, touchsensor and script are
not supported directly in x3dom. Instead one can use native web browser
functionality for a x3dom style scene access interface. The ported scene is
here:

http://andreasplesch.github.io/x3dom/x3dom_text/driver_x3dom.xhtml

I added some commenting in the x3d scene to point out what was necessary
both in the xml and in the javascript.

Here are source views:

https://github.com/andreasplesch/x3dom/blob/gh-pages/x3dom_text/driver_x3dom.xhtml
https://github.com/andreasplesch/x3dom/blob/gh-pages/x3dom_text/driver_x3dom.js

One could probably find more elegant code but this tries to stick closely
to the original.

One can see that some work is involved in the porting to define the
interface but the main functionality remains as is.

Hopefully this can help as a starting point if there is a need to convert
existing, scripted x3d scenes to x3dom,  for example to integrate more
tightly with a surrounding web page.

Andreas

-- 
Andreas Plesch
39 Barbara Rd.
Waltham, MA 02453
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20150916/3d04aea6/attachment-0001.html>


More information about the x3d-public mailing list