> From: "Veith, Gernot" <[EMAIL PROTECTED]>
>
> i would like to make a proposal for a new behavior class or wakeup
> conditions. Actually behaviors only listen to AWTEvents. It would be usefull
> to have conditions handling user defined events. If you try to handle input
> data from a port, the only way is polling data from a sensor. A behavior
> that wakes up only when new data is supplied would be more mvc like and
> would take less performance.


What about using Behavior.postId()?

It works like this:  set up a behavior that will process the sensor input with a
WakeOnBehaviorPost() wakeup criteria. This takes a Behavior and an integer ID
which identifies the event type (you define the meanings for the IDs, J3D just
checks the values).  Set up your listener for the sensor to call
Behavior.postId() with the same ID when the sensor has new input.

Behavior.postId() is the right mechanism to use whenever you want to change your
J3D scene graph due to "external" inputs.  It packages the outside input into
the Behavior mechanism, which allows J3D to better synchronize the changes.  For
example, a big MCAD application has a AWT menu which tells whether to render a
part as wireframe or solid.  When the menu value changes, many nodes in the
scene graph need to be changed to update the appearances.  At first, the
application just made these changes when the AWT event was processed.  But this
had the bad side effect that the display would update before all the changes
were processed, leading to frames with mixed wireframe and solid appearances.
The fix was to use Behavior.postID() to pass the notification to a behavior.
The changes to the scene graph are now made inside the behavior's
processStimulus() method, which allows J3D to wait until the changes are made
before displaying a new frame.

Doug Gehringer
Sun Microsystems

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to