merged with upstream/OpenSceneGraph-3.6

This commit is contained in:
valid-ptr 2021-03-24 17:45:11 +03:00 committed by konstantin.matveyev
commit e260dfb582
28 changed files with 162 additions and 90 deletions

View File

@ -30,6 +30,9 @@ if(COMMAND cmake_policy)
cmake_policy(SET CMP0017 NEW) cmake_policy(SET CMP0017 NEW)
endif() endif()
# INTERPROCEDURAL_OPTIMIZATION is enforced when enabled.
# Allows passing -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
cmake_policy(SET CMP0069 NEW)
endif() endif()
IF(APPLE) IF(APPLE)
@ -85,7 +88,7 @@ ELSEIF(APPLE)
# OSX >= 10.5 uses Cocoa windowing system, otherwise Carbon # OSX >= 10.5 uses Cocoa windowing system, otherwise Carbon
IF(OSG_OSX_VERSION VERSION_LESS 10.5) 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" 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() ELSE()
SET(OSG_WINDOWING_SYSTEM "Cocoa" CACHE STRING "Windowing system type for graphics window creation; options: Carbon, Cocoa, X11 or None.") SET(OSG_WINDOWING_SYSTEM "Cocoa" CACHE STRING "Windowing system type for graphics window creation; options: Carbon, Cocoa, X11 or None.")
ENDIF() ENDIF()
@ -118,6 +121,9 @@ ELSE()
SET(OSG_WINDOWING_SYSTEM "X11" CACHE STRING "Windowing system type for graphics window creation; options: X11 or None.") SET(OSG_WINDOWING_SYSTEM "X11" CACHE STRING "Windowing system type for graphics window creation; options: X11 or None.")
ENDIF() 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}) SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION})
@ -353,7 +359,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) 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) MARK_AS_ADVANCED(MSVC_DISABLE_CHECKED_ITERATORS)
IF(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_SECURE_SCL=0)
ADD_DEFINITIONS(-D_HAS_ITERATOR_DEBUGGING=0)
ENDIF(MSVC_DISABLE_CHECKED_ITERATORS) 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) 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)
@ -723,7 +731,9 @@ OPTION(BUILD_OSG_PLUGINS "Build OSG Plugins - Disable for compile testing exampl
mark_as_advanced(BUILD_OSG_PLUGINS) mark_as_advanced(BUILD_OSG_PLUGINS)
################################################################################ ################################################################################
# 3rd Party Dependency Stuff # 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) INCLUDE(Find3rdPartyDependencies)
ENDIF() ENDIF()
@ -734,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) : # you can use the following style of command line option when invoking Cmake (here illustrating ignoring PythonLibs) :
# cmake -DCMAKE_DISABLE_FIND_PACKAGE_PythonLibs=1 . # cmake -DCMAKE_DISABLE_FIND_PACKAGE_PythonLibs=1 .
# #
IF(ANDROID) IF(ANDROID AND OSG_FIND_3RD_PARTY_DEPS)
ANDROID_3RD_PARTY() ANDROID_3RD_PARTY()
ELSE() ELSE()
# Common to all platforms except android: # Common to all platforms except android:
@ -811,7 +821,7 @@ ENDIF(BUILD_OSG_EXAMPLES AND NOT ANDROID)
# Image readers/writers depend on 3rd party libraries except for OS X which # Image readers/writers depend on 3rd party libraries except for OS X which
# can use Quicktime. # can use Quicktime.
IF(NOT ANDROID) IF(NOT (ANDROID AND OSG_FIND_3RD_PARTY_DEPS))
IF(NOT APPLE) IF(NOT APPLE)
FIND_PACKAGE(GIFLIB) FIND_PACKAGE(GIFLIB)
FIND_PACKAGE(JPEG) FIND_PACKAGE(JPEG)

View File

@ -63,6 +63,13 @@ class BoundingSphereImpl
* otherwise. */ * otherwise. */
inline bool valid() const { return _radius>=0.0; } 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; }
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; }

View File

