Best way to implement Java3D style Switch node

I’ve ported the Xith3D quake 3 level viewer to JME. Read more about it on

Porting Quake III to Java3D

The level contains a possible visible set. So I need a fast way to enable/disable TriMeshes. The same functionality as Java3ds Switch. What I’ve done is similar to com.jme.scene.SwitchNode. Only the render function looks like this:

   public void draw(Renderer r) {
      for (int i=0; i<bitSet.length(); i++) {
         if (bitSet.get(i)) {

Where bitSet is a java.util.BitSet marking wich children are visible.

Is there a better way of implementing this?

Interesting…  did you also implement BSPs in that for jME?  Or is that handled simply in the way you load in the scenegraph?  We are in the midst of version .10 and the next feature set is BSP/Portals and such…  so I'm curious how you kept us on the same playing field as two other engines that (I believe) already have those features.

In answer to your question though… your bitmap switch looks like a possible way of handling child culling.  It's kind of hard to tell you if it is the best way from such an isolated piece of code :)  I'll spend some time with your source later today and see what you are doing.

Also, curious as to why you are using Xith's vecmath libs when we have our own?  Shouldn't a true port… well, port everything?  Are we missing some feature in our math classes that you need?

renanse said: