This file is indexed.

/usr/include/osgEarthDrivers/engine_mp/MPGeometry 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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/* -*-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.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
* 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_DRIVERS_MP_TERRAIN_ENGINE_MPGEOMETRY
#define OSGEARTH_DRIVERS_MP_TERRAIN_ENGINE_MPGEOMETRY 1

#include "Common"
#include "TileNode"
#include "TileNodeRegistry"
#include <osg/Geometry>
#include <osg/buffered_value>
#include <osgEarth/Map>
#include <osgEarth/MapFrame>

using namespace osgEarth;

namespace osgEarth { namespace Drivers { namespace MPTerrainEngine
{
    /**
     * A Geometry that will draw its primitive sets multiple time,
     * once for each configured "layer". For rendering multipass
     * data from a single cull.
     */
    class MPGeometry : public osg::Geometry
    {
    public:
        /**
         * Per-tile attribution for use with the MPGeometry.
         */
        struct Layer
        {
            Layer()
            {
                _texMatUniformID = ~0;
            }

            osgEarth::UID                  _layerID;
            osg::ref_ptr<const ImageLayer> _imageLayer;
            osg::ref_ptr<osg::Texture>     _tex;
            osg::ref_ptr<osg::Vec2Array>   _texCoords;
            osg::ref_ptr<osg::Texture>     _texParent;
            osg::Matrixf                   _texMatParent; // yes, must be a float matrix
            float                          _alphaThreshold;
            bool                           _opaque;

            // for shared layers only:
            osg::Matrixf                   _texMat;          // yes, must be a float matrix
            unsigned                       _texMatUniformID; // uniform location ID

            // in support of std::find
            inline bool operator == (const osgEarth::UID& rhs) const {
                return _layerID == rhs;
            }
        };

    public:
        mutable MapFrame           _frame;
        mutable std::vector<Layer> _layers;
        mutable Threading::Mutex   _frameSyncMutex;

        // uniform name IDs.
        unsigned _uidUniformNameID;
        unsigned _birthTimeUniformNameID;
        unsigned _orderUniformNameID;
        unsigned _opacityUniformNameID;
        unsigned _texMatParentUniformNameID;
        unsigned _tileKeyUniformNameID;
        unsigned _minRangeUniformNameID;
        unsigned _maxRangeUniformNameID;

        // Data stored for each graphics context:
        struct PerContextData {
            PerContextData() : birthTime(-1.0f), lastFrame(0) { }
            float    birthTime;
            unsigned lastFrame;
        };
        mutable osg::buffered_object<PerContextData> _pcd;


        mutable osg::Vec4f _tileKeyValue;

        osg::ref_ptr<osg::Vec2Array> _tileCoords; // [0..1] unified tile coordinates

        int _imageUnit;          // image unit for primary texture
        int _imageUnitParent;    // image unit for secondary (parent) texture
        int _elevUnit;           // image unit for elevation texture

        bool _supportsGLSL;

        osg::ref_ptr<osg::Texture> _elevTex;

    public:
        
        // construct a new MPGeometry.
        MPGeometry(const TileKey& key, const MapFrame& frame, int primaryImageUnit);

        // sets an image unit to use for parent texture blending.
        void setParentImageUnit(int value) { _imageUnitParent = value; }

        // render all passes of the geometry.
        void renderPrimitiveSets(osg::State& state, bool renderColor, bool usingVBOs) const;

        // validate the geometry is OK.
        void validate();

    public: // osg::Geometry overrides

        // override so we can properly release the GL buffer objects
        // that are not tracked by the Geometry itself but rather are
        // stored in the LayerRenderData.
        void releaseGLObjects(osg::State* state) const;
        void resizeGLObjectBuffers(unsigned maxSize);
        void compileGLObjects( osg::RenderInfo& renderInfo ) const;

        // this is copied mostly from osg::Geometry, but we've removed 
        // all the code that handles non-fastPath (don't need it) and
        // called into our custom renderPrimitiveSets method.
        void drawImplementation(osg::RenderInfo& renderInfo) const;

        // recalculate the bound for the tile key uniform.
#if OSG_VERSION_GREATER_THAN(3,3,1)
        osg::BoundingBox computeBoundingBox() const;
#else
        osg::BoundingBox computeBound() const;
#endif

    public:
        META_Object(osgEarth, MPGeometry);
        MPGeometry() : osg::Geometry(), _frame(0L) { }
        MPGeometry(const MPGeometry& rhs, const osg::CopyOp& cop) : osg::Geometry(rhs, cop), _frame(rhs._frame) { }
        virtual ~MPGeometry() { }
    };

} } } // namespace osgEarth::Drivers::MPTerrainEngine

#endif // OSGEARTH_DRIVERS_MP_TERRAIN_ENGINE_MPGEOMETRY