2
Copyright (c) 2008-2009 NetAllied Systems GmbH
4
This file is part of COLLADASaxFrameworkLoader.
6
Licensed under the MIT Open Source License,
7
for details please see LICENSE file or the website
8
http://www.opensource.org/licenses/mit-license.php
11
#ifndef __COLLADASAXFWL_LIBRARYCONTROLLERSLOADER_H__
12
#define __COLLADASAXFWL_LIBRARYCONTROLLERSLOADER_H__
14
#include "COLLADASaxFWLPrerequisites.h"
15
#include "COLLADASaxFWLSourceArrayLoader.h"
17
#include "Math/COLLADABUMathMatrix4.h"
22
class SkinControllerData;
23
class MorphController;
26
namespace COLLADASaxFWL
29
/** TODO Documentation */
30
class LibraryControllersLoader : public SourceArrayLoader
33
/** Specifies the parent of a possible input element.*/
38
INPUT_PARENT_VERTEX_WEIGHTS
41
/** Types of controllers that can be loaded by this class.*/
49
typedef std::map< String /*Id of the name array*/, StringList> StringListMap;
52
/** The type of the controller currently being parsed.*/
53
ControllerTypes mCurrentControllerType;
55
/** The original object id, if it in the original file format exist. */
58
/** The id of the current controller.*/
59
String mCurrentControllerId;
61
/** The id of the current controller source.*/
62
COLLADAFW::UniqueId mCurrentControllerSourceUniqueId;
64
/** The name of the current controller.*/
65
String mCurrentControllerName;
67
/** The SkinControllerData currently being filled. */
68
COLLADAFW::SkinControllerData* mCurrentSkinControllerData;
70
/** The MorphController currently being filled. */
71
COLLADAFW::MorphController* mCurrentMorphController;
73
/** The current parent element of a possible input element. Unknown if input is
74
currently not allowed.*/
75
InputParent mCurrentInputParent;
77
/** The sids of the joints of the current skin controller.*/
78
StringList *mJointSidsOrIds;
80
/** Maps ids of name array to the list of name in the name array.*/
81
StringListMap mJointSidsMap;
83
/** Maps ids of id_ref array to the list of ids in the id_ref array.*/
84
StringListMap mJointIdsMap;
86
/** The expected joints/vertex pair count of the current skin data.*/
87
size_t mCurrentJointsVertexPairCount;
89
/** The offset of the joints in the current vertex_weights element.*/
92
/** The offset of the weights in the current vertex_weights element.*/
93
uint64 mWeightsOffset;
95
/** The largest offset of the inputs in the current vertex_weights element.*/
96
uint64 mCurrentMaxOffset;
98
/** The current offset while parsing a v element.*/
99
uint64 mCurrentOffset;
101
/** The bind shape matrix of the current skin controller.*/
102
COLLADABU::Math::Matrix4 mCurrentBindShapeMatrix;
104
/** The index of the current matrix element, while parsing the bind_shape_matrix element.*/
105
size_t mCurrentMatrixIndex;
107
/** Used to control if validate function should report errors
108
or do its job silently */
109
bool mVerboseValidate;
114
LibraryControllersLoader( IFilePartLoader* callingFilePartLoader );
117
virtual ~LibraryControllersLoader();
119
/** Returns the unique id of the current parsed object. */
120
virtual const COLLADAFW::UniqueId& getUniqueId();
122
/** Write the indices of the v element into the framework.*/
123
bool writeVIndices ( const sint64* data, size_t length );
125
/** Sets the String list, the values of an id_ref or name_array should be stored in.
126
@param isIdArray If true, values are stored in idMap otherwise in in sid map*/
127
bool beginJointsArray(bool isIdArray);
128
bool dataJointArray( const ParserString* data, size_t length );
131
virtual bool end__library_controllers( );
134
virtual bool begin__controller( const controller__AttributeData& attributeData );
135
virtual bool end__controller();
138
virtual bool begin__skin( const skin__AttributeData& attributeData );
139
virtual bool end__skin();
141
virtual bool begin__morph( const morph__AttributeData& attributeData );
142
virtual bool end__morph();
145
bool begin__source( const source__AttributeData& attributes );
149
virtual bool begin__joints();
150
virtual bool end__joints();
152
/** Evaluate the semantic and assign the corresponding sources to the current animation curve.*/
153
bool begin__input____InputLocal( const input____InputLocal__AttributeData& attributeData );
155
/** We don't need to do anything here.*/
156
bool end__input____InputLocal() {return true;}
159
virtual bool begin__vertex_weights( const vertex_weights__AttributeData& attributeData );
160
virtual bool end__vertex_weights();
162
virtual bool begin__input____InputLocalOffset( const input____InputLocalOffset__AttributeData& attributeData );
163
virtual bool end__input____InputLocalOffset();
165
virtual bool begin__vcount();
166
virtual bool end__vcount();
167
virtual bool data__vcount( const unsigned long long*, size_t length );
170
virtual bool begin__v();
171
virtual bool end__v();
172
virtual bool data__v( const sint64* data, size_t length );
175
virtual bool begin__Name_array( const Name_array__AttributeData& attributeData );
176
virtual bool end__Name_array();
177
virtual bool data__Name_array( const ParserString* data, size_t length );
179
virtual bool begin__IDREF_array( const IDREF_array__AttributeData& attributeData );
180
virtual bool end__IDREF_array();
181
virtual bool data__IDREF_array( const ParserString* value, size_t length );
184
virtual bool begin__bind_shape_matrix(){return true;}
185
virtual bool end__bind_shape_matrix();
186
virtual bool data__bind_shape_matrix( const float* data, size_t length );
192
/** Disable default copy ctor. */
193
LibraryControllersLoader( const LibraryControllersLoader& pre );
195
/** Disable default assignment operator. */
196
const LibraryControllersLoader& operator= ( const LibraryControllersLoader& pre );
199
} // namespace COLLADASAXFWL
201
#endif // __COLLADASAXFWL_LIBRARYCONTROLLERSLOADER_H__