From 2b6ffad99a9c487937cd90a5a13dec8d883830c7 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 27 Oct 2017 13:48:52 +0100 Subject: [PATCH 1/2] Build fix for when compiling with OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION set to OFF --- src/osgText/Glyph.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osgText/Glyph.cpp b/src/osgText/Glyph.cpp index 17776780c..7c1dba18a 100644 --- a/src/osgText/Glyph.cpp +++ b/src/osgText/Glyph.cpp @@ -167,7 +167,7 @@ void GlyphTexture::addGlyph(Glyph* glyph, int posX, int posY) glyph->setTextureInfo(_shaderTechnique, info.get()); - copyGlyphImage(glyph, info); + copyGlyphImage(glyph, info.get()); } void GlyphTexture::copyGlyphImage(Glyph* glyph, Glyph::TextureInfo* info) From 671847387f7e3a3eb134e154708a600475630ad8 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 27 Oct 2017 14:19:13 +0100 Subject: [PATCH 2/2] Fixed build errors when compiling with OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION set to OFF --- include/osgAnimation/MorphGeometry | 4 ++-- include/osgAnimation/MorphTransformHardware | 4 ++-- include/osgAnimation/RigTransformHardware | 6 +++--- src/osgAnimation/MorphGeometry.cpp | 2 +- src/osgAnimation/RigGeometry.cpp | 2 +- src/osgAnimation/VertexInfluence.cpp | 2 +- src/osgWrappers/serializers/osgAnimation/MorphGeometry.cpp | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/osgAnimation/MorphGeometry b/include/osgAnimation/MorphGeometry index cf4b06228..f1401b6b1 100644 --- a/include/osgAnimation/MorphGeometry +++ b/include/osgAnimation/MorphGeometry @@ -91,13 +91,13 @@ namespace osgAnimation inline void setVertexSource(osg::Vec3Array *v){ _positionSource=v;} /** Get source of vertices for this morph geometry */ - inline osg::Vec3Array * getVertexSource()const{return _positionSource;} + inline osg::Vec3Array * getVertexSource()const{return _positionSource.get();} /** Set source of normals for this morph geometry */ inline void setNormalSource(osg::Vec3Array *n){ _normalSource=n;} /** Get source of normals for this morph geometry */ - inline osg::Vec3Array * getNormalSource()const{return _normalSource;} + inline osg::Vec3Array * getNormalSource() const {return _normalSource.get();} /** Add a \c MorphTarget to the \c MorphGeometry. * If \c MorphTarget is not \c NULL and is not contained in the \c MorphGeometry diff --git a/include/osgAnimation/MorphTransformHardware b/include/osgAnimation/MorphTransformHardware index 650f62efd..bc0eebe8b 100644 --- a/include/osgAnimation/MorphTransformHardware +++ b/include/osgAnimation/MorphTransformHardware @@ -43,8 +43,8 @@ namespace osgAnimation virtual void operator()(MorphGeometry&); inline void setShader( osg::Shader*s ) { _shader=s; } - inline const osg::Shader * getShader() const{ return _shader; } - inline osg::Shader * getShader() { return _shader; } + inline const osg::Shader * getShader() const{ return _shader.get(); } + inline osg::Shader * getShader() { return _shader.get(); } ///texture unit reserved for morphtarget TBO default is 7 void setReservedTextureUnit(unsigned int t) { _reservedTextureUnit=t; } diff --git a/include/osgAnimation/RigTransformHardware b/include/osgAnimation/RigTransformHardware index cf506580f..c71f2ae16 100644 --- a/include/osgAnimation/RigTransformHardware +++ b/include/osgAnimation/RigTransformHardware @@ -50,8 +50,8 @@ namespace osgAnimation unsigned int getFirstVertexAttributeTarget()const { return _minAttribIndex;} void setShader(osg::Shader* shader) { _shader = shader; } - const osg::Shader* getShader() const { return _shader; } - osg::Shader* getShader() { return _shader; } + const osg::Shader* getShader() const { return _shader.get(); } + osg::Shader* getShader() { return _shader.get(); } osg::Vec4Array* getVertexAttrib(unsigned int index); unsigned int getNumVertexAttrib() const {return _boneWeightAttribArrays.size();} @@ -61,7 +61,7 @@ namespace osgAnimation const BoneNamePaletteIndex& getBoneNameToPalette(){ return _boneNameToPalette; } const BonePalette& getBonePalette() { return _bonePalette; } - osg::Uniform* getMatrixPaletteUniform() { return _uniformMatrixPalette; } + osg::Uniform* getMatrixPaletteUniform() { return _uniformMatrixPalette.get(); } void computeMatrixPaletteUniform(const osg::Matrix& transformFromSkeletonToGeometry, const osg::Matrix& invTransformFromSkeletonToGeometry); diff --git a/src/osgAnimation/MorphGeometry.cpp b/src/osgAnimation/MorphGeometry.cpp index 07a86d1a6..5f499716c 100644 --- a/src/osgAnimation/MorphGeometry.cpp +++ b/src/osgAnimation/MorphGeometry.cpp @@ -47,7 +47,7 @@ MorphGeometry::MorphGeometry(const osg::Geometry& g) : MorphGeometry::MorphGeometry(const MorphGeometry& b, const osg::CopyOp& copyop) : osg::Geometry(b,copyop), - _morphTransformImplementation((MorphTransform*)copyop(b._morphTransformImplementation)), + _morphTransformImplementation(osg::clone(b._morphTransformImplementation.get(), copyop)), _dirty(b._dirty), _method(b._method), _morphTargets(b._morphTargets), diff --git a/src/osgAnimation/RigGeometry.cpp b/src/osgAnimation/RigGeometry.cpp index c176cf9df..6884b6c12 100644 --- a/src/osgAnimation/RigGeometry.cpp +++ b/src/osgAnimation/RigGeometry.cpp @@ -67,7 +67,7 @@ RigGeometry::RigGeometry() RigGeometry::RigGeometry(const RigGeometry& b, const osg::CopyOp& copyop) : osg::Geometry(b,copyop), _geometry(b._geometry), - _rigTransformImplementation((RigTransform*)copyop(b._rigTransformImplementation)), + _rigTransformImplementation(osg::clone(_rigTransformImplementation.get(), copyop)), _vertexInfluenceMap(b._vertexInfluenceMap), _needToComputeMatrix(b._needToComputeMatrix) { diff --git a/src/osgAnimation/VertexInfluence.cpp b/src/osgAnimation/VertexInfluence.cpp index 42ca1f254..444651ce4 100644 --- a/src/osgAnimation/VertexInfluence.cpp +++ b/src/osgAnimation/VertexInfluence.cpp @@ -279,7 +279,7 @@ void VertexInfluenceMap::removeUnexpressedBones(Skeleton &skel) const } ///Bone can be removed - Bone * bone2rm = bmit->second; + Bone * bone2rm = bmit->second.get(); for(unsigned int numchild = 0; numchild < bone2rm->getNumChildren(); numchild++) { if( (child = dynamic_cast(bone2rm->getChild(numchild))) ) diff --git a/src/osgWrappers/serializers/osgAnimation/MorphGeometry.cpp b/src/osgWrappers/serializers/osgAnimation/MorphGeometry.cpp index 5479ebaf5..d2af644a9 100644 --- a/src/osgWrappers/serializers/osgAnimation/MorphGeometry.cpp +++ b/src/osgWrappers/serializers/osgAnimation/MorphGeometry.cpp @@ -41,8 +41,8 @@ static bool writeMorphTargets( osgDB::OutputStream& os, const osgAnimation::Morp { return geom.get##PROP()!=0; } \ static bool read##ORIGINAL_PROP( osgDB::InputStream& is, osgAnimation::MorphGeometry& geom ) { \ is >> is.BEGIN_BRACKET; \ - osg::Array* array =is.readArray(); \ - geom.set##PROP((osg::Vec3Array*)array); \ + osg::ref_ptr array = is.readArray(); \ + geom.set##PROP(dynamic_cast(array.get())); \ is >> is.END_BRACKET; \ return true; \ } \