That keyNavigatorBehavior is really not very good. First of all you are
right, having a wakeuponelaspedframes(0) might use more CPU time than is not
needed, but your frame rate will not suffer. In fact your frame rate will
jump to the maximum attainable frame rate once you put your first behavior
that wakes up on elasped frames 0. One thing you can do is lower the
priority of the java3d threads, there is a method to do this in the API
docs. The next thing to realize is that the keynavigatorbehavior is very
badly written. Most people rewrite it. The reason is manyfold, but the
biggest ones is that the keyboard repeat rate is signifigantly less than the
rate you would really want to apply your view transformations. The next
problem is that since it deals with keystrokes, you can't apply both a
rotation and a translation at the same time, since they use different
keystrokes. The keybehavior I wrote uses a thread to compute new
transformations. I capture key presses and post them to the thread object
which monitors them to create a series of transformation transactions. The
thread wakes up frequently and applies all the appropriate changes based on
the current set of depressed keystrokes. I also capture keyreleases,
whereupon I remove the key from the threads process list. This thread does
not operate on the actual view transformation, since that can cause jiggling
in the display. Instead it works on a copy of the view transform. The
"new" transforms are posted to a queue. This queue is read by a
wakeuponelapsedframes(0). I call this behavior the "SceneUpdator" behavior,
whose sole purpose in life is to make sure that changes to the view
transform are synchronized with certain types of scene changes. This
behavior wakes up and scans the queue and takes the most recent view
transform update and throws the rest away. This assures that we don't
perform unnecessary view transformations, and ensures that the end of every
frame the view transform matches what the navigators think the view is.
Dave Yazel
> ----------
> From: Youngseog Lee[SMTP:[EMAIL PROTECTED]]
> Reply To: Discussion list for Java 3D API
> Sent: Wednesday, October 04, 2000 7:13 AM
> To: [EMAIL PROTECTED]
> Subject: [JAVA3D]
> com.sun.j3d.utils.behaviors.keyboard.KeyNavigatorBehavior CLASS
>
> Hi!!
> This is possible problem about KeyNavigatorBehavior Class.
> I'm not sure it's been mentioned before.
> When I looked the source of KeyNavigatorBehavior Class, I found it as
> below
>
> ...
> public class KeyNavigatorBehavior extends Behavior {
> private WakeupOnAWTEvent w1 = new
> WakeupOnAWTEvent(KeyEvent.KEY_PRESSED);
> private WakeupOnAWTEvent w2 = new
> WakeupOnAWTEvent(KeyEvent.KEY_RELEASED);
> private WakeupOnElapsedFrames w3 = new WakeupOnElapsedFrames(0);
> ...
>
> private WakeupOnElapsedFrames w3 = new WakeupOnElapsedFrames(0);
>
> I think it cause j3d application might hold whole cpu time.
> Isn't problem?
> Tell me your opinion & test it!
>
> =======================
> Youngseog Lee
> S/W Engineer
> Development 3 Team
> GOMID
> [EMAIL PROTECTED]
> =======================
>
===========================================================================
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".