// select all visible nodes
UInt32 RenderAction::selectVisibles(void)
{
    if(getFrustumCulling() == false)
        return getNNodes();

    useNodeList();

    Color3f col;

    UInt32 count = 0;

    for(UInt32 i = 0; i < getNNodes(); i++)
    {
        if(isVisible(getNode(i)))
        {
            col.setValuesRGB(0,1,0);

            addNode(getNode(i));

            ++count;
        }
        else
        {
            col.setValuesRGB(1,0,0);
        }

        if(getVolumeDrawing())
        {
            dropVolume(this, getNode(i), col);
        }
    }

    return count;
}
bool RenderAction::pushVisibility(void)
{
    if(_pActivePartition->pushVisibility(getActNode()) == false)
    {
        useNodeList(); // ignore all children
        return false;
    }

    return true;
}
UInt32 AdapterDrawAction::selectVisiblesGlobal (void)
{
   if (!getFrustumCulling()) {
        return getNNodes();
   }

   GLint l = 0;
   bool  d = getVolumeDrawing();
   if ( d ) {
      l = glIsEnabled(GL_LIGHTING);
      glDisable(GL_LIGHTING);
   }

   useNodeList();
   
   UInt32 count = 0;
   for ( UInt32 i = 0; i < getNNodes(); ++i ) {
        if ( isVisible( getNode(i).getCPtr() ) ) {
            addNode( getNode(i) );
            ++count;
        }

        if (d) {
	   OSGCache::CacheData& data = OSGCache::the()[getNode(i)];

	   OSGCache::CacheData::AdapterContainer& all = 
	     data.getAdapter(BVolAdapterBase::getAdapterId());
	   // for BVolHierarchyBase there are more than one leaf nodes, then render
	   // for SingleHierarchyBase there are more than one inner nodes, then skip
	   if (all.size() > 1 && ((BVolAdapterBase*)all[0])->isInner()) { 
	      continue; 
	   }

	   glColor3f(0,1,0);
	   glPushMatrix();
	   glLoadIdentity();
	   getCamera()->setup(this, *getViewport());
	   //const Matrix& matrixI = data.getToWorldMatrix();
	   //glMultMatrixf(matrixI.getValues());
	   OSGCache::CacheData::AdapterContainer::const_iterator iter=all.begin();   
	   for (; iter != all.end(); ++iter) {
	      ((BVolAdapterBase*)*iter)->getBoundingVolume().drawWireframe();
	   }
	   glPopMatrix();
        }
   }
   if (l) { 
      glEnable(GL_LIGHTING);
   }
   
   return count;
}