[x3d-public] prepareEvents and eventsProcessed in ECMAScript
Leonard Daly
web3d at realism.com
Wed Feb 17 16:44:15 PST 2016
Yves,
You asked about the methods prepareEvents and eventsProcessed with the
intent of building an MFFloat array. The abstract details for these
methods is documented in
http://www.web3d.org/documents/specifications/19775-2/V3.3/Part02/servRef.html#ScriptContentRealised
prepareEvents is called when the run-time is about to start the event
cascade. This method is called every frame independent of the containing
[Script] node receiving any events.
eventsProcessed is called at the end of the event cascade only if the
containing [Script] node received an event. The method may be called
more than once per frame.
Note that there is a render operation at the end of the event cascade
and prior to the end of the frame. Everything that happens with a single
frame has the same timestamp.
There is no guarantee of the order of received events during a
timestamp. And as can be seen from the description above there is no
means to capture the "last" event. I am not sure how to implement what
you want.
Note that if you are using X3DOM (besides not having these methods
available), the entire event model is different. It is possible to
accumulate values and generate a new event when the collection is
complete by whatever criteria you wish to use.
Leonard Daly
> Hi,
>
> In ECMAScript binding (19777-1 v3.3), section 7.10 describes functions which can be defined in Script nodes in addition to those handling inputOnly fields. Functions "prepareEvents" and "eventsProcessed" have names which seem to imply some semantics: prepareEvents might be called before any inputOnly function in that Script node for a given timestamp, and eventsProcessed might be called after. But their description is much fuzzier: prepareEvents is said to be called "every frame" (we don't know when), and eventsProcessed "after some set of events have been received" (we don't know how many times).
>
> Could someone clarify? I hope the semantics follows the function names. I want to write a multiplexor Script node where multiple SFFloat values are packed as a single MFFloat which is routed further. This could be done in eventsProcessed provided it isn't called multiple times with the same timestamp.
>
> Thanks,
>
> Yves
>
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
--
*Leonard Daly*
X3D Co-Chair
Cloud Consultant
President, Daly Realism - /Creating the Future/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20160217/aeb0d942/attachment.html>
More information about the x3d-public
mailing list