changed: gcc8 base update
[opensg.git] / Source / System / FileIO / Collada / OSGColladaInstanceAnimation.cpp
blob2d550bd24f50b7c5da0e2743c9bd59e8dbf1dc98
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2009 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
18 * *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #if __GNUC__ >= 4 || __GNUC_MINOR__ >=3
40 #pragma GCC diagnostic ignored "-Wold-style-cast"
41 #endif
43 #include "OSGColladaInstanceAnimation.h"
45 #ifdef OSG_WITH_COLLADA
47 #include "OSGColladaLog.h"
49 #include <dom/domInstanceWithExtra.h>
51 OSG_BEGIN_NAMESPACE
53 ColladaElementRegistrationHelper ColladaInstanceAnimation::_regHelper(
54 &ColladaInstanceAnimation::create, "instance_animation");
57 ColladaElementTransitPtr
58 ColladaInstanceAnimation::create(daeElement *elem, ColladaGlobal *global)
60 return
61 ColladaElementTransitPtr(new ColladaInstanceAnimation(elem, global));
64 void
65 ColladaInstanceAnimation::read(ColladaElement *colElemParent)
67 OSG_COLLADA_LOG(("ColladaInstanceAnimation::read\n"));
69 ColladaAnimationRefPtr colAnim = getTargetElem();
71 if(colAnim == NULL)
73 colAnim = dynamic_pointer_cast<ColladaAnimation>(
74 ColladaElementFactory::the()->create(
75 getTargetDOMElem(), getGlobal()));
77 colAnim->read(this);
81 ColladaAnimation *
82 ColladaInstanceAnimation::getTargetElem(void) const
84 ColladaAnimation *retVal = NULL;
85 daeElementRef targetElem = getTargetDOMElem();
87 if(targetElem != NULL)
89 retVal = getUserDataAs<ColladaAnimation>(targetElem);
92 return retVal;
95 domAnimation *
96 ColladaInstanceAnimation::getTargetDOMElem(void) const
98 domAnimationRef retVal = NULL;
99 domInstanceWithExtraRef instAnim = getDOMElementAs<domInstanceWithExtra>();
101 if(instAnim->getUrl().getElement() != NULL)
103 retVal = daeSafeCast<domAnimation>(instAnim->getUrl().getElement());
106 return retVal;
109 ColladaInstanceAnimation::ColladaInstanceAnimation(
110 daeElement *elem, ColladaGlobal *global)
112 : Inherited(elem, global)
116 ColladaInstanceAnimation::~ColladaInstanceAnimation(void)
120 OSG_END_NAMESPACE
122 #endif // OSG_WITH_COLLADA