Changes to allow the COLLADA plugin to compile against the latest COLLADA DOM version 2.4 as well as retaining compatibility with the old 2.2 DOM.

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14633 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2014-12-23 12:10:03 +00:00
parent dd650921b1
commit 5a4f962013
13 changed files with 110 additions and 23 deletions

View File

@@ -18,7 +18,7 @@ SET(TARGET_SRC
ReaderWriterDAE.cpp
)
SET(TARGET_H
SET(TARGET_H
daeReader.h
daeWriter.h
domSourceReader.h
@@ -35,6 +35,11 @@ ELSE()
ENDIF()
ADD_DEFINITIONS(-DNO_BOOST)
ADD_DEFINITIONS(-DCOLLADA_DOM_SUPPORT141)
IF (COLLADA_DOM_2_4_OR_LATER)
ADD_DEFINITIONS(-DCOLLADA_DOM_2_4_OR_LATER)
ENDIF()
IF(COLLADA_USE_STATIC)
IF(WIN32)
@@ -68,8 +73,8 @@ ELSE()
ENDIF()
ENDIF()
SET(TARGET_ADDED_LIBRARIES osgSim osgAnimation)
SET(TARGET_ADDED_LIBRARIES osgSim osgAnimation)
#### end var setup ###
SETUP_PLUGIN(dae dae)

View File

@@ -33,6 +33,11 @@
using namespace osgDAE;
#ifdef COLLADA_DOM_2_4_OR_LATER
#include <dom/domAny.h>
using namespace ColladaDOM141;
#endif
template <typename T>
void daeReader::getTransparencyCounts(daeDatabase* database, int& zero, int& one) const
{

View File

@@ -29,6 +29,11 @@
using namespace osgDAE;
#ifdef COLLADA_DOM_2_4_OR_LATER
#include <dom/domAny.h>
using namespace ColladaDOM141;
#endif
osg::Group* daeReader::processOsgMultiSwitch(domTechnique* teq)
{
osgSim::MultiSwitch* msw = new osgSim::MultiSwitch;

View File

@@ -24,6 +24,11 @@
#include <osg/MatrixTransform>
#include <osgSim/DOFTransform>
#ifdef COLLADA_DOM_2_4_OR_LATER
#include <dom/domAny.h>
using namespace ColladaDOM141;
#endif
using namespace osgDAE;
// Note <lookat>, <matrix>, <rotate>, <scale>, <skew> and <translate> may appear in any order

View File

@@ -23,6 +23,11 @@
using namespace osgDAE;
#ifdef COLLADA_DOM_2_4_OR_LATER
#include <dom/domAny.h>
using namespace ColladaDOM141;
#endif
daeReader::Options::Options() :
strictTransparency(false),
precisionHint(0),
@@ -296,7 +301,8 @@ bool daeReader::convert( std::istream& fin )
std::vector<char> buffer(length);
fin.read(&buffer[0], length);
_document = _dae->openFromMemory(fileURI, &buffer[0]);
domElement* loaded_element = _dae->openFromMemory(fileURI, &buffer[0]);
_document = dynamic_cast<domCOLLADA*>(loaded_element);
return processDocument (fileURI);
}
@@ -305,7 +311,8 @@ bool daeReader::convert( const std::string &fileURI )
{
clearCaches();
_document = _dae->open(fileURI);
domElement* loaded_element = _dae->open(fileURI);
_document = dynamic_cast<domCOLLADA*>(loaded_element);
return processDocument (fileURI);
}

View File

@@ -35,6 +35,10 @@
#include <osgAnimation/Bone>
#include <osgAnimation/Skeleton>
#ifdef COLLADA_DOM_2_4_OR_LATER
namespace ColladaDOM141
{
#endif
class domBind_material;
class domCamera;
//class domCommon_color_or_texture_type;
@@ -55,6 +59,12 @@ class domTranslate;
class domRotate;
class domVisual_scene;
#ifdef COLLADA_DOM_2_4_OR_LATER
}
using namespace ColladaDOM141;
#endif
namespace osgDAE
{
@@ -380,6 +390,7 @@ private:
osg::Node* _rootNode;
osg::ref_ptr<osg::StateSet> _rootStateSet;
domCOLLADA* _document;
domVisual_scene* _visualScene;
std::map<std::string,bool> _targetMap;

View File

@@ -31,6 +31,7 @@
#include <osg/CameraView>
#include <osgDB/ConvertUTF>
using namespace osgDAE;

View File

@@ -31,6 +31,11 @@
#include "windows.h"
#endif
#ifdef COLLADA_DOM_2_4_OR_LATER
#include <dom/domAny.h>
using namespace ColladaDOM141;
#endif
using namespace osgDAE;

View File

@@ -28,6 +28,11 @@
#include <osg/Billboard>
#include <osg/CameraView>
#ifdef COLLADA_DOM_2_4_OR_LATER
#include <dom/domAny.h>
using namespace ColladaDOM141;
#endif
using namespace osgDAE;
// Write non-standard node data as extra of type "Node" with "OpenSceneGraph" technique

View File

@@ -22,6 +22,11 @@
#include <osgAnimation/Bone>
#include <osgSim/DOFTransform>
#ifdef COLLADA_DOM_2_4_OR_LATER
#include <dom/domAny.h>
using namespace ColladaDOM141;
#endif
using namespace osgDAE;

View File

@@ -50,6 +50,10 @@
#include <dae/daeDocument.h>
#include <dom/domChannel.h>
#ifdef COLLADA_DOM_2_4_OR_LATER
namespace ColladaDOM141
{
#endif
class domCOLLADA;
class domGeometry;
@@ -68,6 +72,12 @@ class domSource;
class domVisual_scene;
class domP;
#ifdef COLLADA_DOM_2_4_OR_LATER
}
using namespace ColladaDOM141;
#endif
namespace osgDAE {
/// Convert value to string using it's stream operator

View File

@@ -17,7 +17,11 @@
#include <osg/Array>
#include <osg/Notify>
class domSource;
#include <dom/domSource.h>
#ifdef COLLADA_DOM_2_4_OR_LATER
using namespace ColladaDOM141;
#endif
namespace osgDAE {