/usr/include/osgEarth/TileRasterizer is in libosgearth-dev 2.9.0+dfsg-1.
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 | /* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2016 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_TILE_RASTERIZER_H
#define OSGEARTH_TILE_RASTERIZER_H 1
#include <osgEarth/Common>
#include <osgEarth/GeoData>
#include <osgEarth/ThreadingUtils>
#include <osgEarth/TileKey>
#include <osg/Camera>
#include <osg/BufferObject>
#include <osg/Texture2D>
#include <queue>
namespace osgEarth
{
// placeholder - might go away -gw
class OSGEARTH_EXPORT GeoNode : public osg::Object
{
public:
META_Object(osgEarth, GeoNode);
GeoNode() { }
GeoNode(const GeoNode& rhs, const osg::CopyOp& copy) { }
GeoNode(osg::Node* node, const GeoExtent& extent) : _node(node), _extent(extent) { }
osg::ref_ptr<osg::Node> _node;
GeoExtent _extent;
};
/**
* Node that will render node graphs to textures, one at a time.
*/
class OSGEARTH_EXPORT TileRasterizer : public osg::Camera
{
public:
/** Construct a new tile rasterizer camera */
TileRasterizer();
/**
* Schedule a rasterization to an osg::Image.
* @param node Node to render to the image
* @param size of the target image (both dimensions)
* @param extent geospatial extent of the node to render.
* @return Future image - blocks on .get()
*/
Threading::Future<osg::Image> push(osg::Node* node, unsigned size, const GeoExtent& extent);
/**
* Schedule a rasterization to a texture.
* @param node Node to render to the texture
* @param texture Texture to which to render the node
* @param extent Geographic extent of the output texture
*/
void push(osg::Node* node, osg::Texture* texture, const GeoExtent& extent);
public: // osg::Node
void traverse(osg::NodeVisitor&);
private:
virtual ~TileRasterizer();
// internal - image with custom readback
struct ReadbackImage : public osg::Image
{
osg::RenderInfo* _ri;
void readPixels(int x, int y, int width, int height, GLenum pixelFormat, GLenum type, int packing);
};
// internal - scheduled rasterization job
struct Job
{
osg::ref_ptr<osg::Node> _node;
GeoExtent _extent;
osg::ref_ptr<osg::Texture> _texture;
osg::ref_ptr<ReadbackImage> _image;
osg::ref_ptr<osg::PixelBufferObject> _imagePBO;
Threading::Promise<osg::Image> _imagePromise;
};
mutable Threading::Mutex _mutex;
typedef std::queue<Job> JobQueue;
mutable JobQueue _pendingJobs; // queue for jobs waiting to render
mutable JobQueue _readbackJobs; // queue for jobs waiting for rtt/glReadPixels to finish
mutable JobQueue _finishedJobs; // queue for jobs waiting for the promise to resolve
//osg::ref_ptr<osg::Uniform> _distortionU;
public: // internal
void preDraw(osg::RenderInfo&) const;
void postDraw(osg::RenderInfo&) const;
};
} // namespace osgEarth
#endif // OSGEARTH_TILE_RASTERIZER_H
|