[x3d-public] event tracing

Andreas Plesch andreasplesch at gmail.com
Mon Oct 31 14:43:11 PDT 2016


Here is what I found:

The function name is is actually field.addFieldCallback() .

1) added field callbacks are called in processEvent()  in cobweb:

https://github.com/create3000/cobweb/blob/master/cobweb.js/cobweb/Basic/X3DField.js#L281

2) processEvent() is called from processEvents() in cobweb here:

https://github.com/create3000/cobweb/blob/master/cobweb.js/cobweb/Routing/X3DRoutingContext.js#L90

3) processEvents() is called twice from traverse() here:

https://github.com/create3000/cobweb/blob/master/cobweb.js/cobweb/Browser/X3DBrowserContext.js#L257

before a DISPLAY traverse. This looks like the main per-frame work function.

So it looks like the DOM events would be dispatched just before things are
drawn via webgl. To me, this means that any changes to fields via dom event
handlers (via cobweb_dom) will be picked up only in the next frame (at the
earliest). It might be better to create and dispatch the DOM events just
after drawing the frame, so there is a chance that resulting updates make
it into the next frame (?). Unfortunately, I do not know how to do that. [
There is a .finished_.processInterests() which means it may be possible to
add a callback as an interest to the 'finished' field (of the browser) (but
x3d events are processed by then so I am not sure how to know which events
had happened). I seem to recall a addInterest() SAI function. ]

4) traverse() is copied to .renderCallback for each browser context and
called from addBrowserEvent():

https://github.com/create3000/cobweb/blob/master/cobweb.js/cobweb/Browser/X3DBrowserContext.js#L139

https://github.com/create3000/cobweb/blob/master/cobweb.js/cobweb/Browser/X3DBrowserContext.js#L246

as the callback for requestAnimationFrame() . The web browser invokes these
callbacks whenever it is ready to draw the next frame but at 60 fps at the
most. This would be place to use the webvr RAF which allows higher frame
rates. ( The cobweb reported fps for me is always below 30. ) .

It looks like there is only rendering when addBrowserEvent() is called, for
example during navigation.

5) addBrowserEvent() is called from various places:

https://github.com/create3000/cobweb/search?q=addBrowserEvent

seemingly to ensure render updates.

It was good for me to get a sense of how cobweb works anyways. Perhaps it
is helpful in general,

-Andreas






On Mon, Oct 31, 2016 at 10:26 AM, Andreas Plesch <andreasplesch at gmail.com>
wrote:

> On Mon, Oct 31, 2016 at 9:48 AM, <x3d-public-request at web3d.org> wrote:
>
> Date: Sun, 30 Oct 2016 16:08:18 -0700
>> From: Leonard Daly <Leonard.Daly at realism.com>
>> To: x3d-public at web3d.org
>> Subject: Re: [x3d-public] event utility usage, and event tracing
>>         techniques
>>
>> Andreas,
>>
>> As Mike points out 20ms is significant. As 60fps, the system needs to
>> generate a new frame every 16.6ms. Desired is > 90fps (or <
>> 11.1ms/frame). Could the DOM event be getting held up until after a
>> frame is generated (20ms = 50fps)?
>>
>>
> The DOM event is created by the SAI field.addEventCallback() method .
>
> What does the SAI standard say about when an added event callback should
> be invoked ?
> Presumably as part of the same event cascade when the x3d event is created
> but is there guidance ?
>
> I see if I can figure out from looking at the cobweb source when exactly
> the callback is called but perhaps Holger can chime in ?
>
> My working hypothesis to test would be at the end of the event processing
> but before the draw traversal, at a given time stamp.
>
> -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/20161031/853812af/attachment.html>


More information about the x3d-public mailing list