~ubuntu-branches/ubuntu/wily/opencollada/wily-proposed

« back to all changes in this revision

Viewing changes to COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryControllersLoader.h

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2015-05-14 17:23:27 UTC
  • Revision ID: package-import@ubuntu.com-20150514172327-f862u8envms01fra
Tags: upstream-0.1.0~20140703.ddf8f47+dfsg1
ImportĀ upstreamĀ versionĀ 0.1.0~20140703.ddf8f47+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (c) 2008-2009 NetAllied Systems GmbH
 
3
 
 
4
    This file is part of COLLADASaxFrameworkLoader.
 
5
 
 
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
 
9
*/
 
10
 
 
11
#ifndef __COLLADASAXFWL_LIBRARYCONTROLLERSLOADER_H__
 
12
#define __COLLADASAXFWL_LIBRARYCONTROLLERSLOADER_H__
 
13
 
 
14
#include "COLLADASaxFWLPrerequisites.h"
 
15
#include "COLLADASaxFWLSourceArrayLoader.h"
 
16
 
 
17
#include "Math/COLLADABUMathMatrix4.h"
 
18
 
 
19
 
 
20
namespace COLLADAFW
 
21
{
 
22
        class SkinControllerData;
 
23
        class MorphController;
 
24
}
 
25
 
 
26
namespace COLLADASaxFWL
 
