From aed9fd74f6cef57b510d043a41b92f4fe8a6b70c Mon Sep 17 00:00:00 2001 From: valid-ptr Date: Tue, 29 Dec 2020 15:04:17 +0300 Subject: [PATCH 01/21] Wrong argument name rename: uniformMap -> defineMap --- include/osg/State | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/osg/State b/include/osg/State index afff8341f..b74fcbb5b 100644 --- a/include/osg/State +++ b/include/osg/State @@ -1328,12 +1328,12 @@ class OSG_EXPORT State : public Referenced inline void popModeList(ModeMap& modeMap,const StateSet::ModeList& modeList); inline void popAttributeList(AttributeMap& attributeMap,const StateSet::AttributeList& attributeList); inline void popUniformList(UniformMap& uniformMap,const StateSet::UniformList& uniformList); - inline void popDefineList(DefineMap& uniformMap,const StateSet::DefineList& defineList); + inline void popDefineList(DefineMap& defineMap,const StateSet::DefineList& defineList); inline void applyModeList(ModeMap& modeMap,const StateSet::ModeList& modeList); inline void applyAttributeList(AttributeMap& attributeMap,const StateSet::AttributeList& attributeList); inline void applyUniformList(UniformMap& uniformMap,const StateSet::UniformList& uniformList); - inline void applyDefineList(DefineMap& uniformMap,const StateSet::DefineList& defineList); + inline void applyDefineList(DefineMap& defineMap,const StateSet::DefineList& defineList); inline void applyModeMap(ModeMap& modeMap); inline void applyAttributeMap(AttributeMap& attributeMap); From 9c7cde1db4a143c48e627f39f8bb790adac334a7 Mon Sep 17 00:00:00 2001 From: Sam Brkopac Date: Thu, 10 Dec 2020 14:00:11 -0700 Subject: [PATCH 02/21] updated cmake to properly disable debug iterators on windows --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c8dab207..acb93674b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,7 +85,7 @@ ELSEIF(APPLE) # OSX >= 10.5 uses Cocoa windowing system, otherwise Carbon IF(OSG_OSX_VERSION VERSION_LESS 10.5) SET(OSG_WINDOWING_SYSTEM "Carbon" CACHE STRING "Windowing system type for graphics window creation; options: Carbon, Cocoa, X11 or None.") - SET(OSG_WINDOWING_SYSTEM_CARBON ON INTERNAL "use Carbon (apple; 32 bit only)") + SET(OSG_WINDOWING_SYSTEM_CARBON ON INTERNAL "use Carbon (apple; 32 bit only)") ELSE() SET(OSG_WINDOWING_SYSTEM "Cocoa" CACHE STRING "Windowing system type for graphics window creation; options: Carbon, Cocoa, X11 or None.") ENDIF() @@ -353,7 +353,9 @@ IF(WIN32 AND NOT ANDROID) OPTION(MSVC_DISABLE_CHECKED_ITERATORS "Set to ON to disable Visual C++ checked iterators. If you do this you must ensure that every other project in your solution and all dependencies are compiled with _SECURE_SCL=0." OFF) MARK_AS_ADVANCED(MSVC_DISABLE_CHECKED_ITERATORS) IF(MSVC_DISABLE_CHECKED_ITERATORS) + ADD_DEFINITIONS(-D_ITERATOR_DEBUG_LEVEL=0) # this supercedes _SECURE_SCL and _HAS_ITERATOR_DEBUGGING in VS2010 and forward ADD_DEFINITIONS(-D_SECURE_SCL=0) + ADD_DEFINITIONS(-D_HAS_ITERATOR_DEBUGGING=0) ENDIF(MSVC_DISABLE_CHECKED_ITERATORS) OPTION(MSVC_USE_DEFAULT_STACK_SIZE "Set to ON to use the default Visual C++ stack size. CMake forces a high stack size by default, which can cause problems for applications with large number of threads." OFF) From 5ca6759a1fb025de338115d1236eb0fdb19fdcf7 Mon Sep 17 00:00:00 2001 From: Glenn Waldron Date: Thu, 24 Dec 2020 10:32:44 -0500 Subject: [PATCH 03/21] Fix for #1013 - Texture2DArray fails to regenerate after a releaseGLObjects/dirtyTextureObject - remove the modified count condition on component images when subloading when there is no texture object --- src/osg/Texture2DArray.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/osg/Texture2DArray.cpp b/src/osg/Texture2DArray.cpp index bc267f047..1f4d58292 100644 --- a/src/osg/Texture2DArray.cpp +++ b/src/osg/Texture2DArray.cpp @@ -400,11 +400,8 @@ void Texture2DArray::apply(State& state) const osg::Image* image = itr->get(); if (image) { - if (getModifiedCount(n,contextID) != image->getModifiedCount()) - { - getModifiedCount(n,contextID) = image->getModifiedCount(); - applyTexImage2DArray_subload(state, image, n, _textureWidth, _textureHeight, image->r(), _internalFormat, _numMipmapLevels); - } + getModifiedCount(n,contextID) = image->getModifiedCount(); + applyTexImage2DArray_subload(state, image, n, _textureWidth, _textureHeight, image->r(), _internalFormat, _numMipmapLevels); n += image->r(); } } From 417f78ac5e72c9f8745e9ebe4cb3ff9fb4034a56 Mon Sep 17 00:00:00 2001 From: ankurverma85 <31362771+ankurverma85@users.noreply.github.com> Date: Wed, 13 Jan 2021 14:01:00 -0800 Subject: [PATCH 04/21] Update unzip.cpp --- src/osgPlugins/zip/unzip.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/osgPlugins/zip/unzip.cpp b/src/osgPlugins/zip/unzip.cpp index 0bec28f0c..dd4b48b80 100644 --- a/src/osgPlugins/zip/unzip.cpp +++ b/src/osgPlugins/zip/unzip.cpp @@ -269,7 +269,7 @@ FILETIME dosdatetime2filetime(WORD dosdate,WORD dostime) return ft; } -bool FileExists(const TCHAR *fn) +static bool FileExists(const TCHAR *fn) { return (GetFileAttributes(fn)!=0xFFFFFFFF); } #endif @@ -1741,9 +1741,9 @@ int inflate_blocks_free(inflate_blocks_statef *s, z_streamp z) // - -extern const char inflate_copyright[] = - " inflate 1.1.3 Copyright 1995-1998 Mark Adler "; +// This symbol conflicts with other dependencies when OSG is used in static-lib mode +// extern const char inflate_copyright[] = +// " inflate 1.1.3 Copyright 1995-1998 Mark Adler "; // If you use the zlib library in a product, an acknowledgment is welcome // in the documentation of your product. If for some reason you cannot // include such an acknowledgment, I would appreciate that you keep this From 0161b8ab46495a99bebaea62e229f66edd88d547 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Thu, 14 Jan 2021 00:19:02 +0000 Subject: [PATCH 05/21] include/osg/Callback: nullptr -> NULL Fixes travis, which explictly requires c++98 --- include/osg/Callback | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/osg/Callback b/include/osg/Callback index 35480a39c..02a517168 100644 --- a/include/osg/Callback +++ b/include/osg/Callback @@ -121,6 +121,32 @@ class OSG_EXPORT Callback : public virtual Object { } } + /** Convenience method to find a nested callback by type. */ + template + static T* findNestedCallback(osg::Callback* callback) + { + if (!callback) + return NULL; + + if (T* cb = dynamic_cast(callback)) + return cb; + + return findNestedCallback(callback->getNestedCallback()); + } + + /** Convenience method to find a nested callback by type. */ + template + static const T* findNestedCallback(const osg::Callback* callback) + { + if (!callback) + return NULL; + + if (const T* cb = dynamic_cast(callback)) + return cb; + + return findNestedCallback(callback->getNestedCallback()); + } + protected: virtual ~Callback() {} From 4093860c32b0fcdc09c6a2c7ced0a8c50b70a696 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Thu, 14 Jan 2021 01:22:12 +0000 Subject: [PATCH 06/21] cmake: Allow passing LTO option --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index acb93674b..7d339b709 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,9 @@ if(COMMAND cmake_policy) cmake_policy(SET CMP0017 NEW) endif() + # INTERPROCEDURAL_OPTIMIZATION is enforced when enabled. + # Allows passing -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON + cmake_policy(SET CMP0069 NEW) endif() IF(APPLE) From 44d3da02a90c4148d34f18778370aa1c21463d02 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Thu, 14 Jan 2021 21:40:16 +0000 Subject: [PATCH 07/21] Fix osgViewer `USE_GRAPHICSWINDOW` without a windowing system There is no way for the user to know whether OSG was compiled with a windowing system. This means calling USE_GRAPHICSWINDOW() in client libraries was unsafe in the case of the "None" windowing system, as it would fail to link. Turns the call into a no-op in that case. --- CMakeLists.txt | 3 +++ include/osgViewer/GraphicsWindow | 4 +++- src/osg/Config.in | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d339b709..a097fe9b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,6 +121,9 @@ ELSE() SET(OSG_WINDOWING_SYSTEM "X11" CACHE STRING "Windowing system type for graphics window creation; options: X11 or None.") ENDIF() +IF(OSG_WINDOWING_SYSTEM STREQUAL "None") + SET(OSG_WINDOWING_SYSTEM_NONE ON INTERNAL "No windowing system") +ENDIF() SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION}) diff --git a/include/osgViewer/GraphicsWindow b/include/osgViewer/GraphicsWindow index c2eb6aacb..bc57f27d7 100644 --- a/include/osgViewer/GraphicsWindow +++ b/include/osgViewer/GraphicsWindow @@ -283,7 +283,9 @@ struct GraphicsWindowFunctionProxy extern "C" void graphicswindow_##ext(void); \ static osgViewer::GraphicsWindowFunctionProxy graphicswindowproxy_##ext(graphicswindow_##ext); -#if defined(_WIN32) +#if defined(OSG_WINDOWING_SYSTEM_NONE) + #define USE_GRAPHICS_WINDOW() +#elif defined(_WIN32) #define USE_GRAPHICSWINDOW() USE_GRAPICSWINDOW_IMPLEMENTATION(Win32) #elif defined(__APPLE__) #if defined(OSG_WINDOWING_SYSTEM_CARBON) diff --git a/src/osg/Config.in b/src/osg/Config.in index 342069a08..cfb5f8a77 100644 --- a/src/osg/Config.in +++ b/src/osg/Config.in @@ -37,5 +37,6 @@ #cmakedefine OSG_USE_DEPRECATED_API #cmakedefine OSG_ENVVAR_SUPPORTED #cmakedefine OSG_WINDOWING_SYSTEM_CARBON +#cmakedefine OSG_WINDOWING_SYSTEM_NONE #endif From b4663ded943e23a81d87c643c828fbdac2964dbf Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Fri, 15 Jan 2021 17:55:33 +0000 Subject: [PATCH 08/21] osgAnimation/Keyframe: Fix -Wshadow warning ``` include/osgAnimation/Keyframe:108:53: warning: declaration of 'iterator' shadows a member of 'osgAnimation::TemplateKeyframeContainer >' [-Wshadow] 108 | for(std::vector::iterator iterator = intervalSizes.begin() ; iterator != intervalSizes.end() ; ++ iterator) { | ^~~~~~~~ include/osg/MixinVector:39:44: note: shadowed declaration is here 39 | typedef typename vector_type::iterator iterator; | ^~~~~~~~ ``` --- include/osgAnimation/Keyframe | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/osgAnimation/Keyframe b/include/osgAnimation/Keyframe index 3e6142376..26aeff84a 100644 --- a/include/osgAnimation/Keyframe +++ b/include/osgAnimation/Keyframe @@ -105,12 +105,12 @@ namespace osgAnimation // 2. build deduplicated list of keyframes unsigned int cumul = 0; VectorType deduplicated; - for(std::vector::iterator iterator = intervalSizes.begin() ; iterator != intervalSizes.end() ; ++ iterator) { + for(std::vector::iterator it = intervalSizes.begin() ; it != intervalSizes.end() ; ++ it) { deduplicated.push_back((*this)[cumul]); - if(*iterator > 1) { - deduplicated.push_back((*this)[cumul + (*iterator) - 1]); + if(*it > 1) { + deduplicated.push_back((*this)[cumul + (*it) - 1]); } - cumul += *iterator; + cumul += *it; } unsigned int count = size() - deduplicated.size(); From 295bfffc17c8f25ab65ec8151f8c2ef8c97388b6 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 18 Jan 2021 15:38:43 +0000 Subject: [PATCH 09/21] Added 0 to end of array. --- src/osgPlugins/dae/daeReader.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/osgPlugins/dae/daeReader.cpp b/src/osgPlugins/dae/daeReader.cpp index 282389fd0..839c5fc05 100644 --- a/src/osgPlugins/dae/daeReader.cpp +++ b/src/osgPlugins/dae/daeReader.cpp @@ -294,12 +294,19 @@ bool daeReader::convert( std::istream& fin ) // get the size of the file and rewind fin.seekg(0, std::ios::end); - std::streampos length = fin.tellg(); + unsigned long length = static_cast(fin.tellg()); fin.seekg(0, std::ios::beg); // use a vector as buffer and read from stream - std::vector buffer(length); + std::vector buffer(length + 1ul); + buffer[length] = 0; + fin.read(&buffer[0], length); + if (fin.fail()) + { + OSG_WARN << "daeReader::convert: Failed to read istream" << std::endl; + return false; + } domElement* loaded_element = _dae->openFromMemory(fileURI, &buffer[0]); _document = dynamic_cast(loaded_element); From 644251db98c787a6031c26d8a27cd6798d97af4e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 18 Jan 2021 16:33:34 +0000 Subject: [PATCH 10/21] Fixed warnings --- src/osgPlugins/gstreamer/GStreamerImageStream.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/osgPlugins/gstreamer/GStreamerImageStream.cpp b/src/osgPlugins/gstreamer/GStreamerImageStream.cpp index 8e4dc03dc..8e1b9dee5 100644 --- a/src/osgPlugins/gstreamer/GStreamerImageStream.cpp +++ b/src/osgPlugins/gstreamer/GStreamerImageStream.cpp @@ -22,6 +22,7 @@ GStreamerImageStream::GStreamerImageStream(): GStreamerImageStream::GStreamerImageStream(const GStreamerImageStream & image, const osg::CopyOp & copyop) : osg::ImageStream(image, copyop), + OpenThreads::Thread(), _loop(0), _pipeline(0), _internal_buffer(0), @@ -239,7 +240,7 @@ GstFlowReturn GStreamerImageStream::on_new_preroll(GstAppSink *appsink, GStreame return GST_FLOW_OK; } -gboolean GStreamerImageStream::on_message(GstBus *bus, GstMessage *message, GStreamerImageStream *user_data) +gboolean GStreamerImageStream::on_message(GstBus* /*bus*/, GstMessage *message, GStreamerImageStream* user_data) { if( GST_MESSAGE_TYPE(message) == GST_MESSAGE_EOS) { From b7c186f6d397b0b1b7c2a3a9476b535d5ef671b4 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 26 Aug 2020 15:19:23 +0100 Subject: [PATCH 11/21] Fixed warnings reported by gcc-9.3.0 Note from glebm@: Back-ported from https://github.com/openscenegraph/OpenSceneGraph/commit/e0d5e4b0ffa382ea0cf1d3290937722950a9ed80 Identical except for the changes to `MatrixTemplate`, which does not exist in 3.6 --- include/osg/BoundingSphere | 7 +++++++ include/osg/GLExtensions | 9 +++++++++ include/osg/Quat | 8 ++++++++ src/osg/glu/libtess/tess.cpp | 2 +- src/osgPlugins/dds/ReaderWriterDDS.cpp | 3 --- src/osgPlugins/gles/IndexMeshVisitor.cpp | 1 - src/osgPlugins/gles/glesUtil | 6 ------ src/osgPlugins/ive/DataInputStream.cpp | 2 +- src/osgPlugins/ive/DataOutputStream.cpp | 2 +- src/osgPlugins/osc/OscReceivingDevice.cpp | 22 +++++++++++----------- src/osgUtil/MeshOptimizers.cpp | 5 +++++ 11 files changed, 43 insertions(+), 24 deletions(-) diff --git a/include/osg/BoundingSphere b/include/osg/BoundingSphere index 4502e4595..d3903b380 100644 --- a/include/osg/BoundingSphere +++ b/include/osg/BoundingSphere @@ -63,6 +63,13 @@ class BoundingSphereImpl * otherwise. */ inline bool valid() const { return _radius>=0.0; } + inline BoundingSphereImpl& operator = (const BoundingSphereImpl& rhs) + { + _center = rhs._center; + _radius = rhs._radius; + return *this; + } + inline bool operator == (const BoundingSphereImpl& rhs) const { return _center==rhs._center && _radius==rhs._radius; } inline bool operator != (const BoundingSphereImpl& rhs) const { return _center!=rhs._center || _radius!=rhs._radius; } diff --git a/include/osg/GLExtensions b/include/osg/GLExtensions index aa868e9cf..28e810b69 100644 --- a/include/osg/GLExtensions +++ b/include/osg/GLExtensions @@ -149,6 +149,15 @@ class VertexAttribAlias _osgName(osgName), _declaration(declaration) {} + VertexAttribAlias& operator = (const VertexAttribAlias& rhs) + { + _location = rhs._location; + _glName = rhs._glName; + _osgName = rhs._osgName; + _declaration = rhs._declaration; + return *this; + } + GLuint _location; std::string _glName; std::string _osgName; diff --git a/include/osg/Quat b/include/osg/Quat index 863a029e8..adebc8768 100644 --- a/include/osg/Quat +++ b/include/osg/Quat @@ -53,6 +53,14 @@ class OSG_EXPORT Quat _v[3]=w; } + inline Quat( const Quat& rhs ) + { + _v[0]=rhs._v[0]; + _v[1]=rhs._v[1]; + _v[2]=rhs._v[2]; + _v[3]=rhs._v[3]; + } + inline Quat( const Vec4f& v ) { _v[0]=v.x(); diff --git a/src/osg/glu/libtess/tess.cpp b/src/osg/glu/libtess/tess.cpp index ccdbfada7..ca14854bc 100644 --- a/src/osg/glu/libtess/tess.cpp +++ b/src/osg/glu/libtess/tess.cpp @@ -213,7 +213,7 @@ osg::gluTessProperty( GLUtesselator *tess, GLenum which, GLdouble value ) tess->windingRule = windingRule; return; default: - break; + return; } case GLU_TESS_BOUNDARY_ONLY: diff --git a/src/osgPlugins/dds/ReaderWriterDDS.cpp b/src/osgPlugins/dds/ReaderWriterDDS.cpp index 26532d778..345cdfede 100644 --- a/src/osgPlugins/dds/ReaderWriterDDS.cpp +++ b/src/osgPlugins/dds/ReaderWriterDDS.cpp @@ -1079,15 +1079,12 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout, bool autoFlipDDSWri // Initialize ddsd structure and its members DDSURFACEDESC2 ddsd; - memset( &ddsd, 0, sizeof( ddsd ) ); DDPIXELFORMAT ddpf; - memset( &ddpf, 0, sizeof( ddpf ) ); //DDCOLORKEY ddckCKDestOverlay; //DDCOLORKEY ddckCKDestBlt; //DDCOLORKEY ddckCKSrcOverlay; //DDCOLORKEY ddckCKSrcBlt; DDSCAPS2 ddsCaps; - memset( &ddsCaps, 0, sizeof( ddsCaps ) ); ddsd.dwSize = sizeof(ddsd); ddpf.dwSize = sizeof(ddpf); diff --git a/src/osgPlugins/gles/IndexMeshVisitor.cpp b/src/osgPlugins/gles/IndexMeshVisitor.cpp index 617a86221..7f6dc4f05 100644 --- a/src/osgPlugins/gles/IndexMeshVisitor.cpp +++ b/src/osgPlugins/gles/IndexMeshVisitor.cpp @@ -55,7 +55,6 @@ void IndexMeshVisitor::process(osg::Geometry& geom) { new_primitives.reserve(primitives.size()); // compute duplicate vertices - typedef std::vector IndexList; unsigned int numVertices = geom.getVertexArray()->getNumElements(); IndexList indices(numVertices); unsigned int i, j; diff --git a/src/osgPlugins/gles/glesUtil b/src/osgPlugins/gles/glesUtil index 88f381728..5071b3835 100644 --- a/src/osgPlugins/gles/glesUtil +++ b/src/osgPlugins/gles/glesUtil @@ -222,9 +222,6 @@ namespace glesUtil { virtual void apply(osg::Vec2ubArray& array) { remap(array); } virtual void apply(osg::MatrixfArray& array) { remap(array); } - - protected: - RemapArray& operator= (const RemapArray&) { return *this; } }; @@ -252,9 +249,6 @@ namespace glesUtil { } return 0; } - - protected: - VertexAttribComparitor& operator= (const VertexAttribComparitor&) { return *this; } }; // Move the values in an array to new positions, based on the diff --git a/src/osgPlugins/ive/DataInputStream.cpp b/src/osgPlugins/ive/DataInputStream.cpp index d53330343..3524c3e32 100644 --- a/src/osgPlugins/ive/DataInputStream.cpp +++ b/src/osgPlugins/ive/DataInputStream.cpp @@ -287,7 +287,7 @@ bool DataInputStream::uncompress(std::istream& fin, std::string& destination) co return ret == Z_STREAM_END ? true : false; } #else -bool DataInputStream::uncompress(std::istream& fin, std::string& destination) const +bool DataInputStream::uncompress(std::istream& /*fin*/, std::string& /*destination*/) const { return false; } diff --git a/src/osgPlugins/ive/DataOutputStream.cpp b/src/osgPlugins/ive/DataOutputStream.cpp index afeada60e..b55fd6e13 100644 --- a/src/osgPlugins/ive/DataOutputStream.cpp +++ b/src/osgPlugins/ive/DataOutputStream.cpp @@ -320,7 +320,7 @@ bool DataOutputStream::compress(std::ostream& fout, const std::string& source) c return true; } #else -bool DataOutputStream::compress(std::ostream& fout, const std::string& source) const +bool DataOutputStream::compress(std::ostream& /*fout*/, const std::string& /*source*/) const { return false; } diff --git a/src/osgPlugins/osc/OscReceivingDevice.cpp b/src/osgPlugins/osc/OscReceivingDevice.cpp index 3ca662c0b..ab9078886 100644 --- a/src/osgPlugins/osc/OscReceivingDevice.cpp +++ b/src/osgPlugins/osc/OscReceivingDevice.cpp @@ -309,7 +309,7 @@ public: return true; } - catch(osc::Exception e) { + catch(osc::Exception& e) { handleException(e); } @@ -342,7 +342,7 @@ public: return true; } - catch(osc::Exception e) { + catch(osc::Exception& e) { handleException(e); } @@ -378,7 +378,7 @@ public: return true; } - catch(osc::Exception e) { + catch(osc::Exception& e) { handleException(e); } @@ -413,7 +413,7 @@ public: return true; } - catch(osc::Exception e) { + catch(osc::Exception& e) { handleException(e); } @@ -449,7 +449,7 @@ public: return true; } - catch (osc::Exception e) { + catch (osc::Exception& e) { handleException(e); } return false; @@ -491,7 +491,7 @@ public: return true; } - catch (osc::Exception e) { + catch (osc::Exception& e) { handleException(e); } return false; @@ -529,7 +529,7 @@ public: return true; } - catch (osc::Exception e) { + catch (osc::Exception& e) { handleException(e); } return false; @@ -588,7 +588,7 @@ public: return true; } - catch (osc::Exception e) { + catch (osc::Exception& e) { handleException(e); } return false; @@ -630,7 +630,7 @@ public: return true; } - catch (osc::Exception e) { + catch (osc::Exception& e) { handleException(e); } return false; @@ -662,7 +662,7 @@ public: return true; } - catch (osc::Exception e) { + catch (osc::Exception& e) { handleException(e); } return false; @@ -695,7 +695,7 @@ public: return true; } - catch (osc::Exception e) { + catch (osc::Exception& e) { handleException(e); } return false; diff --git a/src/osgUtil/MeshOptimizers.cpp b/src/osgUtil/MeshOptimizers.cpp index f337fc436..5d5ef92d6 100644 --- a/src/osgUtil/MeshOptimizers.cpp +++ b/src/osgUtil/MeshOptimizers.cpp @@ -109,6 +109,11 @@ struct VertexAttribComparitor : public GeometryArrayGatherer { } + VertexAttribComparitor(const VertexAttribComparitor& rhs) + : GeometryArrayGatherer(rhs) + { + } + bool operator() (unsigned int lhs, unsigned int rhs) const { for(ArrayList::const_iterator itr=_arrayList.begin(); From f36e9f2a4a963c5d5c621e9411fdefc20268ada1 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Fri, 22 Jan 2021 22:34:00 +0000 Subject: [PATCH 12/21] include/osgViewer: Fix typo Follow-up to #1027 --- include/osgViewer/GraphicsWindow | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/osgViewer/GraphicsWindow b/include/osgViewer/GraphicsWindow index bc57f27d7..c60b6ce46 100644 --- a/include/osgViewer/GraphicsWindow +++ b/include/osgViewer/GraphicsWindow @@ -284,7 +284,7 @@ struct GraphicsWindowFunctionProxy static osgViewer::GraphicsWindowFunctionProxy graphicswindowproxy_##ext(graphicswindow_##ext); #if defined(OSG_WINDOWING_SYSTEM_NONE) - #define USE_GRAPHICS_WINDOW() + #define USE_GRAPHICSWINDOW() #elif defined(_WIN32) #define USE_GRAPHICSWINDOW() USE_GRAPICSWINDOW_IMPLEMENTATION(Win32) #elif defined(__APPLE__) From a531f2bd13ce2c6e698d7dcee0303f0794043d15 Mon Sep 17 00:00:00 2001 From: Nelsson Huotari Date: Sat, 23 Jan 2021 14:46:16 +0200 Subject: [PATCH 13/21] Use c-locale with std::istream --- src/osgPlugins/dae/daeReader.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/osgPlugins/dae/daeReader.cpp b/src/osgPlugins/dae/daeReader.cpp index 839c5fc05..59d650ac4 100644 --- a/src/osgPlugins/dae/daeReader.cpp +++ b/src/osgPlugins/dae/daeReader.cpp @@ -292,6 +292,8 @@ bool daeReader::convert( std::istream& fin ) // set fileURI to null device const std::string fileURI("from std::istream"); + fin.imbue(std::locale::classic()); + // get the size of the file and rewind fin.seekg(0, std::ios::end); unsigned long length = static_cast(fin.tellg()); From 199035ae51898b4648cd7f4ce80dfe5a6c232690 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Fri, 22 Jan 2021 14:29:22 +0000 Subject: [PATCH 14/21] CMakeLists.txt: OSG_FIND_3RD_PARTY_DEPS option Android-specific macros aren't needed in some cases, e.g. if the NDK is setup with all the needed dependencies a much easier way to find packages is to simply specify the correct `CMAKE_FIND_ROOT_PATH`. The `ANDROID_3RD_PARTY` macro interferes with this. Adds an option to disable it. WIN32 build is in a similar situation, the new option affects it also. --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a097fe9b6..c98408d84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -731,7 +731,9 @@ OPTION(BUILD_OSG_PLUGINS "Build OSG Plugins - Disable for compile testing exampl mark_as_advanced(BUILD_OSG_PLUGINS) ################################################################################ # 3rd Party Dependency Stuff -IF(WIN32 AND NOT ANDROID) +OPTION(OSG_FIND_3RD_PARTY_DEPS "Enable to search for Android or Windows dependencies in ./3rdparty" ON) + +IF(WIN32 AND NOT ANDROID AND OSG_FIND_3RD_PARTY_DEPS) INCLUDE(Find3rdPartyDependencies) ENDIF() @@ -742,7 +744,7 @@ OPTION(OSG_USE_LOCAL_LUA_SOURCE "Enable to use local Lua source when building th # you can use the following style of command line option when invoking Cmake (here illustrating ignoring PythonLibs) : # cmake -DCMAKE_DISABLE_FIND_PACKAGE_PythonLibs=1 . # -IF(ANDROID) +IF(ANDROID AND OSG_FIND_3RD_PARTY_DEPS) ANDROID_3RD_PARTY() ELSE() # Common to all platforms except android: @@ -819,7 +821,7 @@ ENDIF(BUILD_OSG_EXAMPLES AND NOT ANDROID) # Image readers/writers depend on 3rd party libraries except for OS X which # can use Quicktime. -IF(NOT ANDROID) +IF(NOT (ANDROID AND OSG_FIND_3RD_PARTY_DEPS)) IF(NOT APPLE) FIND_PACKAGE(GIFLIB) FIND_PACKAGE(JPEG) From 8a0114a46a4bad9041297950fe3bfbb2aea6e1da Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sat, 23 Jan 2021 18:27:58 +0000 Subject: [PATCH 15/21] Replaced std::mem_fun_ref usage to avoid compatiblity with modern compilers. --- src/osgUtil/tristripper/include/detail/graph_array.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osgUtil/tristripper/include/detail/graph_array.h b/src/osgUtil/tristripper/include/detail/graph_array.h index dc1f38027..ce7000cc8 100644 --- a/src/osgUtil/tristripper/include/detail/graph_array.h +++ b/src/osgUtil/tristripper/include/detail/graph_array.h @@ -446,7 +446,7 @@ inline void graph_array::swap(graph_type & Right) template inline void unmark_nodes(graph_array & G) { - std::for_each(G.begin(), G.end(), std::mem_fun_ref(&graph_array::node::unmark)); + for(typename graph_array::node_iterator itr = G.begin(); itr != G.end(); ++itr) itr->unmark(); } From 219adb7419837a2a199fcbd7d2806a0a299de3b0 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 17 Feb 2021 17:50:21 +0000 Subject: [PATCH 16/21] Ran dos2unix to fix line endings --- src/osg/Image.cpp | 60 ++++++++++++++++++++++---------------------- src/osg/Texture.cpp | 52 +++++++++++++++++++------------------- src/osg/dxtctool.cpp | 10 ++++---- 3 files changed, 61 insertions(+), 61 deletions(-) diff --git a/src/osg/Image.cpp b/src/osg/Image.cpp index 9d116f0dd..04668f6a3 100644 --- a/src/osg/Image.cpp +++ b/src/osg/Image.cpp @@ -538,10 +538,10 @@ unsigned int Image::computeNumComponents(GLenum pixelFormat) { case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): return 3; case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT): return 3; - case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT): return 4; - case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): return 4; - case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT): return 4; - case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): return 4; + case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT): return 4; + case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): return 4; + case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT): return 4; + case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): return 4; case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT): return 4; case(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT): return 1; case(GL_COMPRESSED_RED_RGTC1_EXT): return 1; @@ -721,13 +721,13 @@ unsigned int Image::computePixelSizeInBits(GLenum format,GLenum type) switch(format) { - case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): return 4; - case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT): return 4; - case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): return 4; - case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT): return 4; - case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): return 8; - case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT): return 8; - case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): return 8; + case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): return 4; + case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT): return 4; + case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): return 4; + case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT): return 4; + case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): return 8; + case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT): return 8; + case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): return 8; case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT): return 8; case(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT): return 4; case(GL_COMPRESSED_RED_RGTC1_EXT): return 4; @@ -948,14 +948,14 @@ unsigned int Image::computeBlockSize(GLenum pixelFormat, GLenum packing) { switch(pixelFormat) { - case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): - case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT): - case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): - case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT): - return osg::maximum(8u, packing); // block size of 8 - case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): - case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT): - case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): + case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): + case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT): + case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): + case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT): + return osg::maximum(8u, packing); // block size of 8 + case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): + case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT): + case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT): case(GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG): case(GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG): @@ -1106,12 +1106,12 @@ bool Image::isCompressed() const case(GL_COMPRESSED_RGBA_ARB): case(GL_COMPRESSED_RGB_ARB): case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): - case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT): - case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): - case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT): - case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): - case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT): - case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): + case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT): + case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): + case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT): + case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): + case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT): + case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT): case(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT): case(GL_COMPRESSED_RED_RGTC1_EXT): @@ -2030,11 +2030,11 @@ bool Image::isImageTranslucent() const case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT): return false; - case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): - case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT): - case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): - case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT): - case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): + case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): + case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT): + case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): + case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT): + case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT): return dxtc_tool::isCompressedImageTranslucent(_s, _t, _pixelFormat, _data); default: diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index b286acc52..8a1faa0b4 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -304,18 +304,18 @@ void Texture::TextureProfile::computeSize() case(GL_RGBA): numBitsPerTexel = 32; break; case(4): numBitsPerTexel = 32; break; - case(GL_COMPRESSED_ALPHA_ARB): numBitsPerTexel = 4; break; - case(GL_COMPRESSED_INTENSITY_ARB): numBitsPerTexel = 4; break; + case(GL_COMPRESSED_ALPHA_ARB): numBitsPerTexel = 4; break; + case(GL_COMPRESSED_INTENSITY_ARB): numBitsPerTexel = 4; break; case(GL_COMPRESSED_LUMINANCE_ALPHA_ARB): numBitsPerTexel = 4; break; - case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): numBitsPerTexel = 4; break; - case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT): numBitsPerTexel = 4; break; - case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): numBitsPerTexel = 4; break; - case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT): numBitsPerTexel = 4; break; - - case(GL_COMPRESSED_RGB_ARB): numBitsPerTexel = 8; break; - case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): numBitsPerTexel = 8; break; - case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT): numBitsPerTexel = 8; break; - case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): numBitsPerTexel = 8; break; + case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): numBitsPerTexel = 4; break; + case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT): numBitsPerTexel = 4; break; + case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): numBitsPerTexel = 4; break; + case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT): numBitsPerTexel = 4; break; + + case(GL_COMPRESSED_RGB_ARB): numBitsPerTexel = 8; break; + case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): numBitsPerTexel = 8; break; + case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT): numBitsPerTexel = 8; break; + case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): numBitsPerTexel = 8; break; case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT): numBitsPerTexel = 8; break; case(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT): numBitsPerTexel = 4; break; @@ -1797,8 +1797,8 @@ bool Texture::isCompressedInternalFormat(GLint internalFormat) case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): - case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT): - case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): + case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT): + case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT): case(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT): case(GL_COMPRESSED_RED_RGTC1_EXT): @@ -2156,19 +2156,19 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima OSG_NOTICE<<"Received a request to compress an image, but image size is not a multiple of four ("<> 2) * ((height + 3) >> 2); switch(format) { - case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): - case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT): - return false; - - case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): + case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): + case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT): + return false; + + case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT): { const DXT1TexelsBlock *texelsBlock = reinterpret_cast(imageData); From 94d5211f432f84f6bb1412849ffa76e377957858 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 17 Feb 2021 18:23:32 +0000 Subject: [PATCH 17/21] Ran dos2unix to fix line endings --- include/osg/Texture | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/osg/Texture b/include/osg/Texture index 22f0b91c1..f6614633a 100644 --- a/include/osg/Texture +++ b/include/osg/Texture @@ -62,9 +62,9 @@ #define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 #define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 #define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 - #define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C - #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D - #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E + #define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C + #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D + #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F #endif From 159c0271b715d4829c3dd90968471c9b704d27df Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 18 Feb 2021 16:08:25 +0000 Subject: [PATCH 18/21] Fixed osgWidget event handling --- src/osgWidget/WindowManager.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/osgWidget/WindowManager.cpp b/src/osgWidget/WindowManager.cpp index 7bccbd348..9267cefe0 100644 --- a/src/osgWidget/WindowManager.cpp +++ b/src/osgWidget/WindowManager.cpp @@ -317,7 +317,17 @@ bool WindowManager::pickAtXY(float x, float y, WidgetList& wl) // Iterate over every picked result and create a list of Widgets that belong // to that Window. for(Intersections::iterator i = intr.begin(); i != intr.end(); i++) { - Window* win = dynamic_cast(i->nodePath.back()->getParent(0)); + + Widget* widget = dynamic_cast(i->drawable.get()); + if(!widget) continue; + + Window* win = 0; + const osg::NodePath& nodePath = i->nodePath; + for(osg::NodePath::const_reverse_iterator np_itr = nodePath.rbegin(); np_itr != nodePath.rend(); ++np_itr) + { + win = dynamic_cast(*np_itr); + if (win) break; + } // Make sure that our window is valid, and that our pick is within the // "visible area" of the Window. @@ -335,9 +345,6 @@ bool WindowManager::pickAtXY(float x, float y, WidgetList& wl) // If we've found a new Widnow, break out! else if(activeWin != win) break; - Widget* widget = dynamic_cast(i->drawable.get()); - - if(!widget) continue; // We need to return a list of every Widget that was picked, so // that the handler can operate on it accordingly. From 5d51e5bf2acf659708f1da0a2f898fdbdcc3cd0d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 18 Feb 2021 16:13:50 +0000 Subject: [PATCH 19/21] Fixed META_ macro usage --- include/osgWidget/Widget | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/osgWidget/Widget b/include/osgWidget/Widget index 5c2d3d962..6d9ac2054 100644 --- a/include/osgWidget/Widget +++ b/include/osgWidget/Widget @@ -75,7 +75,7 @@ public: Widget (const std::string& = "", point_type = 0.0f, point_type = 0.0f); Widget (const Widget&, const osg::CopyOp&); - META_Object (osgWidget, Widget); + META_Node (osgWidget, Widget); virtual ~Widget() { } From 5faae0e52ef8fce5a2cc39f9b5e531712b4f0219 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 19 Feb 2021 12:03:07 +0000 Subject: [PATCH 20/21] Moved Widget case to later. --- src/osgWidget/WindowManager.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/osgWidget/WindowManager.cpp b/src/osgWidget/WindowManager.cpp index 9267cefe0..838141ce7 100644 --- a/src/osgWidget/WindowManager.cpp +++ b/src/osgWidget/WindowManager.cpp @@ -318,9 +318,6 @@ bool WindowManager::pickAtXY(float x, float y, WidgetList& wl) // to that Window. for(Intersections::iterator i = intr.begin(); i != intr.end(); i++) { - Widget* widget = dynamic_cast(i->drawable.get()); - if(!widget) continue; - Window* win = 0; const osg::NodePath& nodePath = i->nodePath; for(osg::NodePath::const_reverse_iterator np_itr = nodePath.rbegin(); np_itr != nodePath.rend(); ++np_itr) @@ -345,6 +342,8 @@ bool WindowManager::pickAtXY(float x, float y, WidgetList& wl) // If we've found a new Widnow, break out! else if(activeWin != win) break; + Widget* widget = dynamic_cast(i->drawable.get()); + if(!widget) continue; // We need to return a list of every Widget that was picked, so // that the handler can operate on it accordingly. From 8b2e02b71df6548ee5cb1e753deec63680b9145d Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sun, 7 Mar 2021 04:25:22 +0000 Subject: [PATCH 21/21] Ensure global Mutex is initialized before Registry A Registry instance may be accessed before the global mutex, e.g. here: https://github.com/openscenegraph/OpenSceneGraph/blob/e77f50371ce6ab05ee0c523fc7a4604ad639e047/src/osgText/Font.cpp#L49 This leads to the Mutex being destroyed before the Registry is destroyed. This causes a crash at exit, as described in #1048. Fixes #1048. --- include/osgDB/Registry | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/osgDB/Registry b/include/osgDB/Registry index 2829ca61d..2b317ea91 100644 --- a/include/osgDB/Registry +++ b/include/osgDB/Registry @@ -50,7 +50,8 @@ namespace osgDB { The RegisterReaderWriterProxy can be used to automatically register at runtime a reader/writer with the Registry. */ -class OSGDB_EXPORT Registry : public osg::Referenced +class OSGDB_EXPORT Registry : osg::depends_on, + public osg::Referenced { public: