Hi Niklas,

   There are three types of InputDevice:

 public static final int BLOCKING = 3;
 public static final int NON_BLOCKING = 4;
 public static final int DEMAND_DRIVEN = 5;

For Blocking device, Java3D will create another
thread (InputDeviceBlockingThread) to
invoke pollAndProcessInput() continuously.
Since this thread is blocking when read the device,
it should not taking inordinate amount of CPU time.

For Non-Blocking device, InputDeviceScheduler
is used to invoke pollAndProcessInput() method
which in turn read from sensor input. This
scheduler wake up every 5ms in current
implementation. (Currently there is no
API to set this value)

For Demand Driven device, Java3D will not schedule
to invoke pollAndProcessInput(), instead it is
user responsiblity to invoke this function
to read from sensor. So it will not take CPU time.

There is only two Wakeup function support by Sensor:
WakeupOnSensorEntry and WakeupOnSensorExit.

You may need to have your own behavior that wake
up every frame to see whether Sensor read change
or not.

Thanks.

- Kelvin
---------------
Java 3D Team
Sun Microsystems Inc.



>MIME-Version: 1.0
>Content-transfer-encoding: 7BIT
>Date: Wed, 9 Aug 2000 19:25:39 +0200
>From: Niklas Mehner <[EMAIL PROTECTED]>
>Subject: [JAVA3D] InputDevices
>Comments: To: Discussion list for Java 3D API
<[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>
>Hi !
>
>I'm currently trying to understand how InputDevices are to be used.
>
>Somehow I have the feeling I am missing something, or something is missing in
Java3D.
>
>Currently I instantiated a InputDevice and added it to the PhysicalEnvironment
and called
>setHeadIndex(int index).
>
>So what happens now ? Java3D starts polling the device ... ummh, very nice ....
but
>whatfor ? There is no WakeupCriterion to let a behavior wake up, when the
sensor values
>change. What is the best way to implement something like :
WakeUpOnSensorReadNotIdentity
>or WakeUpOnSensorReadChange. Will be something similar be available in future
versions of
>Java3D ? Can I write my own WakeUpCriterions ?
>
>Just now I am using a behavior with WakeupOnElapsedFrames to poll and update
the head-
>position. But this can't be the right way to do this !?!
>(This results in 100%-CPU usage again ;)
>
>The only better way I see, is to write a InputDevice that calls
Behavior.postID() to wake
>up other behaviors ..
>
>Can somebody please enlighten me ?
>
>Niklas
>
>===========================================================================
>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".

===========================================================================
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