@ -121,6 +121,32 @@ class OSG_EXPORT Callback : public virtual Object {
} }
} }
/** Convenience method to find a nested callback by type. */
template <typename T>
static T* findNestedCallback(osg::Callback* callback)
{
if (!callback)
return NULL;
if (T* cb = dynamic_cast<T*>(callback))
return cb;
return findNestedCallback<T>(callback->getNestedCallback());
}
/** Convenience method to find a nested callback by type. */
template <typename T>
static const T* findNestedCallback(const osg::Callback* callback)
{
if (!callback)
return NULL;
if (const T* cb = dynamic_cast<const T*>(callback))
return cb;
return findNestedCallback<T>(callback->getNestedCallback());
}
protected: protected:
virtual ~Callback() {} virtual ~Callback() {}

View File

@ -149,6 +149,15 @@ class VertexAttribAlias
_osgName(osgName), _osgName(osgName),
_declaration(declaration) {} _declaration(declaration) {}
VertexAttribAlias& operator = (const VertexAttribAlias& rhs)
{
_location = rhs._location;
_glName = rhs._glName;
_osgName = rhs._osgName;
_declaration = rhs._declaration;
return *this;
}
GLuint _location; GLuint _location;
std::string _glName; std::string _glName;
std::string _osgName; std::string _osgName;

View File

@ -53,6 +53,14 @@ class OSG_EXPORT Quat
_v[3]=w; _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 ) inline Quat( const Vec4f& v )
{ {
_v[0]=v.x(); _v[0]=v.x();

View File

@ -1328,12 +1328,12 @@ class OSG_EXPORT State : public Referenced
inline void popModeList(ModeMap& modeMap,const StateSet::ModeList& modeList); inline void popModeList(ModeMap& modeMap,const StateSet::ModeList& modeList);
inline void popAttributeList(AttributeMap& attributeMap,const StateSet::AttributeList& attributeList); inline void popAttributeList(AttributeMap& attributeMap,const StateSet::AttributeList& attributeList);
inline void popUniformList(UniformMap& uniformMap,const StateSet::UniformList& uniformList); 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 applyModeList(ModeMap& modeMap,const StateSet::ModeList& modeList);
inline void applyAttributeList(AttributeMap& attributeMap,const StateSet::AttributeList& attributeList); inline void applyAttributeList(AttributeMap& attributeMap,const StateSet::AttributeList& attributeList);
inline void applyUniformList(UniformMap& uniformMap,const StateSet::UniformList& uniformList); 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 applyModeMap(ModeMap& modeMap);
inline void applyAttributeMap(AttributeMap& attributeMap); inline void applyAttributeMap(AttributeMap& attributeMap);

View File

@ -62,9 +62,9 @@
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 #define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 #define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 #define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C #define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
#endif #endif

View File

@ -105,12 +105,12 @@ namespace osgAnimation
// 2. build deduplicated list of keyframes // 2. build deduplicated list of keyframes
unsigned int cumul = 0; unsigned int cumul = 0;
VectorType deduplicated; VectorType deduplicated;
for(std::vector<unsigned int>::iterator iterator = intervalSizes.begin() ; iterator != intervalSizes.end() ; ++ iterator) { for(std::vector<unsigned int>::iterator it = intervalSizes.begin() ; it != intervalSizes.end() ; ++ it) {
deduplicated.push_back((*this)[cumul]); deduplicated.push_back((*this)[cumul]);
if(*iterator > 1) { if(*it > 1) {
deduplicated.push_back((*this)[cumul + (*iterator) - 1]); deduplicated.push_back((*this)[cumul + (*it) - 1]);
} }
cumul += *iterator; cumul += *it;
} }
unsigned int count = size() - deduplicated.size(); unsigned int count = size() - deduplicated.size();

View File

@ -50,7 +50,8 @@ namespace osgDB {
The RegisterReaderWriterProxy can be used to automatically The RegisterReaderWriterProxy can be used to automatically
register at runtime a reader/writer with the Registry. register at runtime a reader/writer with the Registry.
*/ */
class OSGDB_EXPORT Registry : public osg::Referenced class OSGDB_EXPORT Registry : osg::depends_on<OpenThreads::Mutex*, osg::Referenced::getGlobalReferencedMutex>,
public osg::Referenced
{ {
public: public:

View File

@ -283,7 +283,9 @@ struct GraphicsWindowFunctionProxy
extern "C" void graphicswindow_##ext(void); \ extern "C" void graphicswindow_##ext(void); \
static osgViewer::GraphicsWindowFunctionProxy graphicswindowproxy_##ext(graphicswindow_##ext); static osgViewer::GraphicsWindowFunctionProxy graphicswindowproxy_##ext(graphicswindow_##ext);
#if defined(_WIN32) #if defined(OSG_WINDOWING_SYSTEM_NONE)
#define USE_GRAPHICSWINDOW()
#elif defined(_WIN32)
#define USE_GRAPHICSWINDOW() USE_GRAPICSWINDOW_IMPLEMENTATION(Win32) #define USE_GRAPHICSWINDOW() USE_GRAPICSWINDOW_IMPLEMENTATION(Win32)
#elif defined(__APPLE__) #elif defined(__APPLE__)
#if defined(OSG_WINDOWING_SYSTEM_CARBON) #if defined(OSG_WINDOWING_SYSTEM_CARBON)

View File

@ -75,7 +75,7 @@ public:
Widget (const std::string& = "", point_type = 0.0f, point_type = 0.0f); Widget (const std::string& = "", point_type = 0.0f, point_type = 0.0f);
Widget (const Widget&, const osg::CopyOp&); Widget (const Widget&, const osg::CopyOp&);
META_Object (osgWidget, Widget); META_Node (osgWidget, Widget);
virtual ~Widget() { virtual ~Widget() {
} }

View File

@ -37,5 +37,6 @@
#cmakedefine OSG_USE_DEPRECATED_API #cmakedefine OSG_USE_DEPRECATED_API
#cmakedefine OSG_ENVVAR_SUPPORTED #cmakedefine OSG_ENVVAR_SUPPORTED
#cmakedefine OSG_WINDOWING_SYSTEM_CARBON #cmakedefine OSG_WINDOWING_SYSTEM_CARBON
#cmakedefine OSG_WINDOWING_SYSTEM_NONE
#endif #endif

View File

@ -538,10 +538,10 @@ unsigned int Image::computeNumComponents(GLenum pixelFormat)
{ {
case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): return 3; case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): return 3;
case(GL_COMPRESSED_SRGB_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_SRGB_ALPHA_S3TC_DXT1_EXT): return 4;
case(GL_COMPRESSED_RGBA_S3TC_DXT3_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_SRGB_ALPHA_S3TC_DXT3_EXT): return 4;
case(GL_COMPRESSED_RGBA_S3TC_DXT5_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_SRGB_ALPHA_S3TC_DXT5_EXT): return 4;
case(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT): return 1; case(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT): return 1;
case(GL_COMPRESSED_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) switch(format)
{ {
case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): return 4; case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): return 4;
case(GL_COMPRESSED_SRGB_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_RGBA_S3TC_DXT1_EXT): return 4;
case(GL_COMPRESSED_SRGB_ALPHA_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_RGBA_S3TC_DXT3_EXT): return 8;
case(GL_COMPRESSED_SRGB_ALPHA_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_RGBA_S3TC_DXT5_EXT): return 8;
case(GL_COMPRESSED_SRGB_ALPHA_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_SIGNED_RED_RGTC1_EXT): return 4;
case(GL_COMPRESSED_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) switch(pixelFormat)
{ {
case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT):
case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT): case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT):
case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT):
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT): case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT):
return osg::maximum(8u, packing); // block size of 8 return osg::maximum(8u, packing); // block size of 8
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT):
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT): case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT):
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT):
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT): case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT):
case(GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG): case(GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG):
case(GL_COMPRESSED_RGBA_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_RGBA_ARB):
case(GL_COMPRESSED_RGB_ARB): case(GL_COMPRESSED_RGB_ARB):
case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT):
case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT): case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT):
case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT):
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT): case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT):
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT):
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT): case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT):
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT):
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT): case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT):
case(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT): case(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT):
case(GL_COMPRESSED_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_RGB_S3TC_DXT1_EXT):
case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT): case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT):
return false; return false;
case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT):
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT): case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT):
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT):
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT): case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT):
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT):
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT): case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT):
return dxtc_tool::isCompressedImageTranslucent(_s, _t, _pixelFormat, _data); return dxtc_tool::isCompressedImageTranslucent(_s, _t, _pixelFormat, _data);
default: default:

