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_LIBRARYANIMATIONSLOADER_H__
12
#define __COLLADASAXFWL_LIBRARYANIMATIONSLOADER_H__
14
#include "COLLADASaxFWLPrerequisites.h"
15
#include "COLLADASaxFWLSourceArrayLoader.h"
24
namespace COLLADASaxFWL
27
/** Loads all the animations the the library animations */
28
class LibraryAnimationsLoader : public SourceArrayLoader
32
/** Maps strings to unique ids.*/
33
typedef std::map< String /*samplerId*/,AnimationInfo > StringAnimationInfoMap;
38
* The original object id, if it in the original file format exist.
42
/** Pretty-print name for this animation. Optional. */
45
/** The animation curve currently being filled. Is not null only inside a sampler element.*/
46
COLLADAFW::AnimationCurve* mCurrentAnimationCurve;
48
/** Maps the id of sampler to the unique id of the frame work animation created for this sampler.*/
49
StringAnimationInfoMap mSamplerIdAnimationInfoMap;
51
/** True, if the array currently parsed is an IDREF_array, supposed to contain the interpolation data.*/
52
bool mCurrentlyParsingInterpolationArray;
54
/** The animation info of the currently being parsed sampler.*/
55
AnimationInfo* mCurrentAnimationInfo;
57
/** True, if at least one interpolation type of the current animation curve is bezier or hermite,
58
false otherwise. Use this to decide if we can clear the tangents. Is set to true when starting
59
to parse a sampler. This allows to not store tangents, if set to false.*/
60
bool mCurrentAnimationCurveRequiresTangents;
62
/** Used to control if validate function should report errors
63
or do its job silently */
64
bool mVerboseValidate;
66
/* internal count of animation processed, used to build up a default id */
67
size_t mProcessedCount;
71
LibraryAnimationsLoader( IFilePartLoader* callingFilePartLoader );
74
virtual ~LibraryAnimationsLoader();
76
/** Returns the unique id of the current parsed object. */
77
virtual const COLLADAFW::UniqueId& getUniqueId();
79
/** Searches for the animation info of animation created for the COLLADA sampler with id @a samplerId.
80
If it could not be found, an invalid Unique id is returned.*/
81
AnimationInfo* getAnimationInfoBySamplerId( const String& samplerId);
83
/** Determines the interpolation with @a name.*/
84
static COLLADAFW::AnimationCurve::InterpolationType getInterpolationTypeByString( const ParserString& string);
86
/** Cleans up everything and gives control to calling file part loader.*/
87
bool end__library_animations();
89
bool begin__source( const source__AttributeData& attributes );
94
bool begin__animation( const animation__AttributeData& attributeData );
97
bool end__animation();
99
/** Create new animation.*/
100
bool begin__sampler( const sampler__AttributeData& attributeData );
105
virtual bool begin__channel( const channel__AttributeData& attributeData );
107
virtual bool end__channel();
109
/** Evaluate the semantic and assign the corresponding sources to the current animation curve.*/
110
bool begin__input____InputLocal( const input____InputLocal__AttributeData& attributeData );
112
/** We don't need to do anything here.*/
113
bool end__input____InputLocal() {return true;}
115
virtual bool begin__Name_array( const Name_array__AttributeData& attributeData );
116
virtual bool end__Name_array();
117
virtual bool data__Name_array( const ParserString* data, size_t length );
122
* The original object id, if it in the original file format exist.
124
const COLLADAFW::String& getOriginalId () const { return mOriginalId; }
127
* The original object id, if it in the original file format exist.
129
void setOriginalId ( const COLLADAFW::String& val ) { mOriginalId = val; }
131
/** Pretty-print name for this animation. Optional. */
132
const COLLADAFW::String& getName () const { return mName; }
134
/** Pretty-print name for this animation. Optional. */
135
void setName ( const COLLADAFW::String& val ) { mName = val; }
137
/** Disable default copy ctor. */
138
LibraryAnimationsLoader( const LibraryAnimationsLoader& pre );
140
/** Disable default assignment operator. */
141
const LibraryAnimationsLoader& operator= ( const LibraryAnimationsLoader& pre );
144
} // namespace COLLADASAXFWL
146
#endif // __COLLADASAXFWL_LIBRARYANIMATIONSLOADER_H__