[ODE] dxQuadTreeSpace::remove patch

Marco Grubert mgrubert at conitec.net
Fri May 13 14:16:52 MST 2005


I am using/abusing dxQuadTreeSpace as a general purpose Quadtree for object 
culling. One problem I have encountered is that dxQuadTreeSpace assumes any 
geom to only be in the dirty list once. Calling dxQuadTreeSpace::dirty 
multiple times on the same object can lead to a crash if this object is to 
be removed. Here's a simple fix to make sure remove() deals properly with 
multiple listings of a geom in its Dirty list.

void dxQuadTreeSpace::remove(dxGeom* g){
//...
  for (int i = 0; i < DirtyList.size(); i++){
    if (DirtyList[i] == g){
      DirtyList.remove(i);
      //(mg) there can be multiple instances of a dirty object on stack
      //(mg) be sure to remove ALL and not just first, for this we decrement 
i
      //break;
      --i;
    }
  }
//...
} 



More information about the ODE mailing list