View File

@ -400,11 +400,8 @@ void Texture2DArray::apply(State& state) const
osg::Image* image = itr->get(); osg::Image* image = itr->get();
if (image) 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(); n += image->r();
} }
} }

View File

@ -190,11 +190,11 @@ bool isCompressedImageTranslucent(size_t width, size_t height, GLenum format, vo
int blockCount = ((width + 3) >> 2) * ((height + 3) >> 2); int blockCount = ((width + 3) >> 2) * ((height + 3) >> 2);
switch(format) switch(format)
{ {
case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT):
case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT): case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT):
return false; return false;
case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT):
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT): case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT):
{ {
const DXT1TexelsBlock *texelsBlock = reinterpret_cast<const DXT1TexelsBlock*>(imageData); const DXT1TexelsBlock *texelsBlock = reinterpret_cast<const DXT1TexelsBlock*>(imageData);

View File

@ -213,7 +213,7 @@ osg::gluTessProperty( GLUtesselator *tess, GLenum which, GLdouble value )
tess->windingRule = windingRule; tess->windingRule = windingRule;
return; return;
default: default:
break; return;
} }
case GLU_TESS_BOUNDARY_ONLY: case GLU_TESS_BOUNDARY_ONLY:

View File

@ -292,14 +292,23 @@ bool daeReader::convert( std::istream& fin )
// set fileURI to null device // set fileURI to null device
const std::string fileURI("from std::istream"); const std::string fileURI("from std::istream");
fin.imbue(std::locale::classic());
// get the size of the file and rewind // get the size of the file and rewind
fin.seekg(0, std::ios::end); fin.seekg(0, std::ios::end);
std::streampos length = fin.tellg(); unsigned long length = static_cast<unsigned long>(fin.tellg());
fin.seekg(0, std::ios::beg); fin.seekg(0, std::ios::beg);
// use a vector as buffer and read from stream // use a vector as buffer and read from stream
std::vector<char> buffer(length); std::vector<char> buffer(length + 1ul);
buffer[length] = 0;
fin.read(&buffer[0], length); 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]); domElement* loaded_element = _dae->openFromMemory(fileURI, &buffer[0]);
_document = dynamic_cast<domCOLLADA*>(loaded_element); _document = dynamic_cast<domCOLLADA*>(loaded_element);

View File

@ -1079,15 +1079,12 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout, bool autoFlipDDSWri
// Initialize ddsd structure and its members // Initialize ddsd structure and its members
DDSURFACEDESC2 ddsd; DDSURFACEDESC2 ddsd;
memset( &ddsd, 0, sizeof( ddsd ) );
DDPIXELFORMAT ddpf; DDPIXELFORMAT ddpf;
memset( &ddpf, 0, sizeof( ddpf ) );
//DDCOLORKEY ddckCKDestOverlay; //DDCOLORKEY ddckCKDestOverlay;
//DDCOLORKEY ddckCKDestBlt; //DDCOLORKEY ddckCKDestBlt;
//DDCOLORKEY ddckCKSrcOverlay; //DDCOLORKEY ddckCKSrcOverlay;
//DDCOLORKEY ddckCKSrcBlt; //DDCOLORKEY ddckCKSrcBlt;
DDSCAPS2 ddsCaps; DDSCAPS2 ddsCaps;
memset( &ddsCaps, 0, sizeof( ddsCaps ) );
ddsd.dwSize = sizeof(ddsd); ddsd.dwSize = sizeof(ddsd);
ddpf.dwSize = sizeof(ddpf); ddpf.dwSize = sizeof(ddpf);

