Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11992 Posts in 1588 Topics- by 3509 Members - Latest Member: fishigon

26. May 2012, 04:12:25 pm
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)[SOLVED] Upating geomtry
Pages: [1]
Print
Author Topic: [SOLVED] Upating geomtry  (Read 313 times)
ChrisE
Becoming dependent
**
Offline Offline

Posts: 104


View Profile
« on: 10. December 2010, 04:30:18 pm »

So, I've got another question (I know--big surprise, right?).

I've got a TransformGroup node with several Shape3Ds attached to it. Sometimes I wish to update both the attached shapes, and the transform. So, what I've done so far is something like:

Code:
TransformGroup tg = (TransformGroup) tgOrig.cloneNode(false);

// setup Shape3Ds and add to group tg
// ...snip...

// add the operation to get this replaced in the correct thread context
getOperationScheduler().scheduleOperation(new replaceTransformGroupSO(toReplace,tg));

// down in the replace group scheduled operation
public void update(long gameTime, long frameTime, TimingMode timingMode)
{
if (this.original != null && this.replacement != null)
{
this.original.getParent().addChild(this.replacement);
this.original.detach();
}
}

Now, this seems to work, except that the cloneNode() function just seems to create a new instance of a TransformGroup, instead of copying over relevant data (such as transforms). Any suggestions on how to do an in-place swap like this?

-Chris

EDIT: The reason I'd like to do a swap instead of directly changing the node's children from a scheduled operation is that I'm accumulating a lot of Scheduled Operations... is this normal, or am I doing something silly and writing (effectively) thread-safe wrappers into my Xith interface?
« Last Edit: 15. December 2010, 10:08:34 pm by ChrisE » Logged
ChrisE
Becoming dependent
**
Offline Offline

Posts: 104


View Profile
« Reply #1 on: 14. December 2010, 06:33:43 pm »

Got the above working. Seems to be a fine way of handling replacements.

However, new problem: I successfully remove nodes from my branch, as they are no longer rendered. However, I'm still seeing them appear in the BranchGroup child table, though they have no parent node. They don't seem to draw.

Is there any way to have Xith verify that the branch group contains children that actually have a parent (set to the BranchGroup)? Any idea what might cause this?
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #2 on: 14. December 2010, 09:01:56 pm »

There's a getRootBranch() method IIRC, and there should be something like isAttached(). Don't remember exactly.

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic