2.8 branch: Fix multiply defined symbols in static link by qualifying FBX and 3DS plugin symbols with namespaces.
This commit is contained in:
@@ -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<osg::Node &>(node).accept(w); // Ugly const_cast<> for visitor...
|
||||
if (!w.succeeded()) return false;
|
||||
w.writeMaterials();
|
||||
|
||||
@@ -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<Lib3dsNode*>(node3ds), reinterpret_cast<Lib3dsNode*>(parent));
|
||||
_cur3dsNode = node3ds;
|
||||
}
|
||||
|
||||
// end namespace plugin3ds
|
||||
}
|
||||
|
||||
@@ -48,6 +48,9 @@ void copyOsgMatrixToLib3dsMatrix(Lib3dsMatrix lib3ds_matrix, const osg::Matrix&
|
||||
typedef std::map<std::pair<unsigned int, unsigned int>, unsigned int> MapIndices;
|
||||
typedef std::vector<std::pair<Triangle, int> > 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<osg::Image *> _imageSet;
|
||||
};
|
||||
|
||||
// end namespace plugin3ds
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -25,6 +25,13 @@
|
||||
#include "WriterNodeVisitor.h"
|
||||
#include <limits.h>
|
||||
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -41,6 +41,9 @@ struct Triangle
|
||||
typedef std::map<std::pair<unsigned int, unsigned int>, unsigned int> MapIndices;
|
||||
typedef std::vector<std::pair<Triangle, int> > 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__
|
||||
|
||||
Reference in New Issue
Block a user