Tachio Terauchi 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.

The question is _what_ gets overwritten? If I set up a default Sensor,
it has 30 SensorRead objects already "allocated" internally for
buffering, prediction etc. When I setNextSensorRead, does it take my
copy of the SensorRead object and make a reference to it internally or
does it clone it (or copy it into the internal version). Therefore, in
my application, if I want to only ever allocate one SensorRead object
(or Transform3D if you do things that way) and keep passing that in to
setNextSensorRead, depending on the behaviour internally of Sensor, it
can throw things 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.

That's exactly the problem. If Sensor only references the object that I
pass in rather than copies it, we're stuffed because it throws out
predictions etc. I don't care really which behaviour the sensor
implements internally, I just want the specification to tell what should
be happening (which it doesn't do. Also, as I pointed out in my first
post, there are other cases around in J3D that suffer from the same
problem of no-specified-behaviour). 

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

I may or may not be doing this. I'm just describing a high rate input
device like the current crop of USB mice and Joysticks that can be
dealing with inputs up around 200+ Hz. Obviously if I have to create 200
transform3Ds a second we could be in serious problem GC-wise, but if It
copies things, then I could create a native side Transform3D and copy
items in from the external input as much as I like without harming
performance.

-- 
Justin Couch                                   Author, Java Hacker
Snr Software Engineer                     [EMAIL PROTECTED]
ADI Ltd, Systems Group              http://www.vlc.com.au/~justin/
Java3D FAQ:       http://tintoy.ncsa.uiuc.edu/~srp/java3d/faq.html
-------------------------------------------------------------------
"Look through the lens, and the light breaks down into many lights.
 Turn it or move it, and a new set of arrangements appears... is it
 a single light or many lights, lights that one must know how to
 distinguish, recognise and appreciate? Is it one light with many
 frames or one frame for many lights?"      -Subcomandante Marcos
-------------------------------------------------------------------
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to