//-----------------------------------------------------------------------
    void SWTraversal::onTree(PagingLandScapeOctree & n, VisibleObjectsBoundsInfo * const visibleBounds)
    {
        if(occlusion.mCurrentCam->isVisible(n.getCullBoundingBox ())) 
        {

		    #ifdef _VISIBILITYDEBUG
	            occlusion.traversed_nodes_cnt++; 
                n.getNodeData (occlusion.mCurrentCam)->viewFrustumVisible = true;
		    #endif //_VISIBILITYDEBUG    

            const bool isitVisible = isVisible(n);

		    if (isitVisible) 
            {
                traverseChildren (n, visibleBounds);
		    }

		    #ifdef _VISIBILITYDEBUG
		        n.getNodeData (occlusion.mCurrentCam)->queryVisible = isitVisible;
		    #endif //_VISIBILITYDEBUG    

	    }

		#ifdef _VISIBILITYDEBUG
	        else 
            {
	            occlusion.traversed_nodes_cnt++; 
                n.getNodeData (occlusion.mCurrentCam)->viewFrustumVisible = false;
		        occlusion.frustum_culled_nodes_cnt++;
	        }
		#endif //_VISIBILITYDEBUG    
    }
        //-----------------------------------------------------------------------
        void TreeOverlayDebug::onTree(PagingLandScapeOctree& n, VisibleObjectsBoundsInfo * const visibleBounds) const 
		{    
			SimpleRenderable * const s = n.getRectangle2d(mScnMrg);
            if (n.getNodeData (occlusion.mCurrentCam)->viewFrustumVisible)
            {
			    if (n.getNodeData (occlusion.mCurrentCam)->queryVisible) 
                {
                    s->setMaterial ("BaseWhiteNoLightNoDepthCheck");
                    occlusion.mCurrentRenderQueue->addRenderable (s, s->getRenderQueueGroup ());

                    traverseChildren (n, visibleBounds);
			    }
			    else 
                {
                    s->setMaterial ("BaseRedNoLightNoDepthCheck");
                    occlusion.mCurrentRenderQueue->addRenderable (s, s->getRenderQueueGroup ());
			    }
		    }
		    else 
			{
                s->setMaterial ("BaseGreenNoLightNoDepthCheck");
                occlusion.mCurrentRenderQueue->addRenderable (s, s->getRenderQueueGroup ());
		    }       
        }
    //-----------------------------------------------------------------------
    void CHCTraversal::onTree(PagingLandScapeOctree& node, VisibleObjectsBoundsInfo * const visibleBounds) const 
    {
    	#ifdef _VISIBILITYDEBUG
            assert (node.getNodeData (occlusion.mCurrentCam)->viewFrustumVisible);
		    occlusion.traversed_nodes_cnt++;       
        #endif //_VISIBILITYDEBUG    
                
        if (!node.mNodes.empty())
        {	
            PagingLandScapeOctreeNodeList::iterator it =  node.mNodes.begin();  
            while (it != node.mNodes.end())
            { 
                stack.push (*it);
                ++it;
            }
        }

        PagingLandScapeOctree *n = 
            node.mChildren[ 0 ][ 0 ][ 0 ];
        if (n && n->hasChildren())  
           stack.push(n);
        n = node.mChildren[ 1 ][ 0 ][ 0 ];
        if (n && n->hasChildren())  
            stack.push(n);
        n = node.mChildren[ 0 ][ 1 ][ 0 ];
        if (n && n->hasChildren())  
            stack.push(n);
        n = node.mChildren[ 1 ][ 1 ][ 0 ];
        if (n && n->hasChildren())  
            stack.push(n);
        n = node.mChildren[ 0 ][ 0 ][ 1 ];
        if (n && n->hasChildren())  
            stack.push(n);
        n = node.mChildren[ 1 ][ 0 ][ 1 ];
        if (n && n->hasChildren())  
            stack.push(n);
        n = node.mChildren[ 0 ][ 1 ][ 1 ];
        if (n && n->hasChildren())  
            stack.push(n);
        n = node.mChildren[ 1 ][ 1 ][ 1 ];
        if (n && n->hasChildren())  
            stack.push(n);
	}