/usr/include/osgEarthUtil/AutoClipPlaneHandler is in libosgearth-dev 2.7.0+dfsg-2+b3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | /* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2015 Pelican Mapping
* http://osgearth.org
*
* osgEarth is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#ifndef OSGEARTHUTIL_AUTOCLIPPLANEHANDLER_H
#define OSGEARTHUTIL_AUTOCLIPPLANEHANDLER_H
#include <osgEarthUtil/Common>
#include <osgEarth/Containers>
#include <osgEarth/Utils>
#include <osgGA/GUIEventHandler>
#include <osgGA/EventVisitor>
#include <osg/Camera>
namespace osgEarth {
class MapNode;
}
namespace osgEarth { namespace Util
{
using namespace osgEarth;
/**
* A CULL callback that automatically adjusts the calculated near and far clip planes for
* use in a geocentric map.
*
* Usage: add this as a cull callback to a camera, like:
*
* osgViewer::Viewer viewer;
* ...
* viewer.getCamera()->addCullCallback( new AutoClipPlaneCallback(map) )
*/
class OSGEARTHUTIL_EXPORT AutoClipPlaneCullCallback : public osg::NodeCallback
{
public:
/**
* Constructs a new auto-clip plane manager corresponding to the parameters
* in the specified map.
* @param map Map to take ellipsoid information from; if NULL, use WGS84 values
*/
AutoClipPlaneCullCallback( MapNode* mapNode =0L );
virtual ~AutoClipPlaneCullCallback() { }
/**
* Sets the minimum near/far ratio to use for this camera. The minimum ratio takes
* effect when the camera HAE hits zero.
*/
void setMinNearFarRatio( double value ) { _minNearFarRatio = value; }
double getMinNearFarRatio() const { return _minNearFarRatio; }
/**
* Sets the maximum near/far ratio to use for the camera. The maximum ratio
* takes effect when the camera HAE hits the Height Threshold.
*/
void setMaxNearFarRatio( double value ) { _maxNearFarRatio = value; }
double getMaxNearFarRatio() const { return _maxNearFarRatio; }
/**
* Sets the camera Height (above ellipsoide) at which the near/far ratio
* hits its maximum value.
*/
void setHeightThreshold( double value ) { _haeThreshold = value; }
double getHeightThreshold() const { return _haeThreshold; }
/**
* Whether to clamp the the far clipping plane to the approximate
* visible horizon.
*/
void setClampFarClipPlane( bool value ) { _autoFarPlaneClamping = value; }
bool getClampFarClipPlane() const { return _autoFarPlaneClamping; }
public:
virtual void operator()( osg::Node* node, osg::NodeVisitor* nv );
protected:
bool _active;
double _minNearFarRatio, _maxNearFarRatio;
double _haeThreshold;
double _rp2, _rp;
bool _autoFarPlaneClamping;
osg::observer_ptr<MapNode> _mapNode;
PerObjectFastMap< osg::Camera*, osg::ref_ptr<osg::CullSettings::ClampProjectionMatrixCallback> > _clampers;
};
} } // namespace osgEarth::Util
#endif // OSGEARTHUTIL_AUTOCLIPPLANEHANDLER_H
|