Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed: handle top level <COLLADA> tag through element factory
git-svn-id: https://opensg.vrsource.org/svn/trunk@2253 4683daeb-ad0f-0410-a623-93161e962ae5
- Loading branch information
cneumann
committed
Dec 29, 2009
1 parent
3830d5e
commit fdaf217
Showing
4 changed files
with
220 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/*---------------------------------------------------------------------------*\ | ||
* OpenSG * | ||
* * | ||
* * | ||
* Copyright (C) 2009 by the OpenSG Forum * | ||
* * | ||
* www.opensg.org * | ||
* * | ||
* contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * | ||
* * | ||
\*---------------------------------------------------------------------------*/ | ||
/*---------------------------------------------------------------------------*\ | ||
* License * | ||
* * | ||
* This library is free software; you can redistribute it and/or modify it * | ||
* under the terms of the GNU Library General Public License as published * | ||
* by the Free Software Foundation, version 2. * | ||
* * | ||
* This library is distributed in the hope that it will be useful, but * | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * | ||
* Library General Public License for more details. * | ||
* * | ||
* You should have received a copy of the GNU Library General Public * | ||
* License along with this library; if not, write to the Free Software * | ||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * | ||
* * | ||
\*---------------------------------------------------------------------------*/ | ||
/*---------------------------------------------------------------------------*\ | ||
* Changes * | ||
* * | ||
* * | ||
* * | ||
* * | ||
* * | ||
* * | ||
\*---------------------------------------------------------------------------*/ | ||
|
||
#if __GNUC__ >= 4 || __GNUC_MINOR__ >=3 | ||
#pragma GCC diagnostic ignored "-Wold-style-cast" | ||
#endif | ||
|
||
#include "OSGColladaCOLLADA.h" | ||
|
||
#ifdef OSG_WITH_COLLADA | ||
|
||
#include "OSGColladaLog.h" | ||
#include "OSGColladaScene.h" | ||
|
||
#include <dom/domCOLLADA.h> | ||
|
||
OSG_BEGIN_NAMESPACE | ||
|
||
ColladaElementRegistrationHelper ColladaCOLLADA::_regHelper( | ||
&ColladaCOLLADA::create, "COLLADA"); | ||
|
||
|
||
ColladaElementTransitPtr | ||
ColladaCOLLADA::create(daeElement *elem, ColladaGlobal *global) | ||
{ | ||
return ColladaElementTransitPtr(new ColladaCOLLADA(elem, global)); | ||
} | ||
|
||
void | ||
ColladaCOLLADA::read(void) | ||
{ | ||
OSG_COLLADA_LOG(("ColladaCOLLADA::read\n")); | ||
|
||
domCOLLADARef collada = getDOMElementAs<domCOLLADA>(); | ||
domCOLLADA::domSceneRef scene = collada->getScene(); | ||
|
||
ColladaSceneRefPtr colScene = getUserDataAs<ColladaScene>(scene); | ||
|
||
if(colScene == NULL) | ||
{ | ||
colScene = dynamic_pointer_cast<ColladaScene>( | ||
ColladaElementFactory::the()->create(scene, getGlobal())); | ||
|
||
colScene->read(); | ||
} | ||
|
||
colScene->process(); | ||
} | ||
|
||
ColladaCOLLADA::ColladaCOLLADA(daeElement *elem, ColladaGlobal *global) | ||
: Inherited(elem, global) | ||
{ | ||
} | ||
|
||
ColladaCOLLADA::~ColladaCOLLADA(void) | ||
{ | ||
} | ||
|
||
OSG_END_NAMESPACE | ||
|
||
#endif // OSG_WITH_COLLADA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/*---------------------------------------------------------------------------*\ | ||
* OpenSG * | ||
* * | ||
* * | ||
* Copyright (C) 2009 by the OpenSG Forum * | ||
* * | ||
* www.opensg.org * | ||
* * | ||
* contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * | ||
* * | ||
\*---------------------------------------------------------------------------*/ | ||
/*---------------------------------------------------------------------------*\ | ||
* License * | ||
* * | ||
* This library is free software; you can redistribute it and/or modify it * | ||
* under the terms of the GNU Library General Public License as published * | ||
* by the Free Software Foundation, version 2. * | ||
* * | ||
* This library is distributed in the hope that it will be useful, but * | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * | ||
* Library General Public License for more details. * | ||
* * | ||
* You should have received a copy of the GNU Library General Public * | ||
* License along with this library; if not, write to the Free Software * | ||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * | ||
* * | ||
\*---------------------------------------------------------------------------*/ | ||
/*---------------------------------------------------------------------------*\ | ||
* Changes * | ||
* * | ||
* * | ||
* * | ||
* * | ||
* * | ||
* * | ||
\*---------------------------------------------------------------------------*/ | ||
|
||
#ifndef _OSGCOLLADACOLLADA_H_ | ||
#define _OSGCOLLADACOLLADA_H_ | ||
|
||
#include "OSGConfig.h" | ||
|
||
#ifdef OSG_WITH_COLLADA | ||
|
||
#include "OSGColladaElement.h" | ||
#include "OSGColladaElementFactoryHelper.h" | ||
|
||
OSG_BEGIN_NAMESPACE | ||
|
||
class OSG_FILEIO_DLLMAPPING ColladaCOLLADA : public ColladaElement | ||
{ | ||
/*========================== PUBLIC =================================*/ | ||
public: | ||
/*---------------------------------------------------------------------*/ | ||
/*! \name Types */ | ||
/*! \{ */ | ||
|
||
typedef ColladaElement Inherited; | ||
typedef ColladaCOLLADA Self; | ||
|
||
OSG_GEN_INTERNAL_MEMOBJPTR(ColladaCOLLADA); | ||
|
||
/*! \} */ | ||
/*---------------------------------------------------------------------*/ | ||
/*! \name Create */ | ||
/*! \{ */ | ||
|
||
static ColladaElementTransitPtr | ||
create(daeElement *elem, ColladaGlobal *global); | ||
|
||
/*! \} */ | ||
/*---------------------------------------------------------------------*/ | ||
/*! \name Reading */ | ||
/*! \{ */ | ||
|
||
virtual void read(void); | ||
|
||
/*! \} */ | ||
/*========================= PROTECTED ===============================*/ | ||
protected: | ||
/*---------------------------------------------------------------------*/ | ||
/*! \name Constructors/Destructor */ | ||
/*! \{ */ | ||
|
||
ColladaCOLLADA(daeElement *elem, ColladaGlobal *global); | ||
virtual ~ColladaCOLLADA(void ); | ||
|
||
/*! \} */ | ||
/*---------------------------------------------------------------------*/ | ||
|
||
static ColladaElementRegistrationHelper _regHelper; | ||
}; | ||
|
||
OSG_GEN_MEMOBJPTR(ColladaCOLLADA); | ||
|
||
OSG_END_NAMESPACE | ||
|
||
// #include "OSGColladaCOLLADA.inl" | ||
|
||
#endif // OSG_WITH_COLLADA | ||
|
||
#endif // _OSGCOLLADACOLLADA_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters