Dear Katja,
> My problem is that I want the user to be able to open ANY j3d file e.g. some
> downloaded or self programed virtual world. That means there is no switch
> group in that file. All functionality has to build into my application (main
> window). Unfortunately I can't come up with anything but recompilation (I don't
> like that either) after I put in the spheres. Is there any other way? Is
> there any possibility of changing parts of the scenegraph without recompilation
> from the main application?
I'm not 100% sure if I really understand, what you want to do,
but I interpret: after loading (via some loader or via scene
graph io) you have a scene graph to show, you are able to add
a sphere to your overall scene graph and by recompilation you mean
BranchGroup.compile(). If so, it still would make sense to only
once add the proposed switch with enough tgs/spheres. That avoids
frequent restructuring of the scene graph on every pick/selection
change.
When you use a loader you get the scene graph via Scene.getSceneGroup()
and have to attach that to your locale anyway. So you could have:
+ locale
|
+ bgRoot
|
+ aSwitch
| |
| + tg1
| | |
| | + sphere1
| |
| + tg2
| | |
| | + sphere2
| .
|
+ bgLoaded (as gotten by Scene.getSceneGroup())
|
.
bgRoot has capabilities to allow child addition/removal, all
down to bgLoaded is constructed on app startup and never changes
again (except switching spheres on/off and tranforming them), on
every load you de/attach bgLoaded.
And if the problem were, that the BranchGroup gotten from
Scene.getSceneGroup() has the capability ALLOW_DETACH not
set (the loader docs seem to not enforce that) and that capability
is not settable (because bgLoaded is compiled already), you could
have:
| | |
| | + sphere2
| .
|
+ bgDetachable
|
+ bgLoaded (as gotten by Scene.getSceneGroup())
|
.
where bgDetachable is created by you and has ALLOW_DETACH. Then
you can, at load time, detach bgDetachable, get rid of the current
bgLoaded (as bgDetachable now isn't live any more), add the new
loaded scene to it and reattach bgDetachable.
Does this make sense? Regards
Georg
___ ___
| + | |__ Georg Rehfeld Woltmanstr. 12 20097 Hamburg
|_|_\ |___ [EMAIL PROTECTED] +49 (40) 23 53 27 10
===========================================================================
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".