/usr/include/osgEarth/DrapingTechnique is in libosgearth-dev 2.5.0+dfsg-2+b2.
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 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | /* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2008-2013 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 OSGEARTH_OVERLAY_DRAPING_TECHNIQUE
#define OSGEARTH_OVERLAY_DRAPING_TECHNIQUE
#include <osgEarth/Common>
#include <osgEarth/OverlayDecorator>
#include <osg/TexGenNode>
#include <osg/Uniform>
namespace osgEarth
{
class TerrainEngineNode;
/**
* Projects an overlay scene graph onto the main model.
*
* The OverlayDecorator is automatically installed in the MapNode and is used
* to display ModelLayer's whose "overlay" property is set to true.
*
* This class is similar in scope to osgSim::OverlayNode, but is optimized
* for use with osgEarth and geocentric terrains.
*/
class OSGEARTH_EXPORT DrapingTechnique : public OverlayTechnique
{
public:
DrapingTechnique();
/**
* Explicity sets the texture unit to use. Note! When you add this class
* to a MapNode, it will automatically allocate a free texture unit; so you
* usually do NOT need to call this method.
*/
void setTextureUnit( int unit );
int getTextureUnit() const { return *_textureUnit; }
/**
* The size (resolution in both directions) of the overlay texture. By
* default, this defaults to 4096 or your hardware's maximum supported
* texture size, whichever is less.
*/
void setTextureSize( int texSize );
int getTextureSize() const { return *_textureSize; }
/**
* Whether mipmapping is enabled on the projected overlay texture. Mapmapping
* will improve the visual appearance, but will use more memory, and will affect
* performance for overlays that are dynamic. Mipmapping can slow things down
* a LOT on some GPUs (e.g. Intel GMA)
*/
void setMipMapping( bool value );
bool getMipMapping() const { return _mipmapping; }
/**
* Whether to enable blending on the RTT camera graph. Default = true. You might
* want to disable this is you are draping polygons that cover a very large area
* and curve around the globe; sometimes they suffer from tessellation artifacts
* when draped.
*/
void setOverlayBlending( bool value );
bool getOverlayBlending() const { return _rttBlending; }
/**
* Whether to attach the RTT to camera to the stencil buffer. Default = true.
* Some older cards don't have very good support
*/
void setAttachStencil( bool value );
bool getAttachStencil() const;
/**
* Ratio of near resolution to far resolution when draping. [value >= 1.0]
*/
void setResolutionRatio( float value );
float getResolutionRatio() const;
public: // OverlayTechnique
virtual bool hasData(
OverlayDecorator::TechRTTParams& params) const;
void reestablish(
TerrainEngineNode* engine );
void preCullTerrain(
OverlayDecorator::TechRTTParams& params,
osgUtil::CullVisitor* cv );
void cullOverlayGroup(
OverlayDecorator::TechRTTParams& params,
osgUtil::CullVisitor* cv );
void onInstall( TerrainEngineNode* engine );
void onUninstall( TerrainEngineNode* engine );
protected:
virtual ~DrapingTechnique() { }
private:
optional<int> _explicitTextureUnit;
optional<int> _textureUnit;
optional<int> _textureSize;
bool _mipmapping;
bool _rttBlending;
bool _attachStencil;
double _maxFarNearRatio;
struct TechData : public osg::Referenced
{
osg::ref_ptr<osg::Uniform> _texGenUniform;
};
private:
void setUpCamera(OverlayDecorator::TechRTTParams& params);
};
} // namespace osgEarth
#endif //OSGEARTH_OVERLAY_DRAPING_TECHNIQUE
|