1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2009 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
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. *
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. *
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. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGCOLLADASOURCE_H_
40 #define _OSGCOLLADASOURCE_H_
42 #include "OSGConfig.h"
44 #if defined(OSG_WITH_COLLADA) || defined(OSG_DO_DOC)
46 #include "OSGColladaElement.h"
47 #include "OSGColladaElementFactoryHelper.h"
48 #include "OSGGeoVectorProperty.h"
49 #include "OSGAnimKeyFrameDataSource.h"
53 /*! \ingroup GrpFileIOCollada
57 class OSG_FILEIO_DLLMAPPING ColladaSource
: public ColladaElement
59 /*========================== PUBLIC =================================*/
61 /*---------------------------------------------------------------------*/
65 typedef ColladaElement Inherited
;
66 typedef ColladaSource Self
;
68 OSG_GEN_INTERNAL_MEMOBJPTR(ColladaSource
);
70 typedef std::vector
<std::string
> NameStore
;
71 typedef NameStore::iterator NameStoreIt
;
72 typedef NameStore::const_iterator NameStoreConstIt
;
74 typedef std::vector
<Matrix
> MatrixStore
;
75 typedef MatrixStore::iterator MatrixStoreIt
;
76 typedef MatrixStore::const_iterator MatrixStoreConstIt
;
78 typedef std::vector
<Real32
> FloatStore
;
79 typedef FloatStore::iterator FloatStoreIt
;
80 typedef FloatStore::const_iterator FloatStoreConstIt
;
83 /*---------------------------------------------------------------------*/
87 static ColladaElementTransitPtr
88 create(daeElement
*elem
, ColladaGlobal
*global
);
91 /*---------------------------------------------------------------------*/
95 virtual void read(ColladaElement
*colElemParent
);
98 /*---------------------------------------------------------------------*/
102 GeoVectorProperty
*getProperty (const std::string
&semantic
);
103 AnimKeyFrameDataSource
*getDataSource(const std::string
&semantic
);
105 const NameStore
&getNameStore (void);
106 const MatrixStore
&getMatrixStore(void);
107 const FloatStore
&getFloatStore (void);
109 std::string
getNameValue (UInt32 idx
);
110 bool getNameValue (UInt32 idx
, std::string
&nameVal
);
112 Real32
getFloatValue (UInt32 idx
);
113 bool getFloatValue (UInt32 idx
, Real32
&floatVal
);
115 Matrix
getMatrixValue(UInt32 idx
);
116 bool getMatrixValue(UInt32 idx
, Matrix
&matVal
);
119 /*========================= PROTECTED ===============================*/
121 /*---------------------------------------------------------------------*/
122 /*! \name Constructors/Destructor */
125 ColladaSource(daeElement
*elem
, ColladaGlobal
*global
);
126 virtual ~ColladaSource(void );
129 /*---------------------------------------------------------------------*/
131 // map semantic to a property holding data of this source in the
132 // appropriate form for the semantic
133 typedef std::map
<std::string
,
134 GeoVectorPropertyUnrecPtr
> PropertyMap
;
135 typedef PropertyMap::iterator PropertyMapIt
;
136 typedef PropertyMap::const_iterator PropertyMapConstIt
;
138 typedef std::map
<std::string
,
139 AnimKeyFrameDataSourceUnrecPtr
> DataSourceMap
;
140 typedef DataSourceMap::iterator DataSourceMapIt
;
141 typedef DataSourceMap::const_iterator DataSourceMapConstIt
;
143 typedef std::vector
<Int16
> StrideMap
;
144 typedef StrideMap::iterator StrideMapIt
;
145 typedef StrideMap::const_iterator StrideMapConstIt
;
148 GeoVectorProperty
*fillProperty (const std::string
&semantic
);
149 AnimKeyFrameDataSource
*fillDataSource (const std::string
&semantic
);
150 void fillNameStore (void );
151 void fillMatrixStore(void );
152 void fillFloatStore (void );
155 static ColladaElementRegistrationHelper _regHelper
;
161 StrideMap _strideMap
;
163 PropertyMap _propMap
;
164 DataSourceMap _dataMap
;
165 NameStore _nameStore
;
166 MatrixStore _matrixStore
;
167 FloatStore _floatStore
;
170 OSG_GEN_MEMOBJPTR(ColladaSource
);
174 // #include "OSGColladaSource.inl"
176 #endif // OSG_WITH_COLLADA
178 #endif // _OSGCOLLADASOURCE_H_