27
{
 
28
 
 
29
    /** TODO Documentation */
 
30
        class LibraryControllersLoader : public SourceArrayLoader 
 
31
        {
 
32
        private:
 
33
                /** Specifies the parent of a possible input element.*/
 
34
                enum InputParent
 
35
                {
 
36
                        INPUT_PARENT_UNKNOWN,
 
37
                        INPUT_PARENT_JOINTS,
 
38
                        INPUT_PARENT_VERTEX_WEIGHTS
 
39
                };
 
40
 
 
41
                /** Types of controllers that can be loaded by this class.*/
 
42
                enum ControllerTypes
 
43
                {
 
44
                        UNKNOWN_CONTROLLER,
 
45
                        SKIN_CONTROLLER,
 
46
                        MORPH_CONTROLLER
 
47
                };
 
48
 
 
49
                typedef std::map< String /*Id of the name array*/,  StringList> StringListMap;
 
50
 
 
51
        private:
 
52
                /** The type of the controller currently being parsed.*/
 
53
                ControllerTypes mCurrentControllerType;
 
54
 
 
55
                /** The original object id, if it in the original file format exist. */
 
56
                String mOriginalId;
 
57
 
 
58
                /** The id of the current controller.*/
 
59
                String mCurrentControllerId;
 
60
 
 
61
                /** The id of the current controller source.*/
 
62
                COLLADAFW::UniqueId mCurrentControllerSourceUniqueId;
 
63
 
 
64
                /** The name of the current controller.*/
 
65
                String mCurrentControllerName;
 
66
 
 
67
                /** The SkinControllerData currently being filled. */
 
68
                COLLADAFW::SkinControllerData* mCurrentSkinControllerData;
 
69
 
 
70
                /** The MorphController currently being filled. */
 
71
                COLLADAFW::MorphController* mCurrentMorphController;
 
72
 
 
73
                /** The current parent element of a possible input element. Unknown if input is 
 
74
                currently not allowed.*/
 
75
                InputParent mCurrentInputParent;
 
76
 
 
77
                /** The sids of the joints of the current skin controller.*/
 
78
                StringList *mJointSidsOrIds;
 
79
 
 
80
                /** Maps ids of name array to the list of name in the name array.*/
 
81
                StringListMap mJointSidsMap;
 
82
 
 
83
                /** Maps ids of id_ref array to the list of ids in the id_ref array.*/
 
84
                StringListMap mJointIdsMap;
 
85
 
 
86
                /** The expected joints/vertex pair count of the current skin data.*/
 
87
                size_t mCurrentJointsVertexPairCount;
 
88
 
 
89
                /** The offset of the joints in the current vertex_weights element.*/
 
90
                uint64 mJointOffset;
 
91
 
 
92
                /** The offset of the weights in the current vertex_weights element.*/
 
93
                uint64 mWeightsOffset;
 
94
 
 
95
                /** The largest offset of the inputs in the current vertex_weights element.*/
 
96
                uint64 mCurrentMaxOffset;
 
97
 
 
98
                /** The current offset while parsing a v element.*/
 
99
                uint64 mCurrentOffset;
 
100
 
 
101
                /** The bind shape matrix of the current skin controller.*/
 
102
                COLLADABU::Math::Matrix4 mCurrentBindShapeMatrix;
 
103
 
 
104
                /** The index of the current matrix element, while parsing the bind_shape_matrix element.*/
 
105
                size_t mCurrentMatrixIndex;
 
106
 
 
107
                /** Used to control if validate function should report errors
 
108
                or do its job silently */
 
109
                bool mVerboseValidate;
 
110
 
 
111
        public:
 
112
 
 
113
        /** Constructor. */
 
114
                LibraryControllersLoader( IFilePartLoader* callingFilePartLoader );
 
115
 
 
116
        /** Destructor. */
 
117
                virtual ~LibraryControllersLoader();
 
118
 
 
119
        /** Returns the unique id of the current parsed object. */
 
120
        virtual const COLLADAFW::UniqueId& getUniqueId();
 
121
 
 
122
                /** Write the indices of the v element into the framework.*/
 
123
                bool writeVIndices ( const sint64* data, size_t length );
 
124
 
 
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 );
 
129
 
 
130
 
 
131
                virtual bool end__library_controllers( );
 
132
 
 
133
 
 
134
                virtual bool begin__controller( const controller__AttributeData& attributeData );
 
135
                virtual bool end__controller();
 
136
 
 
137
 
 
138
                virtual bool begin__skin( const skin__AttributeData& attributeData );
 
139
                virtual bool end__skin();
 
140
 
 
141
                virtual bool begin__morph( const morph__AttributeData& attributeData );
 
142
                virtual bool end__morph();
 
143
 
 
144
 
 
145
                bool begin__source( const source__AttributeData& attributes );
 
146
                bool end__source();
 
147
 
 
148
 
 
149
                virtual bool begin__joints();
 
150
                virtual bool end__joints();
 
151
 
 
152
                /** Evaluate the semantic and assign the corresponding sources to the current animation curve.*/
 
153
                bool begin__input____InputLocal( const input____InputLocal__AttributeData& attributeData );
 
154
 
 
155
                /** We don't need to do anything here.*/
 
156
                bool end__input____InputLocal() {return true;}
 
157
 
 
158
 
 
159
                virtual bool begin__vertex_weights( const vertex_weights__AttributeData& attributeData );
 
160
                virtual bool end__vertex_weights();
 
161
 
 
162
                virtual bool begin__input____InputLocalOffset( const input____InputLocalOffset__AttributeData& attributeData );
 
163
                virtual bool end__input____InputLocalOffset();
 
164
 
 
165
                virtual bool begin__vcount();
 
166
                virtual bool end__vcount();
 
167
                virtual bool data__vcount( const unsigned long long*, size_t length );
 
168
 
 
169
 
 
170
                virtual bool begin__v();
 
171
                virtual bool end__v();
 
172
                virtual bool data__v( const sint64* data, size_t length );
 
173
 
 
174
 
 
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 );
 
178
 
 
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 );
 
182
 
 
183
 
 
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 );
 
187
 
 
188
 
 
189
 
 
190
        private:
 
191
 
 
192
        /** Disable default copy ctor. */
 
193
                LibraryControllersLoader( const LibraryControllersLoader& pre );
 
194
 
 
195
        /** Disable default assignment operator. */
 
196
                const LibraryControllersLoader& operator= ( const LibraryControllersLoader& pre );
 
197
        };
 
198
 
 
199
} // namespace COLLADASAXFWL
 
200
 
 
201
#endif // __COLLADASAXFWL_LIBRARYCONTROLLERSLOADER_H__