diff --git a/src/osgPlugins/3ds/ReaderWriter3DS.cpp b/src/osgPlugins/3ds/ReaderWriter3DS.cpp index 3f1660d03..364fb9e55 100644 --- a/src/osgPlugins/3ds/ReaderWriter3DS.cpp +++ b/src/osgPlugins/3ds/ReaderWriter3DS.cpp @@ -1197,7 +1197,7 @@ osgDB::ReaderWriter::WriteResult ReaderWriter3DS::doWriteNode(const osg::Node& n bool ReaderWriter3DS::createFileObject(const osg::Node& node, Lib3dsFile * file3ds,const std::string& fileName, const osgDB::ReaderWriter::Options* options) const { - WriterNodeVisitor w(file3ds, fileName, options, osgDB::getFilePath(node.getName())); + plugin3ds::WriterNodeVisitor w(file3ds, fileName, options, osgDB::getFilePath(node.getName())); const_cast(node).accept(w); // Ugly const_cast<> for visitor... if (!w.succeeded()) return false; w.writeMaterials(); diff --git a/src/osgPlugins/3ds/WriterNodeVisitor.cpp b/src/osgPlugins/3ds/WriterNodeVisitor.cpp index 44a5f5178..280b2f1a8 100644 --- a/src/osgPlugins/3ds/WriterNodeVisitor.cpp +++ b/src/osgPlugins/3ds/WriterNodeVisitor.cpp @@ -119,6 +119,11 @@ bool is3DSpath(const std::string & s, bool extendedFilePaths) } +// Use namespace qualification to avoid static-link symbol collitions +// from multiply defined symbols. +namespace plugin3ds +{ + /** writes all primitives of a primitive-set out to a stream, decomposes quads to triangles, line-strips to lines etc */ class PrimitiveIndexWriter : public osg::PrimitiveIndexFunctor @@ -355,8 +360,6 @@ void PrimitiveIndexWriter::drawArrays(GLenum mode,GLint first,GLsizei count) } } - - WriterNodeVisitor::Material::Material(WriterNodeVisitor & writerNodeVisitor, osg::StateSet * stateset, osg::Material* mat, osg::Texture* tex, int index) : index(index), diffuse(1,1,1,1), @@ -1045,3 +1048,6 @@ void WriterNodeVisitor::apply3DSMatrixNode(osg::Node &node, const osg::Matrix & lib3ds_file_append_node(file3ds, reinterpret_cast(node3ds), reinterpret_cast(parent)); _cur3dsNode = node3ds; } + +// end namespace plugin3ds +} diff --git a/src/osgPlugins/3ds/WriterNodeVisitor.h b/src/osgPlugins/3ds/WriterNodeVisitor.h index d55377cf0..8fe3552c5 100644 --- a/src/osgPlugins/3ds/WriterNodeVisitor.h +++ b/src/osgPlugins/3ds/WriterNodeVisitor.h @@ -48,6 +48,9 @@ void copyOsgMatrixToLib3dsMatrix(Lib3dsMatrix lib3ds_matrix, const osg::Matrix& typedef std::map, unsigned int> MapIndices; typedef std::vector > ListTriangle; //the int is the drawable of the triangle +namespace plugin3ds +{ + class WriterNodeVisitor: public osg::NodeVisitor { public: @@ -213,4 +216,7 @@ class WriterNodeVisitor: public osg::NodeVisitor std::set _imageSet; }; +// end namespace plugin3ds +} + #endif diff --git a/src/osgPlugins/fbx/ReaderWriterFBX.cpp b/src/osgPlugins/fbx/ReaderWriterFBX.cpp index 625953ac2..9dc1eb7fe 100644 --- a/src/osgPlugins/fbx/ReaderWriterFBX.cpp +++ b/src/osgPlugins/fbx/ReaderWriterFBX.cpp @@ -428,7 +428,7 @@ osgDB::ReaderWriter::WriteResult ReaderWriterFBX::writeNode( } KFbxScene* pScene = KFbxScene::Create(pSdkManager, ""); - WriterNodeVisitor writerNodeVisitor(pScene, pSdkManager, filename, + pluginfbx::WriterNodeVisitor writerNodeVisitor(pScene, pSdkManager, filename, options, osgDB::getFilePath(node.getName().empty() ? filename : node.getName())); if (useFbxRoot && isBasicRootNode(node)) { diff --git a/src/osgPlugins/fbx/WriterNodeVisitor.cpp b/src/osgPlugins/fbx/WriterNodeVisitor.cpp index d8e00564a..89ce764bd 100644 --- a/src/osgPlugins/fbx/WriterNodeVisitor.cpp +++ b/src/osgPlugins/fbx/WriterNodeVisitor.cpp @@ -25,6 +25,13 @@ #include "WriterNodeVisitor.h" #include + +// Use namespace qualification to avoid static-link symbol collitions +// from multiply defined symbols. +namespace pluginfbx +{ + + /** writes all primitives of a primitive-set out to a stream, decomposes quads to triangles, line-strips to lines etc */ class PrimitiveIndexWriter : public osg::PrimitiveIndexFunctor { @@ -738,3 +745,6 @@ void WriterNodeVisitor::apply(osg::MatrixTransform& node) traverse(node); _curFbxNode = parent; } + +// end namespace pluginfbx +} diff --git a/src/osgPlugins/fbx/WriterNodeVisitor.h b/src/osgPlugins/fbx/WriterNodeVisitor.h index 381c27ffb..2b6b3c3c2 100644 --- a/src/osgPlugins/fbx/WriterNodeVisitor.h +++ b/src/osgPlugins/fbx/WriterNodeVisitor.h @@ -41,6 +41,9 @@ struct Triangle typedef std::map, unsigned int> MapIndices; typedef std::vector > ListTriangle; //the int is the drawable of the triangle +namespace pluginfbx +{ + ///\author Capo (Thibault Caporal) class WriterNodeVisitor: public osg::NodeVisitor { @@ -253,4 +256,7 @@ class WriterNodeVisitor: public osg::NodeVisitor const std::string _srcDirectory; }; +// end namespace pluginfbx +} + #endif // _FBX_WRITER_NODE_VISITOR_HEADER__