Tim Bray wrote:
> I don't find anything in the API or the javadocs about thread-safety, which
> is making me kind of nervous.
You don't find much of anything in there :(
> These updates require
> database fetches and a certain amount of computation, and it's unacceptable
> to stop everything while it goes on. Seems like threading is just the
> ticket. Is it going to cause trouble if I create another thread and busily
> update the scene graph while the KeyboardNav is doing the same thing? Is
> there anything I ought to synchronize on? Quite likely it's in the API and
> I just missed it.
Nope, there's nothing in the APIs, but there isn't that much that will
cause a problem either. J3D quite happily deals with you changing the
scene graph on the fly from a separate thread (for example think of the
demos that use Swing components that have their own thread to do
everything).
For optimisations, I would suggest that if you want to update what is
placed on screen as the user moves that you base your behaviours on
either the AWT event or the transform change of the user's Viewpoint.
Don't used the elapsed frames behaviour. This way updates are only
forced when needed.
Based on what I think you're saying, you want to upate the screen based
on information fetched from a database. As this can be quite slow you
really don't want to be synchronizing your rendering to this otherwise
you'll end up with fractional numbers of fps. It's probably best to look
at using something like the proximity sensor information or keeping a
separate internal 2D/3D map of where the user is in the environment and
use that to trigger the updates. It really sounds like that in order to
have good UI performance with updating that a certain amount of
prediction/pre-fetching is going to be needed. That in itself could get
tricky.
--
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 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".