Esempio n. 1
0
bool
Horizon::getPlane(osg::Plane& out_plane) const
{
    // calculate scaled distance from center to viewer:
    if ( _valid == false || _VCmag2 == 0.0 )
        return false;

    double PCmag;
    if ( _VCmag > 0.0 )
    {
        // eyepoint is above ellipsoid? Calculate scaled distance from center to horizon plane
        PCmag = 1.0/_VCmag;
    }
    else
    {
        // eyepoint is below the ellipsoid? plane passes through the eyepoint.
        PCmag = _VCmag;
    }

    osg::Vec3d pcWorld = osg::componentMultiply(_eyeUnit*PCmag, _scaleInv);
    double dist = pcWorld.length();

    // compute a new clip plane:
    out_plane.set(_eyeUnit, -dist);
    return true;
}
Esempio n. 2
0
bool
Horizon::getPlane(osg::Plane& out_plane) const
{
    // calculate scaled distance from center to viewer:
    double magVC = _cv.length();
    if ( magVC == 0.0 )
        return false;

    // calculate scaled distance from center to horizon plane:
    double magPC = 1.0/magVC;

    osg::Vec3d normal = _cv;
    normal.normalize();

    osg::Vec3d pcWorld = osg::componentMultiply(normal*magPC, _scaleInv);
    double dist = pcWorld.length();

    // compute a new clip plane:
    out_plane.set(normal, -dist);
    return true;
}