View File

@ -55,7 +55,6 @@ void IndexMeshVisitor::process(osg::Geometry& geom) {
new_primitives.reserve(primitives.size()); new_primitives.reserve(primitives.size());
// compute duplicate vertices // compute duplicate vertices
typedef std::vector<unsigned int> IndexList;
unsigned int numVertices = geom.getVertexArray()->getNumElements(); unsigned int numVertices = geom.getVertexArray()->getNumElements();
IndexList indices(numVertices); IndexList indices(numVertices);
unsigned int i, j; unsigned int i, j;

View File

@ -222,9 +222,6 @@ namespace glesUtil {
virtual void apply(osg::Vec2ubArray& array) { remap(array); } virtual void apply(osg::Vec2ubArray& array) { remap(array); }
virtual void apply(osg::MatrixfArray& 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; return 0;
} }
protected:
VertexAttribComparitor& operator= (const VertexAttribComparitor&) { return *this; }
}; };
// Move the values in an array to new positions, based on the // Move the values in an array to new positions, based on the

View File

@ -22,6 +22,7 @@ GStreamerImageStream::GStreamerImageStream():
GStreamerImageStream::GStreamerImageStream(const GStreamerImageStream & image, const osg::CopyOp & copyop) : GStreamerImageStream::GStreamerImageStream(const GStreamerImageStream & image, const osg::CopyOp & copyop) :
osg::ImageStream(image, copyop), osg::ImageStream(image, copyop),
OpenThreads::Thread(),
_loop(0), _loop(0),
_pipeline(0), _pipeline(0),
_internal_buffer(0), _internal_buffer(0),
@ -239,7 +240,7 @@ GstFlowReturn GStreamerImageStream::on_new_preroll(GstAppSink *appsink, GStreame
return GST_FLOW_OK; 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) if( GST_MESSAGE_TYPE(message) == GST_MESSAGE_EOS)
{ {

View File

@ -287,7 +287,7 @@ bool DataInputStream::uncompress(std::istream& fin, std::string& destination) co
return ret == Z_STREAM_END ? true : false; return ret == Z_STREAM_END ? true : false;
} }
#else #else
bool DataInputStream::uncompress(std::istream& fin, std::string& destination) const bool DataInputStream::uncompress(std::istream& /*fin*/, std::string& /*destination*/) const
{ {
return false; return false;
} }

View File

@ -320,7 +320,7 @@ bool DataOutputStream::compress(std::ostream& fout, const std::string& source) c
return true; return true;
} }
#else #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; return false;
} }

View File

@ -309,7 +309,7 @@ public:
return true; return true;
} }
catch(osc::Exception e) { catch(osc::Exception& e) {
handleException(e); handleException(e);
} }
@ -342,7 +342,7 @@ public:
return true; return true;
} }
catch(osc::Exception e) { catch(osc::Exception& e) {
handleException(e); handleException(e);
} }
@ -378,7 +378,7 @@ public:
return true; return true;
} }
catch(osc::Exception e) { catch(osc::Exception& e) {
handleException(e); handleException(e);
} }
@ -413,7 +413,7 @@ public:
return true; return true;
} }
catch(osc::Exception e) { catch(osc::Exception& e) {
handleException(e); handleException(e);
} }
@ -449,7 +449,7 @@ public:
return true; return true;
} }
catch (osc::Exception e) { catch (osc::Exception& e) {
handleException(e); handleException(e);
} }
return false; return false;
@ -491,7 +491,7 @@ public:
return true; return true;
} }
catch (osc::Exception e) { catch (osc::Exception& e) {
handleException(e); handleException(e);
} }
return false; return false;
@ -529,7 +529,7 @@ public:
return true; return true;
} }
catch (osc::Exception e) { catch (osc::Exception& e) {
handleException(e); handleException(e);
} }
return false; return false;
@ -588,7 +588,7 @@ public:
return true; return true;
} }
catch (osc::Exception e) { catch (osc::Exception& e) {
handleException(e); handleException(e);
} }
return false; return false;
@ -630,7 +630,7 @@ public:
return true; return true;
} }
catch (osc::Exception e) { catch (osc::Exception& e) {
handleException(e); handleException(e);
} }
return false; return false;
@ -662,7 +662,7 @@ public:
return true; return true;
} }
catch (osc::Exception e) { catch (osc::Exception& e) {
handleException(e); handleException(e);
} }
return false; return false;
@ -695,7 +695,7 @@ public:
return true; return true;
} }
catch (osc::Exception e) { catch (osc::Exception& e) {
handleException(e); handleException(e);
} }
return false; return false;

