osgEarth 2.1.1
Public Member Functions | Public Attributes

osgEarth::CullNodeByHorizon Struct Reference

List of all members.

Public Member Functions

 CullNodeByHorizon (const osg::Vec3d &world, const osg::EllipsoidModel *model)
void operator() (osg::Node *node, osg::NodeVisitor *nv)

Public Attributes

osg::Vec3d _world
double _r2

Detailed Description

Definition at line 197 of file Utils.


Constructor & Destructor Documentation

CullNodeByHorizon::CullNodeByHorizon ( const osg::Vec3d &  world,
const osg::EllipsoidModel *  model 
)

Definition at line 38 of file Utils.cpp.

                                                                                            :
_world(world),
_r2(model->getRadiusPolar() * model->getRadiusPolar())
{
    //nop
}

Member Function Documentation

void CullNodeByHorizon::operator() ( osg::Node *  node,
osg::NodeVisitor *  nv 
)

Definition at line 46 of file Utils.cpp.

{
    if ( nv )
    {
        osg::Vec3d eye, center, up;
        osgUtil::CullVisitor* cv = static_cast<osgUtil::CullVisitor*>( nv );
        cv->getCurrentCamera()->getViewMatrixAsLookAt(eye,center,up);

        double d2 = eye.length2();
        double horiz2 = d2 - _r2;

        double dist2 = (_world-eye).length2();

        if ( dist2 < horiz2 )
        {
            traverse(node, nv);
        }
    }
}

Member Data Documentation

Definition at line 199 of file Utils.

Definition at line 198 of file Utils.


The documentation for this struct was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines