TransformNode

It has been awhile since I did a CVS update on Xith. My code no longer compiles. I see there have been a lot of changes.

I have updated my code here and there to adjust to the new API but I need a few fixes. I will give them to you one at a time. Hopefully we can get my application to compile again within a few days.

First, please add a getName() method to the new interface TransformNode.

Done.

Please add getChildren().

A TransformNode is not a Group so this methods does not make any sense. If you know exactly that you’re having a TransformGroup, then use this type or cast to it. But this methods cannot be present in the TransformNode interface. Sorry.

OK, I did the cast.

My next question is this:
scene.setSceneGroup ( sceneBranchGroup )

This no longer works because BranchGroup is not a subclass of Group anymore. What should I do?

Just use an instance of Group, but not BranchGroup. The BranchGroup is reserved to be the very root of a branch in the scenegraph. In general a loader loads 3D models, which’re not to be placed into to scenegraph as root branch (BranchGroup). But some loaders (or a single load) actually load a whole level, so maybe an additional method in any loader would make sense, which loads a scene as BranchGroup or so. What do you think?

This code does not compile:


       final Group  sceneBranchGroup = scene.getSceneGroup ( );
       
       if ( sceneBranchGroup != null )
       {       
         locale.addBranchGraph ( ( BranchGroup ) sceneBranchGroup );
       }

scene.getSceneGroup() returns a Group.
locale.addBranchGraph() takes a BranchGroup as its argument.
BranchGroup is not a subclass of Group so I cannot do the cast.

This is what I meant by the suggestion in the last post regarding the additional method loading the scene as BranchGroup. But a pragmatic solution would be to change the return type of scene.getSceneGroup() from Group to GroupBase, which is the base class of Group and BranchGroup. Feel free to make the change.