Skip to content
Commits on Source (5)
osgearth (2.9~rc3+dfsg-1~exp1) experimental; urgency=medium
* New upstream release candidate.
* Update symbols for amd64.
-- Bas Couwenberg <sebastic@debian.org> Fri, 02 Feb 2018 07:23:55 +0100
osgearth (2.9~rc2+dfsg-1~exp1) experimental; urgency=medium
* New upstream release candidate.
......
# SymbolsHelper-Confirmed: 2.9~rc2 amd64
# SymbolsHelper-Confirmed: 2.9~rc3 amd64
libosgEarth.so.5 #PACKAGE# #MINVER#
_Z10TiXmlFOpenPKcS0_@Base 2.4.0
_ZGVZN13DeclutterSort18sortImplementationEPN7osgUtil9RenderBinEE8s_zero_w@Base 2.5.0
......@@ -448,6 +448,7 @@ libosgEarth.so.5 #PACKAGE# #MINVER#
_ZN8osgEarth10ImageLayerD2Ev@Base 2.4.0
_ZN8osgEarth10ImageUtils10canConvertEPKN3osg5ImageEjj@Base 2.4.0
_ZN8osgEarth10ImageUtils10cloneImageEPKN3osg5ImageE@Base 2.4.0
_ZN8osgEarth10ImageUtils10readStreamERSiPKN5osgDB7OptionsE@Base 2.9~rc3
_ZN8osgEarth10ImageUtils10sameFormatEPKN3osg5ImageES4_@Base 2.6.0
_ZN8osgEarth10ImageUtils10upSampleNNEPKN3osg5ImageEi@Base 2.7.0
_ZN8osgEarth10ImageUtils11PixelReader8setImageEPKN3osg5ImageE@Base 2.9~rc1
......@@ -483,6 +484,7 @@ libosgEarth.so.5 #PACKAGE# #MINVER#
_ZN8osgEarth10ImageUtils20createSharpenedImageEPKN3osg5ImageE@Base 2.5.0
_ZN8osgEarth10ImageUtils22textureArrayCompatibleEPKN3osg5ImageES4_@Base 2.7.0
_ZN8osgEarth10ImageUtils24createMipmapBlendedImageEPKN3osg5ImageES4_@Base 2.4.0
_ZN8osgEarth10ImageUtils24getReaderWriterForStreamERSi@Base 2.9~rc3
_ZN8osgEarth10ImageUtils27buildNearestNeighborMipmapsEPKN3osg5ImageE@Base 2.7.0
_ZN8osgEarth10ImageUtils27convertToPremultipliedAlphaEPN3osg5ImageE@Base 2.4.0
_ZN8osgEarth10ImageUtils29computeTextureCompressionModeEPKN3osg5ImageERNS1_7Texture18InternalFormatModeE@Base 2.6.0
......@@ -2868,6 +2870,7 @@ libosgEarth.so.5 #PACKAGE# #MINVER#
_ZN8osgEarth7MapNode15removeExtensionEPNS_9ExtensionE@Base 2.7.0
_ZN8osgEarth7MapNode17getDrapingManagerEv@Base 2.9~rc1
_ZN8osgEarth7MapNode18getClampingManagerEv@Base 2.9~rc1
_ZN8osgEarth7MapNode21resizeGLObjectBuffersEj@Base 2.9~rc3
_ZN8osgEarth7MapNode4initEv@Base 2.4.0
_ZN8osgEarth7MapNode4loadERN3osg14ArgumentParserE@Base 2.4.0
_ZN8osgEarth7MapNode4loadERN3osg14ArgumentParserERKNS_14MapNodeOptionsE@Base 2.8~rc1
......@@ -3810,6 +3813,7 @@ libosgEarth.so.5 #PACKAGE# #MINVER#
_ZNK8osgEarth10PatchLayer5cloneERKN3osg6CopyOpE@Base 2.9~rc1
_ZNK8osgEarth10PatchLayer9classNameEv@Base 2.9~rc1
_ZNK8osgEarth10PatchLayer9cloneTypeEv@Base 2.9~rc1
_ZNK8osgEarth10PolyShader16releaseGLObjectsEPN3osg5StateE@Base 2.9~rc3
_ZNK8osgEarth10PolyShader9getShaderEj@Base 2.8~rc1
_ZNK8osgEarth10Revisioned10inSyncWithERKNS_8RevisionE@Base 2.4.0
_ZNK8osgEarth10Revisioned4syncERNS_8RevisionE@Base 2.4.0
......@@ -4495,6 +4499,7 @@ libosgEarth.so.5 #PACKAGE# #MINVER#
_ZNK8osgEarth7MapNode12getLayerNodeEPNS_5LayerE@Base 2.9~rc1
_ZNK8osgEarth7MapNode12isGeocentricEv@Base 2.4.0
_ZNK8osgEarth7MapNode16getTerrainEngineEv@Base 2.4.0
_ZNK8osgEarth7MapNode16releaseGLObjectsEPN3osg5StateE@Base 2.9~rc3
_ZNK8osgEarth7MapNode17getLayerNodeGroupEv@Base 2.9~rc1
_ZNK8osgEarth7MapNode17getMapNodeOptionsEv@Base 2.4.0
_ZNK8osgEarth7MapNode19getResourceReleaserEv@Base 2.9~rc1
......
# SymbolsHelper-Confirmed: 2.9~rc2 amd64
# SymbolsHelper-Confirmed: 2.9~rc3 amd64
libosgEarthUtil.so.5 #PACKAGE# #MINVER#
_Z10intersectsRKdS0_S0_S0_S0_S0_S0_S0_@Base 2.4.0
_Z17getHorizSRSStringB5cxx11PKN8osgEarth16SpatialReferenceE@Base 2.7.0
......@@ -559,9 +559,12 @@ libosgEarthUtil.so.5 #PACKAGE# #MINVER#
_ZN8osgEarth4Util13TMSBackFiller9writeTileERKNS_7TileKeyEPN3osg5ImageE@Base 2.4.0
_ZN8osgEarth4Util13TMSBackFillerC1Ev@Base 2.4.0
_ZN8osgEarth4Util13TMSBackFillerC2Ev@Base 2.4.0
_ZN8osgEarth4Util13TopologyGraph12dumpBoundaryERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE@Base 2.9~rc1
_ZN8osgEarth4Util13TopologyGraph12dumpBoundaryERKSt6vectorISt23_Rb_tree_const_iteratorINS1_6VertexEESaIS5_EERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE@Base 2.9~rc3
_ZN8osgEarth4Util13TopologyGraphC1Ev@Base 2.9~rc1
_ZN8osgEarth4Util13TopologyGraphC2Ev@Base 2.9~rc1
_ZN8osgEarth4Util13TopologyGraphD0Ev@Base 2.9~rc3
_ZN8osgEarth4Util13TopologyGraphD1Ev@Base 2.9~rc3
_ZN8osgEarth4Util13TopologyGraphD2Ev@Base 2.9~rc3
_ZN8osgEarth4Util13VerticalScale11mergeConfigERKNS_6ConfigE@Base 2.5.0
_ZN8osgEarth4Util13VerticalScale11onUninstallEPNS_17TerrainEngineNodeE@Base 2.5.0
_ZN8osgEarth4Util13VerticalScale4initEv@Base 2.5.0
......@@ -651,7 +654,9 @@ libosgEarthUtil.so.5 #PACKAGE# #MINVER#
_ZN8osgEarth4Util15TFSReaderWriter4readERSiRNS0_8TFSLayerE@Base 2.4.0
_ZN8osgEarth4Util15TFSReaderWriter5writeERKNS0_8TFSLayerERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE@Base 2.7.0
_ZN8osgEarth4Util15TFSReaderWriter5writeERKNS0_8TFSLayerERSo@Base 2.4.0
_ZN8osgEarth4Util15TopologyBuilder18assignAndPropagateERSt23_Rb_tree_const_iteratorINS0_13TopologyGraph6VertexEEj@Base 2.9~rc3
_ZN8osgEarth4Util15TopologyBuilder3addEj@Base 2.9~rc1
_ZN8osgEarth4Util15TopologyBuilder6createEPKN3osg13TemplateArrayINS2_5Vec3fELNS2_5Array4TypeE28ELi3ELi5126EEEPKNS2_12PrimitiveSetERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE@Base 2.9~rc3
_ZN8osgEarth4Util15TopologyBuilderC1Ev@Base 2.9~rc1
_ZN8osgEarth4Util15TopologyBuilderC2Ev@Base 2.9~rc1
_ZN8osgEarth4Util15TopologyBuilderclEjjj@Base 2.9~rc1
......@@ -2079,7 +2084,13 @@ libosgEarthUtil.so.5 #PACKAGE# #MINVER#
_ZNK8osgEarth4Util13MapNodeHelper5parseEPNS_7MapNodeERN3osg14ArgumentParserEPN9osgViewer4ViewEPNS4_5GroupEPNS0_8Controls12LabelControlE@Base 2.7.0
_ZNK8osgEarth4Util13MapNodeHelper5parseEPNS_7MapNodeERN3osg14ArgumentParserEPN9osgViewer4ViewEPNS4_5GroupEPNS0_8Controls9ContainerE@Base 2.7.0
_ZNK8osgEarth4Util13MapNodeHelper5usageB5cxx11Ev@Base 2.7.0
_ZNK8osgEarth4Util13TopologyGraph14createBoundaryERSt6vectorISt23_Rb_tree_const_iteratorINS1_6VertexEESaIS5_EE@Base 2.9~rc1
_ZNK8osgEarth4Util13TopologyGraph11libraryNameEv@Base 2.9~rc3
_ZNK8osgEarth4Util13TopologyGraph12isSameKindAsEPKN3osg6ObjectE@Base 2.9~rc3
_ZNK8osgEarth4Util13TopologyGraph14createBoundaryEjRSt6vectorISt23_Rb_tree_const_iteratorINS1_6VertexEESaIS5_EE@Base 2.9~rc3
_ZNK8osgEarth4Util13TopologyGraph16getNumBoundariesEv@Base 2.9~rc3
_ZNK8osgEarth4Util13TopologyGraph5cloneERKN3osg6CopyOpE@Base 2.9~rc3
_ZNK8osgEarth4Util13TopologyGraph9classNameEv@Base 2.9~rc3
_ZNK8osgEarth4Util13TopologyGraph9cloneTypeEv@Base 2.9~rc3
_ZNK8osgEarth4Util13VerticalScale9getConfigEv@Base 2.5.0
_ZNK8osgEarth4Util14HSLColorFilter12getHSLOffsetEv@Base 2.4.0
_ZNK8osgEarth4Util14HSLColorFilter25getEntryPointFunctionNameB5cxx11Ev@Base 2.7.0
......@@ -2410,7 +2421,6 @@ libosgEarthUtil.so.5 #PACKAGE# #MINVER#
(optional=templinst)_ZNSt8_Rb_treeIN3osg12observer_ptrIN5osgGA15GUIEventHandlerEEESt4pairIKS4_NS1_IN9osgViewer4ViewEEEESt10_Select1stISA_ESt4lessIS4_ESaISA_EE8_M_eraseEPSt13_Rb_tree_nodeISA_E@Base 2.4.0
(optional=templinst)_ZNSt8_Rb_treeIN7osgUtil22LineSegmentIntersector12IntersectionES2_St9_IdentityIS2_ESt4lessIS2_ESaIS2_EE8_M_eraseEPSt13_Rb_tree_nodeIS2_E@Base 2.4.0
(optional=templinst)_ZNSt8_Rb_treeIN8osgEarth20PrimitiveIntersector12IntersectionES2_St9_IdentityIS2_ESt4lessIS2_ESaIS2_EE8_M_eraseEPSt13_Rb_tree_nodeIS2_E@Base 2.5.0
(optional=templinst)_ZNSt8_Rb_treeIN8osgEarth4Util13TopologyGraph6VertexES3_St9_IdentityIS3_ESt4lessIS3_ESaIS3_EE16_M_insert_uniqueIRKS3_EESt4pairISt17_Rb_tree_iteratorIS3_EbEOT_@Base 2.9~rc1
(optional=templinst)_ZNSt8_Rb_treeIN8osgEarth4Util13TopologyGraph6VertexES3_St9_IdentityIS3_ESt4lessIS3_ESaIS3_EE8_M_eraseEPSt13_Rb_tree_nodeIS3_E@Base 2.9~rc1
(optional=templinst)_ZNSt8_Rb_treeIN8osgEarth4Util16EarthManipulator9InputSpecESt4pairIKS3_NS2_6ActionEESt10_Select1stIS7_ESt4lessIS3_ESaIS7_EE24_M_get_insert_unique_posERS5_@Base 2.4.0
(optional=templinst)_ZNSt8_Rb_treeIN8osgEarth4Util16EarthManipulator9InputSpecESt4pairIKS3_NS2_6ActionEESt10_Select1stIS7_ESt4lessIS3_ESaIS7_EE29_M_get_insert_hint_unique_posESt23_Rb_tree_const_iteratorIS7_ERS5_@Base 2.4.0
......@@ -2473,7 +2483,6 @@ libosgEarthUtil.so.5 #PACKAGE# #MINVER#
(optional=templinst)_ZNSt8_Rb_treeIfSt4pairIKfN3osg7ref_ptrIN8osgEarth4Util8Controls11ControlNodeEEEESt10_Select1stIS9_ESt4lessIfESaIS9_EE8_M_eraseEPSt13_Rb_tree_nodeIS9_E@Base 2.4.0
(optional=templinst|arch=hurd-i386 i386 kfreebsd-i386)_ZNSt8_Rb_treeIfSt4pairIKfN3osg7ref_ptrIN8osgEarth4Util9GeoObjectEEEESt10_Select1stIS8_ESt4lessIfESaIS8_EE15_M_insert_equalIS0_IfPS6_EEESt17_Rb_tree_iteratorIS8_EOT_@Base 2.8~rc2
(optional=templinst)_ZNSt8_Rb_treeIfSt4pairIKfN3osg7ref_ptrIN8osgEarth4Util9GeoObjectEEEESt10_Select1stIS8_ESt4lessIfESaIS8_EE8_M_eraseEPSt13_Rb_tree_nodeIS8_E@Base 2.4.0
(optional=templinst)_ZNSt8_Rb_treeIjSt4pairIKjSt23_Rb_tree_const_iteratorIN8osgEarth4Util13TopologyGraph6VertexEEESt10_Select1stIS8_ESt4lessIjESaIS8_EE29_M_get_insert_hint_unique_posES2_IS8_ERS1_@Base 2.9~rc1
(optional=templinst)_ZNSt8_Rb_treeIjSt4pairIKjSt23_Rb_tree_const_iteratorIN8osgEarth4Util13TopologyGraph6VertexEEESt10_Select1stIS8_ESt4lessIjESaIS8_EE8_M_eraseEPSt13_Rb_tree_nodeIS8_E@Base 2.9~rc1
(optional=templinst|arch=ia64)_ZSt22__uninitialized_move_aIPN8osgEarth4Util3TMS7TileSetES4_SaIS3_EET0_T_S7_S6_RT1_@Base 2.4.0
(optional=templinst)_ZSt4copyIN3osg7ref_ptrIN8osgEarth4Util8Controls7ControlEEEESt15_Deque_iteratorIT_RS8_PS8_ES7_IS8_RKS8_PSC_ESF_SB_@Base 2.9~rc1
......@@ -2565,6 +2574,7 @@ libosgEarthUtil.so.5 #PACKAGE# #MINVER#
_ZTIN8osgEarth4Util13GARSGraticuleE@Base 2.9~rc1
_ZTIN8osgEarth4Util13MGRSFormatterE@Base 2.4.0
_ZTIN8osgEarth4Util13MGRSGraticuleE@Base 2.4.0
_ZTIN8osgEarth4Util13TopologyGraphE@Base 2.9~rc3
_ZTIN8osgEarth4Util13VerticalScaleE@Base 2.5.0
_ZTIN8osgEarth4Util14HSLColorFilterE@Base 2.4.0
_ZTIN8osgEarth4Util14RGBColorFilterE@Base 2.4.0
......@@ -2794,6 +2804,7 @@ libosgEarthUtil.so.5 #PACKAGE# #MINVER#
_ZTSN8osgEarth4Util13GARSGraticuleE@Base 2.9~rc1
_ZTSN8osgEarth4Util13MGRSFormatterE@Base 2.4.0
_ZTSN8osgEarth4Util13MGRSGraticuleE@Base 2.4.0
_ZTSN8osgEarth4Util13TopologyGraphE@Base 2.9~rc3
_ZTSN8osgEarth4Util13VerticalScaleE@Base 2.5.0
_ZTSN8osgEarth4Util14HSLColorFilterE@Base 2.4.0
_ZTSN8osgEarth4Util14RGBColorFilterE@Base 2.4.0
......@@ -3028,6 +3039,7 @@ libosgEarthUtil.so.5 #PACKAGE# #MINVER#
_ZTVN8osgEarth4Util13GARSGraticuleE@Base 2.9~rc1
_ZTVN8osgEarth4Util13MGRSFormatterE@Base 2.4.0
_ZTVN8osgEarth4Util13MGRSGraticuleE@Base 2.4.0
_ZTVN8osgEarth4Util13TopologyGraphE@Base 2.9~rc3
_ZTVN8osgEarth4Util13VerticalScaleE@Base 2.5.0
_ZTVN8osgEarth4Util14HSLColorFilterE@Base 2.4.0
_ZTVN8osgEarth4Util14RGBColorFilterE@Base 2.4.0
......
......@@ -26,6 +26,7 @@
#include <osg/Texture>
#include <osg/GL>
#include <osg/NodeVisitor>
#include <osgDB/ReaderWriter>
#include <vector>
//These formats were not added to OSG until after 2.8.3 so we need to define them to use them.
......@@ -346,6 +347,18 @@ namespace osgEarth
*/
static void activateMipMaps(osg::Texture* texture);
/**
* Gets an osgDB::ReaderWriter for the given input stream.
* Returns NULL if no ReaderWriter can be found.
*/
static osgDB::ReaderWriter* getReaderWriterForStream(std::istream& stream);
/**
* Reads an osg::Image from the given input stream.
* Returns NULL if the image could not be read.
*/
static osg::Image* readStream(std::istream& stream, const osgDB::Options* options);
/**
* Reads color data out of an image, regardles of its internal pixel format.
*/
......
......@@ -687,6 +687,82 @@ ImageUtils::createMipmapBlendedImage( const osg::Image* primary, const osg::Imag
return result.release();
}
osgDB::ReaderWriter*
ImageUtils::getReaderWriterForStream(std::istream& stream) {
// Modified from https://oroboro.com/image-format-magic-bytes/
// Get the length of the stream
stream.seekg(0, std::ios::end);
unsigned int len = stream.tellg();
stream.seekg(0, std::ios::beg);
if (len < 16) return 0;
//const char* data = input.c_str();
// Read a 16 byte header
char data[16];
stream.read(data, 16);
// Reset reading
stream.seekg(0, std::ios::beg);
// .jpg: FF D8 FF
// .png: 89 50 4E 47 0D 0A 1A 0A
// .gif: GIF87a
// GIF89a
// .tiff: 49 49 2A 00
// 4D 4D 00 2A
// .bmp: BM
// .webp: RIFF ???? WEBP
// .ico 00 00 01 00
// 00 00 02 00 ( cursor files )
switch (data[0])
{
case '\xFF':
return (!strncmp((const char*)data, "\xFF\xD8\xFF", 3)) ?
osgDB::Registry::instance()->getReaderWriterForExtension("jpg") : 0;
case '\x89':
return (!strncmp((const char*)data,
"\x89\x50\x4E\x47\x0D\x0A\x1A\x0A", 8)) ?
osgDB::Registry::instance()->getReaderWriterForExtension("png") : 0;
case 'G':
return (!strncmp((const char*)data, "GIF87a", 6) ||
!strncmp((const char*)data, "GIF89a", 6)) ?
osgDB::Registry::instance()->getReaderWriterForExtension("gif") : 0;
case 'I':
return (!strncmp((const char*)data, "\x49\x49\x2A\x00", 4)) ?
osgDB::Registry::instance()->getReaderWriterForExtension("tif") : 0;
case 'M':
return (!strncmp((const char*)data, "\x4D\x4D\x00\x2A", 4)) ?
osgDB::Registry::instance()->getReaderWriterForExtension("tif") : 0;
case 'B':
return ((data[1] == 'M')) ?
osgDB::Registry::instance()->getReaderWriterForExtension("bmp") : 0;
default:
return 0;
}
}
osg::Image*
ImageUtils::readStream(std::istream& stream, const osgDB::Options* options) {
osgDB::ReaderWriter* rw = getReaderWriterForStream(stream);
if (!rw) {
return 0;
}
osgDB::ReaderWriter::ReadResult rr = rw->readImage(stream, options);
if (rr.validImage()) {
return rr.takeImage();
}
return 0;
}
namespace
{
struct MixImage
......
......@@ -233,6 +233,10 @@ namespace osgEarth
virtual void traverse( class osg::NodeVisitor& nv );
virtual void resizeGLObjectBuffers(unsigned maxSize);
virtual void releaseGLObjects(osg::State* state) const;
protected:
virtual ~MapNode();
......
......@@ -803,6 +803,32 @@ MapNode::traverse( osg::NodeVisitor& nv )
}
}
void
MapNode::resizeGLObjectBuffers(unsigned maxSize)
{
LayerVector layers;
getMap()->getLayers(layers);
for (LayerVector::const_iterator i = layers.begin(); i != layers.end(); ++i)
{
if ((*i)->getStateSet()) {
(*i)->getStateSet()->resizeGLObjectBuffers(maxSize);
}
}
}
void
MapNode::releaseGLObjects(osg::State* state) const
{
LayerVector layers;
getMap()->getLayers(layers);
for (LayerVector::const_iterator i = layers.begin(); i != layers.end(); ++i)
{
if ((*i)->getStateSet()) {
(*i)->getStateSet()->releaseGLObjects(state);
}
}
}
DrapingManager*
MapNode::getDrapingManager()
{
......
......@@ -391,10 +391,6 @@ ModelLayer::getOrCreateSceneGraph(const Map* map,
ss->setRenderBinDetails( 99999, "RenderBin" ); //TODO: configure this bin ...
}
else
{
groupSS->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
}
// save it.
_graphs[map->getUID()] = node;
......
......@@ -262,6 +262,9 @@ namespace osgEarth
* Given a TileKey, returns a TileKey representing the best known available.
* For example, if the input TileKey exceeds the layer's max LOD, the return
* value will be an ancestor key at that max LOD.
*
* If a setting that effects the visible range of this layer is set (minLevel, maxLevel, minResolution or maxResolution)
* then any key passed in that falls outside of the valid range for the layer will return TileKey::INVALID.
*/
virtual TileKey getBestAvailableTileKey(const TileKey& key) const;
......
......@@ -31,7 +31,7 @@ extern "C" {
#define OSGEARTH_MINOR_VERSION 9
#define OSGEARTH_PATCH_VERSION 0
#define OSGEARTH_SOVERSION 0
#define OSGEARTH_RC_VERSION 2
#define OSGEARTH_RC_VERSION 3
#define OSGEARTH_DEVEL_VERSION 0 // 0 = release; >0 = interim devel version
/* Convenience macro that can be used to decide whether a feature is present or not i.e.
......
......@@ -178,9 +178,12 @@ namespace osgEarth
/** Generates the shaders. */
void prepare();
public:
/** Called from the draw context to resize shader buffers as necessary (OSG) */
virtual void resizeGLObjectBuffers(unsigned maxSize);
void resizeGLObjectBuffers(unsigned maxSize);
/** Called by OSG to release GPu memory associated with the object */
void releaseGLObjects(osg::State* state) const;
protected:
virtual ~PolyShader() { }
......@@ -199,11 +202,6 @@ namespace osgEarth
osg::ref_ptr<osg::Shader> _geomShader;
osg::ref_ptr<osg::Shader> _tessevalShader;
// shader source before running thru the preprocessor. Keep this around so that
// someone can call VirtualProgram::getShaders and have access to code that has
// not been set up for ShaderFactory.
//std::string _originalSource;
bool _dirty;
};
......
......@@ -926,11 +926,6 @@ VirtualProgram::resizeGLObjectBuffers(unsigned maxSize)
}
}
// Resize the buffered_object
//_apply.resize(maxSize);
//_vpStackMemory._item.resize(maxSize);
_programCacheMutex.unlock();
}
......@@ -941,10 +936,17 @@ VirtualProgram::releaseGLObjects(osg::State* state) const
for (ProgramMap::const_iterator i = _programCache.begin(); i != _programCache.end(); ++i)
{
//if ( i->second->referenceCount() == 1 )
i->second._program->releaseGLObjects(state);
}
for (ShaderMap::const_iterator i = _shaderMap.begin(); i != _shaderMap.end(); ++i)
{
if (i->data()._shader.valid())
{
i->data()._shader->releaseGLObjects(state);
}
}
_programCache.clear();
_programCacheMutex.unlock();
......@@ -1949,6 +1951,24 @@ void PolyShader::resizeGLObjectBuffers(unsigned maxSize)
}
}
void PolyShader::releaseGLObjects(osg::State* state) const
{
if (_nominalShader.valid())
{
_nominalShader->releaseGLObjects(state);
}
if (_geomShader.valid())
{
_geomShader->releaseGLObjects(state);
}
if (_tessevalShader.valid())
{
_tessevalShader->releaseGLObjects(state);
}
}
//.......................................................................
// SERIALIZERS for VIRTUALPROGRAM
......
......@@ -59,7 +59,7 @@ namespace
for(unsigned i=0; i<paddedSize/4; ++i, ++ptr)
(*ptr) ^= prng.next(INT_MAX);
data = std::string(buf, data.size());
delete buf;
delete [] buf;
}
void unblend(std::string& data, unsigned seed)
......
......@@ -59,7 +59,7 @@ namespace
for(unsigned i=0; i<paddedSize/4; ++i, ++ptr)
(*ptr) ^= prng.next(INT_MAX);
data = std::string(buf, data.size());
delete buf;
delete [] buf;
}
void unblend(std::string& data, unsigned seed)
......
......@@ -153,7 +153,9 @@ namespace osgEarth { namespace Drivers { namespace MPTerrainEngine
#endif
protected:
#if OSG_MIN_VERSION_REQUIRED(3,5,6)
#if OSG_MIN_VERSION_REQUIRED(3,5,9)
virtual osg::VertexArrayState* createVertexArrayStateImplementation(osg::RenderInfo& renderInfo) const;
#elif OSG_MIN_VERSION_REQUIRED(3,5,6)
virtual osg::VertexArrayState* createVertexArrayState(osg::RenderInfo& renderInfo) const;
#endif
......
......@@ -565,11 +565,17 @@ MPGeometry::compileGLObjects( osg::RenderInfo& renderInfo ) const
}
#if OSG_MIN_VERSION_REQUIRED(3,5,6)
osg::VertexArrayState*
#if OSG_MIN_VERSION_REQUIRED(3,5,9)
MPGeometry::createVertexArrayStateImplementation(osg::RenderInfo& renderInfo) const
{
osg::VertexArrayState* vas = osg::Geometry::createVertexArrayStateImplementation(renderInfo);
#else
MPGeometry::createVertexArrayState(osg::RenderInfo& renderInfo) const
{
osg::VertexArrayState* vas = osg::Geometry::createVertexArrayState(renderInfo);
#endif
// make sure we have array dispatchers for the multipass coords
vas->assignTexCoordArrayDispatcher(_texCoordList.size() + 2);
......
......@@ -71,7 +71,11 @@ namespace osgEarth { namespace Drivers { namespace RexTerrainEngine
const osg::DrawElements* getMaskElements() const { return _maskElements.get(); }
#ifdef SUPPORTS_VAO
#if OSG_MIN_VERSION_REQUIRED(3,5,9)
osg::VertexArrayState* createVertexArrayStateImplementation(osg::RenderInfo& renderInfo) const;
#else
osg::VertexArrayState* createVertexArrayState(osg::RenderInfo& renderInfo) const;
#endif
#endif
void compileGLObjects(osg::RenderInfo& renderInfo) const;
......
......@@ -148,6 +148,26 @@ namespace
if ( (col & 0x1)==1 ) return 2;
return 1;
}
struct Sort_by_X {
osg::Vec3Array& _verts;
Sort_by_X(osg::Vec3Array* verts) : _verts(*verts) { }
bool operator()(unsigned lhs, unsigned rhs) const {
if (_verts[lhs].x() < _verts[rhs].x()) return true;
if (_verts[lhs].x() > _verts[rhs].x()) return false;
return _verts[lhs].y() < _verts[rhs].y();
}
};
struct Sort_by_Y {
osg::Vec3Array& _verts;
Sort_by_Y(osg::Vec3Array* verts) : _verts(*verts) { }
bool operator()(unsigned lhs, unsigned rhs) const {
if (_verts[lhs].y() < _verts[rhs].y()) return true;
if (_verts[lhs].y() > _verts[rhs].y()) return false;
return _verts[lhs].x() < _verts[rhs].x();
}
};
}
#define addSkirtDataForIndex(INDEX, HEIGHT) \
......@@ -229,20 +249,20 @@ GeometryPool::createGeometry(const TileKey& tileKey,
geom->setDrawElements(primSet);
// the vertex locations:
osg::Vec3Array* verts = new osg::Vec3Array();
osg::ref_ptr<osg::Vec3Array> verts = new osg::Vec3Array();
verts->setVertexBufferObject(vbo.get());
verts->reserve( numVerts );
verts->setBinding(verts->BIND_PER_VERTEX);
geom->setVertexArray( verts );
geom->setVertexArray( verts.get() );
// the surface normals (i.e. extrusion vectors)
osg::Vec3Array* normals = new osg::Vec3Array();
osg::ref_ptr<osg::Vec3Array> normals = new osg::Vec3Array();
normals->setVertexBufferObject(vbo.get());
normals->reserve( numVerts );
normals->setBinding(normals->BIND_PER_VERTEX);
geom->setNormalArray( normals );
geom->setNormalArray( normals.get() );
osg::Vec3Array* neighbors = 0L;
osg::ref_ptr<osg::Vec3Array> neighbors = 0L;
if ( _options.morphTerrain() == true )
{
// neighbor positions (for morphing)
......@@ -250,8 +270,7 @@ GeometryPool::createGeometry(const TileKey& tileKey,
neighbors->setBinding(neighbors->BIND_PER_VERTEX);
neighbors->setVertexBufferObject(vbo.get());
neighbors->reserve( numVerts );
geom->setNeighborArray(neighbors);
//geom->setTexCoordArray( 1, neighbors );
geom->setNeighborArray(neighbors.get());
}
// tex coord is [0..1] across the tile. The 3rd dimension tracks whether the
......@@ -267,13 +286,13 @@ GeometryPool::createGeometry(const TileKey& tileKey,
osg::Vec3Array* texCoords = _sharedTexCoords.get();
#else
bool populateTexCoords = true;
osg::Vec3Array* texCoords = new osg::Vec3Array();
osg::ref_ptr<osg::Vec3Array> texCoords = new osg::Vec3Array();
texCoords->setBinding(texCoords->BIND_PER_VERTEX);
texCoords->setVertexBufferObject(vbo.get());
texCoords->reserve( numVerts );
#endif
geom->setTexCoordArray(texCoords);
geom->setTexCoordArray(texCoords.get());
float delta = 1.0/(tileSize-1);
osg::Vec3d tdelta(delta,0,0);
......@@ -317,8 +336,85 @@ GeometryPool::createGeometry(const TileKey& tileKey,
}
}
// Now tessellate the surface.
// By default we tessellate the surface, but if there's a masking set
// it might replace some or all of our surface geometry.
bool tessellateSurface = true;
if (maskSet)
{
// The mask generator adds to the passed-in arrays as necessary,
// and then returns a new primtive set containing all the new triangles.
osg::ref_ptr<osg::DrawElementsUInt> maskElements;
MaskGenerator::Result r = maskSet->createMaskPrimitives(
mapInfo,
verts.get(), texCoords.get(), normals.get(), neighbors.get(),
maskElements);
if (r == MaskGenerator::R_BOUNDARY_INTERSECTS_TILE &&
maskElements.valid() &&
maskElements->size() > 0)
{
// Share the same EBO as the surface geometry
maskElements->setElementBufferObject(primSet->getElementBufferObject());
geom->setMaskElements(maskElements.get());
// Build a skirt for the mask geometry?
if (createSkirt)
{
// calculate the skirt extrusion height
double height = tileBound.radius() * _options.heightFieldSkirtRatio().get();
// Construct a node+edge graph out of the masking geometry:
osg::ref_ptr<TopologyGraph> graph = TopologyBuilder::create(verts.get(), maskElements.get(), tileKey.str());
// Extract the boundaries (if the topology is discontinuous,
// there will be more than one)
for (unsigned i = 0; i<graph->getNumBoundaries(); ++i)
{
TopologyGraph::IndexVector boundary;
graph->createBoundary(i, boundary);
if (boundary.size() >= 3)
{
unsigned skirtIndex = verts->size();
for (TopologyGraph::IndexVector::const_iterator i = boundary.begin(); i != boundary.end(); ++i)
{
addSkirtDataForIndex((*i)->index(), height);
}
// then create the elements:
int i;
for (i = skirtIndex; i < (int)verts->size() - 2; i += 2)
addSkirtTriangles(i, i + 2);
addSkirtTriangles(i, skirtIndex);
}
}
}
}
// If the boundary doesn't intersect the tile, draw the entire tile
// as we normally would. Need to reset the masking marker.
else if (r == MaskGenerator::R_BOUNDARY_DOES_NOT_INTERSECT_TILE)
{
maskSet = 0L;
for (osg::Vec3Array::iterator i = texCoords->begin(); i != texCoords->end(); ++i)
i->z() = MASK_MARKER_NORMAL;
}
// If the boundary contains the entire tile, draw nothing!
else // if (r == MaskGenerator::R_BOUNDARY_CONTAINS_ENTIRE_TILE)
{
tessellateSurface = false;
}
}
// Now tessellate the (unmasked) surface.
if (tessellateSurface)
{
// TODO: do we really need this??
bool swapOrientation = !locator->orientationOpenGL();
......@@ -369,70 +465,8 @@ GeometryPool::createGeometry(const TileKey& tileKey,
}
}
// create mask geometry
bool skirtCreated = false;
if (maskSet)
{
int s = verts->size();
osg::ref_ptr<osg::DrawElementsUInt> maskPrim = maskSet->createMaskPrimitives(mapInfo, verts, texCoords, normals, neighbors);
if (maskPrim && maskPrim->size() > 0)
{
maskPrim->setElementBufferObject(primSet->getElementBufferObject());
geom->setMaskElements(maskPrim.get());
// Build skirts for the tile geometry
if ( createSkirt )
{
// Skirts for masking geometries are complicated. There are two parts.
// The first part is the "perimeter" of the tile, i.e the outer edge of the
// tessellation. This code will detect that outer boundary and create skrits
// for it.
// The second part (NYI) detects the actual inner boundary ("patch geometry")
// that patches the tile tessellation to the masking boundary. TDB.
TopologyGraph topo;
BuildTopologyVisitor visitor(topo);
visitor.apply(geom.get(), verts);
if (topo._verts.empty() == false)
{
TopologyGraph::IndexVector boundary;
topo.createBoundary(boundary);
double height = tileBound.radius() * _options.heightFieldSkirtRatio().get();
unsigned skirtIndex = verts->size();
unsigned matches = 0;
for (TopologyGraph::IndexVector::const_iterator i = boundary.begin(); i != boundary.end(); ++i)
{
int k;
for (k = 0; k<skirtIndex; ++k)
{
if ((*verts)[k].x() == (*i)->x() && (*verts)[k].y() == (*i)->y())
{
addSkirtDataForIndex(k, height);
matches++;
break;
}
}
}
if (matches != boundary.size()) {
OE_WARN << LC << "matches != boundary size" << std::endl;
}
int n;
for (n = skirtIndex; n<(int)verts->size()-2; n+=2)
addMaskSkirtTriangles(n, n+2);
addMaskSkirtTriangles(n, skirtIndex);
skirtCreated = true;
}
}
}
}
if ( createSkirt && !skirtCreated )
{
// SKIRTS:
// calculate the skirt extrusion height
......@@ -460,6 +494,7 @@ GeometryPool::createGeometry(const TileKey& tileKey,
addSkirtTriangles( i, skirtIndex );
}
}
return geom.release();
}
......@@ -592,7 +627,11 @@ SharedGeometry::empty() const
#ifdef SUPPORTS_VAO
#if OSG_MIN_VERSION_REQUIRED(3,5,9)
osg::VertexArrayState* SharedGeometry::createVertexArrayStateImplementation(osg::RenderInfo& renderInfo) const
#else
osg::VertexArrayState* SharedGeometry::createVertexArrayState(osg::RenderInfo& renderInfo) const
#endif
{
osg::State& state = *renderInfo.getState();
......
......@@ -26,7 +26,7 @@
#define MASK_MARKER_DISCARD 0.0f // do not draw
#define MASK_MARKER_NORMAL 1.0f // normal vertex
#define MASK_MARKER_SKIRT 2.0f // not subject to morphing
#define MASK_MARKER_PATCH 2.0f // not subject to morphing
#define MASK_MARKER_BOUNDARY 3.0f // not subject to elevation texture
namespace osgEarth { namespace Drivers { namespace RexTerrainEngine
......@@ -52,41 +52,52 @@ namespace osgEarth { namespace Drivers { namespace RexTerrainEngine
/**
* Creates geometry for the part of a tile containing mask data.
* Used internally by GeometryPool.
*/
class MaskGenerator : public osg::Referenced
{
public:
MaskGenerator(const TileKey& key, unsigned tileSize, const Map* map);
enum Result {
R_BOUNDARY_DOES_NOT_INTERSECT_TILE,
R_BOUNDARY_CONTAINS_ENTIRE_TILE,
R_BOUNDARY_INTERSECTS_TILE
};
public:
MaskGenerator(const TileKey& key, unsigned tileSize, const Map* map);
//! True if this tile has masking data at all
bool hasMasks() const
{
return _maskRecords.size() > 0;
}
/** whether a texcoord indicates that the corresponding vert is masked. */
//! whether a texcoord indicates that the corresponding vert is masked.
bool isMasked(const osg::Vec3f& texCoord) const
{
return texCoord.z() == MASK_MARKER_DISCARD;
}
/** whether the masking geometry contains a unit location. */
/* 0.0 - contains */
/* 1.0 - does not contain */
/* 2.0 - does not contain but is a tile vert on the outer */
/* masking skirt boundary */
float getMarker(float nx, float ny) const;
bool containedByQuadAtColRow(int col, int row, int tileSize) const
//! True if the texcoord indicates a bounary vertex
bool isBoundary(const osg::Vec3f& texCoord) const
{
// Placeholder for now.
return false;
return texCoord.z() == MASK_MARKER_BOUNDARY;
}
//! returns once of the MASK_MARKER_* defines for the given NDC location
float getMarker(float nx, float ny) const;
//! Gets the LL and UR corners of the "patch rectangle" in NDC space
void getMinMax(osg::Vec3d& min, osg::Vec3d& max);
osg::DrawElementsUInt* createMaskPrimitives(const MapInfo& mapInfo, osg::Vec3Array* verts, osg::Vec3Array* texCoords, osg::Vec3Array* normals, osg::Vec3Array* neighbors);
//! Generates all the masking geometry and appened it to the passed-in arrays.
Result createMaskPrimitives(
const MapInfo& mapInfo,
osg::Vec3Array* verts,
osg::Vec3Array* texCoords,
osg::Vec3Array* normals,
osg::Vec3Array* neighbors,
osg::ref_ptr<osg::DrawElementsUInt>& out_elements);
protected:
void setupMaskRecord(const MapInfo& mapInfo, osg::Vec3dArray* boundary);
......