The only way to get the compile out of the way is to compile the
scene without your OrderedGroup's, and then add them in after
the compile. Other than that, I don't see any other ways
to do this in 1.2.*.
Doug Twilleager
Sun Microsystems
>To: "'Doug Twilleager'" <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
>Subject: RE: [JAVA3D] Range ordering of transparent objects
>MIME-Version: 1.0
>
>Doug,
>The only way to rearrange the children of the OrderedGroup is to do
>attaches and reattaches of BranchGroups since I get an exception if I do
>a "setChild(Node, index)" without the child being a BranchGroup. This
>is from the Group.setChild() Javadoc:
>
>"RestrictedAccessException - if this group node is part of live or
>compiled scene graph and the child node being set is not a BranchGroup
>node"
>
>Since they are BranchGroups, I still get the overhead of doing
>attach/detach with each child. My code for swapping children looks like
>this:
>
> in constructor...
> {
> ...
> empty = new BranchGroup();
> empty.setCapability(BranchGroup.ALLOW_DETACH);
> ...
> }
>
> private void doReordering()
> {
> myBranch.detach(); // detach OrderedGroup from scene
>
> // Call "swapBranches" as necessary
>
> myParent.addChild( myBranch );
> }
>
> private void swapBranches(int a, int b)
> {
>
> BranchGroup b1 = (BranchGroup)myOrderedGroup.getChild( a );
> BranchGroup b2 = (BranchGroup)myOrderedGroup.getChild( b );
> myOrderedGroup.setChild( empty, a ); // I think this calls
>b1.detach()
> myOrderedGroup.setChild( b1, b );
> myOrderedGroup.setChild( b2, a );
> }
>
>What do you think I can do? Is there a way to prevent my OrderedGroup
>from being compiled so I don't have to use BranchGroups for the
>children??
>
>Thx
>-Lee
>
>> -----Original Message-----
>> From: Doug Twilleager [mailto:[EMAIL PROTECTED]]
>> Sent: Monday, April 23, 2001 1:23 PM
>> To: [EMAIL PROTECTED]
>> Subject: Re: [JAVA3D] Range ordering of transparent objects
>
><snip...>
>
>> If you detach the branch graph which contains the
>> OrderedGroup, rearrange
>> the OrderedGroup, then reattach again, you will get better performance
>> that attaching and reattaching the children of the
>> OrderedGroup individually.
>>
>> Doug Twilleager
>> Sun Microsystems
>>
===========================================================================
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".