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,9 +18,9 @@
SET( COLLADA_ENV_VAR_AVAILABLE $ENV{COLLADA_DIR} )
IF ( COLLADA_ENV_VAR_AVAILABLE )
SET(COLLADA_DOM_ROOT "$ENV{COLLADA_DIR}/dom" CACHE PATH "Location of Collada DOM directory" FORCE)
ELSE ( COLLADA_ENV_VAR_AVAILABLE )
ELSE ()
SET(COLLADA_DOM_ROOT "${ACTUAL_3DPARTY_DIR}/include/1.4/dom" CACHE PATH "Location of Collada DOM directory" FORCE)
ENDIF( COLLADA_ENV_VAR_AVAILABLE )
ENDIF()
@ -66,9 +66,10 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h
)
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
NAMES collada_dom collada14dom Collada14Dom libcollada14dom21 libcollada14dom22
NAMES collada_dom collada14dom Collada14Dom libcollada14dom21 libcollada14dom22 collada-dom2.4-dp
PATHS
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4
${COLLADA_DOM_ROOT}
$ENV{COLLADA_DIR}/build/${COLLADA_BUILDNAME}-1.4
$ENV{COLLADA_DIR}/lib
$ENV{COLLADA_DIR}/lib-dbg
@ -89,9 +90,10 @@ FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
)
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
NAMES collada_dom-d collada14dom-d Collada14Dom-d libcollada14dom21-d libcollada14dom22-d
NAMES collada_dom-d collada14dom-d Collada14Dom-d libcollada14dom21-d libcollada14dom22-d collada-dom2.4-dp-d
PATHS
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4-d
${COLLADA_DOM_ROOT}
$ENV{COLLADA_DIR}/build/${COLLADA_BUILDNAME}-1.4-d
$ENV{COLLADA_DIR}/lib
$ENV{COLLADA_DIR}/lib-dbg
@ -277,6 +279,23 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
SET(COLLADA_FOUND "NO")
IF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
IF (COLLADA_INCLUDE_DIR)
SET(COLLADA_FOUND "YES")
ENDIF(COLLADA_INCLUDE_DIR)
ENDIF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
FIND_PATH(COLLADA_INCLUDE_DOMANY_DIR 1.4/dom/domAny.h
${COLLADA_INCLUDE_DIR}
)
IF (COLLADA_INCLUDE_DOMANY_DIR)
SET(COLLADA_DOM_2_4_OR_LATER TRUE)
ELSEIF()
SET(COLLADA_DOM_2_4_OR_LATER FALSE)
ENDIF()
MESSAGE("\n\n COLLADA_DOM_2_4_OR_LATER=" ${COLLADA_DOM_2_4_OR_LATER})
ENDIF()
ENDIF()

View File

@ -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)

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 {