[x3d-public] x3d script to x3dom scripting example

Roy Walmsley roy.walmsley at ntlworld.com
Wed Sep 16 03:13:38 PDT 2015


Andreas,

 

Your work below is very timely! Script node handling is under serious consideration at the moment with respect to the next version of the specifications. So we will look at your examples with great interest. 

 

Regards,

 

Roy

 

From: x3d-public [mailto:x3d-public-bounces at web3d.org] On Behalf Of Andreas Plesch
Sent: 16 September 2015 08:30
To: X3D Graphics public mailing list
Subject: [x3d-public] x3d script to x3dom scripting example

 

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/e1c6d492/attachment-0001.html>


More information about the x3d-public mailing list