Hi Lawrence,

Your custom NodeVisitor will be using the default traversal selection
for PagedLOD rather than one based on camera distance for the PagedLOD
child as is done in the cull traversal.    You'll need to set up your
custom NodeVisitor with the Camera position, the following NodeVisitor
virtual methods are what PagedLOD invokes to work our which child
range to select, note the default 0 which gives you the highest.  Have
a look at the CullVisitor implementation of these for inspiration.

        /** Get the distance from a point to the eye point, distance
value in local coordinate system.
          * Note, not all NodeVisitor implement this method, it is
mainly cull visitors which will implement.
          * If the getDistanceFromEyePoint(pos) is not implemented
then a default value of 0.0 is returned.*/
        virtual float getDistanceToEyePoint(const Vec3& /*pos*/, bool
/*useLODScale*/) const { return 0.0f; }

        /** Get the distance of a point from the eye point, distance
value in the eye coordinate system.
          * Note, not all NodeVisitor implement this method, it is
mainly cull visitors which will implement.
          * If the getDistanceFromEyePoint(pos) is not implemented
than a default value of 0.0 is returned.*/
        virtual float getDistanceFromEyePoint(const Vec3& /*pos*/,
bool /*useLODScale*/) const { return 0.0f; }

        /** Get the distance from a point to the view point, distance
value in local coordinate system.
          * Note, not all NodeVisitor implement this method, it is
mainly cull visitors which will implement.
          * If the getDistanceToViewPoint(pos) is not implemented then
a default value of 0.0 is returned.*/
        virtual float getDistanceToViewPoint(const Vec3& /*pos*/, bool
/*useLODScale*/) const { return 0.0f; }

Robert.

On 24 February 2014 22:23, lawrence bertoldi <lbe...@comcast.net> wrote:
> Hi all....
>
> I'm working in a osg::NodeVisitor to see TerrainTiles that are Currently 
> Active, Which I thought were the visible tiles... when I zoom in to the DB 
> and look at hi rez tiles, then zoom out again to see lo rez tiles, the tile 
> printout information always the highest level for that location.. and while I 
> can see the mesh in the window is a low res tile, or page or cell etc... my 
> printout always shows the highest LOD data.
>
>
> Here is the code
>
>    virtual void apply(osgTerrain::TerrainTile& tile)
>    {
>           osgTerrain::TerrainTile* TT = 
> dynamic_cast<osgTerrain::TerrainTile*>(&tile);
>           osgTerrain::TileID tid = tile.getTileID();
>           for (int i=0;i< tid.level; i++)
>             std::cout << " | ";
>           std::cout << " Tile X  "<< tid.x  << " Tile Y "<< tid.y << " Tile 
> level " << tid.level << std::endl;
>     }
>
>     virtual void apply(osg::Group& group)
>     {
>       static int depth = 0;
>           std::cout<<" " << depth << " "<< &group  << "G "<< 
> group.className() <<" has " <<group.getNumChildren()<< "C" << std::endl;
>
>          // distinguish a tile from other groups
>          osgTerrain::TerrainTile* tile = 
> dynamic_cast<osgTerrain::TerrainTile*>(&group);
>           if (tile)
>           {
>             apply(*tile);
>           }
>           else
>           {
>             depth++;
>             traverse(group);
>             depth--;
>           }
>      }
>
>
>
> ...
>
> Thank you!
>
> Cheers,
> lawrence
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=58283#58283
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to