[X3D-Public] Open-Source Multi-User - SAI

Joe D Williams joedwil at earthlink.net
Mon Feb 1 13:54:10 PST 2010


Hi Russ and All,

So far, I won't speak now about any main differences between the EAI 
and the SAI.
However, using the "External' SAI, the style is to extract, or gain 
access to, the X3D browser runtime, then navigate to the desired 
executionContext and then do your thing. Once you have access to the 
executionContext, the 'External' script can pretty much manipulate the 
scene and event graphs in the same way as an "Internal" Script running 
in that context.

This is shown as a DOM ecmascript running as part of a document, 
talking to an X3D plugin.

1. DOM=>SAI for propagating a click in the DOM into the SAI;

HTML - example object element
<object id="objectDOMID"
 type='application/x3d+xml'
 data='content.x3d'>...</object>

HTML - DOMtoSAI <script> - update X3D node:
// obtain interface to current X3D scene
x3dbrowser = document.objectDOMID.getBrowser();
thex3dscene = x3dbrowser.currentScene();
thex3dText = thex3dscene.getNamedNode('NodeToUpdate');

Of course this looks simple, but now you have thex3dText node in tha 
same way as an internal script declaration.

So, what more do we need?

Another External SAI style is that the X3D browser is always open to 
accepting external events. That is, any external event will be 
processed immediately with a new time stamp. Contrast this with an 
Internal script where events are not sent until the Script completes.

>From 'External'  scripts, group events similarly to the internal 
Script using beginUpdate, next send a group of events that will have 
the same internal time stamp, then send endUpdate.

More HTML - DOMtoSAI <script> to update X3D node:
x3dBrowser.beginUpdate();
thex3dText = thex3dscene.getNamedNode('NodeToUpdate');
thex3dText.string[0] = "Hello";
thex3dText.string[1] = "From HTML DOM script";
x3dBrowser.endUpdate();}

When the DOM script completes, the current scene should be updated.

So, without beginUpdate/endUpdate any 'external' event may initiate a 
new (internal) cascade. Maybe contrast this with an internal directOut 
which, when sent, is not part of any cascade nor can initiate a new 
cascade.

Please point me to any more complete examples of this.
I have read the standards and used Flux and maybe made a simpifying 
assumption or two.
Sorry the wealth of this sort of info at the Flux and Ajax3D forums 
has submerged.

Thanks and Best Regards,
Joe




More information about the X3D-Public mailing list