View File

@ -269,7 +269,7 @@ FILETIME dosdatetime2filetime(WORD dosdate,WORD dostime)
return ft; return ft;
} }
bool FileExists(const TCHAR *fn) static bool FileExists(const TCHAR *fn)
{ return (GetFileAttributes(fn)!=0xFFFFFFFF); { return (GetFileAttributes(fn)!=0xFFFFFFFF);
} }
#endif #endif
@ -1741,9 +1741,9 @@ int inflate_blocks_free(inflate_blocks_statef *s, z_streamp z)
// //
// This symbol conflicts with other dependencies when OSG is used in static-lib mode
extern const char inflate_copyright[] = // extern const char inflate_copyright[] =
" inflate 1.1.3 Copyright 1995-1998 Mark Adler "; // " inflate 1.1.3 Copyright 1995-1998 Mark Adler ";
// If you use the zlib library in a product, an acknowledgment is welcome // 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 // in the documentation of your product. If for some reason you cannot
// include such an acknowledgment, I would appreciate that you keep this // include such an acknowledgment, I would appreciate that you keep this

View File

@ -109,6 +109,11 @@ struct VertexAttribComparitor : public GeometryArrayGatherer
{ {
} }
VertexAttribComparitor(const VertexAttribComparitor& rhs)
: GeometryArrayGatherer(rhs)
{
}
bool operator() (unsigned int lhs, unsigned int rhs) const bool operator() (unsigned int lhs, unsigned int rhs) const
{ {
for(ArrayList::const_iterator itr=_arrayList.begin(); for(ArrayList::const_iterator itr=_arrayList.begin();

View File

@ -446,7 +446,7 @@ inline void graph_array<N>::swap(graph_type & Right)
template <class N> template <class N>
inline void unmark_nodes(graph_array<N> & G) inline void unmark_nodes(graph_array<N> & G)
{ {
std::for_each(G.begin(), G.end(), std::mem_fun_ref(&graph_array<N>::node::unmark)); for(typename graph_array<N>::node_iterator itr = G.begin(); itr != G.end(); ++itr) itr->unmark();
} }

View File

@ -317,7 +317,14 @@ bool WindowManager::pickAtXY(float x, float y, WidgetList& wl)
// Iterate over every picked result and create a list of Widgets that belong // Iterate over every picked result and create a list of Widgets that belong
// to that Window. // to that Window.
for(Intersections::iterator i = intr.begin(); i != intr.end(); i++) { for(Intersections::iterator i = intr.begin(); i != intr.end(); i++) {
Window* win = dynamic_cast<Window*>(i->nodePath.back()->getParent(0));
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<Window*>(*np_itr);
if (win) break;
}
// Make sure that our window is valid, and that our pick is within the // Make sure that our window is valid, and that our pick is within the
// "visible area" of the Window. // "visible area" of the Window.
@ -336,7 +343,6 @@ bool WindowManager::pickAtXY(float x, float y, WidgetList& wl)
else if(activeWin != win) break; else if(activeWin != win) break;
Widget* widget = dynamic_cast<Widget*>(i->drawable.get()); Widget* widget = dynamic_cast<Widget*>(i->drawable.get());
if(!widget) continue; if(!widget) continue;
// We need to return a list of every Widget that was picked, so // We need to return a list of every Widget that was picked, so