On Sat, 10 Apr 1999, Justin Couch wrote:
> When building an InputDevice, what happens when we set a new bunch of
> information in the sensor.
The old value in the sensor will get overwritten by the new one each time.
>
> In the various versions of setSensorRead, are the values copied to
> internal values or are they referenced?
I don't know which version you are referring to, but
SensorRead.set(transform) changes the transform which needs to be
allocated before you make the call.
>
> The reason for this is that I want to be able to compute how much
> garbage is going to be generated from a fast moving sensor input. Say I
> have sensor information 100Hz. Do I need to be generating a new
> SensorRead/Transform3d object each time pollAndProcessInput is called or
> use single instance and reset the values each time before passing it to
> setSensorRead. In the second case I need to be confident that the
> information is copied to internal structures otherwise I may be
> overwriting the outbound information used by the rest of the app and
> previous values of sensorRead (which would screw prediction really
> badly).
First of all, you should not generate a new SensorRead/Transform3d object
each time pollAndProcessInput is called...that will be very inefficient. I
suggest you create all the Transform3D's you need beforehand, then
setIdentity them if you need to set a new transform to the sensor.
Next, pollAndProcessInput is only called when you actually read the sensor
values using getRead (Note, I'm using DEMAND_DRIVEN). I don't know why
you need to set the sensor 100 times/sec, but you could actually try to
getRead 100 times/sec to make this work.
In my case, I have a device that sends output at 50hz. For this, I let
the driver process the raw values from the output, then getRead at every
frame by using WakeupOnElapsedFrames(0).
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/